{"id":"CVE-2025-22131","aliases":["EUVD-2025-0143","GHSA-79xx-vf93-p7cx"],"status":"published","title":"Cross-Site Scripting (XSS) vulnerability in generateNavigation() function","description":"PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.","severity":{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","level":"medium","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-12","score":0.00396,"percentile":0.34271,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":true,"fix_available":true},"cwes":["CWE-79"],"published":"2025-01-20T15:31:19Z","modified":"2026-10-28T02:31:05Z","exploits":[{"source":"pocgithub","id":"ZzN1NJ4/CVE-2025-22131-PoC","title":"ZzN1NJ4/CVE-2025-22131-PoC","date":"2025-09-03","url":"https://github.com/ZzN1NJ4/CVE-2025-22131-PoC"},{"source":"pocgithub","id":"s0ck37/CVE-2025-22131-POC","title":"s0ck37/CVE-2025-22131-POC","date":"2025-09-05","url":"https://github.com/s0ck37/CVE-2025-22131-POC"}],"fixes":[{"ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","fixed_in":["3.8.0","1.29.8","2.1.7","2.3.6"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.0.0"},{"fixed":"3.8.0"}]}]},{"source":"ghsa","ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.29.8"}]}]},{"source":"ghsa","ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.0.0"},{"fixed":"2.1.7"}]}]},{"source":"ghsa","ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.2.0"},{"fixed":"2.3.6"}]}]},{"source":"ghsa","ecosystem":"Packagist","package":"phpoffice/phpexcel","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"1.8.2"}]}]},{"source":"osv","ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.0.0"},{"fixed":"3.8.0"}]}],"versions":["3.3.0","3.4.0","3.5.0","3.6.0","3.7.0"]},{"source":"osv","ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.29.8"}]}],"versions":["1.0.0","1.0.0-beta","1.0.0-beta2","1.1.0","1.10.0","1.10.1","1.11.0","1.12.0","1.13.0","1.14.0","1.14.1","1.15.0","1.16.0","1.17.0","1.17.1","1.18.0","1.19.0","1.2.0","1.2.1","1.20.0","1.21.0","1.22.0","1.23.0","1.24.0","1.24.1","1.25.0","1.25.1","1.25.2","1.26.0","1.27.0","1.27.1","1.28.0","1.29.0","1.29.1","1.29.2","1.29.4","1.29.5","1.29.6","1.29.7","1.3.0","1.3.1","1.4.0","1.4.1","1.5.0","1.5.1","1.5.2","1.6.0","1.7.0","1.8.0","1.8.1","1.8.2","1.9.0"]},{"source":"osv","ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.0.0"},{"fixed":"2.1.7"}]}],"versions":["2.0.0","2.1.0","2.1.1","2.1.3","2.1.4","2.1.5","2.1.6"]},{"source":"osv","ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.2.0"},{"fixed":"2.3.6"}]}],"versions":["2.2.0","2.2.1","2.2.2","2.3.0","2.3.2","2.3.3","2.3.4","2.3.5"]},{"source":"osv","ecosystem":"Packagist","package":"phpoffice/phpexcel","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"1.8.2"}]}],"versions":["1.7.9","1.7.9-rc1","1.8.0","1.8.0rc1","1.8.0rc2","1.8.0rc3","1.8.0rc4","1.8.1","1.8.2"]}],"products":[{"vendor":"phpoffice","product":"phpspreadsheet"}],"references":[{"url":"https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-79xx-vf93-p7cx","tags":["x_refsource_CONFIRM","Exploit","Vendor Advisory","advisory","web"]},{"url":"https://github.com/PHPOffice/PhpSpreadsheet/commit/4088381ccfaf241d7d42c333de0dc8c98e338743","tags":["x_refsource_MISC","Patch","fix","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-22131","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-79xx-vf93-p7cx"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/22xxx/CVE-2025-22131.json","tags":["advisory"]},{"url":"https://github.com/PHPOffice/PhpSpreadsheet","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2025-22131","title":"Cross-Site Scripting (XSS) vulnerability in generateNavigation() function","description":"PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.","status":"published","published":"2025-01-20T15:31:19.693Z","modified":"2025-01-21T14:58:15.541Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","level":"medium","assessor":"cna"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:32:28.943062Z"}],"euvd":[{"id":"EUVD-2025-0143","description":"PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.","status":"published","published":"2025-01-20T15:31:19Z","modified":"2025-01-21T14:58:15Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","level":"medium"}],"updated_at":"2026-11-03T00:04:16.173755Z"}],"ghsa":[{"id":"GHSA-79xx-vf93-p7cx","title":"Cross-Site Scripting (XSS) vulnerability in generateNavigation() function in PhpSpreadsheet","description":"### Summary\nThe researcher discovered zero-day vulnerability Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.\n\n### Details\nWhen generating the HTML from an xlsx file containing multiple sheets, a navigation menu is created. This menu includes the sheet names, which are not sanitized. As a result, an attacker can exploit this vulnerability to execute JavaScript code.\n\n```php\n        // Construct HTML\n        $html = '';\n\n        // Only if there are more than 1 sheets\n        if (count($sheets) \u003e 1) {\n            // Loop all sheets\n            $sheetId = 0;\n\n            $html .= '\u003cul class=\"navigation\"\u003e' . PHP_EOL;\n\n            foreach ($sheets as $sheet) {\n                $html .= '  \u003cli class=\"sheet' . $sheetId . '\"\u003e\u003ca href=\"#sheet' . $sheetId . '\"\u003e' . $sheet-\u003egetTitle() . '\u003c/a\u003e\u003c/li\u003e' . PHP_EOL;\n                ++$sheetId;\n            }\n\n            $html .= '\u003c/ul\u003e' . PHP_EOL;\n        }\n```\n\n### PoC\n1. Create an XLSX file with multiple sheets : \n![image](https://github.com/user-attachments/assets/e3fc027a-9525-4d7f-b107-cfa6e78d04e7)\n\n2. Generate the HTML content \n```php\n\u003c?php\n\trequire __DIR__ . '/vendor/autoload.php';\n\n\t$inputFileName = 'payload.xlsx';\n\t$spreadsheet = \\PhpOffice\\PhpSpreadsheet\\IOFactory::load($inputFileName);\n\t$writer = new \\PhpOffice\\PhpSpreadsheet\\Writer\\Html($spreadsheet);\n\t$writer-\u003ewriteAllSheets();\n\techo $writer-\u003egenerateHTMLAll();\n?\u003e\n```\n3. Enjoy\n![image](https://github.com/user-attachments/assets/3e3c24f4-cb5d-451d-978f-9d33234f3bd1)\n\n\n### Impact\n\nXSS can cause a variety of problems for the end user that range in severity from an annoyance to complete account compromise.\nExample of impacts :\n\n- Disclosure of the user’s session cookie, allowing an attacker to hijack the user’s session and take over the account (Only if HttpOnly cookie's flag is set to false).\n- Redirecting the user to some other page or site (like phishing websites)\n- Modifying the content of the current page (add a fake login page that sends credentials to the attacker).\n- Automatically download malicious files.\n- Requests access to the victim geolocation / camera.\n- ...","status":"published","published":"2025-01-21T21:09:13Z","modified":"2025-03-06T18:16:09Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","level":"medium"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:38:34.185137Z"}],"nvd":[{"id":"CVE-2025-22131","description":"PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.","status":"published","published":"2025-01-20T16:15:27.88Z","modified":"2026-06-17T08:45:13.62Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"medium","assessor":"secondary"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"primary"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:10:49.483601Z"}],"osv":[{"id":"CVE-2025-22131","title":"Cross-Site Scripting (XSS) vulnerability in generateNavigation() function","description":"PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.","status":"published","published":"2025-01-20T15:31:19.693Z","modified":"2026-10-28T02:31:05.337100524Z","cvss":[{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:44:47.009967Z"},{"id":"GHSA-79xx-vf93-p7cx","title":"Cross-Site Scripting (XSS) vulnerability in generateNavigation() function in PhpSpreadsheet","description":"### Summary\nThe researcher discovered zero-day vulnerability Cross-Site Scripting (XSS) vulnerability in the code which translates the XLSX file into a HTML representation and displays it in the response.\n\n### Details\nWhen generating the HTML from an xlsx file containing multiple sheets, a navigation menu is created. This menu includes the sheet names, which are not sanitized. As a result, an attacker can exploit this vulnerability to execute JavaScript code.\n\n```php\n        // Construct HTML\n        $html = '';\n\n        // Only if there are more than 1 sheets\n        if (count($sheets) \u003e 1) {\n            // Loop all sheets\n            $sheetId = 0;\n\n            $html .= '\u003cul class=\"navigation\"\u003e' . PHP_EOL;\n\n            foreach ($sheets as $sheet) {\n                $html .= '  \u003cli class=\"sheet' . $sheetId . '\"\u003e\u003ca href=\"#sheet' . $sheetId . '\"\u003e' . $sheet-\u003egetTitle() . '\u003c/a\u003e\u003c/li\u003e' . PHP_EOL;\n                ++$sheetId;\n            }\n\n            $html .= '\u003c/ul\u003e' . PHP_EOL;\n        }\n```\n\n### PoC\n1. Create an XLSX file with multiple sheets : \n![image](https://github.com/user-attachments/assets/e3fc027a-9525-4d7f-b107-cfa6e78d04e7)\n\n2. Generate the HTML content \n```php\n\u003c?php\n\trequire __DIR__ . '/vendor/autoload.php';\n\n\t$inputFileName = 'payload.xlsx';\n\t$spreadsheet = \\PhpOffice\\PhpSpreadsheet\\IOFactory::load($inputFileName);\n\t$writer = new \\PhpOffice\\PhpSpreadsheet\\Writer\\Html($spreadsheet);\n\t$writer-\u003ewriteAllSheets();\n\techo $writer-\u003egenerateHTMLAll();\n?\u003e\n```\n3. Enjoy\n![image](https://github.com/user-attachments/assets/3e3c24f4-cb5d-451d-978f-9d33234f3bd1)\n\n\n### Impact\n\nXSS can cause a variety of problems for the end user that range in severity from an annoyance to complete account compromise.\nExample of impacts :\n\n- Disclosure of the user’s session cookie, allowing an attacker to hijack the user’s session and take over the account (Only if HttpOnly cookie's flag is set to false).\n- Redirecting the user to some other page or site (like phishing websites)\n- Modifying the content of the current page (add a fake login page that sends credentials to the attacker).\n- Automatically download malicious files.\n- Requests access to the victim geolocation / camera.\n- ...","status":"published","published":"2025-01-21T21:09:13Z","modified":"2025-03-06T18:37:31.054095Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"},{"version":"4.0","score":5.1,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:46:41.002603Z"}]}}
