subscript icon indicating copy to clipboard operation
subscript copied to clipboard

The object access can be exploited to execute JS code

Open spider853 opened this issue 6 months ago • 1 comments

The library is nice but is dangerous to load arbitrary expressions as they can execute arbitrary code like this: const fn = subscript("Math.constructor.constructor('alert(1)')()"); fn({ Math })

suggestion: disable access to these keys: "proto", "constructor", "prototype" or use Object.hasOwn as a filter

spider853 avatar Jun 24 '25 13:06 spider853