Weakness · High
CWE-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')
What it is
The product constructs all or part of an expression language (EL) statement in a framework such as a Java Server Page (JSP) using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended EL statement before it is executed.
- Severity (our rating)
- High
- Likelihood of exploit
- Not rated by MITRE
- Introduced during
- Architecture and Design, Implementation
- Exploited in the wild
- 5 known exploited CVEs
In more detail
Frameworks such as Java Server Page (JSP) allow a developer to insert executable expressions within otherwise-static content. When the developer is not aware of the executable nature of these expressions and/or does not disable them, then if an attacker can inject expressions, this could lead to code execution or other unexpected behaviors.
What an attacker can do
- Read Application Data (Confidentiality)
- Execute Unauthorized Code or Commands (Integrity)
How to prevent it
Architecture and Design
- Avoid adding user-controlled data into an expression interpreter when possible.
Implementation
- If user-controlled data must be added to an expression interpreter, one or more of the following should be performed: Validate that the user input will not evaluate as an expression Encode the user input in a way that ensures it is not evaluated as an expression
System Configuration
- The framework or tooling might allow the developer to disable or deactivate the processing of EL expressions, such as setting the isELIgnored attribute for a JSP page to "true".
While the code is being fixed, a WAF in blocking mode stops Log4Shell (JNDI lookup) payloads at the edge.
How to find it
- Automated Static Analysis. Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Exploited in the wild: 5 CVEs
Vulnerabilities caused by CWE-917 that attackers have used, from CISA's Known Exploited Vulnerabilities catalog, newest first.
- CVE-2021-45046 ransomwareApache Log4j2 Deserialization of Untrusted Data Vulnerability · added May 1, 2023
- CVE-2022-26134 ransomwareAtlassian Confluence Server and Data Center Remote Code Execution Vulnerability · added June 2, 2022
- CVE-2021-26084 ransomwareAtlassian Confluence Server and Data Center Object-Graph Navigation Language (OGNL) Injection Vulnerability · added November 3, 2021
- CVE-2020-17530Apache Struts Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2020-10199Sonatype Nexus Repository Remote Code Execution Vulnerability · added November 3, 2021
The Dome
Block it at the edge while you fix it
The Dome's WAF runs the OWASP Core Rule Set in blocking mode and stops Log4Shell (JNDI lookup) payloads before they reach your application.
See the DomeT Academy
Stop writing it in the first place
Learn to build software and systems without weaknesses like this one, with practice on real hosts in your browser, every objective checked on the machine.
Start freeSource: MITRE Common Weakness Enumeration, CWE version 4.19.1. CWE is a trademark of The MITRE Corporation.