# JSONP Injection

> Detects JSONP endpoints that reflect user-controlled callback names without validation, enabling XSS.

- Skill: `zakirkun/jsonp-injection` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add zakirkun/jsonp-injection`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zakirkun/jsonp-injection/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: zakirkun (https://skillmd.com/u/zakirkun)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zakirkun/jsonp-injection

---


# JSONP Callback Injection

## Overview
JSONP (JSON with Padding) endpoints that reflect a user-supplied callback name without validation allow attackers to inject arbitrary JavaScript. JSONP is a legacy cross-origin technique that modern applications should replace with CORS.

**Attack:** `https://api.example.com/data?callback=alert(document.cookie)//`
**Response:** `alert(document.cookie)//({"user": "admin"})` — executes JS

## Remediation
- Replace JSONP with CORS
- If JSONP must be maintained, validate callback against `[a-zA-Z0-9._]+`
- Set `Content-Type: application/javascript` not `text/html`

