CVE-2024-7254: Stack overflow in Protocol Buffers Java Lite
Summary When parsing unknown fields in the Protobuf Java Lite and Full library, a maliciously crafted message can cause a StackOverflow error and lead to a program crash.
Reporter: Alexis Challande, Trail of Bits Ecosystem Security Team <ecosystem@trailofbits.com>
Affected versions: This issue affects all versions of both the Java full and lite Protobuf runtimes, as well as Protobuf for Kotlin and JRuby, which themselves use the Java Protobuf runtime.
Severity CVE-2024-7254 High CVSS4.0 Score 8.7 (NOTE: there may be a delay in publication) This is a potential Denial of Service. Parsing nested groups as unknown fields with DiscardUnknownFieldsParser or Java Protobuf Lite parser, or against Protobuf map fields, creates unbounded recursions that can be abused by an attacker.
Proof of Concept For reproduction details, please refer to the unit tests (Protobuf Java LiteTest and CodedInputStreamTest) that identify the specific inputs that exercise this parsing weakness.
Remediation and Mitigation We have been working diligently to address this issue and have released a mitigation that is available now. Please update to the latest available versions of the following packages: protobuf-java (3.25.5, 4.27.5, 4.28.2) protobuf-javalite (3.25.5, 4.27.5, 4.28.2) protobuf-kotlin (3.25.5, 4.27.5, 4.28.2) protobuf-kotlin-lite (3.25.5, 4.27.5, 4.28.2) com-protobuf [JRuby gem only] (3.25.5, 4.27.5, 4.28.2)
Other sources
Any project that parses untrusted Protocol Buffers data containing an arbitrary number of nested groups / series of SGROUP tags can corrupted by exceeding the stack limit i.e. StackOverflow. Parsing nested groups as unknown fields with DiscardUnknownFieldsParser or Java Protobuf Lite parser, or against Protobuf map fields, creates unbounded recursions that can be abused by an attacker.
— Red Hat
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-7254?
CVE-2024-7254 has a high severity rating due to its potential to cause application crashes through a StackOverflow error.
How do I fix CVE-2024-7254?
To mitigate CVE-2024-7254, upgrade to protobuf-java, protobuf-javalite, protobuf-kotlin, or protobuf-kotlin-lite version 4.28.2 or 4.27.5.
Which versions are affected by CVE-2024-7254?
CVE-2024-7254 affects protobuf-java, protobuf-javalite, protobuf-kotlin, and protobuf-kotlin-lite versions between 4.0.0.rc.1 and 4.28.2 inclusive.
What causes the CVE-2024-7254 vulnerability?
CVE-2024-7254 is caused by the parsing of unknown fields in the Protobuf library, which can lead to a StackOverflow error.
Is there a workaround for CVE-2024-7254?
The best approach to address CVE-2024-7254 is to update to the latest secure versions of the affected Protobuf libraries.