[XSS] Better specificity of potential fragmented injection through framework syntax detection (thanks Rom623, barbaz et al).
This commit is contained in:
parent
93b3d888e3
commit
45f3ebd408
|
@ -24,6 +24,7 @@ XSS.InjectionChecker = (async () => {
|
||||||
"/nscl/common/Base64.js",
|
"/nscl/common/Base64.js",
|
||||||
"/nscl/common/AsyncRegExp.js",
|
"/nscl/common/AsyncRegExp.js",
|
||||||
"/nscl/common/DebuggableRegExp.js",
|
"/nscl/common/DebuggableRegExp.js",
|
||||||
|
"/nscl/common/RegExpCombo.js",
|
||||||
"/nscl/common/Timing.js",
|
"/nscl/common/Timing.js",
|
||||||
"/xss/ASPIdiocy.js",
|
"/xss/ASPIdiocy.js",
|
||||||
"/lib/he.js"]
|
"/lib/he.js"]
|
||||||
|
@ -886,13 +887,20 @@ XSS.InjectionChecker = (async () => {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
AttributesChecker: new RegExp(
|
AttributesChecker: RegExp.combo(
|
||||||
"(?:\\W|^)(?:javascript:(?:[^]+[=\\\\\\(`\\[\\.<]|[^]*(?:\\bname\\b|\\\\[ux]\\d))|" +
|
/(?:\W|^)/i, // beginning or after non-space
|
||||||
"data:(?:(?:[a-z]\\w+/\\w[\\w+-]+\\w)?[;,]|[^]*;[^]*\\b(?:base64|charset=)|[^]*,[^]*<[^]*\\w[^]*>))|@" +
|
'(?:',
|
||||||
("import\\W*(?:\\/\\*[^]*)?(?:[\"']|url[^]*\\()" +
|
// executable URLs
|
||||||
"|-moz-binding[^]*:[^]*url[^]*\\(|\\{\\{[^]+\\}\\}")
|
/javascript:(?:[^]+[=\\\(`\[\.<]|[^]*(?:\bname\b|\\[ux]\d))/,
|
||||||
.replace(/[a-rt-z\-]/g, "\\W*$&"),
|
/|data:(?:(?:[a-z]\w+\/\w[\w+-]+\w)?[;,]|[^]*;[^]*\b(?:base64|charset=)|[^]*,[^]*<[^]*\w[^]*>)/,
|
||||||
"i"),
|
')|',
|
||||||
|
// CSS injection
|
||||||
|
/@import\W*(?:\/\*[^]*)?(?:["']|url[^]*\()|-moz-binding[^]*:[^]*url[^]*\(/
|
||||||
|
.source.replace(/[@a-rt-z\-]/g, "\\W*$&"), // fuzzify keywords
|
||||||
|
// potential JS fragmentation in client-side template framework
|
||||||
|
/|(?:\{\{[^]*\S[^]*}}[^]*){2,}/
|
||||||
|
),
|
||||||
|
|
||||||
async checkAttributes(s) {
|
async checkAttributes(s) {
|
||||||
s = this.reduceDashPlus(s);
|
s = this.reduceDashPlus(s);
|
||||||
if (this._rxCheck("Attributes", s)) return true;
|
if (this._rxCheck("Attributes", s)) return true;
|
||||||
|
|
Loading…
Reference in New Issue