Advisory Database
  • Advisories
  • Dependency Scanning
  1. composer
  2. ›
  3. league/commonmark
  4. ›
  5. GHSA-f8fg-pg57-v4j8

GHSA-f8fg-pg57-v4j8: league/commonmark XSS: `on*` event-handler filter in `AttributesExtension` bypassed with a U+000C form feed

September 1, 2026

The AttributesExtension documents a security guarantee:

Note: Attributes starting with on (e.g. onclick or onerror) are capable of executing JavaScript code and are therefore never allowed by default. You must explicitly add them to the allow list if you want to use them.

— docs/2.x/extensions/attributes.md

Prefixing the attribute name with a single U+000C FORM FEED byte defeats that guarantee. {<FF>onclick="alert(1)"} passes through AttributesHelper::filterAttributes() untouched and is written verbatim into the output, where browsers parse it as a genuine onclick handler.

The same prefix defeats the allow_unsafe_links check, letting a javascript: URI through on href / src even when allow_unsafe_links is false.

This bypasses the fix shipped in the 2.7.0 security release (“Fix XSS in AttributesExtension”, 43207253ea5f14867c77c697cd3838c446cadcea), which added filterAttributes() for the express purpose of blocking these attributes.

Throughout this report <FF> denotes a literal U+000C byte ("\x0C" in PHP). It is invisible in rendered text, so all payloads below are written with PHP escape sequences to stay unambiguous.

References

  • github.com/advisories/GHSA-f8fg-pg57-v4j8
  • github.com/thephpleague/commonmark/commit/dfcdf4554c16aa37c15e3a5ee3243ee26147c239
  • github.com/thephpleague/commonmark/releases/tag/2.9.1
  • github.com/thephpleague/commonmark/security/advisories/GHSA-f8fg-pg57-v4j8

Code Behaviors & Features

Detect and mitigate GHSA-f8fg-pg57-v4j8 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 2.7.0 before 2.9.1

Fixed versions

  • 2.9.1

Solution

Upgrade to version 2.9.1 or above.

Impact 7.2 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N

Learn more about CVSS

Weakness

  • CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
  • CWE-86: Improper Neutralization of Invalid Characters in Identifiers in Web Pages

Source file

packagist/league/commonmark/GHSA-f8fg-pg57-v4j8.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 09 Sep 2026 12:23:54 +0000.