Dependency Confusion Vulnerability Found in an Archived Apache Project
An archived Apache project referenced a local npm package by name and version range instead of a file path, so npm would prefer a higher-versioned public package with the same name. An attacker could publish a malicious package under that name and achieve remote code execution on machines that install the project.
Published on legitsecurity.com
Get details on the Legit research team's discovery of a dependency confusion vulnerability in an archived Apache project.
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
The project declared a local dependency by name and version range instead of using a file path, so npm resolved it from the public registry.
Impact
An attacker could execute arbitrary code with the application's privileges, potentially leading to remote code execution in production.
What the attacker needed
Victim installs the archived project; attacker can publish to public npm
The fix
The project should reference the local package with a relative file path, and the Apache team accepted a public placeholder package to prevent hijacking.
How it was found
- Find an archived Apache project that references a local package by name.
- Publish a public package with the same name and a higher version that satisfies the version range.
- Observe that npm downloads the public package instead of the local one.
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.
When a project needs extra code, it often downloads 'packages' from a public store like npm. This project meant to use a package stored locally, but it asked for it by name only. npm then looked in the public store first and found a newer package with the same name. An attacker could put bad code in that public package, and it would run on the victim's computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.