Cyber Risks · PortSwigger Research

Java Script prototypes and inheritance

Summary: PortSwigger Research explains that JavaScript uses prototypal inheritance, where every object is linked to a prototype and inherits its properties unless it defines its own with the same key. The article notes that objects inherit from all objects up the prototype chain back to Object.prototype, whose prototype is null, and that the __proto__ property serves as a de facto standard getter and setter for an object's prototype.

What's compelling: The same __proto__ accessor that lets developers read and reassign a prototype is the mechanism behind prototype pollution, the vulnerability class the article points to next - so a language feature treated as ordinary plumbing becomes the attack surface.

Read the original at PortSwigger Research ↗

Topics
Vulnerabilities & Patching
Related