Skip to content
Prototype pollution Write-up Intermediate

Supply Chain Pollution: Hunting a 16 Million Download/Week npm Package Vulnerability for a CTF Challenge

An npm package that parses INI files was vulnerable to prototype pollution because it did not block dangerous keys, allowing an attacker to supply a malicious INI file and pollute object prototypes.

Eugene Lim Follow

Published on spaceraccoon.dev

GovTech’s Cyber Security Group recently organised the STACK the Flags Cybersecurity Capture-the-Flag (CTF) competition from 4th to 6th December 2020. For the web domain, my team wanted to build challenges that addressed real-world issues we have encountered during penetration testing of government web applications and…

Eugene Lim (@spaceraccoonsec), on spaceraccoon.dev

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

Impact

An attacker could exploit this vulnerability to pollute object prototypes, though the actual impact depends on how the application uses the parsed configuration.

What the attacker needed

Application uses 'ini' to parse untrusted input; attacker can supply a crafted INI file

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.

Prototype pollution is a JavaScript bug where an attacker can add or change properties on the base object that all other objects inherit from. This can make the application behave unexpectedly, for example by making every user appear to be an administrator. In this case, a library that reads configuration files allowed such changes because it did not block special property names.

What is Prototype pollution?

Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.

More by Eugene Lim

View all

10 more disclosed reports, best first.

More from Node.js third-party modules

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Prototype pollution

The lesson behind this report.

Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.