Linux中进行Active Directory渗透的瑞士军刀

admin 2024年6月21日12:10:41评论41 views字数 9540阅读31分48秒阅读模式
Linux中进行Active Directory渗透的瑞士军刀
Linux中进行Active Directory渗透的瑞士军刀

摘要

Linux中进行Active Directory渗透的瑞士军刀

linWinPwn 是一个 bash 脚本,它包装了许多 Active Directory 工具,用于枚举(LDAP、RPC、ADCS、MSSQL、Kerberos)、漏洞检查(noPac、ZeroLogon、MS17-010、MS14-068)、对象修改(密码更改、将用户添加到组、RBCD、Shadow Credentials)和密码转储(secretsdump、lsassy、nanodump、DonPAPI)。该脚本简化了大量工具的使用:impacket、bloodhound、netexec、enum4linux-ng、ldapdomaindump、lsassy、smbmap、kerbrute、adidnsdump、certipy、silenthound、bloodyAD、DonPAPI 等。

Linux中进行Active Directory渗透的瑞士军刀
Linux中进行Active Directory渗透的瑞士军刀

安装方法

Linux中进行Active Directory渗透的瑞士军刀

(1).克隆存储库安装

执行以下命令完成安装:

git clone https://github.com/lefayjey/linWinPwn
cd linWinPwn; chmod +x linWinPwn.sh

(2).通过脚本安装

直接使用安装脚本,命令如下:

chmod +x install.sh
./install.sh
Linux中进行Active Directory渗透的瑞士军刀
Linux中进行Active Directory渗透的瑞士军刀

命令模式

Linux中进行Active Directory渗透的瑞士军刀

安装完成后,linWinPwn界面如下图:

Linux中进行Active Directory渗透的瑞士军刀

linWinPwn 脚本可以在交互模式(默认)或自动模式(仅限枚举)下执行。

(1).交互模式

打开交互菜单单独运行检查,命令如下:

./linWinPwn.sh -t <Domain_Controller_IP> [-d <AD_domain> -u <AD_user> -p <AD_password> -H <hash[LM:NT]> -K <kerbticket[./krb5cc_ticket]> -A <AES_key> -C <cert[./cert.pfx]> -o <output_dir>]

(2).自动模式

使用--auto参数,运行枚举工具。使用自动模式时, 根据身份验证方法执行不同的检查。

  • 未经身份验证(未提供凭据)

    • 使用 netexec、enum4linux-ng、ldapdomaindump、ldeep 进行匿名枚举

    • 使用 netexec 进行 RID 暴力破解

    • Kerberos用户枚举和密码喷射攻击

    • 对收集的计算机列表进行 Pre2k 身份验证检查

    • ASREPRoast 使用收集的用户列表(并使用 john-the-ripper 和 rockyou 单词列表破解哈希值)

    • Blind Kerberoast攻击

    • CVE-2022-33679 漏洞利用

    • 使用 krbjack 检查 DNS 不安全更新是否存在 AS-REQ 滥用情况

    • SMB 在已识别的服务器上共享匿名枚举

    • 枚举已识别服务器上的 WebDav、dfscoerce、shadowcoerce 和 Spooler 服务

    • 检查 ms17-010、zerologon、petitpotam、nopac、smb-sigining、ntlmv1、runasppl 弱点

执行命令如下:

./linWinPwn.sh -t <Domain_Controller_IP> --auto [-o <output_dir>]
  • 经过身份验证(使用密码、NTLM 哈希、Kerberos 票证、AES 密钥或 pfx 证书)

    • 使用 adidnsdump 提取 DNS

    • BloodHound数据收集

    • 使用 netexec、enum4linux-ng、ldapdomaindump、bloodyAD、sccmhunter、rdwatool、sccmhunter、GPOwned 进行枚举

    • 生成密码破解的单词列表

    • netexec 查找 user=pass 的帐户

    • 域计算机上的 Pre2k 身份验证检查

    • 使用 certipy 和 certi.py 提取 ADCS 信息

    • kerbrute 查找 user=pas 的帐户

    • ASREPRoasting(并使用 john-the-ripper 和 rockyou 单词列表破解哈希值)

    • Kerberoasting(以及使用 john-the-ripper 和 rockyou 单词列表破解哈希值)

    • 有针对性的 Kerberoasting(以及使用 john-the-ripper 和 rockyou 单词列表破解哈希值)

    • 使用 smbmap、FindUncommonShares 和 cme 的 Spider_plus 在所有域服务器上共享 SMB 共享枚举

    • 枚举所有域服务器上的 WebDav、dfscoerce、shadowcoerce 和 Spooler 服务(使用 cme、Coercer 和 RPC Dump)

    • 检查 ms17-010、ms14-068、zerologon、petitpotam、nopac、smb-signing、ntlmv1、runasppl、certifried 弱点

    • 检查mssql权限提升路径

    • 检查 mssql 中继的可能性

