Summary
Penpot is vulnerable to stored cross-site scripting when custom font family names are inserted into generated CSS and rendered as HTML without sanitization. A team member who opens a file containing a malicious font reference may trigger JavaScript execution in the Penpot origin, potentially allowing actions as the victim and access to their projects.
Affected context
The vulnerability affects Penpot deployments that accept arbitrary custom font family names, interpolate those names into a generated @font-face rule, and insert the resulting content into the page through an HTML-capable sink. It becomes risky when an attacker can create or modify a shared design file and another team member later opens or renders that file.
Exploit preconditions
- Attack surface: Penpot file content and frontend rendering of custom font definitions
- Required access: Ability to create or modify a file, font reference, or other content accepted by the affected workflow
- Trigger point: A victim opens or renders a file containing the stored malicious font value
- Why exploitation is possible: The font family value reaches an HTML-capable rendering path without adequate output encoding or sanitization, allowing stored content to escape its intended CSS context
Why this happens
The underlying bug is context-unsafe handling of user-controlled data. Penpot accepts an arbitrary font-family string, interpolates it into CSS, and writes the resulting style through innerHTML without ensuring that the value remains confined to a CSS string or declaration.
This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, because attacker-controlled data is stored and later interpreted as executable browser content rather than being safely encoded for its output context.
Potential impact
- JavaScript execution in the Penpot origin
- Theft of session data or other accessible browser credentials
- Actions performed with the victim's permissions
- Unauthorized access to files, projects, or team content
- Modification or destruction of shared design assets
- Further compromise of accounts or connected workflows
General mitigation guidance
Mitigation generally focuses on preserving strict separation between data, CSS, and HTML contexts.
Common defensive patterns include:
- Treating font family names and related metadata as untrusted input
- Applying context-aware encoding before inserting values into CSS
- Prefering DOM and stylesheet APIs that assign structured values instead of using
innerHTML - Enforcing an allowlist or strict grammar for accepted font family names
- Sanitizing stored content before rendering, while retaining output encoding as the primary control
- Applying restrictive content security policies as defense in depth
- Limiting file-editing permissions and reviewing content-sharing boundaries
How teams detect issues like this
Organizations can identify similar issues through:
- Static analysis rules for
innerHTMLand other HTML-capable sinks receiving stored or request-derived data - Searches for string interpolation into
<style>elements, CSS rules, or generated markup - Code review checks for missing context-aware encoding and unrestricted font metadata
- Dynamic testing with benign marker values that verify whether CSS and HTML contexts remain isolated
- Policy enforcement that prohibits unsafe DOM sinks unless explicitly justified and reviewed
- Automated security review tools that trace user-controlled data into browser rendering APIs

