Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> 關於伺服器

Web 服務器系統盤 (C:) 權限最小化配置標準表 (IIS 6.0/7.x 通用)

編輯:關於伺服器

設計原則

  • 最小權限: 僅授予運行必需的「讀取/執行/列出目錄」,拒絕寫入/修改/完全控制。
  • 繼承切斷: 關鍵目錄停用繼承,顯式定義 ACL,防止父目錄權限漂移。
  • 系統賬號保底: Administrators、SYSTEM 保留「完全控制」,確保補丁安裝、備份、恢復不受阻。

標準權限矩陣 (NTFS ACL)

路徑 / 對象主體權限 (僅列出額外授予)備註
C:\ (根目錄)Administrators完全控制 (繼承)系統管理必需
SYSTEM完全控制 (繼承)系統服務必需
C:\Program Files\Common FilesGuests / IIS_IUSRS讀取、執行、列出目錄COM 組件、共享庫調用
C:\WINNT\Temp / C:\Windows\TempGuests / IIS_IUSRS讀取、寫入ASP/ASP.NET 臨時編譯、上傳緩存
C:\Windows\system32\*.exeIWAM_* (應用程序池標識)讀取、執行CGI/ISAPI 進程啟動
C:\Windows\system32\*.dllIUSR_* (匿名用戶)讀取、執行經典 ASP/舊組件調用
C:\Windows\system32\*.tlbGuests / IIS_IUSRS讀取、執行類型庫註冊,舊應用常需
C:\WINNT\system32\inetsrvGuests / IIS_IUSRS讀取、執行IIS 核心組件 (asp.dll 等)
Web 站點物理根目錄自定義 Web_User_Group讀取、寫入 (上傳目錄)拒絕執行權限,防 WebShell

操作 SOP (命令行 批量、可審計)

REM 1. 根目錄保底
icacls C:\ /grant:r "Administrators:(OI)(CI)F" "SYSTEM:(OI)(CI)F" /inheritance:e

REM 2. 關鍵目錄顯式授權 (示例)
icacls "C:\Program Files\Common Files" /grant:r "IIS_IUSRS:(OI)(CI)(RX)" /inheritance:r
icacls "C:\Windows\Temp" /grant:r "IIS_IUSRS:(OI)(CI)(R,W)" /inheritance:r
icacls "C:\Windows\system32\*.exe" /grant:r "IWAM_*:(RX)" /inheritance:r
icacls "C:\Windows\system32\*.dll" /grant:r "IUSR_*:(RX)" /inheritance:r
icacls "C:\Windows\system32\*.tlb" /grant:r "IIS_IUSRS:(RX)" /inheritance:r
icacls "C:\Windows\system32\inetsrv" /grant:r "IIS_IUSRS:(RX)" /inheritance:r

REM 3. 站點目錄寫入隔離
icacls "D:\WebRoot\Upload" /grant:r "Web_Users:(OI)(CI)(R,W)" /inheritance:r
icacls "D:\WebRoot\Upload" /deny "Web_Users:(OI)(CI)(X)"  REM 關鍵:拒絕執行

驗證清單

  • ✅ icacls 目標路徑 輸出無「Everyone:(F)」、「Users:(M)」等過度授權。
  • ✅ Process Monitor 監啟 w3wp.php-cgi.exe 進程訪問 .exe/.dll/tlb 為 SUCCESS。
  • ✅ 上傳測試:可寫入 Upload 目錄,上傳 .asp/.php/.aspx 訪問返回 403/500 (無執行權限)。
  • ✅ Windows Update / 補丁安裝 / 系統備份 正常完成 (Administrators/SYSTEM 全控生效)。

避坑指南

  • ❌ 直接給 Everyone 完全控制 (史上最懶也最危險)。
  • ❌ 為了省事把整個 C:\Windows 給 IIS_IUSRS 修改權限 (補丁安裝會報錯、惡意代碼可替換系統文件)。
  • ❌ 忽略 IWAM_*/IUSR_* 動態賬號 (IIS 6.0 進程隔離模式下每站點獨立),需通過腳本枚舉站點自動配置。
Copyright © Windows教程網 All Rights Reserved