ข้ามไปยังเนื้อหาหลัก
ProgrammerThailand

Security

IIS: Lack of HTTP Secure Flag

ใน Internet Information Service : IIS เราสามารถกำหนดให้ระบบ require SSL เพื่อความปลอดภัยของการรับส่งข้อมูล

ระดับความเสี่ยง : ต่ำมาก

HTTP Secue Flag เป็นการทำให้ระบบรับส่ง cookie ผ่าน Protocol HTTPS เท่านั้น เพื่อป้องกันไม่ให้ ข้อมูล cookie ถูกดักจับระหว่างการรับส่งได้ ซึ่งหากรับส่งผ่าน HTTP Protocol ถือว่ายังไม่ปลอดภัย

ให้ทำการแก้ไขไฟล์ web.config โดยเพิ่มคำสั่งดังต่อไปนี้

<system.web>
    <httpCookies httpOnlyCookies="true" requireSSL="true" lockItem="true" />
</system.web>

และ

<system.webServer>
  <rewrite>
    <outboundRules>
      <rule name="Use only secure cookies" preCondition="Unsecured cookie">
        <match serverVariable="RESPONSE_SET_COOKIE" pattern=".*" negate="false" />
        <action type="Rewrite" value="{R:0}; secure" />
      </rule>
      <preConditions>
        <preCondition name="Unsecured cookie">
          <add input="{RESPONSE_SET_COOKIE}" pattern="." />
          <add input="{RESPONSE_SET_COOKIE}" pattern="; secure" negate="true" />
        </preCondition>
      </preConditions>
    </outboundRules>
  </rewrite>
...
</system.webServer>

 

ติดปัญหาตอนทำตาม? ถามในชุมชน

ความคิดเห็น (0)

ยังไม่มีความคิดเห็น — เริ่มคุยเป็นคนแรก ถามสิ่งที่สงสัย หรือแชร์ประสบการณ์ของคุณ

แชร์