Course contentsShow
← Security
Lesson 1162 of 3,05224. Application Security - Input ValidationFree lesson

Case Sensitivity and Case Mapping Attacks

Leveraging inconsistent case handling between validation and execution, including locale-specific case transformations.

Case Sensitivity and Case Mapping Attacks

What you'll learn: How attackers exploit differences in case handling between validation and execution to bypass security checks.

The Core Problem

Not all systems treat uppercase and lowercase letters the same way. A validator might check for dangerous strings like "SCRIPT" but miss "script" or "ScRiPt". Worse, some systems perform case mapping (converting between upper and lower case) in ways that change meaning—and these transformations can vary by locale.

The attack works when validation happens at one layer with one set of case rules, but execution happens elsewhere with different case rules.

How Case Mapping Gets Dangerous

Imagine a security filter that converts input to lowercase before checking against a blocklist of banned words. Seems safe, right? Not always.

Turkish Locale Problem:
In Turkish, the uppercase version of "i" is "İ" (with a dot), not "I". And "I" lowercases to "ı" (dotless), not "i". If your validator uses Turkish locale rules but your backend uses English rules, the word "ADMINISTRATOR" might become "ADMİNİSTRATOR" → "admİnİstrator" (note the dotted İ), bypassing a check for "administrator".

Real-world scenario:
An attacker uploads a file named "SCRIPT.txt". The validator checks extensions in lowercase and blocks ".exe". But the filesystem is case-sensitive—"SCRIPT.TXT" passes through. Later, an IIS server (case-insensitive) interprets it as executable.

Defense Strategy

  • Normalize case early using a consistent, locale-agnostic method
  • Perform validation and execution with identical case handling rules
  • Use case-insensitive comparisons explicitly when appropriate
  • Never rely on case transformation alone for security

Key Takeaway: Case sensitivity mismatches between validation and execution create exploitable gaps; always normalize and validate with consistent, locale-aware rules across all security boundaries.