Homograph and Visual Spoofing Attacks
What you'll learn: How attackers exploit visually identical characters from different Unicode blocks to bypass input validation and trick users.
The Core Problem
You've learned about various canonicalization attacks where encoding tricks bypass validation. Homograph attacks take this further: they exploit the fact that some characters from different alphabets or Unicode blocks look identical but have different underlying code points.
For example, the Latin letter "a" (U+0061) looks identical to the Cyrillic "а" (U+0430). To the human eye, they're indistinguishable. To a computer, they're completely different characters.
The Attack
Imagine your allowlist permits only "paypal.com" as a trusted domain. An attacker registers "pаypal.com" using the Cyrillic "а". Your validation checks if the domain equals "paypal.com" — it doesn't match (different bytes), so naive substring checks might pass it as "different enough." But visually? Users see "paypal.com" and trust it.
Common attack vectors:
- Domain spoofing: Creating fake domains that look legitimate (аpple.com vs apple.com)
- Username spoofing: admin vs аdmin in authentication systems
- Bypassing allowlists: Injecting lookalike characters to pass validation while executing malicious payloads
Think of It Like This
It's like identical twins with different ID numbers. A security guard checking IDs catches them, but someone just glancing at faces thinks they're the same person.
Defense
Always normalize Unicode input (as you learned in lesson 1161), convert to a single case, and validate against normalized allowlists. Reject mixed-script inputs where inappropriate, and consider using punycode representation for domains.
Key Takeaway: Homograph attacks exploit visually identical characters from different Unicode blocks to bypass validation and deceive users; always normalize and validate input at the byte/codepoint level, not just visual appearance.