Penpot: Stored XSS via Uploaded SVG Files in the Asset Path

A registered user uploads an SVG file containing <script>; Penpot serves it unchanged and without authentication as image/svg+xml on the application origin.

Advisory ID: TP-2026-164
Product: Penpot (open-source design and prototyping platform)
Vulnerability type: Stored cross-site scripting (CWE-79)
CVE: requested (GitHub CNA), assignment pending
CVSS 3.1: 8.7 (High) · CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
Affected versions: before 2.18.0 (verified live: 2.15.3)
Fixed in: 2.18.0
Reported: 24 May 2026

Summary

Penpot is an open-source design and prototyping platform; users upload images as media objects into their files. The RPC command upload-file-media-object stores an SVG file byte for byte, including any <script> elements it contains. The endpoint /assets/by-id/<media-id> serves it without authentication with Content-Type: image/svg+xml, without Content-Disposition and without a Content Security Policy. When the URL is opened directly, the browser renders the file as a document on the application origin and runs the script. A registered user thereby acts with the session of every authenticated user who opens the asset URL and creates a long-lived access token in that user's name.

Root cause

process-main-image stores the uploaded bytes unchanged with the declared type (:mtype info) in the file-media-object bucket (backend/src/app/rpc/commands/media.clj:114-123, all line numbers as of version 2.15.3).
The SAX parser run at upload reads only width and height and removes neither <script> nor event attributes (backend/src/app/media.clj:117-123, backend/src/app/media.clj:251-260).
file-media-object is listed in public-buckets (backend/src/app/http/assets.clj:29-33), and requires-auth? demands no authentication for that bucket (backend/src/app/http/assets.clj:76-80).
objects-handler serves the object with the stored type (backend/src/app/http/assets.clj:82-97), and the headers from docker/images/files/nginx-security-headers.conf:1-4 contain neither a Content Security Policy nor Content-Disposition.
The default flags allow registration with a password (common/src/app/common/flags.cljc:162-183).

Proof of Concept

cat > x.svg <<'EOF'
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
  <script>document.title = 'XSS-PWN-' + document.domain;</script>
  <rect width="100" height="100" fill="red"/>
</svg>
EOF

curl -s -X POST http://localhost:9001/api/rpc/command/upload-file-media-object \
  -b c.txt -F 'file-id=<file-id>' -F 'is-local=true' -F 'name=x' \
  -F '[email protected];type=image/svg+xml'
# ["^ ","~:media-id","~u<media-id>",...]

curl -s -i http://localhost:9001/assets/by-id/<media-id>
# HTTP/1.1 200 OK
# Content-Type: image/svg+xml
# <svg ...><script>document.title = 'XSS-PWN-' + document.domain;</script>...

The served bytes are identical to the uploaded ones, and the request needs no cookie. Verified on version 2.15.3 with the project's Docker Compose setup: when the asset URL was opened in the browser, the script ran on the application origin, read the authenticated user's profile through get-profile and obtained an access token for that account through create-access-token.

Impact

  • JavaScript execution on the application origin in the session of every authenticated user who opens the asset URL.
  • Read and write access to the victim's profile, teams and files through the RPC interface.
  • create-access-token requires no password re-entry; the created token stays valid outside the browser session.
  • The file stays in storage and can be distributed to any number of users through a single URL; a self-registered account is enough for the attacker.

References

Is Something Like This in Your Software?

Our team found this vulnerability during its work. Have your applications tested by the same specialists, with a penetration test from turingpoint.