@@ -12,33 +12,28 @@ import semmle.python.dataflow.new.TaintTracking
1212import 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}
0 commit comments