{"id":"CVE-2025-22131","aliases":["CVE-2025-22131","GHSA-79xx-vf93-p7cx"],"related":[],"kind":"vulnerability","state":"published","title":"Cross-Site Scripting (XSS) vulnerability in generateNavigation() function","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### 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) > 1) {\n            // Loop all sheets\n            $sheetId = 0;\n\n            $html .= '<ul class=\"navigation\">' . PHP_EOL;\n\n            foreach ($sheets as $sheet) {\n                $html .= '  <li class=\"sheet' . $sheetId . '\"><a href=\"#sheet' . $sheetId . '\">' . $sheet->getTitle() . '</a></li>' . PHP_EOL;\n                ++$sheetId;\n            }\n\n            $html .= '</ul>' . 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<?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->writeAllSheets();\n\techo $writer->generateHTMLAll();\n?>\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- ...","format":"markdown","source":"ghsa"},{"lang":"es","text":"PhpSpreadsheet es una librería de PHP para leer y escribir archivos de hojas de cálculo. Vulnerabilidad de Cross-Site Scripting (XSS) en el código que traduce el archivo XLSX a una representación HTML y lo muestra en la respuesta.","source":"nvd"}],"published":"2025-01-20T15:31:19.693Z","modified":"2026-06-17T08:45:13.620Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","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","score":5.1,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","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","score":5.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","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","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":">= 3.0.0, < 3.8.0","status":"affected"},{"version":">= 2.2.0, < 2.3.6","status":"affected"},{"version":">= 2.0.0, < 2.1.7","status":"affected"},{"version":"< 1.29.8","status":"affected"}],"vendor":"PHPOffice","product":"PhpSpreadsheet","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"3.0.0","status":"affected","fixed":"3.8.0"}],"ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","purl":"pkg:composer/phpoffice/phpspreadsheet","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.29.8"}],"ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","purl":"pkg:composer/phpoffice/phpspreadsheet","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.0.0","status":"affected","fixed":"2.1.7"}],"ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","purl":"pkg:composer/phpoffice/phpspreadsheet","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.2.0","status":"affected","fixed":"2.3.6"}],"ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","purl":"pkg:composer/phpoffice/phpspreadsheet","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"1.8.2"}],"ecosystem":"Packagist","package":"phpoffice/phpexcel","purl":"pkg:composer/phpoffice/phpexcel","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.29.8"},{"status":"affected","introduced":"2.0.0","fixed":"2.1.7"},{"status":"affected","introduced":"2.2.0","fixed":"2.3.6"},{"status":"affected","introduced":"3.0.0","fixed":"3.8.0"}],"vendor":"phpoffice","product":"phpspreadsheet","cpe":"cpe:2.3:a:phpoffice:phpspreadsheet:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-79xx-vf93-p7cx","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/PHPOffice/PhpSpreadsheet/commit/4088381ccfaf241d7d42c333de0dc8c98e338743","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-22131","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/PHPOffice/PhpSpreadsheet","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-01-21T14:58:10.245Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-22131","url":"https://www.cve.org/CVERecord?id=CVE-2025-22131","licence":"CVE Terms of Use","modified":"2025-01-21T14:58:15.541Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-79xx-vf93-p7cx","url":"https://github.com/advisories/GHSA-79xx-vf93-p7cx","licence":"CC-BY-4.0","modified":"2025-03-06T18:37:31.054Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-22131","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-22131","licence":"Public domain","modified":"2026-06-17T08:45:13.620Z"}],"updatedAt":"2026-11-25T22:58:53.444Z","epss":{"score":0.00396,"percentile":0.35911,"date":"2026-12-01T12:00:22.000Z"}}