[研究]GCB,IIS,「表單驗證需要 SSL」預設值 False 改為 GCB 建議值 True 的影響?那些 套件 功能會異常?
2025-11-17
政府組態基準(Government Configuration Baseline,簡稱GCB)
TWGCB-04-014_Microsoft IIS 10政府組態基準說明文件v1.1_1141002
https://www.nics.nat.gov.tw/core_business/cybersecurity_defense/GCB/GCB_Documentation/
No.8
IIS 管理員\伺服器\站台\網站\管理\設定編輯器\動作\開啟功能\區段\system.web\authentication\forms\requireSSL
「表單驗證需要 SSL」從預設值 False 改為 GCB 建議值 True 的影響?那些 套件 功能會異常?
- AngleSharp 0.17.1
- AngleSharp.Css 0.17.0
- Antlr 3.5.0.2
- Aspose.Cells 25.10.0
- Autofac 8.4.0
- Autofac.WebApi2 6.1.1
- Bootstrap.Datepicker 1.8.0.1
- BouncyCastle.Cryptography 2.6.2
- ByteSize 2.1.2
- Chart.js 3.7.1
- ClosedXML 0.105.0
- ClosedXML.Parser 2.0.0
- Common.Logging 3.4.1
- Common.Logging.Core 3.4.1
- DocumentFormat.OpenXml 3.3.0
- DocumentFormat.OpenXml.Framework 3.3.0
- EFUtilities 1.0.2
- EntityFramework 6.5.1
- Enums.NET 5.0.0
- ExcelDataReader 3.8.0
- ExcelDataReader.DataSet 3.8.0
- ExcelNumberFormat 1.1.0
- ExtendedNumerics.BigDecimal 3001.1.0.233
- FastMember 1.5.0
- FastMember.Signed 1.5.0
- Font.Awesome 5.15.4
- FontAwesome 4.7.0
- FreeDataExports 1.1.12
- FreeSpire.PDF 8.6.0
- HtmlSanitizer 9.0.876
- HtmlSanitizer 9.0.886
- Irony 1.5.3
- Irony.NetCore 1.1.11
- JetBrains.Annotations 2025.2.2
- LinqKit 1.3.8
- LinqKit.Core 1.2.8
- LogicExtensions 0.0.3
- MailKit 4.14.1
- MathNet.Numerics.Signed 5.0.0
- Microsoft.AspNet.FriendlyUrls 1.0.2
- Microsoft.AspNet.FriendlyUrls.Core 1.0.2
- Microsoft.AspNet.FriendlyUrls.Core.zh-Hant 1.0.2
- Microsoft.AspNet.Identity.Core 2.2.4
- Microsoft.AspNet.Identity.Core.zh-Hant 2.2.4
- Microsoft.AspNet.Identity.EntityFramework 2.2.4
- Microsoft.AspNet.Identity.EntityFramework.zh-Hant 2.2.4
- Microsoft.AspNet.Identity.Owin 2.2.4
- Microsoft.AspNet.Identity.Owin.zh-Hant 2.2.4
- Microsoft.AspNet.Providers.Core 2.0.0
- Microsoft.AspNet.Providers.Core.zh-Hant 2.0.0
- Microsoft.AspNet.ScriptManager.MSAjax 5.0.0
- Microsoft.AspNet.ScriptManager.WebForms 5.0.0
- Microsoft.AspNet.Web.Optimization 1.1.3
- Microsoft.AspNet.Web.Optimization.WebForms 1.1.3
- Microsoft.AspNet.Web.Optimization.zh-Hans 1.1.3
- Microsoft.AspNet.Web.Optimization.zh-Hant 1.1.3
- Microsoft.AspNet.WebApi 5.3.0
- Microsoft.AspNet.WebApi.Client 6.0.0
- Microsoft.AspNet.WebApi.Client.zh-Hant 6.0.0
- Microsoft.AspNet.WebApi.Core 5.3.0
- Microsoft.AspNet.WebApi.Core.zh-Hant 5.3.0
- Microsoft.AspNet.WebApi.WebHost 5.3.0
- Microsoft.AspNet.WebApi.WebHost.zh-Hant 5.3.0
- Microsoft.Bcl.AsyncInterfaces 9.0.10
- Microsoft.Bcl.Build 1.0.21
- Microsoft.Bcl.Cryptography 9.0.10
- Microsoft.Bcl.HashCode 6.0.0
- Microsoft.CSharp 4.7.0
- Microsoft.Extensions.DependencyInjection 9.0.10
- Microsoft.Extensions.DependencyInjection.Abstractions 9.0.10
- Microsoft.IO.RecyclableMemoryStream 3.0.1
- Microsoft.NETCore.Platforms 7.0.4
- Microsoft.Owin 4.2.3
- Microsoft.Owin.Host.SystemWeb 4.2.3
- Microsoft.Owin.Security 4.2.3
- Microsoft.Owin.Security.Cookies 4.2.3
- Microsoft.Owin.Security.OAuth 4.2.3
- Microsoft.Web.Infrastructure 2.0.0
- Microsoft.Win32.Primitives 4.3.0
- MimeKit 4.14.0
- Modernizr 2.8.3
- Modernizr.New 3.4.0
- Moment.js 2.30.1
- NETStandard.Library 2.0.3
- NLog 6.0.5
- NLog.Schema 6.0.5
- NPOI 2.7.5
- NReco.PdfGenerator 1.2.1
- NSax 1.0.2
- Newtonsoft.Json 13.0.4
- Newtonsoft.Json.Bson 1.0.3
- Npoi.Mapper 6.2.2
- Oracle.ManagedDataAccess 23.26.0
- Owin 1.0
- Portable.BouncyCastle 1.9.0
- ProDotNetZip 1.20.0
- RBush 4.0.0
- RBush.Signed 4.0.0
- Respond 1.4.2
- RestSharp 106.15.0
- RestSharp 112.1.0
- Select2.js 4.0.13
- SendGrid 9.29.3
- SendGrid.CSharp.HTTP.Client 3.4.12
- SendGrid.SmtpApi 1.4.6
- SharpZipLib 1.4.2
- SixLabors.Fonts 1.0.1
- SixLabors.ImageSharp 3.1.11
- Swashbuckle 5.6.0
- Swashbuckle.Core 5.6.0
- System.AppContext 4.3.0
- System.Buffers 4.6.1
- System.Collections 4.3.0
- System.Collections.Concurrent 4.3.0
- System.Collections.Immutable 9.0.10
- System.Configuration.ConfigurationManager 9.0.10
- System.Console 4.3.1
- System.Diagnostics.Debug 4.3.0
- System.Diagnostics.DiagnosticSource 9.0.10
- System.Diagnostics.Tools 4.3.0
- System.Diagnostics.Tracing 4.3.0
- System.Formats.Asn1 9.0.10
- System.Globalization 4.3.0
- System.Globalization.Calendars 4.3.0
- System.IO 4.3.0
- System.IO.Compression 4.3.0
- System.IO.Compression.ZipFile 4.3.0
- System.IO.FileSystem 4.3.0
- System.IO.FileSystem.Primitives 4.3.0
- System.IO.Packaging 9.0.10
- System.IO.Pipelines 9.0.10
- System.IO.UnmanagedMemoryStream 4.3.0
- System.Linq 4.3.0
- System.Linq.Dynamic.Core 1.6.9
- System.Linq.Expressions 4.3.0
- System.Linq.Queryable 4.3.0
- System.Memory 4.6.3
- System.Net.Http 4.3.4
- System.Net.Primitives 4.3.1
- System.Net.Sockets 4.3.0
- System.Numerics.Vectors 4.6.1
- System.ObjectModel 4.3.0
- System.Reflection 4.3.0
- System.Reflection.Emit.ILGeneration 4.7.0
- System.Reflection.Emit.Lightweight 4.7.0
- System.Reflection.Extensions 4.3.0
- System.Reflection.Primitives 4.3.0
- System.Resources.ResourceManager 4.3.0
- System.Runtime 4.3.1
- System.Runtime.CompilerServices.Unsafe 6.1.2
- System.Runtime.CompilerServices.Unsafe 7.0.0-preview.2.22152.2
- System.Runtime.Extensions 4.3.1
- System.Runtime.Handles 4.3.0
- System.Runtime.InteropServices 4.3.0
- System.Runtime.InteropServices.RuntimeInformation 4.3.0
- System.Runtime.Numerics 4.3.0
- System.Security.AccessControl 6.0.1
- System.Security.Cryptography.Algorithms 4.3.1
- System.Security.Cryptography.Encoding 4.3.0
- System.Security.Cryptography.Pkcs 9.0.10
- System.Security.Cryptography.Primitives 4.3.0
- System.Security.Cryptography.X509Certificates 4.3.2
- System.Security.Cryptography.Xml 9.0.10
- System.Security.Permissions 9.0.10
- System.Security.Principal.Windows 5.0.0
- System.Text.Encoding 4.3.0
- System.Text.Encoding.CodePages 9.0.10
- System.Text.Encoding.Extensions 4.3.0
- System.Text.Encodings.Web 9.0.10
- System.Text.Json 9.0.10
- System.Text.RegularExpressions 4.3.1
- System.Threading 4.3.0
- System.Threading.Tasks 4.3.0
- System.Threading.Tasks.Extensions 4.6.3
- System.Threading.Tasks.Parallel 4.3.0
- System.Threading.Timer 4.3.0
- System.ValueTuple 4.5.0
- System.ValueTuple 4.6.1
- System.Xml.Linq 3.5.21022.801
- System.Xml.ReaderWriter 4.3.1
- System.Xml.XDocument 4.3.0
- WebActivatorEx 2.2.0
- WebGrease 1.6.0
- WkHtmlToPdf 1.0.2
- X.PagedList 10.5.9
- XLParser 1.7.5
- ZString 2.6.0
- bootstrap 3.4.1
- bootstrap 5.3.8
- elmah 1.2.2
- elmah.corelibrary 1.2.2
- html5-shiv 3.7.3
- icheck-bootstrap 3.0.1
- jQuery 3.7.1
- jQuery-datetimepicker 2.4.5
- jQuery.UI.Combined 1.14.1
- jQuery.Validation 1.21.0
- js-cookie 2.2.1
- popper.js 1.16.1
- starkbank-ecdsa 1.3.3
- vue 2.6.11
********************************************************************************
ChatGPT
✅ 結論:requireSSL="true" 幾乎不會讓你列出的任何 NuGet 套件異常
因為:
➡ requireSSL 只影響「ASP.NET Forms Authentication 的 FormTicket Cookie 是否只能在 HTTPS 傳送」,也就是 只有這顆 Cookie:
.ASPXAUTH |
➡ 你列出的所有套件,都不會直接操作 .ASPXAUTH Cookie,也不依賴 Form Authentication Cookie
因此 不會受到 requireSSL 啟用的影響。
🧠 requireSSL="true" 會產生的真正影響(重點)
僅在以下情況會出現問題:
1. 你的網站有 HTTP 與 HTTPS 混用
如果網站允許用戶從 http:// 進入
→ 這時瀏覽器不會送出 requireSSL 的 .ASPXAUTH cookie
→ 使用者會被認為未登入
→ 無限重新登入、跳回登入頁
2. 你有手動寫程式讀取 Request.Cookies[".ASPXAUTH"]
在 HTTP 下會變成 null。
✔ 完全不會受影響的套件(佔 99%)
➡ 只有舊式 Forms Authentication 才會受影響
➡ OWIN Cookie Authentication 也不受 requireSSL 影響(它用的是另一顆 cookie)
⚠ 可能間接受影響的情境(但不是套件本身的問題)
只有 你網站使用 Forms Authentication 才會有影響:
1. ASP.NET Forms Authentication
如果 web.config 有:
<authentication mode="Forms">
<forms loginUrl="Login.aspx" timeout="30" requireSSL="true" />
</authentication>
|
則:
使用 HTTP → 認證 Cookie 不會送出 → 使用者變成「未登入」
使用 HTTPS → 完全正常
**2. 你的網站有:
自訂登入機制 + 使用 FormsAuthentication.SetAuthCookie**
→ 在 HTTP 下 Cookie 不會出現
3. js-cookie 套件(如果你用來讀 auth cookie)
你有 js-cookie 2.2.1,但:
✔ js-cookie 不會自動處理 requireSSL
✔ 只有你自己寫程式讀取 .ASPXAUTH Cookie 才會受影響
✘ js-cookie 不會造成錯誤
只是你在 HTTP 下讀不到 cookie
⛔ 你的清單中「只有這一類」可能與登入邏輯有關
(但仍不直接受影響)
✔ Microsoft.AspNet.Identity 系列
但:
- ASP.NET Identity 不使用 Forms Authentication Cookie
- 它使用 OWIN Cookie Authentication → cookie 名稱不同(如 .AspNet.Cookies)
- requireSSL="true" 完全不影響 OWIN Cookie
👉 除非你的網站仍同時啟用 旧式 Forms Authentication(多數公司都沒有)
🟢 總整理:哪些功能會壞?
只有:
➡ 用 HTTP 存取網站時:登入失效、一直被登出、一直跳回 Login.aspx
(原因:ASPXAUTH Cookie 無法在 HTTP 傳送)
➡ 用 JavaScript 想讀取 .ASPXAUTH
也讀不到(因為 cookie 被標記為 Secure)
➡ 混用 HTTP / HTTPS
會產生:
- Session 看似亂跳
- 登入狀態消失
- 某些 postback 變成未登入狀態
🟢 建議處理方式(企業正式機最標準作法)
1. 全站 HTTPS 強制導向(最常見解法)
在 Web.config 加:
<rewrite>
<rules>
<rule name="HTTP to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
|
2. 啟用 HSTS(GCB 也要求)
確保 scanner (Nessus / AppScan) 不會誤報。
📌 最終回答摘要
- ✔ requireSSL="true" 不會讓任何上述 NuGet 套件異常。
- ✔ 唯一的影響是 .ASPXAUTH Cookie 只能在 HTTPS 傳送。
- ✔ 若網站仍允許 HTTP 存取,則所有使用者會被登出、無法登入。
- ✔ 若網站已全站 HTTPS,則完全沒有任何相容性問題。
- ✔ ASP.NET Identity / OWIN Cookie Authentication 不受影響。
(完)
沒有留言:
張貼留言