Not every browser is Chrome. SpiderMonkey NaN-boxes its values and has its own JIT; SerenityOS's LibJS and the small MuJS and mJS interpreters are C/C++ programs where a JavaScript bug quickly becomes a glibc heap or GOT exploit. These engines run through a bundled Ubuntu 22.04 glibc, so their heap behaves like the original servers'. Take this module any time after 01.
Where to start
Start from the engine, not the bug. For Outfoxed, read how SpiderMonkey boxes values and lays out arrays and typed arrays, and redo module 01's chain with NaN-boxed values. For LibJS, MuJS and mJS, read the engine's source for the value representation and the object the patch touches. These are ordinary C/C++ programs: once you have a primitive, the ending is usually glibc heap or GOT work, so checksec the binary and use the bundled glibc version when you plan it.
Reading
- SpiderMonkey documentation: the engine's own docs, and pointers to the
[SMDOC]comments on JS::Value. - Introduction to SpiderMonkey exploitation (Axel Souchet): JS::Value encoding, shapes and slots, and an OOB taken to code execution in SpiderMonkey.
- Write up for CVE-2019-11707 (vigneshsrao): a SpiderMonkey typed-array exploit, for comparison with V8.
- OR'LYEH? The Shadow over Firefox (Phrack 69): Firefox's jemalloc heap and exploitation primitives in depth.
- LibJS exploitation: broobwser writeup: SerenityOS LibJS objects and a full LibJS exploit.
- how2heap (shellphish): glibc heap techniques by version, for the MuJS, mJS and LibJS endings.
- MuJS: the engine source for jsy.
- mJS: the engine source for KalmarCTF's mjs.
Challenges
30-Day Scoreboard:
This scoreboard reflects solves for challenges in this module after the module launched in this dojo.
| Rank | Hacker | Badges | Score |