CVE-2021-31805 Forced OGNL evaluation, when evaluated on raw not validated user input in tag attributes, may lead to RCE.
Attackers can achieve remote code execution by exploiting forced OGNL evaluation on unvalidated user input in specific tag attributes.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-31805?
CVE-2021-31805 is a critical code injection vulnerability in Apache Struts, published on 12 Apr 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official 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.
Weakness: CWE-917
Which versions are affected by CVE-2021-31805?
2 open source packages ship an affected version, including org.apache.struts:struts2-core. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
org.apache.struts:struts2-core Maven | From 2.0.0 | 2.5.30 |
org.apache.struts:struts2-core Maven | From 2.0.0 | 2.5.30 |
Products include Apache Struts.
How do I fix CVE-2021-31805?
Upgrade org.apache.struts:struts2-core to 2.5.30 or later.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2021-31805 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-31805 exists.
Public exploit code: 1 Nuclei template and 8 proofs of concept on GitHub.
Other vulnerabilities in Apache Struts
Sources
Also known as GHSA-v8j6-6c2r-r27c.