Simple Explanation by PwnFunction
- https://www.youtube.com/watch?v=XS_UMqQalLI
Collection of Exploitable Functions
- https://github.com/Kirill89/prototype-pollution-exploits
=========================================
Consequences of Server-side Prototype Pollution
- https://security.snyk.io/vuln/SNYK-JS-OPENGRAPH-1536747
Property Injection
- Bypass Admin: https://pentesterlab.com/exercises/prototype_pollution/course
- The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens.
- For example: if a codebase checks privileges for someuser.isAdmin, then when the attacker pollutes Object.prototype.isAdmin and sets it to equal true, they can then achieve admin privileges.
Denial of service (DoS)
- This is the most likely attack.
- DoS occurs when Object holds generic functions that are implicitly called for various operations (for example, toString and valueOf).
- The attacker pollutes Object.prototype.someattr and alters its state to an unexpected value such as Int or Object. In this case, the code fails and is likely to cause a denial of service.
- For example: if an attacker pollutes Object.prototype.toString by defining it as an integer, if the codebase at any point was reliant on someobject.toString() it would fail.
Remote Code Execution
- Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation.
- For example: eval(someobject.someattr). In this case, if the attacker pollutes Object.prototype.someattr they are likely to be able to leverage this in order to execute code.
===========================================
Resources
Grandfather paper for Prototype Pollution
- https://github.com/HoLyVieR/prototype-pollution-nsec18/blob/master/paper/JavaScript_prototype_pollution_attack_in_NodeJS.pdf
Prototype Pollution Fuzzer
- https://github.com/HoLyVieR/prototype-pollution-nsec18/tree/master/find-vuln
More definitions
- https://infosecwriteups.com/javascript-prototype-pollution-practice-of-finding-and-exploitation-f97284333b2
