Skip to content

Prototype Pollution in getQueryParam Function (URL Query Parser)

Moderate
freescout-helpdesk published GHSA-rx6j-4c33-9h3r May 13, 2024

Package

No package listed

Affected versions

< 1.8.139

Patched versions

1.8.139

Description

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:

  1. Sanitize Property Keys.
  2. Prevent Changes to Prototype Objects
  3. 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:

image
Figure 1: Code Vulnerable to Prototype Pollution

image
Figure 2: Prototype Polluted

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
Low
User interaction
Required
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:L

CVE ID

CVE-2024-34698

Weaknesses

Credits