forked from typpo/quickchart
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
A prototype pollution vulnerability has been detected in the application where user-controlled input can modify Object.prototype.
Location
- File: telemetry.js
- Line: 26
Issue
The application is assigning values to an object using property names that come from user input. If a malicious user provides proto as the property name, they could modify the Object.prototype, leading to prototype pollution. This could allow an attacker to tamper with application logic and potentially escalate to remote code execution or cross-site scripting.
Recommendation
To fix this issue:
- Use Map objects instead of regular objects when storing key-value pairs with user-controlled keys
- Explicitly check and reject dangerous property names like proto, constructor, and prototype
- Use Object.create(null) to create objects without a prototype when appropriate
- Consider using a library that prevents prototype pollution
Example Fix
Before:
After:
Alternative fix using Map:
References
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels