# Unicode normalization matching bypass

String/domain allow-deny checks and UI rendering that skip Unicode normalization, case folding, or bidi handling

_Area: Web business logic and race conditions. Seen in 2 disclosed reports; latest 2024-03-20. Updated 2026-11-14._

## How it works
A security decision compares a raw string (domain, email, filename, origin) against a list, but the consumer downstream normalizes, case-folds, or reorders that string before acting on it. The check sees one value; the mail server, browser, or renderer sees another. The broken assumption is that "equal as bytes" equals "equal as interpreted." Any layer that applies Unicode normalization, case folding, or the BIDI algorithm after the check creates a gap the check never sees [E1](https://bugbountylibrary.com/r/h1%3A2033005.md)[E2](https://bugbountylibrary.com/r/h1%3A1710564.md)[E3](https://bugbountylibrary.com/r/blog%3Ablog-doyensec-com-2024-09-19-phishing-case-study-html.md).

## Where it shows up
- Email/domain deny-lists or allow-lists matched on the raw string with no `NFKC`/case-fold step [E1](https://bugbountylibrary.com/r/h1%3A2033005.md)
- Homoglyphs and locale-specific case pairs (Turkish İ/ı) that fold to a blocked value downstream [E1](https://bugbountylibrary.com/r/h1%3A2033005.md)
- UI rendering user-controlled identifiers with `direction: rtl` or other bidi-sensitive CSS [E2](https://bugbountylibrary.com/r/h1%3A1710564.md)
- Domains starting with digits/hyphens, or containing RTL marks, in origin/site lists [E2](https://bugbountylibrary.com/r/h1%3A1710564.md)
- Extension allow-lists accepting empty extension after a trailing dot [E3](https://bugbountylibrary.com/r/blog%3Ablog-doyensec-com-2024-09-19-phishing-case-study-html.md)
- Domain allow-list regexes that are unanchored or have unescaped dots [E3](https://bugbountylibrary.com/r/blog%3Ablog-doyensec-com-2024-09-19-phishing-case-study-html.md)
- Links/filenames rendered without Punycode or RTLO filtering [E3](https://bugbountylibrary.com/r/blog%3Ablog-doyensec-com-2024-09-19-phishing-case-study-html.md)

## How to review
Find every place a string is compared to a security list, then find every place the same string is consumed. The invariant: the value the check evaluates must be byte-identical to the value the consumer acts on, after the consumer's own normalization. Concretely: does the check normalize (NFKC + case fold) before comparing? Does the renderer avoid bidi-sensitive styling on untrusted text, or wrap it in isolation? Are regexes anchored (`^...$`) with escaped dots? Does the extension parser reject empty extensions and trailing dots? If any consumer normalizes and the check does not, it is unsafe.

## How finders spotted it
- Consulted a Unicode normalization table and hypothesized İ would evade string matching, then tested the invite flow [E1](https://bugbountylibrary.com/r/h1%3A2033005.md)
- Noticed a numeric-hyphen domain rendered reversed in the Connected Sites list, traced it to `direction: rtl` plus BIDI behavior [E2](https://bugbountylibrary.com/r/h1%3A1710564.md)
- Tested upload edge cases (trailing dots, empty extension), read domain allow-list regexes for anchoring, and examined how links/filenames render to users [E3](https://bugbountylibrary.com/r/blog%3Ablog-doyensec-com-2024-09-19-phishing-case-study-html.md)

## Variants seen
- Case-folding/normalization mismatch in email domain deny-list [E1](https://bugbountylibrary.com/r/h1%3A2033005.md)
- BIDI reordering via CSS `direction: rtl` spoofing a trusted origin [E2](https://bugbountylibrary.com/r/h1%3A1710564.md)
- Trailing-dot empty-extension bypass, unanchored regex, RTLO/Punycode link spoofing [E3](https://bugbountylibrary.com/r/blog%3Ablog-doyensec-com-2024-09-19-phishing-case-study-html.md)

## Impact and severity
Bypasses a security control (blocked-domain invite restriction) [E1](https://bugbountylibrary.com/r/h1%3A2033005.md), spoofs a trusted origin in a wallet UI to enable phishing [E2](https://bugbountylibrary.com/r/h1%3A1710564.md), and enables phishing via multiple upload/link weaknesses [E3](https://bugbountylibrary.com/r/blog%3Ablog-doyensec-com-2024-09-19-phishing-case-study-html.md). Impact rises when the bypassed control gates trust (wallet origins, invite restrictions) or when combined with social engineering [E2](https://bugbountylibrary.com/r/h1%3A1710564.md)[E3](https://bugbountylibrary.com/r/blog%3Ablog-doyensec-com-2024-09-19-phishing-case-study-html.md).

## Evidence
- E1: https://bugbountylibrary.com/r/h1%3A2033005.md
- E2: https://bugbountylibrary.com/r/h1%3A1710564.md
- E3: https://bugbountylibrary.com/r/blog%3Ablog-doyensec-com-2024-09-19-phishing-case-study-html.md
