[XSS] Fixed regression in invalid characters optimization causing false negatives (thanks Tsubasa for reporting).
This commit is contained in:
parent
b9121e65ae
commit
2a30b265f1
|
@ -31,6 +31,8 @@ if (UA.isMozilla) {
|
||||||
() => y("https://vulnerabledoma.in/char_test?body=%3Ca%20href=javascript%26colo%u0000n%3balert%281%u0029%3ECLICK"),
|
() => y("https://vulnerabledoma.in/char_test?body=%3Ca%20href=javascript%26colo%u0000n%3balert%281%u0029%3ECLICK"),
|
||||||
() => y("https://vulnerabledoma.in/xss_link?url=javascript%26colo%00n%3Balert%u00281%29"),
|
() => y("https://vulnerabledoma.in/xss_link?url=javascript%26colo%00n%3Balert%u00281%29"),
|
||||||
() => y("https://vulnerabledoma.in/xss_link?url=javascript:\\u{%0A6e}ame"),
|
() => y("https://vulnerabledoma.in/xss_link?url=javascript:\\u{%0A6e}ame"),
|
||||||
|
() => y("https://sandbox.hack.vet/issue/noscript/bypass/multibyte/?q=alert(document.cookie)//<"),
|
||||||
|
() => y("https://sandbox.hack.vet/issue/noscript/bypass/multibyte/?q=/**🚫*/alert(document.cookie)"),
|
||||||
].map(t => Test.run(t))
|
].map(t => Test.run(t))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -530,7 +530,7 @@ XSS.InjectionChecker = (async () => {
|
||||||
let value;
|
let value;
|
||||||
try {
|
try {
|
||||||
// see https://mathiasbynens.be/notes/javascript-identifiers-es6#acceptable-unicode-symbols
|
// see https://mathiasbynens.be/notes/javascript-identifiers-es6#acceptable-unicode-symbols
|
||||||
value = new RegExp(preamble + "[^$_\\p{ID_Start}\\p{ID_Continue}\\u200c\\u200d\\u2028\\u2029]", "u");
|
value = new RegExp(preamble + "[^\\x00-\\x7E\\p{ID_Start}\\p{ID_Continue}\\u200c\\u200d\\u2028\\u2029]", "u");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Unicode entities are not supported in Gecko <= 77
|
// Unicode entities are not supported in Gecko <= 77
|
||||||
value = new RegExp(preamble + `[${this._createInvalidRanges()}]`, "u");
|
value = new RegExp(preamble + `[${this._createInvalidRanges()}]`, "u");
|
||||||
|
@ -665,12 +665,13 @@ XSS.InjectionChecker = (async () => {
|
||||||
|
|
||||||
lastExpr = expr;
|
lastExpr = expr;
|
||||||
|
|
||||||
if (invalidCharsRx && invalidCharsRx.test(expr)) {
|
if (invalidCharsRx) {
|
||||||
this.log("Quick skipping invalid chars");
|
let m = invalidCharsRx.test(expr);
|
||||||
|
if (m) {
|
||||||
|
this.log(`Quick skipping invalid chars on ${expr}, (${JSON.stringify(m)}).`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (quote) {
|
if (quote) {
|
||||||
if (this.checkNonTrivialJSSyntax(expr)) {
|
if (this.checkNonTrivialJSSyntax(expr)) {
|
||||||
|
|
Loading…
Reference in New Issue