GitHub Advisoryadvisory · Packagist

GHSA-6363-v5m4-fvq3 timber/timber vulnerable to Deserialization of Untrusted Data

HIGH Published 2024-04-12 Modified 2024-04-18 Official page ↗
Aliases
CVE-2024-29800
Ecosystem
Packagist
Packages
timber/timber
Severity
High
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H
Weaknesses
CWE-502, CWE-73
Reviewed
2024-04-12

Affected packages

• Packagist timber/timber: >= 2.0.0, < 2.1.0 → fixed in 2.1.0 • Packagist timber/timber: >= 1.24.0, < 1.24.1 → fixed in 1.24.1 • Packagist timber/timber: >= 0.16.6, < 1.23.1 → fixed in 1.23.1

Description

Summary Timber is vulnerable to PHAR deserialization due to a lack of checking the input 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 Timber is used with frameworks with documented POP chains like Wordpress/ vulnerable developer code. Details The vulnerability lies in the run function within the toJpg.php file. The two parameters passed into it are not checked or sanitized, hence an attacker could potentially inject malicious input leading to Deserialization of Untrusted Data, allowing for remote code execution: PoC Setup the following code in /var/www/html: vuln.php represents our use of Timber functions and phar-poc.php represents code with a vulnerable POP chain. As an attacker, we generate our PHAR payload using the following exploit script: Generate with: then change extension file from .phar to valid extension as svg,jpg,... and execute vuln.php with php vuln.php, you should see whoami being executed: Impact This vulnerability is capable of remote code execution if Timber is used with frameworks or developer code with vulnerable POP chains. Recommended Fix Filter the phar:// protocol.

Related

Alias · CVE (1)

  • CVE-2024-29800 Deserialization of Untrusted Data vulnerability in Timber Team & Contributors Timber.This issue affects Timber: from n/a through 1.23.0. vulnerability

Weakness · CWE (2)

  • CWE-502 Deserialization of Untrusted Data weakness
  • CWE-73 External Control of File Name or Path weakness

References