TMAegis
Thêm quy tắc cho iis

TMA-IIS-3.7

Ensure 'cookies' are set with HttpOnly attribute

Trung bìnhCấp 1Tự độngiis

Mô tả

The httpOnlyCookies attribute of the httpCookies node determines if IIS will set the HttpOnly flag on HTTP cookies it sets. The HttpOnly flag indicates to the user agent that the cookie must not be accessible by client-side script (i.e document.cookie). It is recommended that the httpOnlyCookies attribute be set to true. httpCookies httpOnlyCookies must be true in the root web.config and every site. PowerShell 5.1 with the WebAdministration module; run elevated.

Cách kiểm tra

Phương pháp kiểm tra: Lệnh shell

shell
Import-Module WebAdministration -ErrorAction Stop; $paths = @('MACHINE/WEBROOT') + @(Get-Website | ForEach-Object { "IIS:\Sites\$($_.Name)" }); $bad = @($paths | Where-Object { $c = Get-WebConfiguration -Filter 'system.web/httpCookies' -PSPath $_; $c.httpOnlyCookies -ne $true }); if ($bad.Count -eq 0) { 'compliant' } else { 'noncompliant' }
Đầu ra mong đợi
compliant

Cách khắc phục

Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng

Add <httpCookies httpOnlyCookies="true" /> inside <system.web> of each application web.config.

Thuộc tính

Hệ điều hành
Bất kỳ
Thẻ
iissession
Tham chiếu
CIS Microsoft IIS 10 Benchmark v1.2.1 - 3.7 Ensure 'cookies' are set with HttpOnly attribute

Kiểm tra máy này

Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.

shell
tmaegis scan --target iis