Try   HackMD

網站檢測的資安風險修正筆記

tags: 資安

IIS Crypto 軟體說明

IIS Crypto 是一個免費軟體,可以利用圖形介面關閉舊的加密協定或是不安全的加密演算法

下載點
https://www.nartac.com/Products/IISCrypto/Download


懶人包:打開後該怎麼勾選?

2024年建議參考 中正大學資訊處-弱點掃描常見問題修補建議


以下介紹各種風險以及對應的修正方式

中 使用TLS 1.0/1.1 停用TLS舊版協定,只啟用TLS 1.2(含)

直接關閉TLS協議可能會會造成 遠端桌面連不上、sql server開不起來、sql server連不上、Crystal Report 不正常等問題需要排除,詳細問題請先看完這一篇
https://blog.darkthread.net/blog/query-detail-sqlserver-verion

2017年以前的舊系統可能發生的問題:
直接關閉舊版TLS後可能產生 0x80090331 的錯誤,因為SQL Server 2014 預設沒有支援 TLS 1.2,需要更新到 SP1 以上(版本 12.0.4522.0 以上),再安裝對應的更新 SQLServer2014-KB4019099-x64
其他版本請對應 Microsoft SQL Server 的 TLS 1.2 支援

如果想檢查 sql server 的版本,可以輸入以下 sql 語法
Select @@version

查詢結果可能會是這樣,可以看到 KB數字 或是 版號數字。
Microsoft SQL Server 2019 (RTM-GDR) (KB5021125) - 15.0.2101.7 (X64) Jan 23 2023 13:08:05 Copyright (C) 2019 Microsoft Corporation Express Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 22621: ) (Hypervisor)

看完上述文章後,確定對應的東西都更新完成,再下載 IISCrypto 來關閉TLS1.0/1.1協定

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

中 TLS/SSL LOGJAM attack Web server 停用僅使用DHE 協定 < 1024 bit 長度的加密套件

使用 IIS Crypto 停用即可

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

停用弱的加密演算法

使用 IIS Crypto 停用即可

  • 中 TLS/SSL Sweet32 attack Web server 停用TLS_RSA_WITH_3DES_EDE_CBC_SHA
  • 中 TLS/SSL Weak Cipher Suites Web server 停用TLS_RSA_WITH_3DES_EDE_CBC_SHA

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

低 Clickjacking: CSP frame-ancestors missing 設定web server CSP frame-ancestors directive 及 X-Frame-Options表頭

在 web.config 增加這一段

    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <remove name="X-Powered-By" />
                <add name="X-XSS-Protection" value="1; mode:block"/>
                <add name="X-Frame-Options" value="SAMEORIGIN" />
                <add name="Content-Security-Policy" value="default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; frame-src 'self'; frame-ancestors 'self';" />
                <add name="X-Content-Type-Options" value="nosniff"/>
                <add name="Feature-Policy" value="camera 'none'"/>
                <add name="Referrer-Policy" value="origin"/>
                <add name="Strict-Transport-Security" value="max-age=31536000;includeSubDomains"/>
            </customHeaders>
        </httpProtocol>
        <security>
            <requestFiltering removeServerHeader="true" />
        </security>
    </system.webServer>
 <rewrite>
    <rules>
      <rule name="HTTP to HTTPS redirect" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
          <add input="{HTTPS}" pattern="off" ignoreCase="true" />
        </conditions>
        <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
      </rule>
    </rules>
    <outboundRules>
      <rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
        <match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".*" />
          <conditions>
            <add input="{HTTPS}" pattern="on" ignoreCase="true" />
          </conditions>
        <action type="Rewrite" value="max-age=31536000" />
      </rule>
    </outboundRules>
  </rewrite>
<iframe src="demo_iframe_sandbox_origin.htm" sandbox="allow-scripts allow-same-origin allow-popups"></iframe>