Headline
GHSA-wgmf-q9vr-vww6: PhpSpreadsheet HTML writer is vulnerable to Cross-Site Scripting via style information
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.
Skip to content
Navigation Menu
Actions
Automate any workflow
Packages
Host and manage packages
Security
Find and fix vulnerabilities
Codespaces
Instant dev environments
GitHub Copilot
Write better code with AI
Code review
Manage code changes
Issues
Plan and track work
Discussions
Collaborate outside of code
Explore
- Learning Pathways
- White papers, Ebooks, Webinars
- Customer Stories
- Partners
GitHub Sponsors
Fund open source developers
* The ReadME Project
GitHub community articles
Enterprise platform
AI-powered developer platform
- Pricing
Provide feedback
Saved searches****Use saved searches to filter your results more quickly
Sign up
- GitHub Advisory Database
- GitHub Reviewed
- CVE-2024-45046
PhpSpreadsheet HTML writer is vulnerable to Cross-Site Scripting via style information
Moderate severity GitHub Reviewed Published Aug 28, 2024 in PHPOffice/PhpSpreadsheet • Updated Aug 29, 2024
Package
composer phpoffice/phpspreadsheet (Composer)
Affected versions
< 2.1.0
Description
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.
References
- GHSA-wgmf-q9vr-vww6
- https://nvd.nist.gov/vuln/detail/CVE-2024-45046
- PHPOffice/PhpSpreadsheet#3957
- PHPOffice/PhpSpreadsheet@f7cf378
Published to the GitHub Advisory Database
Aug 29, 2024
Last updated
Aug 29, 2024