detects a hard-coded cipher key for shiro

This commit is contained in:
f1v3
2021-05-17 16:22:50 +08:00
committed by Chris Smowton
parent 60a023d064
commit f3bde56de9
14 changed files with 445 additions and 4 deletions

View File

@@ -27,9 +27,9 @@ class HardcodedCredentialApiCallConfiguration extends DataFlow::Configuration {
override predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
node1.asExpr().getType() instanceof TypeString and
exists(MethodAccess ma | ma.getMethod().hasName(["getBytes", "toCharArray"]) |
exists(MethodAccess ma | ma.getMethod().hasName(["getBytes", "toCharArray","decode"]) |
node2.asExpr() = ma and
ma.getQualifier() = node1.asExpr()
(ma.getQualifier() = node1.asExpr() or ma.getAnArgument() = node1.asExpr())
)
}

View File

@@ -490,7 +490,8 @@ private predicate javaApiCallableCryptoKeyParam(string s) {
s = "sun.security.provider.JavaKeyStore;engineSetKeyEntry(String, byte[], Certificate[]);1" or
s = "sun.security.tools.keytool.Main;recoverKey(String, char[], char[]);2" or
s = "sun.security.tools.keytool.Main;getKeyPasswd(String, String, char[]);2" or
s = "sun.security.x509.X509Key;decode(byte[]);0"
s = "sun.security.x509.X509Key;decode(byte[]);0" or
s = "org.apache.shiro.mgt.AbstractRememberMeManager;setCipherKey(byte[]);0"
}
/**