Skip to content

Commit ef6f022

Browse files
committed
Crypto: Addressing FPs in BadMacOrderMacOnEncryptPlaintext
1 parent 5923e5c commit ef6f022

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ module CommonDataFlowNodeConfig implements DataFlow::ConfigSig {
2828
sink = any(Crypto::FlowAwareElement other).getInputNode()
2929
}
3030

31+
// Don't go in to a known out node, this will prevent the plaintext
32+
// from tracing out of cipher operations for example, we just want to trace
33+
// the plaintext to uses.
34+
// NOTE: we are not using a barrier out on input nodes, because
35+
// that would remove 'use-use' flows, which we need
36+
predicate isBarrierIn(DataFlow::Node node) {
37+
node = any(Crypto::FlowAwareElement element).getOutputNode()
38+
}
39+
3140
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
3241
node1.(AdditionalFlowInputStep).getOutput() = node2
3342
or
@@ -43,6 +52,7 @@ module CommonDataFlowNodeFlow = TaintTracking::Global<CommonDataFlowNodeConfig>;
4352

4453
from DataFlow::Node src, DataFlow::Node sink1, DataFlow::Node sink2
4554
where
55+
not src.asExpr() instanceof NullLiteral and
4656
CommonDataFlowNodeFlow::flow(src, sink1) and
4757
CommonDataFlowNodeFlow::flow(src, sink2) and
4858
exists(Crypto::CipherOperationNode cipherOp |

0 commit comments

Comments
 (0)