GHSA-95M2-CHM4-MQ7M
Vulnerability from github – Published: 2025-01-07 17:11 – Updated: 2025-01-07 17:11Details
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='<script>alert(1);</script>'+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.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 4.1.2"
},
"package": {
"ecosystem": "Packagist",
"name": "netcarver/textile"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "4.1.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-79"
],
"github_reviewed": true,
"github_reviewed_at": "2025-01-07T17:11:02Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "### Details\n\nPersistent 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.\n\nIn 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.\n\nIn 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.\n\n### Resolution\n\nThis 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\u0027s [README](https://github.com/textile/php-textile?tab=readme-ov-file#parsing-untrusted-input).\n\n### PoC\n\nThe following Textile input:\n\n```\n!securing.pl(Click Tu)!:javascript:document.innerHTML=\u0027\u003cscript\u003ealert(1);\u003c/script\u003e\u0027+document.cookie)\n```\n\nWould render as the following HTML even in restricted mode:\n\n`\u003cp\u003e\u003ca href=\"javascript:document.innerHTML=\u0026#39;\u0026lt;script\u0026gt;alert(1);\u0026lt;/script\u0026gt;\u0026#39;+document.cookie\"\u003e\u003cimg alt=\"Click Tu\" src=\"securing.pl\" title=\"Click Tu\"\u003e\u003c/a\u003e)\u003c/p\u003e`\n\n### Impact\n\nThe attacker can perform any operation in the application with user\u2019s privileges or remotely control user\u2019s browser with automated tools.",
"id": "GHSA-95m2-chm4-mq7m",
"modified": "2025-01-07T17:11:02Z",
"published": "2025-01-07T17:11:02Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/textile/php-textile/security/advisories/GHSA-95m2-chm4-mq7m"
},
{
"type": "WEB",
"url": "https://github.com/textile/php-textile/commit/ab18ae9703bee8b15f1b9d889d40e1881728bae6"
},
{
"type": "PACKAGE",
"url": "https://github.com/textile/php-textile"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L",
"type": "CVSS_V3"
}
],
"summary": "PHP-Textile has persistent XSS vulnerability in image link handling"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.