Vulnerability record · CVE-2021-31805 · published 12 April 2022
CVE-2021-31805: Apache Struts 2 tag attribute double OGNL evaluation RCE
Apache · Struts
The fix for CVE-2020-17530 was incomplete: in Apache Struts 2.0.0 through 2.5.29, certain tag attributes still perform a double evaluation when a developer forces OGNL evaluation with the %{...} syntax. If that forced evaluation is applied to untrusted user input, the injected expression is evaluated a second time, allowing remote code execution. This matters because it is a network-reachable, unauthenticated flaw in a widely deployed Java web framework.
Description
The fix issued for CVE-2020-17530 was incomplete. So from Apache Struts 2.0.0 to 2.5.29, still some of the tag’s attributes could perform a double evaluation if a developer applied forced OGNL evaluation by using the %{...} syntax. Using forced OGNL evaluation on untrusted user input can lead to a Remote Code Execution and security degradation.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Automated analysis
critical priorityCVSS 9.8 with network, unauthenticated, no-interaction remote code execution and a very high EPSS score make this an urgent patch target despite no KEV listing.
What it is
The fix for CVE-2020-17530 was incomplete: in Apache Struts 2.0.0 through 2.5.29, certain tag attributes still perform a double evaluation when a developer forces OGNL evaluation with the %{...} syntax. If that forced evaluation is applied to untrusted user input, the injected expression is evaluated a second time, allowing remote code execution. This matters because it is a network-reachable, unauthenticated flaw in a widely deployed Java web framework.
Impact
An attacker can execute arbitrary code in the context of the Struts application, leading to full compromise of confidentiality, integrity and availability of the affected server.
Attack surface
Reached over the network via HTTP requests that supply input to a Struts tag attribute using forced %{...} OGNL evaluation; the CVSS vector indicates no authentication and no user interaction are required. Exploitation depends on the application actually passing untrusted input into such a forced-evaluation attribute.
Exploitation
Not listed in CISA KEV and no ransomware usage is documented, but EPSS is very high (0.854, 99.7th percentile), and vendor and third-party references provide patch and mitigation guidance.
What to do
- Upgrade Apache Struts to a version later than 2.5.29 that contains the complete fix for S2-062.
- If immediate upgrade is not possible, apply the mitigation guidance in the Apache S2-062 advisory and the oss-security posting.
- Remove or avoid forced OGNL evaluation (%{...}) on any tag attribute that can receive untrusted user input.
- Audit application code and third-party Struts components for tag attributes that evaluate user-controlled values.
- Track vendor advisories (NetApp, Oracle) for affected bundled products and patch accordingly.
Detection
- Search web and application logs for requests containing OGNL expression syntax such as %{...} or ${...} in parameters reaching Struts tag attributes.
- Monitor for unexpected child processes or command execution spawned by the Java/Struts application server.
- Deploy WAF or IDS signatures for known Struts OGNL injection patterns and alert on matches.
- Review application code and runtime behavior for tag attributes that double-evaluate user input.
This assessment is produced automatically and is not human-reviewed. Verify against the vendor advisory before acting on it.
Affected products
1 vulnerable configurations from NVD's CPE data, grouped by vendor and product.
References
| Link | Tags |
|---|---|
| http://www.openwall.com/lists/oss-security/2022/04/12/6 | Mailing ListMitigationThird Party Advisory |
| https://cwiki.apache.org/confluence/display/WW/S2-062 | MitigationPatchVendor Advisory |
| https://security.netapp.com/advisory/ntap-20220420-0001/ | Third Party Advisory |
| https://www.oracle.com/security-alerts/cpujul2022.html | |
| http://www.openwall.com/lists/oss-security/2022/04/12/6 | Mailing ListMitigationThird Party Advisory |
| https://cwiki.apache.org/confluence/display/WW/S2-062 | MitigationPatchVendor Advisory |
| https://security.netapp.com/advisory/ntap-20220420-0001/ | Third Party Advisory |
| https://www.oracle.com/security-alerts/cpujul2022.html |
Track CVE-2021-31805 inside VULONE
Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.
Related vulnerabilities
Same products first, then exploited flaws of the same weakness class.
Source: NIST National Vulnerability Database (record CVE-2021-31805), CISA KEV, FIRST EPSS (scores of 2026-09-26). This page is refreshed as NVD updates the record.