Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1ebc9f4

Browse files
committed
Java: Only detect JxBrowser < 6.24
1 parent b308728 commit 1ebc9f4

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

java/ql/src/experimental/Security/CWE/CWE-295/JXBrowserWithoutCertValidation.ql

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@ import semmle.code.java.security.Encryption
1212
import semmle.code.java.dataflow.TaintTracking
1313

1414
/*
15-
* This query is version specific to JXBrowser 6.x.x. The version is indirectly detected.
15+
* This query is version specific to JXBrowser < 6.24. The version is indirectly detected.
1616
* In version 6.x.x the `Browser` class is in a different package compared to version 7.x.x.
1717
*/
1818

19+
/**
20+
* Holds if a safe JXBrowser 6.x.x version is used, such as version 6.24.
21+
* This is detected by the the presence of the `addBoundsListener` in the `Browser` class.
22+
*/
23+
private predicate isSafeJXBrowserVersion() {
24+
exists(Method m | m.getDeclaringType() instanceof JXBrowser | m.hasName("addBoundsListener"))
25+
}
26+
1927
/** The `com.teamdev.jxbrowser.chromium.Browser` class. */
2028
private class JXBrowser extends RefType {
2129
JXBrowser() { this.hasQualifiedName("com.teamdev.jxbrowser.chromium", "Browser") }
@@ -69,5 +77,6 @@ private class JXBrowserTaintTracking extends TaintTracking::Configuration {
6977
from JXBrowserTaintTracking cfg, DataFlow::Node src
7078
where
7179
cfg.isSource(src) and
72-
not cfg.hasFlow(src, _)
80+
not cfg.hasFlow(src, _) and
81+
not isSafeJXBrowserVersion()
7382
select src, "This JXBrowser instance allows man-in-the-middle attacks."

0 commit comments

Comments
 (0)