GitHub Advisoryadvisory · Packagist

GHSA-95m2-chm4-mq7m PHP-Textile has persistent XSS vulnerability in image link handling

HIGH Published 2025-01-07 Modified 2025-01-07 Official page ↗
Ecosystem
Packagist
Packages
netcarver/textile
Severity
High
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Weaknesses
CWE-79
Reviewed
2025-01-07

Affected packages

• Packagist netcarver/textile: < 4.1.3 → fixed in 4.1.3

Description

Details Persistent XSS vulnerability in image link handling of PHP-Textile versions 4.1.2 and older, when running the parser in restricted mode. In restricted mode it is expected that the input would be sanitized, allowing user-input (such as user comments) to be parsed and handled safely by the PHP-Textile library. In restricted mode, the version 4.1.2 of the library does not sanitize or validate user-controllable href input in image links, but allows any link protocol or JavaScriptt links to be used. The vulnerability allows an attacker to add malicious JavaScript code to the page which is then executed when an unexpecting user clicks the link. In non-restricted mode, the library allows mixed HTML input, and any link protocol by design. In restricted mode, text links were already handled correctly and the vulnerability only affects image links. Resolution This issue was fixed in PHP-Textile version 4.1.3. Version 4.1.3 disallows use of JavaScript in image links when the parser is ran in restricted mode. Restricted mode can be enabled with `Parser::setRestricted()` method prior to calling the `parse` method. For more information, see Parsing unstructed input in the project's README. PoC The following Textile input: ``` !securing.pl(Click Tu)!:javascript:document.innerHTML='alert(1);'+document.cookie) ``` Would render as the following HTML even in restricted mode: `)` Impact The attacker can perform any operation in the application with user’s privileges or remotely control user’s browser with automated tools.

Related

Weakness · CWE (1)

  • CWE-79 Improper Neutralization of Input During Web Page Generation weakness

References