Skip to content

Conversation

@ezhiltech
Copy link

Summary of Fix:
This PR addresses CVE-2024-57077, a Prototype Pollution vulnerability in the extend function. The issue arises because the function does not properly prevent properties like proto, constructor, and prototype from being modified.

Root Cause:
The existing check correctly attempts to skip proto, constructor, and prototype, but the subsequent hasOwnProperty validation was not effectively used due to an empty if block.
This allowed potential prototype pollution attacks by modifying inherited properties of Object.prototype.

Fix Details:
Added a continue; statement inside the hasOwnProperty check to ensure only direct properties of source are copied to target.
This prevents attackers from injecting prototype properties via malicious object assignments.
The extend function now properly validates properties before assigning them, mitigating potential security risks.

Security Impact:
✅ Blocks prototype pollution attempts.
✅ Ensures extend only copies own properties of source.
✅ Maintains backward compatibility without breaking existing functionality.

ezhilkumaran-g_psl and others added 2 commits February 17, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant