I Reverse-Engineered a 500MB AI Binary and Found 9 Security Bugs
The public npm package for a CLI tool shipped internal type definitions and a postinstall script that placed a large binary without any integrity verification, and the binary contained build server paths and an unreleased microphone feature. An attacker could substitute a malicious binary during installation or learn internal details to craft further attacks.
Published on blogs.visheshrawal.in
Free link for non-members.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the installer script lacked any hash or signature check before placing the binary, and the build process embedded internal paths and unreleased code in the shipped package.
Impact
An attacker who can influence the optional dependency could get a malicious binary installed silently, and the leaked internal details and unreleased feature could aid further attacks or privacy concerns.
What the attacker needed
Ability to tamper with optional dependency; user installs the npm package
The fix
The installer should verify the binary's integrity using a signed hash before placing it, and the build should exclude internal paths and unreleased code.
How it was found
- Download the npm package tarball and extract it.
- Inspect the package contents, noting the type definitions file.
- Install the package to obtain the platform-specific binary.
- Use file and readelf to identify the binary format and locate the .bun section.
- Extract the .bun section and run strings on the binary to recover application strings.
- Read the postinstall script and check for hash or signature verification.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This is a write-up about looking inside a large program you install from npm. The author found that the installer does not check whether the main program file is the correct one, so someone who can tamper with the download could replace it with their own. They also found internal notes and an unfinished microphone feature inside the program.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.