CWE
79 80
EPSS
0.067%
Advisory Published
CVE Published
Updated

CVE-2024-24574: phpMyFAQ vulnerable to stored XSS on attachments filename

First published: Mon Feb 05 2024(Updated: )

### 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 ``` <?php foreach ($crumbs as $item) : ?> <tr id="attachment_<?= $item->id ?>" title="<?= $item->thema ?>"> <td><?= $item->id ?></td> <td><?= $item->filename ?></td> <td><?= $item->record_lang ?></td> <td><?= Utils::formatBytes($item->filesize) ?></td> <td><?= $item->mime_type ?></td> <td> ``` 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;` ``` <td><?= Strings::htmlentities($item->filename); ?></td> <td><?= Strings::htmlentities($item->record_lang); ?></td> <td><?= Utils::formatBytes($item->filesize) ?></td> <td><?= Strings::htmlentities($item->mime_type); ?></td> ``` Propose fixing on that pull request https://github.com/thorsten/phpMyFAQ/pull/2827 ### PoC 1. An attacker with permission will upload the attachments image on [http://{base_url}/admin/?action=editentry](http://{base_url}/admin/?action=editentry) 2. On endpoint of ajax upload image POST /admin/index.php?action=ajax&ajax=att&ajaxaction=upload 3. Change the originally name file on parameters filename to a XSS payload 4. The XSS will trigger on attachment pages /admin/?action=attachments - Trigger XSS ![image](https://user-images.githubusercontent.com/37658579/301022211-81da265b-5dce-48bd-a043-8bae0991fe46.png) - Payload XSS <img width="1000" alt="image" src="https://user-images.githubusercontent.com/37658579/301022571-d6cdd166-b1f9-4062-87c5-c8bbb308cd5d.png"> ### 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 1. Stealing the cookies (isn’t possible since HttpOnly) 2. Crashing the application with a looping javascript payload

Credit: security-advisories@github.com security-advisories@github.com

Affected SoftwareAffected VersionHow to fix
composer/phpmyfaq/phpmyfaq<3.2.5
3.2.5
Phpmyfaq Phpmyfaq<3.2.5
<3.2.5

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2024 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203