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

Added file:/ to the list of excluded paths and string contains & added option to disable redirects #881

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JaredPage
Copy link

@JaredPage JaredPage commented Aug 30, 2024

  1. There are currently checks in src/Browsershot.php to ensure that external linking to a file does not work, as this very easily introduces a security vulnerability.

In this PR - I simply introduce a further check to not only check for file:// but also for file:/ - which also works for linking to local files alongside some tests to check this.

A straightforward POC to demonstrate this being used is:
Browsershot::url('file:/etc/password')->save("vuln.pdf");
Which allows the password file to be generated out as a PDF. This flaw can be further exploited to bypass the security filters and read local files from the applicationserver through the use of iFrames, leading to unauthorised access and potential data compromise.

  1. There exists the ability to not follow redirects in puppeteer, but this functionality isn't exposed in Browsershot. Users may not want to follow redirects for security reasons as it can lead to the download of unexpected data or information leakage such as NTLM authentication material.

In this PR - the option to disable redirects is added alongside some tests to ensure this still works when a redirect isn't returned.

https://cwe.mitre.org/data/definitions/425.html

You would have received an email from Tanto Security regarding this - who should be credited with finding these issues.

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.

1 participant