Skip to content

Expression injection (OGNL)

Description

The Object Graph Navigation Language (OGNL) is an expression language that allows access to Java objects and properties stored in an ActionContext. Usage of these low-level functions is discouraged because they can effectively execute strings as code, leading to remote code execution vulnerabilities. Consider using struts tags when processing user-supplied input and templates.

Examples

Insecure Code

java
TextParseUtil.translateVariables(userInput);

Secure Code

java
use struts tags for user input processing

Remediation

Avoid using OGNL packages with user-supplied input. Instead, use struts tags for processing user input and templates.

Rule Details

FieldValue
IDCODE-0711
CategoryInjection
SeverityHIGH
CWECWE-917
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
Tagsinjection, ognl, struts
OWASPA1:2017-Injection, A03:2021-Injection