CVE-2024-50602:
An issue was discovered in libexpat before 2.6.4. There is a crash within the XML_ResumeParser...
5.9
Basic Information
Technical Details
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability occurs because XML_StopParser
could be called on an XML parser that had been created (XML_ParserCreate
) but not yet started (e.g., no input fed via XML_Parse
or XML_ParseBuffer
). This action would put the parser into an inconsistent state. Subsequently, if XML_ResumeParser
was called on this parser, it would crash due to attempting to access uninitialized or improperly set internal structures, specifically leading to a NULL pointer dereference in normal_updatePosition
as shown in the test case commit message (b3836ff534c7cc78128fe7b935aad3d4353814ed
).
The primary vulnerable function is XML_ResumeParser
because it's the one that crashes. However, XML_StopParser
is also culpable because its incorrect behavior (allowing an unstarted parser to be stopped/suspended) sets up the conditions for the crash. The patches address the issue by modifying XML_StopParser
to explicitly disallow stopping/suspending an unstarted parser (commit 51c7019069b862e88d94ed228659e70bddd5de09
) and by adding test cases to verify this fix and the crash scenario (commit b3836ff534c7cc78128fe7b935aad3d4353814ed
).
The runtime indicators would be XML_ResumeParser
appearing in a stack trace, likely preceded by calls that set up the vulnerable state, such as XML_ParserCreate
, XML_GetBuffer
(or similar to get the parser into a state where XML_StopParser
might be called), and then XML_StopParser
itself. The crash itself, as detailed in the commit message for the test case, happens within normal_updatePosition
, called by initUpdatePosition
, which is called by XML_ResumeParser
.
Therefore, the key functions involved in triggering the vulnerability are XML_StopParser
(due to its flawed logic) and XML_ResumeParser
(where the crash manifests).