Researcher Demonstrates Node.js Code Execution Through File Writes on Read-Only Systems
· 28:41 · Watch on YouTube ↗
Summary
Stefan Schiller demonstrates how an arbitrary file-write vulnerability can lead to code execution in a Node.js application, even when the root filesystem and procfs are read-only and the application runs with low privileges.
Key points
- The target application allowed user-controlled file paths and contents, but its low-privilege account could write only to an uploads directory.
- The technique writes to an exposed pipe file descriptor through procfs, even when procfs itself is mounted read-only.
- A libuv signal handler processes attacker-supplied pipe data in a way that can lead to a function-pointer invocation.
- The exploit uses existing data and return-oriented programming gadgets in the Node.js image to overcome address randomization constraints.
- The researcher adapted the payload to remain valid UTF-8, including using structure padding to satisfy encoding requirements.
- A demonstration against a sample application produced a reverse shell. Schiller said the approach may also apply to other software using libuv.
Article Details
- Topics
- [00:49] Arbitrary file writes and hardened application constraints
- [03:31] Virtual filesystems and limitations of privileged procfs techniques
- [07:27] Pipe file descriptors exposed through procfs
- [09:15] Node.js signal handling and libuv pipe exploitation
- [14:00] Address randomization and return-oriented programming strategy
- [22:10] UTF-8 payload constraints and exploit adjustments
- [26:44] Demonstration against a read-only sample environment
