当我们攻击到复杂系统比如: AD、杀软、AV 等等一些复杂环境时,我们需要对目标中存在什么软件、日志进行简单的收集分析,这可以帮助我们更好的去测试目标中存在的信息以及如何躲避目标检测
网络枚举
在达到目标后,我们需要获取目标的网络信息,以发现目标在网络中地位
PS C:\Users\thm> netstat -na
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
TCP 0.0.0.0:88 0.0.0.0:0 LISTENING
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:389 0.0.0.0:0 LISTENING
PS C:\Users\thm> arp -a
Interface: 10.10.141.51 --- 0xa
Internet Address Physical Address Type
10.10.0.1 02-c8-85-b5-5a-aa dynamic
10.10.255.255 ff-ff-ff-ff-ff-ff static
AD
如果目标存在 AD 服务,那么我们应当去收集有关内部网络以及环境的基本信息: 域信息 用户信息
PS C:\Users\thm> systeminfo | findstr Domain
OS Configuration: Primary Domain Controller
Domain: thmdomain.com
PS C:\Users\thm> Get-ADUser -Filter *
DistinguishedName : CN=Administrator,CN=Users,DC=thmredteam,DC=com
Enabled : True
GivenName :
Name : Administrator
ObjectClass : user
ObjectGUID : 4094d220-fb71-4de1-b5b2-ba18f6583c65
SamAccountName : Administrator
SID : S-1-5-21-1966530601-3185510712-10604624-500
Surname :
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 antivirusproduct
PS 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 WinDefend
Status Name DisplayName
------ ---- -----------
Running WinDefend Windows Defender Antivirus Service
Host-based Firewall:
基于主机的防火墙的主要目的是控制通过设备接口的入站和出站流量。它保护主机免受同一网络上不受信任的设备的影响。现代基于主机的防火墙在建立连接时使用多级分析流量,包括数据包分析。
# 查看防火墙情况
PS C:\Users\thm> Get-NetFirewallProfile | Format-Table Name, Enabled
Name Enabled
---- -------
Domain True
Private True
Public True
# 如果我们具有管理员权限,我们可以尝试禁用一个或多个防火墙
PS C:\Windows\system32> Set-NetFirewallProfile -Profile Domain, Public, Private -Enabled False
PS C:\Windows\system32> Get-NetFirewallProfile | Format-Table Name, Enabled
---- -------
Domain False
Private False
Public False
测试指定端口的入站链接是否被允许
PS C:\Users\thm> Test-NetConnection -ComputerName 127.0.0.1 -Port 80
ComputerName : 127.0.0.1
RemoteAddress : 127.0.0.1
RemotePort : 80
InterfaceAlias : Loopback Pseudo-Interface 1
SourceAddress : 127.0.0.1
TcpTestSucceeded : True
PS C:\Users\thm> (New-Object System.Net.Sockets.TcpClient("127.0.0.1", "80")).Connected
True