CVE-2026-31898: Jspdf Freetext Annotation Injection

jsPDF is vulnerable to arbitrary PDF object injection. The `createAnnotation` method incorrectly concatenates user input into the `/DS` (default style) PDF string property without escaping. An attacker can break out of the parentheses to inject malicious PDF metadata, including `/AA` for JavaScript execution.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0JS
greprules fetch cve-2026-31898-jspdf-freetext-annotation-injection --engine opengrep

Description

jsPDF is vulnerable to arbitrary PDF object injection. The `createAnnotation` method incorrectly concatenates user input into the `/DS` (default style) PDF string property without escaping. An attacker can break out of the parentheses to inject malicious PDF metadata, including `/AA` for JavaScript execution.