{"id":"CVE-2025-22131","aliases":["GHSA-79xx-vf93-p7cx"],"url":"https://o3.security/vulnerability/CVE-2025-22131","summary":"Cross-Site Scripting (XSS) vulnerability in generateNavigation() function","details":"### 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- ...","published":"2025-01-20T15:31:19.693Z","modified":"2026-08-12T03:51:48.448502577Z","cvss":null,"epss":null,"cisaKev":null,"exploitsKnown":1,"affectedPackages":[{"ecosystem":"Packagist","name":"phpoffice/phpspreadsheet","fixedVersion":"3.8.0"},{"ecosystem":"Packagist","name":"phpoffice/phpspreadsheet","fixedVersion":"1.29.8"},{"ecosystem":"Packagist","name":"phpoffice/phpspreadsheet","fixedVersion":"2.1.7"},{"ecosystem":"Packagist","name":"phpoffice/phpspreadsheet","fixedVersion":"2.3.6"},{"ecosystem":"Packagist","name":"phpoffice/phpexcel","fixedVersion":null}],"fix":{"url":"https://github.com/PHPOffice/PhpSpreadsheet/commit/4088381ccfaf241d7d42c333de0dc8c98e338743","label":"PHPOffice/PhpSpreadsheet@4088381"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/22xxx/CVE-2025-22131.json"},{"type":"ADVISORY","url":"https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-79xx-vf93-p7cx"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-22131"},{"type":"FIX","url":"https://github.com/PHPOffice/PhpSpreadsheet/commit/4088381ccfaf241d7d42c333de0dc8c98e338743"},{"type":"PACKAGE","url":"https://github.com/PHPOffice/PhpSpreadsheet"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:48.448502577Z"}}