# 網站檢測的資安風險修正筆記 ###### tags: `資安` ## IIS Crypto 軟體說明 IIS Crypto 是一個免費軟體,可以利用圖形介面關閉舊的加密協定或是不安全的加密演算法 下載點 https://www.nartac.com/Products/IISCrypto/Download --- ## 懶人包:打開後該怎麼勾選? 2024年建議參考 中正大學資訊處-弱點掃描常見問題修補建議 [](https://isms.ccu.edu.tw/var/file/44/1044/img/571/692918244.pdf) --- ## 以下介紹各種風險以及對應的修正方式 ### 中 使用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 :::info 2017年以前的舊系統可能發生的問題: 直接關閉舊版TLS後可能產生 0x80090331 的錯誤,因為SQL Server 2014 預設沒有支援 TLS 1.2,需要更新到 SP1 以上(版本 12.0.4522.0 以上),再安裝對應的更新 SQLServer2014-KB4019099-x64 其他版本請對應 [Microsoft SQL Server 的 TLS 1.2 支援 ](https://support.microsoft.com/zh-tw/help/3135244/kb3135244-tls-1-2-support-for-microsoft-sql-server) ::: 如果想檢查 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](https://www.nartac.com/Products/IISCrypto/Download) 來關閉TLS1.0/1.1協定  ### 中 TLS/SSL LOGJAM attack Web server 停用僅使用DHE 協定 < 1024 bit 長度的加密套件 使用 IIS Crypto 停用即可  ### 停用弱的加密演算法 使用 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  ### 低 Clickjacking: CSP frame-ancestors missing 設定web server CSP frame-ancestors directive 及 X-Frame-Options表頭 在 web.config 增加這一段 ```=xml <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> ``` - 低 HTTP Strict Transport Security (HSTS) not implemented 設定web server HTTP Strict Transport Security (HSTS)表頭 https://medium.com/@lawrencechuang760223/%E5%A6%82%E4%BD%95%E5%9C%A8iis7-5%E4%B8%8B%E8%A8%AD%E5%AE%9Ahttp-strict-transport-security-54edf9256ce9 安裝 IIS UrlRewrite 模組之後,在Web.config加入這一段 ```=xml <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> ``` - 低 Insecure Inline Frame (iframe) 請勿於程式中使用inline frame,如需使用,應加上sandbox屬性。https://www.w3.org/TR/html52/semantics-embedded-content.html#element-attrdef-iframe-sandbox google map 的話,推薦使用以下屬性 ```=html <iframe src="demo_iframe_sandbox_origin.htm" sandbox="allow-scripts allow-same-origin allow-popups"></iframe> ``` - 低 TLS/SSL DHE Key Reuse 微軟更新: https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-1596  
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.