当我们攻击到复杂系统比如: AD、杀软、AV 等等一些复杂环境时,我们需要对目标中存在什么软件、日志进行简单的收集分析,这可以帮助我们更好的去测试目标中存在的信息以及如何躲避目标检测
网络枚举
在达到目标后,我们需要获取目标的网络信息,以发现目标在网络中地位
PS C:\Users\thm> netstat -naActive ConnectionsProto Local Address Foreign Address StateTCP 0.0.0.0:80 0.0.0.0:0 LISTENINGTCP 0.0.0.0:88 0.0.0.0:0 LISTENINGTCP 0.0.0.0:135 0.0.0.0:0 LISTENINGTCP 0.0.0.0:389 0.0.0.0:0 LISTENING
PS C:\Users\thm> arp -aInterface: 10.10.141.51 --- 0xaInternet Address Physical Address Type10.10.0.1 02-c8-85-b5-5a-aa dynamic10.10.255.255 ff-ff-ff-ff-ff-ff static
AD
如果目标存在 AD 服务,那么我们应当去收集有关内部网络以及环境的基本信息: 域信息 用户信息
PS C:\Users\thm> systeminfo | findstr DomainOS Configuration: Primary Domain ControllerDomain: thmdomain.com
PS C:\Users\thm> Get-ADUser -Filter *DistinguishedName : CN=Administrator,CN=Users,DC=thmredteam,DC=comEnabled : TrueGivenName :Name : AdministratorObjectClass : userObjectGUID : 4094d220-fb71-4de1-b5b2-ba18f6583c65SamAccountName : AdministratorSID : S-1-5-21-1966530601-3185510712-10604624-500Surname :UserPrincipalName :PS C:\Users\thm>
杀软 (AV)
目标中肯定会存在一些杀软,我们需要枚举发现其中有什么软件,然后我们才可以更好的编写相关的程序,以躲避检测。
常见的程序主要分为:
- 杀毒软件
- Windows Defender
- Host-based Firewall
- Security Event Logging and Monitoring
- Host-based Intrusion Detection System (HIDS)/ Host-based Intrusion Prevention System (HIPS)
- Endpoint Detection and Response (EDR)
PS C:\Users\thm> wmic /namespace:\\root\securitycenter2 path antivirusproductPS C:\Users\thm> Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntivirusProduct
Windows Defender:
Microsoft Windows Defender 是在端点上运行的预安装防病毒安全工具。它在检测中使用了各种算法,包括机器学习、大数据分析、深入的威胁抵抗研究以及用于防御恶意软件和病毒的 Microsoft 云基础设施。MS Defender 在三种保护模式下工作:主动、被动、禁用模式。主动模式用于 MS Defender 作为主要防病毒软件在提供保护和补救的计算机上运行的情况。安装第 3 方防病毒软件时运行被动模式。因此,它用作辅助防病毒软件,扫描文件并检测威胁,但不提供补救措施。最后,禁用模式是指 MS Defender 被禁用或从系统中卸载
# 检测 Windows Defender 服务状态PS C:\Users\thm> Get-Service WinDefendStatus Name DisplayName------ ---- -----------Running WinDefend Windows Defender Antivirus Service
Host-based Firewall:
基于主机的防火墙的主要目的是控制通过设备接口的入站和出站流量。它保护主机免受同一网络上不受信任的设备的影响。现代基于主机的防火墙在建立连接时使用多级分析流量,包括数据包分析。
# 查看防火墙情况PS C:\Users\thm> Get-NetFirewallProfile | Format-Table Name, EnabledName Enabled---- -------Domain TruePrivate TruePublic True# 如果我们具有管理员权限,我们可以尝试禁用一个或多个防火墙PS C:\Windows\system32> Set-NetFirewallProfile -Profile Domain, Public, Private -Enabled FalsePS C:\Windows\system32> Get-NetFirewallProfile | Format-Table Name, Enabled---- -------Domain FalsePrivate FalsePublic False
测试指定端口的入站链接是否被允许
PS C:\Users\thm> Test-NetConnection -ComputerName 127.0.0.1 -Port 80ComputerName : 127.0.0.1RemoteAddress : 127.0.0.1RemotePort : 80InterfaceAlias : Loopback Pseudo-Interface 1SourceAddress : 127.0.0.1TcpTestSucceeded : TruePS C:\Users\thm> (New-Object System.Net.Sockets.TcpClient("127.0.0.1", "80")).ConnectedTrue
