[javascript] TaintTracking of html with external scripts #87
-
I want to analyze single html page with all external scripts for DOM based XSS. I made a simple page https://github.com/codeqln00b/xss/blob/master/index.html where both default lgtm queries https://lgtm.com/projects/g/codeqln00b/xss/?mode=list and my TaintTracking::Configuration |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Looking at https://lgtm.com/projects/g/codeqln00b/xss/alerts/?mode=list and the results of your custom query, I see that the two XSS vulnerabilities you introduced are correctly flagged by CodeQL.
In both your example files, there is no vulnerability involving the variable
Perhaps you meant to update your examples so that |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Hi 👋. I can confirm that we don't track data flow from global variables in We'll look into improving this, but in the meantime you can add this extra step to your taint-tracking configuration to enable full flow through globals: (here is the query with that step added) override predicate isAdditionalTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
exists(GlobalVariable var |
pred = var.getAnAssignedExpr().flow() and
succ = var.getAnAccess().flow()
)
} I understand you might be wondering why we don't include this step by default. A lot of our work is driven by variant-analysis of real-world vulnerabilities, and this type of data flow is quite rare outside of synthetic tests like yours. I'd be very interested to hear about any real-world vulnerability where this step was needed. What you'd typically find is that the |
Beta Was this translation helpful? Give feedback.
Hi 👋. I can confirm that we don't track data flow from global variables in
main.js
to global variablesindex.html
.We'll look into improving this, but in the meantime you can add this extra step to your taint-tracking configuration to enable full flow through globals: (here is the query with that step added)
I understand you might be wondering why we don't include this step by default. A lot of our work is driven by variant-analysis of real-world vulnerabilities, and this type …