From 4e35e93676a9d6b3ab92a8a30d8df005aadba7e8 Mon Sep 17 00:00:00 2001 From: "advisory-database[bot]" <45398580+advisory-database[bot]@users.noreply.github.com> Date: Tue, 16 Apr 2024 15:41:20 +0000 Subject: [PATCH] Publish GHSA-6363-v5m4-fvq3 --- .../GHSA-6363-v5m4-fvq3.json | 56 +++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/advisories/github-reviewed/2024/04/GHSA-6363-v5m4-fvq3/GHSA-6363-v5m4-fvq3.json b/advisories/github-reviewed/2024/04/GHSA-6363-v5m4-fvq3/GHSA-6363-v5m4-fvq3.json index d176df7e348..af564715619 100644 --- a/advisories/github-reviewed/2024/04/GHSA-6363-v5m4-fvq3/GHSA-6363-v5m4-fvq3.json +++ b/advisories/github-reviewed/2024/04/GHSA-6363-v5m4-fvq3/GHSA-6363-v5m4-fvq3.json @@ -1,13 +1,13 @@ { "schema_version": "1.4.0", "id": "GHSA-6363-v5m4-fvq3", - "modified": "2024-04-12T15:15:46Z", + "modified": "2024-04-16T15:40:18Z", "published": "2024-04-12T15:15:46Z", "aliases": [ "CVE-2024-29800" ], "summary": "timber/timber vulnerable to Deserialization of Untrusted Data", - "details": "### Summary\nTimber is vulnerable to [PHAR deserialization](https://portswigger.net/web-security/deserialization/exploiting#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.\n\n### Details\nThe 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:\n![image](https://github.com/timber/timber/assets/89630690/bcd6d031-33c6-4cc5-96b7-b72f0cf0e26c)\n\n### PoC\nSetup 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.\n![image](https://github.com/timber/timber/assets/89630690/967f0a16-3b7e-4b58-84cb-c1dee3291339)\n![image](https://github.com/timber/timber/assets/89630690/78bb98cf-0cd2-4635-aa01-a1eea571d0fc)\nAs an attacker, we generate our PHAR payload using the following exploit script:\n![image](https://github.com/timber/timber/assets/89630690/d823e76a-fb07-468e-aed1-97b304d53ee5)\nGenerate with:\n![image](https://github.com/timber/timber/assets/89630690/d3d57333-a113-468a-8b27-dc6bc1fca4e7)\nthen change extension file from `.phar` to valid extension as svg,jpg,...\n![image](https://github.com/timber/timber/assets/89630690/c4fdbd25-e828-4408-9feb-168f2e301d7a)\nand execute `vuln.php` with php `vuln.php`, you should see `whoami` being executed:\n![image](https://github.com/timber/timber/assets/89630690/e341de8d-555c-4390-86a1-469b11cf0ffc)\n![image](https://github.com/timber/timber/assets/89630690/17afdb95-10ed-4c52-a93d-95eb1f60a146)\n\n### Impact\nThis vulnerability is capable of remote code execution if Timber is used with frameworks or developer code with vulnerable POP chains.\n\n### Recommended Fix\nFilter the `phar://` protocol and upgrade to [version 2.1.0](https://github.com/timber/timber/releases/tag/v2.1.0).", + "details": "### Summary\nTimber 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.\n\n### Details\nThe 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:\n![image](https://github.com/timber/timber/assets/89630690/bcd6d031-33c6-4cc5-96b7-b72f0cf0e26c)\n\n### PoC\nSetup 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.\n![image](https://github.com/timber/timber/assets/89630690/967f0a16-3b7e-4b58-84cb-c1dee3291339)\n![image](https://github.com/timber/timber/assets/89630690/78bb98cf-0cd2-4635-aa01-a1eea571d0fc)\nAs an attacker, we generate our PHAR payload using the following exploit script:\n![image](https://github.com/timber/timber/assets/89630690/d823e76a-fb07-468e-aed1-97b304d53ee5)\nGenerate with:\n![image](https://github.com/timber/timber/assets/89630690/d3d57333-a113-468a-8b27-dc6bc1fca4e7)\nthen change extension file from .phar to valid extension as svg,jpg,...\n![image](https://github.com/timber/timber/assets/89630690/c4fdbd25-e828-4408-9feb-168f2e301d7a)\nand execute vuln.php with php vuln.php, you should see whoami being executed:\n![image](https://github.com/timber/timber/assets/89630690/e341de8d-555c-4390-86a1-469b11cf0ffc)\n![image](https://github.com/timber/timber/assets/89630690/17afdb95-10ed-4c52-a93d-95eb1f60a146)\n\n### Impact\nThis vulnerability is capable of remote code execution if Timber is used with frameworks or developer code with vulnerable POP chains.\n\n### Recommended Fix\nFilter the phar:// protocol.", "severity": [ { "type": "CVSS_V3", @@ -25,7 +25,7 @@ "type": "ECOSYSTEM", "events": [ { - "introduced": "0" + "introduced": "2.0.0" }, { "fixed": "2.1.0" @@ -33,9 +33,53 @@ ] } ], + "versions": [ + "2.0.0" + ] + }, + { + "package": { + "ecosystem": "Packagist", + "name": "timber/timber" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "0" + }, + { + "fixed": "1.23.1" + } + ] + } + ], "database_specific": { - "last_known_affected_version_range": "<= 2.0.0" + "last_known_affected_version_range": "<= 1.23.0" } + }, + { + "package": { + "ecosystem": "Packagist", + "name": "timber/timber" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "1.24.0" + }, + { + "fixed": "1.24.1" + } + ] + } + ], + "versions": [ + "1.24.0" + ] } ], "references": [ @@ -43,6 +87,10 @@ "type": "WEB", "url": "https://github.com/timber/timber/security/advisories/GHSA-6363-v5m4-fvq3" }, + { + "type": "WEB", + "url": "https://github.com/timber/timber/issues/2971" + }, { "type": "WEB", "url": "https://github.com/timber/timber/commit/13c6b0f60346304f2eed4da1e0bb51566518de4a"