GHSA-gwpm-pm6x-h7rj: ZendFramework Cross-site Scripting vector in `Zend_Filter_StripTags`
ZendFilterStripTags is a filtering class analogous to PHP's striptags() function. In addition to stripping HTML tags and selectively keeping those provided in a whitelist, it also provides the ability to whitelist specific attributes to retain per whitelisted tag.
Published Jun 7, 2024
Affected packages
zendframework/zendframework1
- Ecosystem
- Composer (PHP)
- Affected
- >= 1.7.0, < 1.7.6
- Fixed in
- 1.7.6
- Check
composer show zendframework/zendframework1
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Zend_Filter_StripTags is a filtering class analogous to PHP's strip_tags() function. In addition to stripping HTML tags and selectively keeping those provided in a whitelist, it also provides the ability to whitelist specific attributes to retain per whitelisted tag.
The reporter discovered that attributes that contained whitespace, and in paricular, line breaks, surrounding the attribute assignment operator would not be stripped, regardless of whether or not they were whitelisted. As examples of input affected:
<!-- newlines before and/or after assignment: -->
IssuesWhen passed to the following code:
$filter = new Zend_Filter_StripTags(array('a' => array('href')));
$value = $filter->($html);then the "onclick" attribute would remain, even though it was not specified in the tag's whitelist. This could open potential cross-site scripting attack (XSS) vectors.
Recommendations
If you were using Zend_Filter_StripTags and utlizing the attribute whitelisting functionality, you should immediately upgrade to Zend Framework 1.7.6 or above; regardless, it is always best to run the most current version of the framework.
Also, if relying on Zend_Filter_StripTags to prevent XSS, the only way to reliably do so is to strip all tags, and never to whitelist. If you are whitelisting, you should consider finding a reliable XSS filter through which to run your output; we recommend HTML Purifier.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Composer (PHP) vulnerabilities
All Composer (PHP) entriesGHSA-229x-22xc-2f2w
Zendframework Local file disclosure via XXE injection in Zend_XmlRpc
high8.6Jun 7, 2024GHSA-2jx7-xg83-j2m7
Zendframework Denial of Service vector via XEE injection
high7.5Jun 7, 2024GHSA-2x36-qhx3-7m5f
ZendFramework1 Potential SQL injection in the ORDER implementation of Zend_Db_Select
critical9.8Jun 7, 2024GHSA-4j9x-g4x8-vcmf
ZendFramework potential XML eXternal Entity injection vectors
high7.5Jun 7, 2024GHSA-4v57-pwvf-x35j
Zendframework potential Cross-site Scripting vector in `Zend_Service_ReCaptcha_MailHide`
medium6.1Jun 7, 2024GHSA-4vf6-mq7w-3hp6
Zend_Filter_StripTags vulnerable to Cross-site Scripting when comments allowed
medium6.1Jun 7, 2024
