Description:
During the Source Code Review of the Freescout Application, a Prototype Pollution has been identified in the /public/js/main.js
source file. The Prototype Pollution is arising because the getQueryParam
Function recursively merges an object containing user-controllable properties into an existing object (For URL Query Parameters Parsing), without first sanitizing the keys. This can allow an attacker to inject a property with a key __proto__
, along with arbitrarily nested properties.
The merge operation assigns the nested properties to the params
object's prototype instead of the target object itself. As a result, the attacker can pollute the prototype with properties containing harmful values, which are then inherited by user-defined objects and subsequently used by the application dangerously.
Impact:
The vulnerability lets an attacker control properties of objects that would otherwise be inaccessible. If the application subsequently handles an attacker-controlled property in an unsafe way, this can potentially be chained with other vulnerabilities like DOM-based XSS, Open Redirection, Cookie Manipulation, Link Manipulation, HTML Injection, etc.
Recommendation:
It is recommended to patch any prototype pollution vulnerabilities identified, regardless of whether these are coupled with exploitable gadgets. Even if you're confident that you haven't missed any, there's no guarantee that future updates to your code or any libraries you use won't introduce new gadgets, paving the way for viable exploits. To mitigate the vulnerability:
- Sanitize Property Keys.
- Prevent Changes to Prototype Objects
- Prevent Object from inheriting properties
For more information: https://portswigger.net/web-security/prototype-pollution/preventing
Steps to Reproduce:
Login to a User.
Go to the following URL: https://demo.freescout.net/conversation/1?__proto__[foo]=bar&folder_id=1
(Replace conversation id to the available conversation id).
Go to the console of the Browser Developer Tool and type Object.foo
, its value will be set to bar. This shows that Prototype Pollution has occurred.
Evidence:
Figure 1: Code Vulnerable to Prototype Pollution
Figure 2: Prototype Polluted
Description:
During the Source Code Review of the Freescout Application, a Prototype Pollution has been identified in the
/public/js/main.js
source file. The Prototype Pollution is arising because thegetQueryParam
Function recursively merges an object containing user-controllable properties into an existing object (For URL Query Parameters Parsing), without first sanitizing the keys. This can allow an attacker to inject a property with a key__proto__
, along with arbitrarily nested properties.The merge operation assigns the nested properties to the
params
object's prototype instead of the target object itself. As a result, the attacker can pollute the prototype with properties containing harmful values, which are then inherited by user-defined objects and subsequently used by the application dangerously.Impact:
The vulnerability lets an attacker control properties of objects that would otherwise be inaccessible. If the application subsequently handles an attacker-controlled property in an unsafe way, this can potentially be chained with other vulnerabilities like DOM-based XSS, Open Redirection, Cookie Manipulation, Link Manipulation, HTML Injection, etc.
Recommendation:
It is recommended to patch any prototype pollution vulnerabilities identified, regardless of whether these are coupled with exploitable gadgets. Even if you're confident that you haven't missed any, there's no guarantee that future updates to your code or any libraries you use won't introduce new gadgets, paving the way for viable exploits. To mitigate the vulnerability:
For more information: https://portswigger.net/web-security/prototype-pollution/preventing
Steps to Reproduce:
Login to a User.
Go to the following URL:
https://demo.freescout.net/conversation/1?__proto__[foo]=bar&folder_id=1
(Replace conversation id to the available conversation id).Go to the console of the Browser Developer Tool and type
Object.foo
, its value will be set to bar. This shows that Prototype Pollution has occurred.Evidence:
Figure 1: Code Vulnerable to Prototype Pollution
Figure 2: Prototype Polluted