Prototype pollution

From zakirkun/ice-tea · View interactive version

Prototype pollution is an AI agent skill from the GitHub repository zakirkun/ice-tea. Detects JavaScript prototype pollution vulnerabilities where attacker-controlled keys can modify Object.prototype.

How to use this skill

Skill file

Prototype Pollution

Overview

Prototype pollution occurs when JavaScript code recursively merges or assigns properties from user-controlled objects without filtering dangerous keys like __proto__, constructor, or prototype. Modifying Object.prototype affects all JavaScript objects in the application, enabling:

Detection Strategy

Remediation

Vulnerable:

function merge(target, src) {
    for (const key of Object.keys(src)) {
        target[key] = src[key]; // key could be __proto__
    }
}

Safe:

const FORBIDDEN_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
function merge(target, src) {
    for (const key of Object.keys(src)) {
        if (!FORBIDDEN_KEYS.has(key)) target[key] = src[key];
    }
}
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.