CVE-2024-29196: phpmyfaq/phpmyfaq - Path Traversal in Attachments
Summary
CVE-2024-29196: phpMyFAQ Path Traversal in Attachments. Affects phpmyfaq/phpmyfaq versions >= 3.2.5, < 3.2.6. Fixed in 3.2.6. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
phpmyfaq/phpmyfaq is a package available on Packagist that provides a frequently asked questions (FAQ) system for websites. It allows administrators to manage and display FAQs on their websites, including the ability to upload attachments to the FAQs. This vulnerability specifically affects the attachment functionality of phpmyfaq/phpmyfaq.
Vulnerability Detail
A Path Traversal vulnerability exists in the Attachments feature of phpmyfaq/phpmyfaq. Attackers with admin rights can exploit this vulnerability to upload malicious files to arbitrary locations within the web root. By manipulating the attachment location setting, an attacker can traverse directories and upload files outside of the intended directory. This can lead to potential remote code execution or unauthorized access to sensitive files.
How To Fix
Minimum fixed version
3.2.6
This is the first release that contains the fix.
composer require phpmyfaq/phpmyfaq:3.2.6
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, users can manually validate the attachment file path before allowing the upload. This can be done by checking if the specified path is within the intended directory and rejecting any paths that contain directory traversal characters. Here is an example of how to perform this validation in PHP:
$attachmentPath = $_POST['attachment_path'];
$intendedDirectory = '/path/to/intended/directory';
if (strpos($attachmentPath, '..') === false && strpos($attachmentPath, $intendedDirectory) === 0) {
// Proceed with the attachment upload
} else {
// Reject the attachment
}
Conclusion
The Path Traversal vulnerability in phpmyfaq/phpmyfaq Attachments allows attackers with admin rights to upload malicious files to arbitrary locations within the web root. Upgrading to version 3.2.6 or later of phpmyfaq/phpmyfaq is recommended to fix this vulnerability. In the meantime, users can implement the provided workaround to mitigate the risk. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for phpmyfaq/phpmyfaq →
FAQ
The vulnerability allows attackers with admin rights to upload malicious files to arbitrary locations within the web root. This can lead to potential remote code execution or unauthorized access to sensitive files.
Users of phpmyfaq/phpmyfaq versions 3.2.5 and earlier are affected by this vulnerability.
Yes, upgrading to version 3.2.6 of phpmyfaq/phpmyfaq or later fixes this vulnerability.
Yes, users can manually validate the attachment file path to prevent path traversal attacks. See the 'workaround' section for more details.
You can find more information about this vulnerability in the official GitHub advisory: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/03/GHSA-mmh6-5cpf-2c72/GHSA-mmh6-5cpf-2c72.json
References
Related vulnerabilities
Recent vulnerabilities recorded for phpmyfaq/phpmyfaq.