Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS05NW0yLWNobTQtbXE3bc4ABDCx

PHP-Textile has persistent XSS vulnerability in image link handling

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.

Permalink: https://github.com/advisories/GHSA-95m2-chm4-mq7m
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS05NW0yLWNobTQtbXE3bc4ABDCx
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: 1 day ago
Updated: 1 day ago


CVSS Score: 7.3
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L

Identifiers: GHSA-95m2-chm4-mq7m
References: Repository: https://github.com/textile/php-textile
Blast Radius: 16.9

Affected Packages

packagist:netcarver/textile
Dependent packages: 20
Dependent repositories: 208
Downloads: 1,122,567 total
Affected Version Ranges: <= 4.1.2
Fixed in: 4.1.3
All affected versions: 2.4.2, 2.4.3, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 3.5.0, 3.5.1, 3.5.2, 3.5.3, 3.5.4, 3.5.5, 3.5.6, 3.6.0, 3.6.1, 3.7.0, 3.7.1, 3.7.2, 3.7.3, 3.7.4, 3.7.5, 3.7.6, 3.7.7, 3.8.0, 4.0.0, 4.1.0, 4.1.1, 4.1.2
All unaffected versions: 4.1.3