Apache Struts Remote Code Execution Vulnerability S2-062 (CVE-2021-31805) Alert

Apache Struts Remote Code Execution Vulnerability S2-062 (CVE-2021-31805) Alert

abril 14, 2022 | Jie Ji

Overview

On April 13, 2022, NSFOCUS CERT detected that Struts officially issued a security notice and fixed a remote code execution vulnerability S2-062 (CVE-2021-31805). This vulnerability is not fully repaired for S2-061. When developers use the %{…} syntax to force OGNL parsing, there are still some special TAG attributes that can be parsed twice; attackers can construct malicious OGNL expressions to trigger vulnerability to enable remote code execution.

Apache Struts is an open source framework for creating Java web applications that is widely used. This vulnerability has been fixed in Struts 2.5.30 version, and relevant users are advised to upgrade the version as soon as possible for protection.

Reference link: https://cwiki.apache.org/confluence/display/WW/S2-062

Scope of Impact

Affected version

  • 2.0.0 <= Apache Struts <= 2.5.29

Unaffected version

  • Apache Struts >= 2.5.30

Vulnerability Detection

Manual check

Projects packaged with maven can view the currently used struts2 version through pom.xml:

You can also check the struts version by looking at the core package in lib.

If the current version is affected, there may be a security risk.

Mitigation

Official upgrade

At present, a new version has been officially released to fix this vulnerability. Please update the affected users as soon as possible for protection. Download link: https://struts.apache.org/download.cgi#struts-ga

Other measures

If the relevant user is temporarily unable to perform the upgrade operation, the following measures can be used for temporary relief:

1. When reassigning the value of an input parameter to some Struts label properties, always validate it, do not use the %{…} syntax in label properties other than the value to refer to user-modifiable inputs.

2. Enable ONGL expression injection protection

See the official guide:

https://struts.apache.org/security/#proactively-protect-from-ognl-expression-injections-attacks-if-easily-applicable

Statement

This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.

About NSFOCUS

NSFOCUS, Inc., a global network and cyber security leader, protects enterprises and carriers from advanced cyber attacks. The company’s Intelligent Hybrid Security strategy utilizes both cloud and on-premises security platforms, built on a foundation of real-time global threat intelligence, to provide multi-layered, unified and dynamic protection against advanced cyber attacks.

NSFOCUS works with Fortune Global 500 companies, including four of the world’s five largest financial institutions, organizations in insurance, retail, healthcare, critical infrastructure industries as well as government agencies. NSFOCUS has technology and channel partners in more than 60 countries, is a member of both the Microsoft Active Protections Program (MAPP), and the Cloud Security Alliance (CSA).

A wholly owned subsidiary of NSFOCUS Technologies Group Co., Ltd., the company has operations in the Americas, Europe, the Middle East and Asia Pacific.