ghsa-wgmf-q9vr-vww6
Vulnerability from github
4.8 (Medium) - CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
Summary
\PhpOffice\PhpSpreadsheet\Writer\Html
doesn't sanitize spreadsheet styling information such as font names, allowing an attacker to inject arbitrary JavaScript on the page.
PoC
Example target script:
``` <?php
require 'vendor/autoload.php';
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx"); $spreadsheet = $reader->load(DIR . '/book.xlsx');
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet); print($writer->generateHTMLAll()); ```
Save this file in the same directory: book.xlsx
Open index.php in a web browser. An alert should be displayed.
Impact
Full takeover of the session of users viewing spreadsheet files as HTML.
{ affected: [ { package: { ecosystem: "Packagist", name: "phpoffice/phpspreadsheet", }, ranges: [ { events: [ { introduced: "2.0.0", }, { fixed: "2.1.0", }, ], type: "ECOSYSTEM", }, ], }, { package: { ecosystem: "Packagist", name: "phpoffice/phpspreadsheet", }, ranges: [ { events: [ { introduced: "0", }, { fixed: "1.29.1", }, ], type: "ECOSYSTEM", }, ], }, { package: { ecosystem: "Packagist", name: "phpoffice/phpexcel", }, ranges: [ { events: [ { introduced: "0", }, { last_affected: "1.8.2", }, ], type: "ECOSYSTEM", }, ], }, ], aliases: [ "CVE-2024-45046", ], database_specific: { cwe_ids: [ "CWE-79", ], github_reviewed: true, github_reviewed_at: "2024-08-29T17:56:56Z", nvd_published_at: "2024-08-28T21:15:06Z", severity: "MODERATE", }, details: "### Summary\n\n`\\PhpOffice\\PhpSpreadsheet\\Writer\\Html` doesn't sanitize spreadsheet styling information such as font names, allowing an attacker to inject arbitrary JavaScript on the page.\n\n### PoC\n\nExample target script:\n\n```\n<?php\n\nrequire 'vendor/autoload.php';\n\n$reader = \\PhpOffice\\PhpSpreadsheet\\IOFactory::createReader(\"Xlsx\");\n$spreadsheet = $reader->load(__DIR__ . '/book.xlsx');\n\n$writer = new \\PhpOffice\\PhpSpreadsheet\\Writer\\Html($spreadsheet);\nprint($writer->generateHTMLAll());\n```\n\nSave this file in the same directory:\n[book.xlsx](https://github.com/PHPOffice/PhpSpreadsheet/files/15212797/book.xlsx)\n\nOpen index.php in a web browser. An alert should be displayed.\n\n### Impact\n\nFull takeover of the session of users viewing spreadsheet files as HTML.", id: "GHSA-wgmf-q9vr-vww6", modified: "2025-03-06T18:09:33Z", published: "2024-08-29T17:56:56Z", references: [ { type: "WEB", url: "https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-wgmf-q9vr-vww6", }, { type: "ADVISORY", url: "https://nvd.nist.gov/vuln/detail/CVE-2024-45046", }, { type: "WEB", url: "https://github.com/PHPOffice/PhpSpreadsheet/pull/3957", }, { type: "WEB", url: "https://github.com/PHPOffice/PhpSpreadsheet/commit/f7cf378faed2e11cf4825bf8bafea4922ae44667", }, { type: "PACKAGE", url: "https://github.com/PHPOffice/PhpSpreadsheet", }, ], schema_version: "1.4.0", severity: [ { score: "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", type: "CVSS_V3", }, { score: "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N", type: "CVSS_V4", }, ], summary: "PhpSpreadsheet HTML writer is vulnerable to Cross-Site Scripting via style information", }
Log in or create an account to share your comment.
This schema specifies the format of a comment related to a security advisory.
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.