PatchClock

PHP security digest · 25 Sep 2026

code16 Sharp vulnerable to stored XSS via iframe srcdoc Attribute

High CVE-2026-61823

Package
code16/sharp
Fixed in
9.22.5
Published
Fri 25 Sep 2026, 16:02 LisbonUpdated Mon 26 Oct 2026, 01:25 Lisbon
Installs on Packagist
69K

In plain words

An attacker with permission to edit an Editor field can store malicious scripts through an improperly sanitised iframe attribute in the rich text editor. The scripts run when other users view the content, potentially allowing session theft, account takeover, privilege escalation or admin panel data theft.

Affected versions

PackageAffectedFixed in
code16/sharp< 9.22.59.22.5

Am I affected?

Check composer.lock for code16/sharp: versions below 9.22.5 are affected, and 9.22.5 contains the fix. Check whether your project uses Editor fields whose content can be edited by an attacker and viewed by other users.

What to do

Check which version you have, then update to a fixed release for your branch (9.22.5):

composer show code16/sharp | grep versions
composer update code16/sharp

If your version constraint in composer.json keeps you below a fixed release, raise it first. Whether your configuration is affected, and the exact version ranges, are in the advisory itself.

If you cannot update yet

If you cannot upgrade immediately, manually sanitise all editor field content to strip srcdoc attributes.

The advisory's description

Impact

A Stored Cross-Site Scripting (XSS) vulnerability exists in the rich text editor due to improper sanitization of the srcdoc attribute on <iframe> elements.

While the underlying Symfony HtmlSanitizer correctly HTML-encodes special characters inside the attribute value (e.g., converting <script> to <script>), the HTML specification mandates that browsers automatically decode HTML entities inside attribute values before processing them. As a result, any encoded JavaScript inside a srcdoc attribute is evaluated and executed as live HTML/JS in the context of the iframe when the page is rendered.

An attacker with permissions to edit an Editor field can inject malicious scripts to target other users viewing the content. Potential impacts include:

  • Session Hijacking (stealing admin session cookies via document.cookie)
  • Account Takeover & Privilege Escalation (e.g., a low-privileged editor triggering actions as an Administrator)
  • Admin panel data theft

Patches

The vulnerability has been patched in version v9.22.5.

The fix explicitly removes srcdoc from the list of allowed iframe attributes in src/Utils/Sanitization/FormatsSanitizedValue.php.

Workarounds

Users who cannot upgrade immediately can manually sanitize all content of editor fields to strip srcdoc attributes.

Weakness: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'). Reported by nova-aryan.

The advisory

From OSV.dev, which gathers the GitHub Advisory Database, FriendsOfPHP and Drupal security advisories; the summary is theirs. The description, affected versions, weakness and credits are from the GitHub Advisory Database (CC BY 4.0). "In plain words", "Am I affected?" and "If you cannot update yet" are based on that advisory, and checked to name no version it does not.