What is Apache Struts 2?
Apache Struts 2 is a widely used open-source Java MVC web framework for building enterprise web applications. It is particularly prevalent in large financial institutions, government agencies, and enterprise environments — and was the framework underlying the Equifax web portal breached in 2017. Struts 2 uses OGNL (Object-Graph Navigation Language) as its expression language, evaluating OGNL expressions throughout the request processing pipeline. This tight integration between OGNL evaluation and request handling has made Struts 2 the source of multiple critical OGNL injection vulnerabilities.
Overview
CVE-2012-0391 is an OGNL injection vulnerability in the ExceptionDelegator interceptor of Apache Struts 2. When an invalid action name is submitted and causes an exception, the ExceptionDelegator logs the exception message — but the action name itself is evaluated as an OGNL expression. An attacker who crafts a request with an action name containing OGNL code can achieve arbitrary Java code execution on the server, unauthenticated.
Apache fixed this in Struts 2.2.3.1, released January 4, 2012.
Affected Versions
| Struts Version | Affected | Fixed |
|---|---|---|
| Struts 2.0.0 – 2.2.3 | Yes | 2.2.3.1 |
| Struts 2.2.3.1 and later | No | Patched |
Technical Details
Apache Struts 2 uses OGNL for expression evaluation in views, interceptors, and action processing. OGNL can access the Java runtime environment, allowing expressions like (#_memberAccess['allowStaticMethodAccess']=true,@java.lang.Runtime@getRuntime().exec('id')) to execute operating system commands.
The ExceptionDelegator interceptor handles exceptions thrown during action processing and formats error messages that may include the action name. The vulnerability occurs because the action name from the URL is evaluated as an OGNL expression without sanitization when an exception is triggered.
Exploitation:
GET /struts2-showcase/ajax/example5/%25%7B%22hello%22%7D.action HTTP/1.1
By encoding OGNL expressions in the action name, an attacker can inject and execute arbitrary Java code with the privileges of the application server process (often running as a privileged service account).
This is part of a recurring pattern of Struts 2 OGNL vulnerabilities — CVE-2012-0391 preceded the more famous CVE-2017-5638 (which triggered the Equifax breach) by five years, demonstrating the persistence of this vulnerability class in the Struts 2 codebase.
Discovery
The vulnerability was discovered through security research into Struts 2's OGNL evaluation pipeline and responsibly disclosed to the Apache Struts team, resulting in the 2.2.3.1 patch.
Exploitation Context
CISA confirmed exploitation in the wild. Apache Struts 2 vulnerabilities are heavily targeted by automated scanners and threat actors because Struts applications are often exposed directly to the internet (web portals, customer-facing applications) and many organizations lag in patching Java web frameworks relative to OS-level patches. Successful exploitation gives unauthenticated code execution as the web server process — the highest-impact initial access short of authenticated exploits.
Remediation
- Upgrade to Struts 2.2.3.1 or later — or to the latest stable release (2.5.x+)
- Struts 2.3.x and 2.5.x lines both received long-term support; use the latest release in the supported branch
- If immediate upgrade is not possible, consider disabling the
ExceptionDelegatorinterceptor (will break error handling but eliminates this specific vector) - Deploy a WAF rule to detect OGNL injection patterns (
%{,#, Java class references) in action names and request parameters - Enforce least-privilege for the application server process account — limit file system write access and outbound network connections to reduce the impact of a successful exploit
- Audit exposed Struts 2 applications for version and patch status using software composition analysis (SCA) tools
Key Details
| Property | Value |
|---|---|
| CVE ID | CVE-2012-0391 |
| Vendor / Product | Apache — Struts 2 |
| NVD Published | 2012-01-08 |
| NVD Last Modified | 2025-10-22 |
| CVSS 3.1 Score | 9.8 |
| CVSS 3.1 Vector | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| Severity | CRITICAL |
| CWE | CWE-20 find similar ↗ |
| CISA KEV Added | 2022-01-21 |
| CISA KEV Deadline | 2022-07-21 |
| Known Ransomware Use | No |
CVSS 3.1 Breakdown
Required Action
Timeline
| Date | Event |
|---|---|
| 2012-01-04 | Apache Struts releases version 2.2.3.1 fixing the ExceptionDelegator OGNL injection |
| 2012-01-08 | CVE-2012-0391 published |
| 2022-01-21 | Added to CISA Known Exploited Vulnerabilities catalog |
| 2022-07-21 | CISA BOD 22-01 remediation deadline |
References
| Resource | Type |
|---|---|
| NVD — CVE-2012-0391 | Vulnerability Database |
| CISA KEV Catalog Entry | US Government |
| Apache Struts Security Announcement (January 2012) | Vendor Advisory |