执行命令如下:

proxychains ./linWinPwn.sh -t <Domain_Controller_IP>  -d <AD_domain> -u <AD_user> [-p <AD_password> -H <hash[LM:NT]> -K <kerbticket[./krb5cc_ticket]> -A <AES_key> -C <cert[./cert.pfx]>] [-o <output_dir>] --auto
Linux中进行Active Directory渗透的瑞士军刀
Linux中进行Active Directory渗透的瑞士军刀

参数使用

Linux中进行Active Directory渗透的瑞士军刀

(1).自动配置 - 与目标 DC 运行 NTP 同步,并在运行模块之前将条目添加到 /etc/hosts

命令执行:

./linWinPwn.sh -t <Domain_Controller_IP> --auto-config

(2).LDAPS - 使用 LDAPS 代替 LDAP(端口 636)

命令执行:

./linWinPwn.sh -t <Domain_Controller_IP> --ldaps

(3).强制 Kerberos 身份验证 - 强制使用 Kerberos 身份验证而不是 NTLM(如果可能)

命令执行:

./linWinPwn.sh -t <Domain_Controller_IP> --force-kerb

(4).启用所有详细和调试输出

命令执行:

./linWinPwn.sh -t <Domain_Controller_IP> --verbose

(5).选择攻击者的网络接口

命令执行:

./linWinPwn.sh -t <Domain_Controller_IP> -I tun0
./linWinPwn.sh -t <Domain_Controller_IP> --interface eth0

(6).选择要扫描的目标(DC、全部、IP=IP_or_hostname、File=./path_to_file)

命令执行:

./linWinPwn.sh -t <Domain_Controller_IP> --targets All
./linWinPwn.sh -t <Domain_Controller_IP> --targets DC
./linWinPwn.sh -t <Domain_Controller_IP> -T IP=192.168.0.1
./linWinPwn.sh -t <Domain_Controller_IP> -T File=./list_servers.txt
Linux中进行Active Directory渗透的瑞士军刀
Linux中进行Active Directory渗透的瑞士军刀

隧道技术

Linux中进行Active Directory渗透的瑞士军刀

当只能在有限的时间内访问 Active Directory 环境,并且希望在枚举过程和证据收集中更加高效时,linWinPwn 会特别有用。此外,linWinPwn 可以取代 Windows 上枚举工具的使用,以减少创建的工件(例如 PowerShell 命令、Windows 事件、磁盘上创建的文件)的数量,并绕过某些防病毒或 EDR。这可以通过创建从 Windows 主机(例如 VDI 计算机或工作站或笔记本电脑)到远程 Linux 计算机(例如 Pentest 笔记本电脑或 VPS)的 SSH 隧道来执行远程动态端口转发,并使用代理链运行 linWinPwn 来实现。

在 Windows 主机上,使用 PowerShell 运行:

ssh.exe kali@<linux_machine> -R 1080 -NCqf

在 Linux 计算机上,首先更新 /etc/proxychains4.conf 以包含 socks5 127.0.0.1 1080 ,然后运行:

proxychains ./linWinPwn.sh -t <Domain_Controller_IP>  -d <AD_domain> -u <AD_user> [-p <AD_password> -H <hash[LM:NT]> -K <kerbticket[./krb5cc_ticket]> -A <AES_key> -C <cert[./cert.pfx]>] [-o <output_dir>] [--auto]
Linux中进行Active Directory渗透的瑞士军刀
Linux中进行Active Directory渗透的瑞士军刀

