-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document CVE-2024-47072 and add test case.
- Loading branch information
Showing
4 changed files
with
99 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<html> | ||
<!-- | ||
Copyright (C) 2024 XStream committers. | ||
All rights reserved. | ||
The software in this package is published under the terms of the BSD | ||
style license a copy of which has been included with this distribution in | ||
the LICENSE.txt file. | ||
Created on 19. September 2024 by Joerg Schaible | ||
--> | ||
<head> | ||
<title>CVE-2024-47072</title> | ||
</head> | ||
<body> | ||
|
||
<h2 id="vulnerability">Vulnerability</h2> | ||
|
||
<p>CVE-2024-47072: XStream is vulnerable to a Denial of Service attack due to stack overflow from a manipulated | ||
binary input stream.</p> | ||
|
||
<h2 id="affected_versions">Affected Versions</h2> | ||
|
||
<p>All versions until and including version 1.4.20 are affected, if using XStream's BinaryStreamDriver.</p> | ||
|
||
<h2 id="description">Description</h2> | ||
|
||
<p>XStream provides a BinaryStreamDriver with an own optimized serialization format. The format uses ids for | ||
string values as deduplication. The mapping for these ids are created on-the-fly at marshalling time. At | ||
unmarshalling time the reader's implementation simply used a simple one-time recursion after reading a mapping | ||
token to process the next normal token of the data stream. However, an endless recursion could be triggered with | ||
manipulated input data resulting in a stack overflow causing a denial of service.</p> | ||
|
||
<h2 id="reproduction">Steps to Reproduce</h2> | ||
|
||
<p>Prepare the manipulated data and provide it as input for a XStream instance using the BinaryDriver:</p> | ||
<div class="Source Java"><pre>final byte[] byteArray = new byte[36000]; | ||
for (int i = 0; i < byteArray.length / 4; i++) { | ||
byteArray[i * 4] = 10; | ||
byteArray[i * 4 + 1] = -127; | ||
byteArray[i * 4 + 2] = 0; | ||
byteArray[i * 4 + 3] = 0; | ||
} | ||
|
||
XStream xstream = new XStream(new BinaryStreamDriver()); | ||
xstream.fromXML(new ByteArrayInputStream(byteArray)); | ||
</pre></div> | ||
|
||
<p>As soon as the data gets unmarshalled, the endless recursion is entered and the executing thread is aborted with | ||
a stack overflow error.</p> | ||
|
||
<h2 id="impact">Impact</h2> | ||
|
||
<p>The vulnerability may allow a remote attacker to terminate the application with a stack overflow error resulting | ||
in a denial of service only by manipulating the processed input stream if the instance is setup with a | ||
BinaryStreamDriver.</p> | ||
|
||
<h2 id="workarounds">Workarounds</h2> | ||
|
||
<p>A simple solution is to catch the StackOverflowError in the client code calling XStream. There's no other known | ||
workaround when using the BinaryStreamDriver.</p> | ||
|
||
<h2 id="credits">Credits</h2> | ||
|
||
<p>Alexis Challande of Trail Of Bits found and reported the issue to XStream and provided the required information to reproduce it.</p> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters