wallabag: Stored XSS via `iframe` `srcdoc` in Publicly Shared Entries

The wallabag HTML sanitizer leaves the srcdoc attribute on iframe elements. An authenticated user shares a crafted entry publicly, and the script runs in the session of every logged-in user who opens the link.

Advisory ID: TP-2026-172
Product: wallabag (self-hosted read-it-later application for saving web articles)
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
Vendor advisory: GHSA-pm9c-2xjm-j395
Affected versions: wallabag 2.3.0 to 2.6.14
Fixed in: wallabag 2.6.15 (requires Graby 2.5.3)
Reported: 29 May 2026

Summary

wallabag is a self-hosted read-it-later application that saves web articles and sanitizes them through the Graby library with htmLawed. The sanitizer allows iframe elements and does not remove their srcdoc attribute. A value written with HTML entities passes the filter unchanged, and the browser runs it as a document in the wallabag origin. An authenticated user creates such an entry and shares it publicly. When a logged-in user opens the link, the script runs in that user's session. Verified on wallabag 2.6.14.

Root cause

cleanupXss() calls htmLawed with 'elements' => '*+iframe-meta' and 'deny_attribute' => 'style' (vendor/j0k3r/graby/src/Graby.php:1038-1048). +iframe re-adds the element that safe mode otherwise removes (htmLawed.php:50-52), and htmLawed lists srcdoc as a valid iframe attribute whose value it does not inspect as HTML (htmLawed.php:1028). ContentProxy::updateEntry passes the content field of POST /api/entries to this filter only (src/Wallabag/CoreBundle/Helper/ContentProxy.php:53-55). shareEntryAction serves the entry at GET /share/{uid} without authentication (src/Wallabag/CoreBundle/Controller/EntryController.php:602-617), and the template prints it with entry.content|raw (src/Wallabag/CoreBundle/Resources/views/Entry/share.html.twig:34). Public sharing is on by default with share_public: 1 (app/config/wallabag.yml:41-42), and the first fix in Graby 2.5.1 had no effect because 'style srcdoc' is written with a space while htmLawed splits the list on commas.

Proof of Concept

POST /api/entries.json HTTP/1.1
Authorization: Bearer <user>

url=https://example.org/a
content=<iframe srcdoc="&lt;img src=x onerror=&quot;alert(document.domain)&quot;&gt;"></iframe>

POST /share/<id>     -> public link /share/<uid>
GET  /share/<uid>    -> script runs in the wallabag origin

htmLawed sees no markup in the attribute value because < and > are encoded as entities. The browser decodes srcdoc and loads the content as a same-origin document, since the iframe carries no sandbox attribute and wallabag sends no Content Security Policy.

Impact

  • JavaScript in the wallabag origin on every visit to the shared link.
  • Same-origin requests in the session of a logged-in viewer, including reading and changing their entries and settings.
  • With an administrator as the viewer, access to the user management of the instance.
  • Entries that are already stored stay unchanged after the upgrade; the vendor recommends reloading or deleting entries that contain srcdoc.

References

Is Something Like This in Your Software?

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