Skip to content

Commit 15e266d

Browse files
committed
Crypto: Tweaks to bad crypto ordering queries.
1 parent 9a6aac1 commit 15e266d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

java/ql/src/experimental/quantum/Examples/BadMacOrderDecryptToMac.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ where
2323
macOp.getAnInputArtifact().asElement() = sink.getNode().asExpr()
2424
)
2525
select sink, src, sink,
26-
"MAC order potentially wrong: observed decrypt output to MAC implying the MAC is on plaintext, and not a cipher."
26+
"MAC order potentially wrong: observed a potential decrypt operation output to MAC implying the MAC is on plaintext, and not a cipher."

java/ql/src/experimental/quantum/Examples/BadMacOrderMacOnEncryptPlaintext.ql

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ import experimental.quantum.Language
1616
// might not be known.
1717
// TODO: can we approximate a message source better?
1818
module CommonDataFlowNodeConfig implements DataFlow::ConfigSig {
19-
predicate isSource(DataFlow::Node source) { exists(source.asParameter()) }
19+
predicate isSource(DataFlow::Node source) {
20+
exists(source.asParameter())
21+
or
22+
exists(Crypto::GenericSourceNode other |
23+
other.asElement() = CryptoInput::dfn_to_element(source)
24+
)
25+
}
2026

2127
predicate isSink(DataFlow::Node sink) {
2228
sink = any(Crypto::FlowAwareElement other).getInputNode()
@@ -41,7 +47,7 @@ module CommonDataFlowNodeConfig implements DataFlow::ConfigSig {
4147
}
4248
}
4349

44-
module CommonDataFlowNodeFlow = DataFlow::Global<CommonDataFlowNodeConfig>;
50+
module CommonDataFlowNodeFlow = TaintTracking::Global<CommonDataFlowNodeConfig>;
4551

4652
from DataFlow::Node src, DataFlow::Node sink1, DataFlow::Node sink2
4753
where

0 commit comments

Comments
 (0)