Описание
phpMyFAQ vulnerable to stored XSS on attachments filename
Summary
Unsafe echo of filename in phpMyFAQ\phpmyfaq\admin\attachments.php leading to allow execute JavaScript code in client side (XSS)
Details
On that snippet code of rendering the file attachments from user tables
The data directly rendering with short hand echo without any sanitation first, its recommend to use existing class of Strings::htmlentities on use phpMyFAQ\Strings;
Propose fixing on that pull request https://github.com/thorsten/phpMyFAQ/pull/2827
PoC
- An attacker with permission will upload the attachments image on http://{base_url}/admin/?action=editentry
- On endpoint of ajax upload image POST /admin/index.php?action=ajax&ajax=att&ajaxaction=upload
- Change the originally name file on parameters filename to a XSS payload
- The XSS will trigger on attachment pages /admin/?action=attachments
-
Trigger XSS

-
Payload XSS
Impact
This vulnerability will allow an attacker with a permissions of uploading an attachment to storing the payload of XSS on database specific table faqattachment columns filename.
The XSS payload could be rendering on page that listing the file on tables, and impact to others user that on the hierarchy.
The payload XSS have several attack scenario such like
- Stealing the cookies (isn’t possible since HttpOnly)
- Crashing the application with a looping javascript payload
Ссылки
- https://github.com/thorsten/phpMyFAQ/security/advisories/GHSA-7m8g-fprr-47fx
- https://nvd.nist.gov/vuln/detail/CVE-2024-24574
- https://github.com/thorsten/phpMyFAQ/pull/2827
- https://github.com/thorsten/phpMyFAQ/commit/5479b4a4603cce71aa7eb4437f1c201153a1f1f5
- https://www.phpmyfaq.de/security/advisory-2024-02-05
Пакеты
phpmyfaq/phpmyfaq
< 3.2.5
3.2.5
Связанные уязвимости
phpMyFAQ is an open source FAQ web application for PHP 8.1+ and MySQL, PostgreSQL and other databases. Unsafe echo of filename in phpMyFAQ\phpmyfaq\admin\attachments.php leads to allowed execution of JavaScript code in client side (XSS). This vulnerability has been patched in version 3.2.5.