Skip to content

Commit 7a13c31

Browse files
committed
Exclude loopback address from reverse DNS source
1 parent 5973f3f commit 7a13c31

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

java/ql/lib/semmle/code/java/dataflow/FlowSources.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private class ReverseDnsSource extends RemoteFlowSource {
126126
m.getMethod() instanceof ReverseDnsMethod and
127127
not exists(MethodCall l |
128128
(variableStep(l, m.getQualifier()) or l = m.getQualifier()) and
129-
l.getMethod().getName() = "getLocalHost"
129+
(l.getMethod().getName() = "getLocalHost" or l.getMethod().getName() = "getLoopbackAddress")
130130
)
131131
)
132132
}

java/ql/test/query-tests/security/CWE-807/semmle/tests/ConditionalBypassTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public static void main(HttpServletRequest request) throws Exception {
5353
InetAddress loopback = InetAddress.getLoopbackAddress();
5454
// GOOD: reverse DNS on loopback address is fine
5555
if (loopback.getCanonicalHostName().equals("localhost")) {
56-
login(user, password); // $ SPURIOUS: hasConditionalBypassTest
56+
login(user, password); // $ hasConditionalBypassTest
5757
}
5858
if (Inet4Address.getLoopbackAddress().getCanonicalHostName().equals("localhost")) {
59-
login(user, password); // $ SPURIOUS: hasConditionalBypassTest
59+
login(user, password); // $ hasConditionalBypassTest
6060
}
6161
}
6262

0 commit comments

Comments
 (0)