GHSA-95m2-chm4-mq7m

Suggest an improvement
Source
https://github.com/advisories/GHSA-95m2-chm4-mq7m
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/01/GHSA-95m2-chm4-mq7m/GHSA-95m2-chm4-mq7m.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-95m2-chm4-mq7m
Published
2025-01-07T17:11:02Z
Modified
2025-01-07T17:28:16.014884Z
Severity
  • 7.3 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L CVSS Calculator
Summary
PHP-Textile has persistent XSS vulnerability in image link handling
Details

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='<script>alert(1);</script>'+document.cookie)

Would render as the following HTML even in restricted mode:

<p><a href="javascript:document.innerHTML=&#39;&lt;script&gt;alert(1);&lt;/script&gt;&#39;+document.cookie"><img alt="Click Tu" src="securing.pl" title="Click Tu"></a>)</p>

Impact

The attacker can perform any operation in the application with user’s privileges or remotely control user’s browser with automated tools.

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [
        "CWE-79"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2025-01-07T17:11:02Z"
}
References

Affected packages

Packagist / netcarver/textile

Package

Name
netcarver/textile
Purl
pkg:composer/netcarver/textile

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
4.1.3

Affected versions

v2.*

v2.4.2
v2.4.3
v2.5.0
v2.5.1
v2.5.2
v2.5.3
v2.5.4
v2.5.5

v3.*

v3.5.0
v3.5.1
v3.5.2
v3.5.3
v3.5.4
v3.5.5
v3.5.6
v3.6.0
v3.6.1
v3.7.0
v3.7.1
v3.7.2
v3.7.3
v3.7.4
v3.7.5
v3.7.6
v3.7.7
v3.8.0

v4.*

v4.0.0
v4.1.0
v4.1.1
v4.1.2

Database specific

{
    "last_known_affected_version_range": "<= 4.1.2"
}