# PDF / Document Injection

> Detects user input embedded in PDF or document generation without sanitization, enabling XSS through PDF rendering and data exfiltration.

- Skill: `zakirkun/pdf-document-injection` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add zakirkun/pdf-document-injection`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zakirkun/pdf-document-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/pdf-document-injection

---


# PDF / Document Injection

## Overview
PDF generators that include user-controlled HTML or data can be exploited:
1. **HTML to PDF injection**: Injecting `<script>` or `<link>` tags that read local files via PDF rendering engine (wkhtmltopdf, Puppeteer)
2. **JavaScript in PDF**: PDF actions that execute JavaScript in Adobe Reader
3. **Formula injection in generated Excel**: See CSV Injection

wkhtmltopdf and similar tools can read local files: `<img src="file:///etc/passwd">` in the input HTML.

## Remediation
- HTML-encode all user input before HTML-to-PDF conversion
- Use `--no-local-file-access` flag with wkhtmltopdf
- Use sandboxed PDF generation with no filesystem access