交互模式菜单

Linux中进行Active Directory渗透的瑞士军刀

(1).主菜单

1) Re-run DNS Enumeration using adidnsdump
2) Active Directory Enumeration Menu
3) ADCS Enumeration Menu
4) Brute Force Attacks Menu
5) Kerberos Attacks Menu
6) SMB shares Enumeration Menu
7) Vulnerability Checks Menu
8) MSSQL Enumeration Menu
9) Password Dump Menu
10) AD Objects or Attributes Modification Menu

(2).AD枚举菜单

1) BloodHound Enumeration using all collection methods (Noisy!)
2) BloodHound Enumeration using DCOnly
3) ldapdomaindump LDAP Enumeration
4) enum4linux-ng LDAP-MS-RPC Enumeration
5) GPP Enumeration using netexec
6) MS-RPC Enumeration using netexec (Users, pass pol)
7) LDAP Enumeration using netexec (Users, passnotreq, userdesc, maq, ldap-checker, subnets)
8) Delegation Enumeration using findDelegation and netexec
9) bloodyAD All Enumeration
10) bloodyAD write rights Enumeration
11) bloodyAD query DNS server
12) SilentHound LDAP Enumeration
13) ldeep LDAP Enumeration
14) windapsearch LDAP Enumeration
15) LDAP Wordlist Harvester
16) Enumeration of RDWA servers
17) SCCM Enumeration using sccmhunter
18) LDAP Enumeration using LDAPPER
19) Adalanche Enumeration
20) GPO Enumeration using GPOwned
21) Open p0dalirius' LDAP Console
22) Open p0dalirius' LDAP Monitor
23) Open garrettfoster13's ACED console
24) Open LDAPPER custom options
25) Run adPEAS enumerations
26) Open breads console
27) Run ADCheck enumerations

(3).ADCS菜单

1) ADCS Enumeration using netexec
2) certi.py ADCS Enumeration
3) Certipy ADCS Enumeration
4) Certifried check
5) Certipy LDAP shell via Schannel (using Certificate Authentication)
6) Certipy extract CA and forge Golden Certificate (requires admin rights on PKI server)
7) Dump LSASS using masky
8) Dump NTDS using certsync

(4).暴力破解菜单

1) RID Brute Force (Null session) using netexec
2) User Enumeration using kerbrute (Null session)
3) User=Pass check using kerbrute (Noisy!)
4) User=Pass check using netexec (Noisy!)
5) Pre2k computers authentication check (Noisy!)

(5).Kerberos 攻击菜单

1) AS REP Roasting Attack using GetNPUsers
2) Kerberoast Attack using GetUserSPNs
3) Cracking AS REP Roast hashes using john the ripper
4) Cracking Kerberoast hashes using john the ripper
5) NoPac check using netexec (only on DC)
6) MS14-068 check (only on DC)
7) CVE-2022-33679 exploit / AS-REP with RC4 session key (Null session)
8) AP-REQ hijack with DNS unsecure updates abuse using krbjack
9) Run custom Kerberoast attack using Orpheus
10) Generate Golden Ticket (requires: hash of krbtgt or DCSync rights)
11) Generate Silver Ticket (requires: hash of SPN service account or DCSync rights)
12) Generate Diamond Ticket (requires: hash of krbtgt or DCSync rights)
13) Generate Sapphire Ticket (requires: hash of krbtgt or DCSync rights)
14) Privilege escalation from Child Domain to Parent Domain using raiseChild (requires: DA rights on child domain)
15) Request impersonated ticket using Constrained Delegation rights (requires: hash of account allowed for delegation or DCSync rights)

(6).SMB 共享菜单

1) SMB shares Scan using smbmap
2) SMB shares Enumeration using netexec
3) SMB shares Spidering using netexec
4) SMB shares Scan using FindUncommonShares
5) SMB shares Scan using manspider
6) Open smbclient.py console on target
7) Open p0dalirius's smbclientng console on target

(7).漏洞检查菜单

