当我们攻击到复杂系统比如: AD、杀软、AV 等等一些复杂环境时,我们需要对目标中存在什么软件、日志进行简单的收集分析,这可以帮助我们更好的去测试目标中存在的信息以及如何躲避目标检测

网络枚举

在达到目标后,我们需要获取目标的网络信息,以发现目标在网络中地位

  1. PS C:\Users\thm> netstat -na
  2. Active Connections
  3. Proto Local Address Foreign Address State
  4. TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
  5. TCP 0.0.0.0:88 0.0.0.0:0 LISTENING
  6. TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
  7. TCP 0.0.0.0:389 0.0.0.0:0 LISTENING
  1. PS C:\Users\thm> arp -a
  2. Interface: 10.10.141.51 --- 0xa
  3. Internet Address Physical Address Type
  4. 10.10.0.1 02-c8-85-b5-5a-aa dynamic
  5. 10.10.255.255 ff-ff-ff-ff-ff-ff static

AD

如果目标存在 AD 服务,那么我们应当去收集有关内部网络以及环境的基本信息: 域信息 用户信息

  1. PS C:\Users\thm> systeminfo | findstr Domain
  2. OS Configuration: Primary Domain Controller
  3. Domain: thmdomain.com
  1. PS C:\Users\thm> Get-ADUser -Filter *
  2. DistinguishedName : CN=Administrator,CN=Users,DC=thmredteam,DC=com
  3. Enabled : True
  4. GivenName :
  5. Name : Administrator
  6. ObjectClass : user
  7. ObjectGUID : 4094d220-fb71-4de1-b5b2-ba18f6583c65
  8. SamAccountName : Administrator
  9. SID : S-1-5-21-1966530601-3185510712-10604624-500
  10. Surname :
  11. UserPrincipalName :
  12. PS C:\Users\thm>

杀软 (AV)

目标中肯定会存在一些杀软,我们需要枚举发现其中有什么软件,然后我们才可以更好的编写相关的程序,以躲避检测。

常见的程序主要分为:

  1. 杀毒软件
  2. Windows Defender
  3. Host-based Firewall
  4. Security Event Logging and Monitoring
  5. Host-based Intrusion Detection System (HIDS)/ Host-based Intrusion Prevention System (HIPS)
  6. Endpoint Detection and Response (EDR)
  1. PS C:\Users\thm> wmic /namespace:\\root\securitycenter2 path antivirusproduct
  2. PS C:\Users\thm> Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntivirusProduct

Windows Defender:

Microsoft Windows Defender 是在端点上运行的预安装防病毒安全工具。它在检测中使用了各种算法,包括机器学习、大数据分析、深入的威胁抵抗研究以及用于防御恶意软件和病毒的 Microsoft 云基础设施。MS Defender 在三种保护模式下工作:主动、被动、禁用模式。

主动模式用于 MS Defender 作为主要防病毒软件在提供保护和补救的计算机上运行的情况。安装第 3 方防病毒软件时运行被动模式。因此,它用作辅助防病毒软件,扫描文件并检测威胁,但不提供补救措施。最后,禁用模式是指 MS Defender 被禁用或从系统中卸载

  1. # 检测 Windows Defender 服务状态
  2. PS C:\Users\thm> Get-Service WinDefend
  3. Status Name DisplayName
  4. ------ ---- -----------
  5. Running WinDefend Windows Defender Antivirus Service

Host-based Firewall:

基于主机的防火墙的主要目的是控制通过设备接口的入站和出站流量。它保护主机免受同一网络上不受信任的设备的影响。现代基于主机的防火墙在建立连接时使用多级分析流量,包括数据包分析。
  1. # 查看防火墙情况
  2. PS C:\Users\thm> Get-NetFirewallProfile | Format-Table Name, Enabled
  3. Name Enabled
  4. ---- -------
  5. Domain True
  6. Private True
  7. Public True
  8. # 如果我们具有管理员权限,我们可以尝试禁用一个或多个防火墙
  9. PS C:\Windows\system32> Set-NetFirewallProfile -Profile Domain, Public, Private -Enabled False
  10. PS C:\Windows\system32> Get-NetFirewallProfile | Format-Table Name, Enabled
  11. ---- -------
  12. Domain False
  13. Private False
  14. Public False

测试指定端口的入站链接是否被允许

  1. PS C:\Users\thm> Test-NetConnection -ComputerName 127.0.0.1 -Port 80
  2. ComputerName : 127.0.0.1
  3. RemoteAddress : 127.0.0.1
  4. RemotePort : 80
  5. InterfaceAlias : Loopback Pseudo-Interface 1
  6. SourceAddress : 127.0.0.1
  7. TcpTestSucceeded : True
  8. PS C:\Users\thm> (New-Object System.Net.Sockets.TcpClient("127.0.0.1", "80")).Connected
  9. True

参考

TryHackMe | Cyber Security Training