From 05df2f2216ff4e854a85c5d6058bb376e0fd9a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nora=20Dimitrijevi=C4=87?= Date: Wed, 16 Jul 2025 10:30:31 +0200 Subject: [PATCH] =?UTF-8?q?[DIFF-INFORMED]=20C++:=20CWE-311/Cleartext?= =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Security/CWE/CWE-311/CleartextBufferWrite.ql | 6 ++++++ .../Security/CWE/CWE-311/CleartextFileWrite.ql | 10 ++++++++++ .../CWE/CWE-311/CleartextTransmission.ql | 16 ++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/cpp/ql/src/Security/CWE/CWE-311/CleartextBufferWrite.ql b/cpp/ql/src/Security/CWE/CWE-311/CleartextBufferWrite.ql index f2754c5811f..c671ad5af7f 100644 --- a/cpp/ql/src/Security/CWE/CWE-311/CleartextBufferWrite.ql +++ b/cpp/ql/src/Security/CWE/CWE-311/CleartextBufferWrite.ql @@ -47,6 +47,12 @@ module ToBufferConfig implements DataFlow::ConfigSig { } predicate isSink(DataFlow::Node sink) { isSinkImpl(sink, _) } + + predicate observeDiffInformedIncrementalMode() { any() } + + Location getASelectedSinkLocation(DataFlow::Node sink) { + exists(SensitiveBufferWrite w | result = w.getLocation() | isSinkImpl(sink, w)) + } } module ToBufferFlow = TaintTracking::Global; diff --git a/cpp/ql/src/Security/CWE/CWE-311/CleartextFileWrite.ql b/cpp/ql/src/Security/CWE/CWE-311/CleartextFileWrite.ql index c04ceae7ada..6aff19ceb4a 100644 --- a/cpp/ql/src/Security/CWE/CWE-311/CleartextFileWrite.ql +++ b/cpp/ql/src/Security/CWE/CWE-311/CleartextFileWrite.ql @@ -31,6 +31,16 @@ module FromSensitiveConfig implements DataFlow::ConfigSig { predicate isBarrier(DataFlow::Node node) { node.asExpr().getUnspecifiedType() instanceof IntegralType } + + predicate observeDiffInformedIncrementalMode() { any() } + + Location getASelectedSourceLocation(DataFlow::Node sourceNode) { + exists(SensitiveExpr source | result = source.getLocation() | isSourceImpl(sourceNode, source)) + } + + Location getASelectedSinkLocation(DataFlow::Node sink) { + exists(FileWrite w | result = w.getLocation() | isSinkImpl(sink, w, _)) + } } module FromSensitiveFlow = TaintTracking::Global; diff --git a/cpp/ql/src/Security/CWE/CWE-311/CleartextTransmission.ql b/cpp/ql/src/Security/CWE/CWE-311/CleartextTransmission.ql index 09db3f21602..10bb10d6a2b 100644 --- a/cpp/ql/src/Security/CWE/CWE-311/CleartextTransmission.ql +++ b/cpp/ql/src/Security/CWE/CWE-311/CleartextTransmission.ql @@ -245,6 +245,14 @@ module FromSensitiveConfig implements DataFlow::ConfigSig { // sources to not get path duplication. isSource(node) } + + predicate observeDiffInformedIncrementalMode() { any() } + + Location getASelectedSinkLocation(DataFlow::Node sink) { + exists(NetworkSendRecv networkSendRecv | result = networkSendRecv.getLocation() | + isSinkSendRecv(sink, networkSendRecv) + ) + } } module FromSensitiveFlow = TaintTracking::Global; @@ -266,6 +274,10 @@ module ToEncryptionConfig implements DataFlow::ConfigSig { // sources to not get path duplication. isSource(node) } + + predicate observeDiffInformedIncrementalMode() { + none() // only used negatively + } } module ToEncryptionFlow = TaintTracking::Global; @@ -281,6 +293,10 @@ module FromEncryptionConfig implements DataFlow::ConfigSig { predicate isBarrier(DataFlow::Node node) { node.asExpr().getUnspecifiedType() instanceof IntegralType } + + predicate observeDiffInformedIncrementalMode() { + none() // only used negatively + } } module FromEncryptionFlow = TaintTracking::Global;