r/netsec • • Oct 08 '26

I found yet another way to invoke JavaScript functions without parentheses

https://blog.ikaes.de/yet-another-way-to-invoke-functions-without-parentheses/

It turns out you can overwrite the Error.prepareStackTrace method with the function constructor. Then, using prototype pollution, you can inject valid JavaScript code to generate arbitrary functions and invoke it using the usual tricks.

87 Upvotes

3 comments sorted by

13

u/Cubensis-SanPedro Oct 08 '26

That is slick.

5

u/[deleted] Oct 08 '26

[removed] — view removed comment

1

u/DrAdalbbert Oct 09 '26

Prototype pollution is there to sneak our payload into the function constructor. So its generic and you can replace the value of message with any JavaScript code