Skip to content

Commit c310948

Browse files
committed
Python: Remove enclosing module for PAM Auth Bypass.qll
1 parent 479a9e4 commit c310948

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

python/ql/lib/semmle/python/security/dataflow/PamAuthorization.qll

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,28 @@ import semmle.python.dataflow.new.TaintTracking
1212
import PamAuthorizationCustomizations::PamAuthorizationCustomizations
1313

1414
/**
15-
* Provides a taint-tracking configuration for detecting "PAM Authorization" vulnerabilities.
15+
* A taint-tracking configuration for detecting "PAM Authorization" vulnerabilities.
1616
*/
17-
module PamAuthorization {
18-
/**
19-
* A taint-tracking configuration for detecting "PAM Authorization" vulnerabilities.
20-
*/
21-
class Configuration extends TaintTracking::Configuration {
22-
Configuration() { this = "RemoteToPam" }
17+
class Configuration extends TaintTracking::Configuration {
18+
Configuration() { this = "RemoteToPam" }
2319

24-
override predicate isSource(DataFlow::Node node) { node instanceof Source }
20+
override predicate isSource(DataFlow::Node node) { node instanceof Source }
2521

26-
override predicate isSink(DataFlow::Node node) { node instanceof Sink }
22+
override predicate isSink(DataFlow::Node node) { node instanceof Sink }
2723

28-
override predicate isAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) {
29-
// Models flow from a remotely supplied username field to a PAM `handle`.
30-
// `retval = pam_start(service, username, byref(conv), byref(handle))`
31-
exists(API::CallNode pamStart, DataFlow::Node handle, API::CallNode pointer |
32-
pointer = API::moduleImport("ctypes").getMember(["pointer", "byref"]).getACall() and
33-
pamStart = libPam().getMember("pam_start").getACall() and
34-
pointer = pamStart.getArg(3) and
35-
handle = pointer.getArg(0) and
36-
pamStart.getArg(1) = node1 and
37-
handle = node2
38-
)
39-
or
40-
// Flow from handle to the authenticate call in the final step
41-
exists(VulnPamAuthCall c | c.getArg(0) = node1 | node2 = c)
42-
}
24+
override predicate isAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) {
25+
// Models flow from a remotely supplied username field to a PAM `handle`.
26+
// `retval = pam_start(service, username, byref(conv), byref(handle))`
27+
exists(API::CallNode pamStart, DataFlow::Node handle, API::CallNode pointer |
28+
pointer = API::moduleImport("ctypes").getMember(["pointer", "byref"]).getACall() and
29+
pamStart = libPam().getMember("pam_start").getACall() and
30+
pointer = pamStart.getArg(3) and
31+
handle = pointer.getArg(0) and
32+
pamStart.getArg(1) = node1 and
33+
handle = node2
34+
)
35+
or
36+
// Flow from handle to the authenticate call in the final step
37+
exists(VulnPamAuthCall c | c.getArg(0) = node1 | node2 = c)
4338
}
4439
}

python/ql/src/Security/CWE-285/PamAuthorization.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import python
1414
import DataFlow::PathGraph
1515
import semmle.python.ApiGraphs
16-
import semmle.python.security.dataflow.PamAuthorization::PamAuthorization
16+
import semmle.python.security.dataflow.PamAuthorization
1717

1818
from Configuration config, DataFlow::PathNode source, DataFlow::PathNode sink
1919
where config.hasFlowPath(source, sink)

0 commit comments

Comments
 (0)