Apache published two security bulletins to address a potential remote code execution vulnerability and a denial of service vulnerability. Public proof of concept code is available.
Background
On August 13, Apache published security bulletins to address two vulnerabilities in Apache Struts version 2. Apache Struts is an open source model-view-controller (MVC) framework used to create Java web applications.
Analysis
CVE-2019-0230 is a forced double Object-Graph Navigation Language (OGNL) evaluation vulnerability that occurs when Struts tries to perform an evaluation of raw user input inside of tag attributes. An attacker could exploit this vulnerability by injecting malicious OGNL expressions into an attribute used within an OGNL expression. According to Apache, exploitation of this vulnerability could result in remote code execution (RCE).
An example of vulnerable tag attributes was provided in Apache’s security bulletin, S2-059:
In Struts 2, Apache has given developers the ability to use forced double evaluation with “certain tag attributes.” While Struts contains mitigations to address potential injected expressions, Apache notes that Struts versions “before 2.5.22 left an attack vector open” which they say is now addressed via this update. This vulnerability was reported to Apache by Matthias Kaiser, a vulnerability researcher at Apple.
CVE-2019-0233 is a denial of service (DoS) vulnerability which results from an access permission override during a file upload. According to the S2-060 security bulletin, an attacker may be able to modify a request during a file upload operation in a way that results in the uploaded file set to read-only access. Once the file is uploaded, any further actions on the file will fail. Exploiting this flaw could also result in the failure of any subsequent file upload operations, either of which could result in a denial of service condition for an affected application. The DoS vulnerability was found and reported to Apache by Takeshi Terada of Mitsui Bussan Secure Directions, Inc. who is also credited in several additional vulnerability reports to the Apache Struts team, including S2-042 and S2-021.
The ghost of CVE-2017-5638
It is certainly natural for developers and organizations alike to express concern at the prospect of a new vulnerability in Apache Struts. After all, the aftermath of CVE-2017-5638, a critical RCE vulnerability in Apache Struts 2, led to one of the most notable breaches in recent history.
Unlike CVE-2017-5638, which was rated as critical at the time of its disclosure, CVE-2019-0230 is currently rated as important according to Apache. While no CVSS score has been assigned at the time of publication, it does not appear that CVE-2019-0230 is as critical as the vulnerability from 2017. However, there is still not enough information about the potential impact of this vulnerability under real world conditions, but caution is certainly warranted regarding this flaw.
Proof of concept
We have identified multiple proof of concept (PoC) examples on GitHub for CVE-2019-0230. However, it’s important to note that because each Struts application is unique, the actual payload needed to exploit it will differ from application to application. Additionally, the application would need to be developed in such a way that it allows an attacker to supply unvalidated input into an attribute used inside of an OGNL expression.
Apache Struts RCE: S2-059 / CVE-2019-0230https://t.co/m6z3jqRsj4
— Henry Chen (@chybeta) August 13, 2020
Forced double OGNL evaluation, when evaluated on raw user input in tag attributes, may lead to remote code execution. pic.twitter.com/6JwZCozTeB
Solution
Apache Struts versions 2.0.0 through 2.5.20 are affected by both CVE-2019-0230 and CVE-2019-0233. They are addressed in Apache Struts version 2.5.22. Developers and site owners are strongly encouraged to upgrade to the latest version as soon as possible. In the case of the CVE-2019-0230, Apache notes that upgrading to 2.5.22 limits the malicious effects of double evaluation and closes the reported attack vector.
Apache also strongly encourages developers to avoid using raw expression language and use Struts tags instead. Their security tips guide provides a helpful set of recommendations for developers on how best to secure their applications, which includes guidance on protecting applications from OGNL expression injection attacks.
Identifying affected systems
A list of Tenable plugins to identify this vulnerability will appear here as they’re released.
Get more information
- Apache Struts S2-059 Advisory for CVE-2019-0230
- Apache Struts S2-060 Advisory for CVE-2019-0233
- Apache Struts Security Announcement
Join Tenable's Security Response Team on the Tenable Community.
Learn more about Tenable, the first Cyber Exposure platform for holistic management of your modern attack surface.
Get a free 30-day trial of Tenable.io Vulnerability Management.