【问题标题】:SameSite=None w/ Secure Breaking iFrame in IE11SameSite=None w/ IE11 中的安全中断 iFrame
【发布时间】:2020-05-28 07:34:03
【问题描述】:

随着最近的变化,SameSite cookie 属性似乎正在向我的网站扔扳手。以前在我的网站上运行的跨浏览器 iframe 现在已损坏 - 即使使用 SameSite=None;安全通过响应头中的 iFrame 传递。

我看到人们说 Windows 7 不支持 SameSite=none 的报告非常不同。其他人说安全正在破坏或没有破坏它。但即使是当前的 Microsoft 文档也没有准确说明 Win7 IE11 应该如何响应 SameSite=None。

此时,我正在向任何可以提供帮助的人寻求一些提示或技巧。我已经做了我能想到的一切。这在以前有效,现在突然阻止 iFrame 并引发 500 错误。设置cookie的顺序会导致这种情况吗?

通过一些浏览器测试,我发现以下内容:

  • Windows 10 - IE11 损坏,Edge 损坏,Edge(测试版)正常工作
  • Windows 8.1 - IE11 工作,Edge(测试版)工作
  • Windows 8 - IE11 损坏,Edge(测试版)工作正常
  • Windows 7 - IE11 损坏,没有边缘
  • Set-Cookie 响应头:
    Set-Cookie MySitePersistence=436457226.47873.0000; path=/; httponly; secure; SameSite=none; Secure

    我尝试使用
    <add input="{RESPONSE_Set_Cookie}" pattern="." />
    <add input="{RESPONSE_Set_Cookie}" pattern="; SameSite=none" negate="true" />
    <add input="{HTTP_USER_AGENT}" pattern="^.*MSIE ([0-9]{1,}[\\.0-9]{0,})*.*$" negate="true" />
    <add input="{HTTP_USER_AGENT}" pattern="^.*Trident/.*rv:([0-9]{1,}[\\.0-9]{0,})*.*$" negate="true" />

    直接将 IE 定位为重写前置条件

    【问题讨论】:

      标签: asp.net cookies windows-7 internet-explorer-11 samesite


      【解决方案1】:

      出现此问题的原因是,由于 cookie 发生了新的更改,Asp.NET_SessionID cookie 并未始终发送,并且 cookie 现在具有 SameSite=Lax 属性。

      您可以通过在 web.config 中添加以下内容,将会话 cookie 的 SameSite 属性设置为 “None”

      <system.web>     
           <sessionState cookieSameSite="None" />     
      </system.web> 
      

      这与出站规则 (SameSite=None; Secure) 将起作用。你可以参考this simiar thread

      更多信息参考:

      (1)SameSite in code for your ASP.net applications

      (2)SameSite=Lax in the new world

      (3)SameSite cookie updates in ASP.net, or how the .Net Framework from December changed my cookie usage

      【讨论】:

      • 更新 以包含 cookieSameSite="None" 是修复它的原因。我唯一担心的是这会在每个页面上添加 sameSite="none" 对吗?在我们尝试仅针对特定浏览器之前。我们现在应该担心哪些类型的安全问题?
      猜你喜欢
      • 2020-05-17
      • 2020-06-29
      • 1970-01-01
      • 1970-01-01
      • 2020-05-21
      • 2021-01-11
      • 1970-01-01
      • 2020-12-16
      • 2020-07-04
      相关资源
      最近更新 更多