When str.lower() is a security vulnerability in Python
Python's IDNA 2003 implementation used the interpreter's current Unicode version for case folding instead of the Unicode 3.2.0 rules required by the StringPrep specification. This caused domain names to be encoded differently from the standard, potentially leading to inconsistent domain name resolution.
sethmlarson.dev
Published on sethmlarson.dev
Some internet standards only support ASCII characters, but the world uses much more than the Latin alphabet. Thus, a mapping from Unicode to ASCII for use in domain names is required.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code used the interpreter's built-in `str.lower()` (which follows the Unicode version shipped with Python) instead of the Unicode 3.2.0 case-folding tables mandated by StringPrep.
Impact
Domain names could be encoded inconsistently with the IDNA 2003 specification, potentially causing a domain to resolve to a different name than expected.
What the attacker needed
Use of Python's IDNA 2003 codec
The fix
The fix added explicit exceptions so that `str.lower()` behaves as if using Unicode 3.2.0 for the affected function, making IDNA 2003 consistent with the specification.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When a computer turns a domain name with non-English characters into the ASCII form used by the internet, it must follow a fixed set of rules. Python was using newer rules than the standard required, so the same name could be converted to different ASCII strings. This mismatch could cause a domain to be treated as a different domain than intended.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.