File tree Expand file tree Collapse file tree 4 files changed +21
-20
lines changed
javascript/ql/src/semmle/javascript Expand file tree Collapse file tree 4 files changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -400,7 +400,20 @@ module HTTP {
400400 */
401401 abstract string getKind ( ) ;
402402
403- override predicate isThirdPartyControllable ( ) {
403+ /**
404+ * Holds if this part of the request may be controlled by a third party,
405+ * that is, an agent other than the one who sent the request.
406+ *
407+ * This is true for the URL, query parameters, and request body.
408+ * These can be controlled by a malicious third party in the following scenarios:
409+ *
410+ * - The user clicks a malicious link or is otherwise redirected to a malicious URL.
411+ * - The user visits a web site that initiates a form submission or AJAX request on their behalf.
412+ *
413+ * In these cases, the request is technically sent from the user's browser, but
414+ * the user is not in direct control of the URL or POST body.
415+ */
416+ predicate isThirdPartyControllable ( ) {
404417 exists ( string kind | kind = getKind ( ) |
405418 kind = "parameter" or
406419 kind = "url" or
Original file line number Diff line number Diff line change @@ -43,10 +43,10 @@ module ReflectedXss {
4343 }
4444 }
4545
46- /** A source of remote user input, considered as a flow source for reflected XSS. */
47- class RemoteFlowSourceAsSource extends Source {
48- RemoteFlowSourceAsSource ( ) {
49- this .( RemoteFlowSource ) .isThirdPartyControllable ( )
46+ /** A third-party controllable request input, considered as a flow source for reflected XSS. */
47+ class ThirdPartyRequestInputAccessAsSource extends Source {
48+ ThirdPartyRequestInputAccessAsSource ( ) {
49+ this .( HTTP :: RequestInputAccess ) .isThirdPartyControllable ( )
5050 }
5151 }
5252
Original file line number Diff line number Diff line change @@ -10,18 +10,6 @@ import semmle.javascript.security.dataflow.DOM
1010abstract class RemoteFlowSource extends DataFlow:: Node {
1111 /** Gets a string that describes the type of this remote flow source. */
1212 abstract string getSourceType ( ) ;
13-
14- /**
15- * Holds if this flow source comes from an incoming request, and this part of the
16- * request can be controlled by a third party, that is, an actor other than the one
17- * sending the request.
18- *
19- * Any web site can redirect the visitor's browser to any other domain, and in doing so control
20- * the entire URL and POST body. In this scenario, these values are technically sent by the
21- * user's browser, but the user is not in direct control of these values, so they are considered
22- * third-party controllable.
23- */
24- predicate isThirdPartyControllable ( ) { none ( ) }
2513}
2614
2715/**
Original file line number Diff line number Diff line change @@ -91,9 +91,9 @@ module ServerSideUrlRedirect {
9191 }
9292
9393 /** A source of third-party user input, considered as a flow source for URL redirects. */
94- class RemoteFlowSourceAsSource extends Source {
95- RemoteFlowSourceAsSource ( ) {
96- this .( RemoteFlowSource ) .isThirdPartyControllable ( )
94+ class ThirdPartyRequestInputAccessAsSource extends Source {
95+ ThirdPartyRequestInputAccessAsSource ( ) {
96+ this .( HTTP :: RequestInputAccess ) .isThirdPartyControllable ( )
9797 }
9898 }
9999
You can’t perform that action at this time.
0 commit comments