Lucene search

K
osvGoogleOSV:GHSA-HM8R-95G3-5HJ9
HistoryMar 25, 2024 - 7:45 p.m.

phpMyFAQ Stored Cross-site Scripting at File Attachments

2024-03-2519:45:12
Google
osv.dev
2
phpmyfaq
admin privileges
unextended attachment
html rendering
xss attacks
md5 hash
attachment path
stored xss
client side javascript

4.3 Medium

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

HIGH

User Interaction

REQUIRED

Scope

UNCHANGED

Confidentiality Impact

LOW

Integrity Impact

LOW

Availability Impact

LOW

CVSS:3.0/AV:N/AC:L/PR:H/UI:R/S:U/C:L/I:L/A:L

6.8 Medium

AI Score

Confidence

High

0.0004 Low

EPSS

Percentile

9.1%

Summary

An attacker with admin privileges can upload an attachment containing JS code without extension and the application will render it as HTML which allows for XSS attacks.

Details

When attachments are uploaded without an extension, the application renders it as HTML by default. Therefore allowing attackers to upload .html files containing javascript code to perform XSS attacks. The direct file path to the uploaded attachment is also easily obtainable as it is made up of substrings of the file’s MD5 hashes.

PoC

  1. Admin users can upload attachments containing XSS payloads in files without extensions to bypass the .html extension check.
    image

  2. Since the path of the uploaded file is built entirely on the file’s MD5 hash and the attachment directory, it is possible for an attacker to know the direct path of the uploaded file.

E.g file MD5 hash: 38fff51cb7248a06d6142c6bdf846831

URL will be: http://127.0.0.1/phpmyfaq/attachments/38fff/51cb7/248a0/6d6142c6bdf846831

- /attachments
- /38fff (first 5 chars of MD5 hash)
- /51cb7 (next 5 chars of MD5 hash)
- /248a0 (next 5 chars of MD5 hash)
- /6d6142c6bdf846831 (remaining chars of MD5 hash)
  1. Even though the attachment was uploaded without a file extension, it is still rendered as .html, hence triggering the XSS payload.
    image

Impact

This allows an attacker to execute arbitrary client side JavaScript within the context of another user’s phpMyFAQ session.

CPENameOperatorVersion
phpmyfaq/phpmyfaqeq3.2.5

4.3 Medium

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

HIGH

User Interaction

REQUIRED

Scope

UNCHANGED

Confidentiality Impact

LOW

Integrity Impact

LOW

Availability Impact

LOW

CVSS:3.0/AV:N/AC:L/PR:H/UI:R/S:U/C:L/I:L/A:L

6.8 Medium

AI Score

Confidence

High

0.0004 Low

EPSS

Percentile

9.1%

Related for OSV:GHSA-HM8R-95G3-5HJ9