2021-03-10 08:33:40 +00:00
|
|
|
id: prototype-pollution-check
|
|
|
|
|
|
|
|
info:
|
|
|
|
name: Prototype Pollution Check
|
2021-04-06 06:46:11 +00:00
|
|
|
author: pdteam
|
2021-03-10 08:33:40 +00:00
|
|
|
severity: medium
|
2022-04-22 10:38:41 +00:00
|
|
|
reference:
|
|
|
|
- https://github.com/msrkp/PPScan
|
2021-03-10 08:33:40 +00:00
|
|
|
tags: headless
|
2021-03-10 10:41:33 +00:00
|
|
|
|
2021-03-10 08:33:40 +00:00
|
|
|
headless:
|
|
|
|
- steps:
|
|
|
|
- action: setheader
|
|
|
|
args:
|
|
|
|
part: response
|
|
|
|
key: Content-Security-Policy
|
|
|
|
value: "default-src * 'unsafe-inline' 'unsafe-eval' data: blob:;"
|
|
|
|
- action: setheader
|
|
|
|
args:
|
|
|
|
part: response
|
|
|
|
key: X-Frame-Options
|
|
|
|
value: foo
|
|
|
|
- action: setheader
|
|
|
|
args:
|
|
|
|
part: response
|
|
|
|
key: If-None-Match
|
|
|
|
value: foo
|
|
|
|
- action: script
|
|
|
|
args:
|
|
|
|
hook: true
|
|
|
|
code: |
|
|
|
|
// Hooking code adapted from https://github.com/msrkp/PPScan/blob/main/scripts/content_script.js
|
2022-07-28 11:21:08 +00:00
|
|
|
() => {
|
|
|
|
window.alerts = [];
|
2021-03-10 08:33:40 +00:00
|
|
|
|
2022-07-28 11:21:08 +00:00
|
|
|
logger = found => window.alerts.push(found);
|
2021-03-10 08:33:40 +00:00
|
|
|
|
2022-07-28 11:21:08 +00:00
|
|
|
function check() {
|
|
|
|
loc = location.href;
|
2021-03-10 08:33:40 +00:00
|
|
|
|
2022-07-28 11:21:08 +00:00
|
|
|
if (loc.indexOf("e32a5ec9c99") >= 0 && loc.search("a0def12bce") == -1) {
|
|
|
|
setTimeout(function() {
|
|
|
|
if (Object.prototype.e32a5ec9c99 == "ddcb362f1d60") {
|
|
|
|
logger(location.href);
|
|
|
|
}
|
|
|
|
var url = new URL(location.origin + location.pathname);
|
|
|
|
url.hash = "__proto__[a0def12bce]=ddcb362f1d60&__proto__.a0def12bce=ddcb362f1d60&dummy";
|
|
|
|
location = url.href;
|
|
|
|
}, 5 * 1000);
|
|
|
|
} else if (loc.search("a0def12bce") != -1) {
|
|
|
|
setTimeout(function() {
|
|
|
|
if (Object.prototype.a0def12bce == "ddcb362f1d60") {
|
|
|
|
logger(location.href);
|
|
|
|
}
|
|
|
|
window.close();
|
|
|
|
}, 5 * 1000);
|
|
|
|
} else {
|
|
|
|
var url = new URL(loc);
|
|
|
|
url.searchParams.append("__proto__[e32a5ec9c99]", "ddcb362f1d60");
|
|
|
|
url.searchParams.append("__proto__.e32a5ec9c99", "ddcb362f1d60");
|
|
|
|
location = url.href;
|
|
|
|
}
|
|
|
|
}
|
2021-03-10 08:33:40 +00:00
|
|
|
|
2022-07-28 11:21:08 +00:00
|
|
|
window.onload = function() {
|
|
|
|
if (Object.prototype.e32a5ec9c99 == "ddcb362f1d60" || Object.prototype.a0def12bce == "ddcb362f1d60") {
|
|
|
|
logger(location.href);
|
|
|
|
} else {
|
|
|
|
check();
|
|
|
|
}
|
|
|
|
};
|
2021-03-10 08:33:40 +00:00
|
|
|
|
2022-07-28 11:21:08 +00:00
|
|
|
var timerID = setInterval(function() {
|
|
|
|
if (Object.prototype.e32a5ec9c99 == "ddcb362f1d60" || Object.prototype.a0def12bce == "ddcb362f1d60") {
|
|
|
|
logger(location.href);
|
|
|
|
clearInterval(timerID);
|
|
|
|
}
|
|
|
|
}, 5 * 1000);
|
|
|
|
}
|
2021-03-10 08:33:40 +00:00
|
|
|
- args:
|
|
|
|
url: "{{BaseURL}}"
|
|
|
|
action: navigate
|
|
|
|
- action: waitload
|
|
|
|
- action: script
|
|
|
|
name: alerts
|
|
|
|
args:
|
2022-07-28 11:21:08 +00:00
|
|
|
code: window.alerts
|
2021-03-10 08:33:40 +00:00
|
|
|
matchers:
|
|
|
|
- type: word
|
|
|
|
part: alerts
|
|
|
|
words:
|
|
|
|
- "__proto__"
|
|
|
|
extractors:
|
|
|
|
- type: kval
|
|
|
|
part: alerts
|
|
|
|
kval:
|
|
|
|
- alerts
|