Read the docs
TI-2026-66469 Aliases GHSA-3h6j-9x8m-rg3g

Graby has stored XSS via iframe srcdoc Attribute in htmLawed Sanitization Config

Priority LOW 38CWE-79Published · Updated

Key facts

Attack vector
—
Privileges required
—
User interaction
—
Attack complexity
—
Impact type
Cross-site scripting
Confidentiality · integrity · availability
—
Fix status
Fixed

No CVSS vector from any source. Fix status from GitHub. Impact type from CWE-79.

Summary

## Summary Graby's `cleanupXss()` function configures htmLawed with conflicting settings: `safe=1` (which removes `<iframe>`) combined with `'elements' => '*+iframe-meta'` (which re-enables `<iframe>`). htmLawed does not sanitize the `srcdoc` attribute, allowing injection of arbitrary JavaScript that executes when the content is rendered via `|raw` in templates. ## Root Cause **`src/Graby.php` lines 1038-1048:** ```php htmLawed($html, [ 'safe' => 1, // removes <iframe> 'elements' => '*+iframe-meta', // re-adds <iframe>, overrides safe=1 'deny_attribute' => 'style', // srcdoc is NOT denied ]); ``` The `safe=1` and `+iframe` combination is a conflict: `safe` mode is designed to strip dangerous elements, but the elements override re-enables `<iframe>` without also blocking the dangerous `srcdoc` attribute. ## Proof of Concept Input to `cleanupXss()`: ```html <iframe srcdoc="&lt;script&gt;alert(document.domain)&lt;/script&gt;"></iframe> ``` Output (unchanged — htmLawed passes it through): ```html <iframe srcdoc="&lt;script&gt;alert(document.domain)&lt;/script&gt;"></iframe> ``` When rendered via `{{ content|raw }}` in a template, `srcdoc` executes in an `about:srcdoc` frame with the same origin as the page. **Confirmed via Puppeteer/Chromium headless: `alert(document.domain)` fires.** Validated on Wallabag (which uses Graby) via Docker: entry created via API with iframe-only content body triggers Readability failure → falls through to `cleanupXss()` path. ## Impact - Stored XSS in any application rendering Graby-sanitized content via `|raw` - In Wallabag: affects both authenticated views and public share pages (unauthenticated) - No CSP headers in default Wallabag config — no secondary mitigation ## Suggested Fix Either remove `+iframe` from the elements config to keep iframes blocked: ```php 'elements' => '*-iframe-meta', ``` Or explicitly deny the `srcdoc` attribute: ```php 'deny_attribute' => 'style srcdoc', ``` ## Credit Discovered by @tikket1, 2026-03-25. Redirected from wallabag/wallabag advisory by @j0k3r.

Why it matters now

Fix Fixed j0k3r/graby (Packagist): 2.5.1

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
—j0k3r/graby (Packagist)before 2.5.12.5.1Patch availableGHSA-3h6j-9x8m-rg3g
  • j0k3r/graby (Packagist) Vendor— Affected before 2.5.1 Fixed in 2.5.1 Patch available GHSA-3h6j-9x8m-rg3g

Remediation

  • Fix · GHSA-3h6j-9x8m-rg3g j0k3r/graby (Packagist) Fixed in 2.5.1 Advisory →

Timeline

  1. 2026-10-03 Threatist record created from GHSA-3h6j-9x8m-rg3g

References

Sources

This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences