Skip to content

Commit d2dc199

Browse files
atorralbasjMarcono1234
authored
Apply suggestions from code review
Co-authored-by: Bas van Schaik <[email protected]> Co-authored-by: Marcono1234 <[email protected]>
1 parent 43a1045 commit d2dc199

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

java/ql/src/experimental/Security/CWE/CWE-020/Log4jJndiInjection.qhelp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@
55

66
<overview>
77
<p>
8-
Log4j versions prior to 2.15.0 are subject to a remote code execution vulnerability via the ldap JNDI parser.
8+
This query flags up situations in which untrusted user data is included in Log4j messages. If an application uses a Log4j version prior to 2.15.0, using untrusted user data in log messages will make an application vulnerable to remote code execution through Log4j's LDAP JNDI parser (CVE-2021-44228).
99
</p>
1010
<p>
1111
As per Apache's Log4j security guide: Apache Log4j2 &lt;=2.14.1 JNDI features used in configuration, log messages, and parameters
1212
do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or
1313
log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled.
14-
From log4j 2.15.0, this behavior has been disabled by default.
14+
From Log4j 2.15.0, this behavior has been disabled by default. Note that this query will not try to determine which version of Log4j is used.
1515
</p>
1616
</overview>
1717

1818
<recommendation>
1919
<p>
20-
This issue was remediated in Log4J v2.15.0. The Apache Logging Services team provides the following mitigation advice:
20+
This issue was remediated in Log4j v2.15.0. The Apache Logging Services team provides the following mitigation advice:
2121
</p>
2222
<p>
2323
In previous releases (>=2.10) this behavior can be mitigated by setting system property "log4j2.formatMsgNoLookups" to “true”
2424
or by removing the JndiLookup class from the classpath (example: zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class).
2525
Java 8u121 protects against RCE by defaulting "com.sun.jndi.rmi.object.trustURLCodebase" and "com.sun.jndi.cosnaming.object.trustURLCodebase" to "false".
2626
</p>
2727
<p>
28-
You can manually check for use of affected versions of Log4J by searching your project repository for Log4J use, which is often in a pom.xml file.
28+
You can manually check for use of affected versions of Log4j by searching your project repository for Log4j use, which is often in a pom.xml file.
2929
</p>
3030
<p>
3131
Where possible, upgrade to Log4J version 2.15.0. If you are using Log4J v1 there is a migration guide available.
3232
</p>
3333
<p>
34-
Please note that Log4J v1 is End Of Life (EOL) and will not receive patches for this issue. Log4J v1 is also vulnerable to other RCE vectors and we
35-
recommend you migrate to Log4J 2.15.0 where possible.
34+
Please note that Log4j v1 is End Of Life (EOL) and will not receive patches for this issue. Log4j v1 is also vulnerable to other RCE vectors and we
35+
recommend you migrate to Log4j 2.15.0 where possible.
3636
</p>
3737
<p>
3838
If upgrading is not possible, then ensure the -Dlog4j2.formatMsgNoLookups=true system property is set on both client- and server-side components.

java/ql/src/experimental/Security/CWE/CWE-020/Log4jJndiInjection.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* @name Log4j JNDI Injection
2+
* @name Log4j log injection and LDAP JNDI injection
33
* @description Building Log4j log entries from user-controlled data may allow
44
* attackers to inject malicious code through JNDI lookups.
55
* @kind path-problem
66
* @problem.severity error
77
* @precision high
8-
* @id java/log4j-jndi-injection
8+
* @id java/log4j-injection
99
* @tags security
1010
* external/cwe/cwe-020
1111
* external/cwe/cwe-074
@@ -168,7 +168,7 @@ private class LoggingSinkModels extends SinkModelCsv {
168168
"org.apache.logging.log4j;LogBuilder;true;log;(String,Object,Object,Object,Object,Object,Object,Object,Object);;Argument[0..8];logging",
169169
"org.apache.logging.log4j;LogBuilder;true;log;(String,Object,Object,Object,Object,Object,Object,Object,Object,Object);;Argument[0..9];logging",
170170
"org.apache.logging.log4j;LogBuilder;true;log;(String,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object);;Argument[0..10];logging",
171-
"org.apache.logging.log4j;LogBuilder;true;log;(String,Supplier);;Argument[0..1];logging",
171+
"org.apache.logging.log4j;LogBuilder;true;log;(String,Supplier[]);;Argument[0..1];logging",
172172
"org.apache.logging.log4j;LogBuilder;true;log;(Supplier);;Argument[0];logging"
173173
]
174174
}

0 commit comments

Comments
 (0)