mirror of
https://github.com/github/codeql.git
synced 2025-12-30 15:46:34 +01:00
Will need subsequent PRs fixing up test failures (due to deprecated methods moving around), but other than that everything should be straight-forward.
31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
/**
|
|
* @name Use of a broken or weak cryptographic algorithm
|
|
* @description Using broken or weak cryptographic algorithms can compromise security.
|
|
* @kind path-problem
|
|
* @problem.severity warning
|
|
* @precision high
|
|
* @id py/weak-cryptographic-algorithm
|
|
* @tags security
|
|
* external/cwe/cwe-327
|
|
*/
|
|
|
|
import python
|
|
import semmle.python.security.Paths
|
|
import semmle.python.security.SensitiveData
|
|
import semmle.python.security.Crypto
|
|
|
|
class BrokenCryptoConfiguration extends TaintTracking::Configuration {
|
|
BrokenCryptoConfiguration() { this = "Broken crypto configuration" }
|
|
|
|
override predicate isSource(TaintTracking::Source source) {
|
|
source instanceof SensitiveDataSource
|
|
}
|
|
|
|
override predicate isSink(TaintTracking::Sink sink) { sink instanceof WeakCryptoSink }
|
|
}
|
|
|
|
from BrokenCryptoConfiguration config, TaintedPathSource src, TaintedPathSink sink
|
|
where config.hasFlowPath(src, sink)
|
|
select sink.getSink(), src, sink, "$@ is used in a broken or weak cryptographic algorithm.",
|
|
src.getSource(), "Sensitive data"
|