Page MenuHome GnuPG

Heap oob read in libksba's parse_rdn
Closed, ResolvedPublic

Description

The hex-escape parsing loop in parse_rdn() has a double increment:

for (; hexdigitp (s); s++)
    s++;                      /* <-- BUG: extra increment */

The for-statement increments s at the end of each iteration, AND
the loop body also increments s, so the pointer advances by 2 per
iteration instead of 1. When the hex string has an odd number of
characters, or when the double-stepping causes the pointer to skip
past the null terminator, parse_rdn() reads past the end of the
heap-allocated buffer.

Reported-by: Francisco Tacliad

His full report for this finding is here:


Disclose timeline for this and other findings:

2026-02-11 Initial report to security@gnupg.org
2026-02-12 Response from GnuPG team
2026-02-12 Detailed technical report (this document)

Related Objects

StatusAssignedTask
ResolvedNone
ResolvedNone

Event Timeline

werner created this task.
werner created this object in space Restricted Space.
werner created this object with edit policy "Contributor (Project)".

Looks like this spot was missed when T5037: dn.cpp:181: suspicious loop was fixed. In libkleo's copy of the DN parser I applied the fix in 2023. Too many copies!

werner shifted this object from the Restricted Space space to the S1 Public space.