CVE−2022-3602: Punycode buffer overflow in OpenSSL
An off-by-one error in OpenSSL's punycode decoding allows a 4-byte buffer overflow when processing a malicious certificate chain. An attacker could potentially alter control flow, but exploitation is limited by compiler protections and the need for a trusted CA.
Published on github.com
BranchesTags
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
Likely an off-by-one error in the length check within `ossl_punycode_decode`, allowing one more element to be written than the buffer size.
Impact
The overflow is only 4 bytes and often lands in padding, so remote code execution is unlikely; however, it could crash the application or potentially alter control flow if other protections are absent.
What the attacker needed
A trusted CA or intermediate certificate; the CA must sign the leaf certificate; the CA certificate must contain a name constraint with…; the leaf certificate must contain a SmtpUTF8Mailbox…
The fix
The issue was fixed in OpenSSL 3.0.7; users should update.
How it was found
- Generate a malicious CA certificate with a name constraint containing a punycode payload.
- Generate a leaf certificate with a SubjectAltName otherName field containing a SmtpUTF8Mailbox string.
- Run the provided script to start an OpenSSL client and server and attempt the exploit.
- Observe that a vulnerable OpenSSL likely crashes.
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.
OpenSSL is a widely used library for secure connections. A bug in how it reads certain encoded domain names (punycode) could let an attacker write four extra bytes of data onto the stack, a small memory area. This might crash the program or, in rare cases, let an attacker redirect execution, but most systems have protections that make this hard.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.