I'm not even sure whether there's a defense against this when trying to limit the user to a subset of JavaScript. It feels like you need to write a compiler or interpreter that doesn't know anything outside of that subset otherwise you can break out of the language sandbox.
Security
A community for discussion about cybersecurity, hacking, cybersecurity news, exploits, bounties etc.
Rules :
- All instance-wide rules apply.
- Keep it totally legal.
- Remember the human, be civil.
- Be helpful, don't be rude.
Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient
This article reads like AI and lacks coherence in crucial parts of the attempted "explanation", specifically:
TypeScript compiler checks the code: ✓ Types match (at compile-time)
Seems like TypeScript could be generating JavaScript code that does these type checks on function entry - with a runtime cost of course.
Is there no such setting, general or conditional toggle on functions or types?
Sanitizer logic: Skips execution (wrong type)
But why? Why does it "skip" when there's logic there? That doesn't make sense.
If someone passes an object with a length property, this works. If they pass an array, it works.
This later example explains how it can work for some logic. But it doesn't correlate to the actual exploitation or code in question.