Skip to content

Commit d5da748

Browse files
committed
doc: add warning based on wkhtmltopdf recommendations
1 parent 3dd138e commit d5da748

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,30 @@ composer require knplabs/knp-snappy
2525

2626
## Usage
2727

28+
> ⚠️ **Security Warning**
29+
>
30+
> A critical vulnerability was discovered in the use of the `--enable-local-file-access` option in `wkhtmltopdf`.
31+
> When enabled and used with untrusted HTML or JavaScript, this option may allow access to local files or even result in **remote code execution**, leading to a **full server compromise**.
32+
>
33+
> To reduce the risk:
34+
> - **Avoid enabling `--enable-local-file-access` unless absolutely necessary.**
35+
> - **Never process untrusted or user-supplied HTML/JS without strict sanitization.**
36+
> - **Run `wkhtmltopdf` in a sandbox** using tools like **AppArmor** or **SELinux**.
37+
> - Consider safer alternatives for untrusted content, such as **WeasyPrint**, **Prince** (commercial), or **Puppeteer** for JavaScript-heavy content.
38+
>
39+
> This vulnerability was discovered and responsibly disclosed by
40+
> **Nikita Sveshnikov (Positive Technologies)**.
41+
>
42+
> 🔗 [Official security recommendations](https://wkhtmltopdf.org/status.html#recommendations)
43+
### ⚠️ Unsafe Options Overview
44+
45+
| Option | Risk Level | Description |
46+
|----------------------------|------------|---------------------------------------------------------|
47+
| `--enable-local-file-access` | High | Allows access to local files from HTML – dangerous if input is not trusted |
48+
| `--enable-javascript` | High | Executes JavaScript – can be abused with user input |
49+
50+
51+
2852
### Initialization
2953
```php
3054
<?php

0 commit comments

Comments
 (0)