Summary
Penpot contains a stored cross-site scripting vulnerability in file comments because comment content is rendered with innerHTML without sanitization. A team member who can comment on a shared file may cause scripts to execute in the browsers of collaborators who open the comments panel, potentially enabling actions as those users and access to their Penpot data.
Affected context
The vulnerability occurs in Penpot file comments when comment text is stored without removing active markup and later inserted into the page as HTML. It is relevant to shared files where one team member can create comments and other collaborators may view the affected comments panel.
Exploit preconditions
- Attack surface: Penpot's file comment interface
- Required access: Permission to comment on a shared file
- Trigger point: A collaborator opens the comments panel for the affected file
- Why exploitation is possible: Comment content is written to the browser through
innerHTMLwithout effective sanitization, allowing active HTML or script-capable browser behavior to run in the Penpot origin
Why this happens
The underlying bug is a failure to treat user-controlled comment content as untrusted data when rendering it in the browser. A length check limits size but does not neutralize markup, while direct use of innerHTML permits attacker-controlled content to become executable page structure. This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting.
Potential impact
- Session information may be exposed to malicious code, subject to browser cookie protections
- Actions could be performed as an affected collaborator
- Private files and projects may be accessed or modified
- Project content could be altered or exfiltrated
- Additional users may be affected when they view the same shared file
General mitigation guidance
Mitigation generally focuses on ensuring that comment content is treated as text or is safely sanitized before rendering.
Common defensive patterns include:
- Prefer text-rendering APIs such as
textContentfor untrusted comments - Apply a well-maintained, context-aware HTML sanitizer when limited formatting is required
- Enforce output encoding appropriate to the rendering context
- Avoid assigning untrusted values to
innerHTMLand similar injection-prone sinks - Apply restrictive Content Security Policy controls as defense in depth
- Limit project and file permissions according to least privilege
- Reduce trust in user-generated content across all collaborative surfaces
How teams detect issues like this
Organizations can detect related issues through:
- Static analysis rules identifying
innerHTMLassignments fed by user-controlled data - Code review checks for unsanitized comment, annotation, or messaging content
- Testing that submits markup and script-capable inputs to collaborative text fields
- Browser security testing that verifies rendered content remains inert
- Policy enforcement requiring approved sanitization libraries for HTML rendering
- Automated code review tools that flag unsafe DOM sinks and missing output encoding

