Skip to content

Commit b0983cb

Browse files
committed
Specifically include Base64 encode/decode as a likely intermediate step for hardcoded credentials
1 parent b57a58c commit b0983cb

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

java/ql/src/Security/CWE/CWE-798/HardcodedCredentialsApiCall.ql

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,24 @@ class HardcodedCredentialApiCallConfiguration extends DataFlow::Configuration {
3434
ma.getQualifier() = node1.asExpr()
3535
)
3636
or
37-
FlowSummaryImpl::Private::Steps::summaryThroughStep(node1, node2, false)
37+
// These base64 routines are usually taint propagators, and this is not a general
38+
// TaintTracking::Configuration, so we must specifically include them here
39+
// as a common transform applied to a constant before passing to a remote API.
40+
exists(MethodAccess ma |
41+
ma.getMethod()
42+
.hasQualifiedName([
43+
"java.util", "cn.hutool.core.codec", "org.apache.shiro.codec",
44+
"apache.commons.codec.binary", "org.springframework.util"
45+
], ["Base64$Encoder", "Base64$Decoder", "Base64", "Base64Utils"],
46+
[
47+
"encode", "encodeToString", "decode", "decodeBase64", "encodeBase64",
48+
"encodeBase64Chunked", "encodeBase64String", "encodeBase64URLSafe",
49+
"encodeBase64URLSafeString"
50+
])
51+
|
52+
node1.asExpr() = ma.getArgument(0) and
53+
node2.asExpr() = ma
54+
)
3855
)
3956
}
4057

0 commit comments

Comments
 (0)