Cross-site Scripting (XSS) Affecting phpoffice/phpexcel package, versions >=0.0.0


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.09% (40th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Cross-site Scripting (XSS) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PHP-PHPOFFICEPHPEXCEL-9299814
  • published7 Mar 2025
  • disclosed19 Nov 2020
  • creditNikkolai Fernandez

Introduced: 19 Nov 2020

CVE-2020-7776  (opens in a new tab)
CWE-79  (opens in a new tab)
First added by Snyk

How to fix?

There is no fixed version for phpoffice/phpexcel.

Overview

Affected versions of this package are vulnerable to Cross-site Scripting (XSS). The library is vulnerable to XSS when creating an html output from an excel file by adding a comment on any cell. The root cause of this issue is within the HTML writer where user comments are concatenated as part of link and this is returned as HTML.

PoC

1. Setup a project folder on your local web server
2. Open project folder in terminal to run `composer require phpoffice/phpspreadsheet`
3. Create an excel file -> Insert Comment -> Insert this payload `<script>alert(1)</script>`
4. Move the excel file to the project dir
5. Create a php file with filename `convert-excel-to-html.php` -> Insert code below

<?php require './vendor/autoload.php'; use PhpOffice\PhpSpreadsheet\IOFactory;

$filename = 'INSERT_YOUR_EXCEL_FILE_HERE';

$spreadsheet = IOFactory::load('./'.$filename);

$writer = IOFactory::createWriter($spreadsheet, 'Html');

$filename = 'testxss.html'; $writer->save($filename);

CVSS Base Scores

version 3.1