1) zerologon check using netexec (only on DC)
2) MS17-010 check using netexec
3) PetitPotam check using netexec (only on DC)
4) dfscoerce check using netexec (only on DC)
5) Print Spooler check using netexec
6) Printnightmare check using netexec
7) WebDAV check using netexec
8) shadowcoerce check using netexec
9) SMB signing check using netexec
10) ntlmv1 check using netexec
11) runasppl check using netexec
12) RPC Dump and check for interesting protocols
13) Coercer RPC scan
14) PushSubscription abuse using PrivExchange
15) RunFinger scan

(8).MSSQL 枚举菜单

1) MSSQL Enumeration using netexec
2) MSSQL Relay check
3) Open mssqlclient.py console on target

(9).密码转储菜单

1) LAPS Dump using netexec
2) gMSA Dump using netexec
3) DCSync using secretsdump (only on DC)
4) Dump SAM and LSA using secretsdump
5) Dump SAM and SYSTEM using reg
6) Dump NTDS using netexec
7) Dump SAM using netexec
8) Dump LSA secrets using netexec
9) Dump LSASS using lsassy
10) Dump LSASS using handlekatz
11) Dump LSASS using procdump
12) Dump LSASS using nanodump
13) Dump dpapi secrets using netexec
14) Dump secrets using DonPAPI
15) Dump secrets using hekatomb (only on DC)
16) Search for juicy credentials (Firefox, KeePass, Rdcman, Teams, WiFi, WinScp)
17) Dump Veeam credentials (only from Veeam server)
18) Dump Msol password (only from Azure AD-Connect server)
19) Extract Bitlocker Keys

(10).命令执行菜单

1) Open CMD console using smbexec on target
2) Open CMD console using wmiexec on target
3) Open CMD console using psexec on target
4) Open PowerShell console using evil-winrm on target

(11).修改菜单

1) Change user or computer password (Requires: ForceChangePassword on user or computer)
2) Add user to group (Requires: GenericWrite or GenericAll on group)
3) Add new computer (Requires: MAQ > 0)
4) Add new DNS entry
5) Change Owner of target (Requires: WriteOwner permission)
6) Add GenericAll rights on target (Requires: Owner permission)
7) Targeted Kerberoast Attack (Noisy!)
8) Perform RBCD attack (Requires: GenericWrite or GenericAll on computer)
9) Perform ShadowCredentials attack (Requires: AddKeyCredentialLink)
10) Abuse GPO to execute command (Requires: GenericWrite or GenericAll on GPO)
11) Add Unconstrained Delegation rights (Requires: SeEnableDelegationPrivilege right)
12) Add CIFS and HTTP SPNs entries to computer with Unconstrained Deleg rights (Requires: Owner of computer)
13) Add userPrincipalName to perform Kerberos impersonation (Requires: GenericWrite or GenericAll on user)

(12).认证菜单

1) Generate and use NTLM hash of current user (requires: password) - Pass the hash
2) Crack NTLM hash of current user and use password (requires: NTLM hash)
3) Generate and use TGT for current user (requires: password, NTLM hash or AES key) - Pass the key/Overpass the hash
4) Extract NTLM hash from Certificate using PKINIT (requires: pfx certificate)
5) Request and use certificate (requires: authentication)

(13).配置菜单

1) Check installation of tools and dependencies
2) Synchronize time with Domain Controller (requires root)
3) Add Domain Controller's IP and Domain to /etc/hosts (requires root)
4) Update resolv.conf to define Domain Controller as DNS server (requires root)
5) Update krb5.conf to define realm and KDC for Kerberos (requires root)
6) Download default username and password wordlists (non-kali machines)
7) Change users wordlist file
8) Change passwords wordlist file
9) Change attacker'
s IP
10) Switch between LDAP (port 389) and LDAPS (port 636)
11) Show session information

点个在看你最好看

Linux中进行Active Directory渗透的瑞士军刀

东 WHAT HAPPENED IN MAY 西

Linux中进行Active Directory渗透的瑞士军刀

原文始发于微信公众号(二进制空间安全):Linux中进行Active Directory渗透的瑞士军刀

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年6月21日12:10:41
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Linux中进行Active Directory渗透的瑞士军刀https://cn-sec.com/archives/2870168.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息