Know every vulnerabilitybefore it knows you.
DevGuard continuously monitors your dependencies and alerts you when CVEs like this one affect your stack — with real-time threat intelligence built for developers.
GHSA-7m8g-fprr-47fx
No affected components available
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
- 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
<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
- Stealing the cookies (isn’t possible since HttpOnly)
- Crashing the application with a looping javascript payload
The vulnerability can be exploited over the network without needing physical access. It is easy for an attacker to exploit this vulnerability. An attacker does not need any special privileges or access rights. No user interaction is needed for the attacker to exploit this vulnerability. The impact is confined to the system where the vulnerability exists. There is a low impact on the confidentiality of the information. There is a low impact on the availability of the system.
Exploitation attempts have been detected. Elevated vigilance and prompt remediation are advised.
The exploit probability is very low. The vulnerability is unlikely to be exploited in the next 30 days.
We did not find any exploit available. Neither in GitHub repositories nor in the Exploit-Database.
Browse More
Continuously monitor your dependencies and get alerted when vulnerabilities like this one affect your stack.
Checkout DevGuard