CVE-2023-28115 Snappy vulnerable to PHAR deserialization, allowing remote code execution
Attackers can achieve remote code execution via PHAR deserialization in the Snappy PHP library if they can upload files and trigger specific functions.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2023-28115?
CVE-2023-28115 is a critical unsafe deserialization vulnerability in KnpLabs snappy, published on 17 Mar 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
Snappy is a PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Prior to version 1.4.2, Snappy is vulnerable to PHAR deserialization due to a lack of checking on the protocol before passing it into the `file_exists()` function. If an attacker can upload files of any type to the server he can pass in the phar:// protocol to unserialize the uploaded file and instantiate arbitrary PHP objects. This can lead to remote code execution especially when snappy is used with frameworks with documented POP chains like Laravel/Symfony vulnerable developer code. If a user can control the output file from the `generateFromHtml()` function, it will invoke deserialization. This vulnerability is capable of remote code execution if Snappy is used with frameworks or developer code with vulnerable POP chains. It has been fixed in version 1.4.2.
Weakness: CWE-502
Which versions are affected by CVE-2023-28115?
2 open source packages ship an affected version, including knplabs/knp-snappy. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
knplabs/knp-snappy Packagist | All versions | 1.4.2 |
knplabs/knp-snappy Packagist | All versions | 1.4.2 |
Products include Knplabs Snappy.
How do I fix CVE-2023-28115?
Upgrade knplabs/knp-snappy to 1.4.2 or later.
Upgrade, and only deserialise data from trusted sources or with an allow-list of types. More about Unsafe deserialization.
Is CVE-2023-28115 being exploited?
There is no known exploitation of CVE-2023-28115 in the wild and no public exploit code.
Other vulnerabilities in KnpLabs snappy
Sources
Also known as DEBIAN-CVE-2023-28115, GHSA-gq6w-q6wh-jggc, UBUNTU-CVE-2023-28115.