Close Menu
  • Home
  • Articles
    • Attacks
      • BEC
      • Data Breach
      • DDoS
      • Evasion Attacks
      • Injection
      • Malware
      • MITM
      • Phishing
      • Ransomware
      • RCE
      • Social Engineering
      • Spoofing
      • Spyware
    • Business and Policy
      • BCP and DRP
      • GRC
      • Regulations
    • Data Protection
      • DLP
      • DRM
      • Encryption
      • IAM
    • Future, Trends and Insight
      • AI
      • Events & Community
      • Emerging Tech
      • Expert Panel
      • Interviews With Experts
      • Insights
      • Study & Research
    • Resources
      • Guides
      • Tools
      • Training & Education
    • Security
      • API
      • Apps
      • Cloud
      • Critical Infrastructure
      • Endpoint
      • Hardware
      • IoT
      • Mobile
      • Network
      • OT
      • Port Security
      • Security Architecture
      • Software Development
      • Supply Chain
      • Zero Trust
    • Threats and Vulnerabilities
      • Emerging Threats
      • Insider Threats
      • Risk Management
      • Threat Intelligence
      • Zero Day
  • News and Exclusives
    • Latest News
    • ISB Exclusive
    • Positive News
  • Who We Are
    • About Us
    • Information Security Buzz Expert Panel​
    • Write for Us
    • Media Pack
  • Contact Us
  • Newsletter
Facebook X (Twitter) LinkedIn
Facebook X (Twitter) LinkedIn
Information Security BuzzInformation Security Buzz
  • Home
  • Articles
    • Attacks
      • BEC
      • Data Breach
      • DDoS
      • Evasion Attacks
      • Injection
      • Malware
      • MITM
      • Phishing
      • Ransomware
      • RCE
      • Social Engineering
      • Spoofing
      • Spyware
    • Business and Policy
      • BCP and DRP
      • GRC
      • Regulations
    • Data Protection
      • DLP
      • DRM
      • Encryption
      • IAM
    • Future, Trends and Insight
      • AI
      • Events & Community
      • Emerging Tech
      • Expert Panel
      • Interviews With Experts
      • Insights
      • Study & Research
    • Resources
      • Guides
      • Tools
      • Training & Education
    • Security
      • API
      • Apps
      • Cloud
      • Critical Infrastructure
      • Endpoint
      • Hardware
      • IoT
      • Mobile
      • Network
      • OT
      • Port Security
      • Security Architecture
      • Software Development
      • Supply Chain
      • Zero Trust
    • Threats and Vulnerabilities
      • Emerging Threats
      • Insider Threats
      • Risk Management
      • Threat Intelligence
      • Zero Day
  • News and Exclusives
    • Latest News
    • ISB Exclusive
    • Positive News
  • Who We Are
    • About Us
    • Information Security Buzz Expert Panel​
    • Write for Us
    • Media Pack
  • Contact Us
  • Newsletter
Subscribe
Information Security BuzzInformation Security Buzz
Home - Articles - Securing your Web Application Through HTTP Headers
Articles

Securing your Web Application Through HTTP Headers

Brian A. McHenryBy Brian A. McHenryAugust 27, 2015Updated:July 8, 20246 Mins Read
Share LinkedIn Twitter Facebook Copy Link Email
Share
Facebook Twitter LinkedIn Email Copy Link
Quick AI Summary
ChatGPTClaudeGeminiGrokPerplexityDeepSeekCopilot

Web application security is hard to implement and harder still to maintain. The application layer is also the top attack vector for data loss, via such well-known vulnerabilities as SQL injection. Needless to say, we infosec practitioners are always looking for an application security “easy button.” Part of the solution is staring us right in the eyes, yet we have been slow to leverage HTTP response headers.

With that in mind, the revelations of Scott Helme’s recent survey of the top one million web sites came as a huge shock. Security-centric HTTP response headers are relatively easy to insert and provide a range of robust protections against attacks such as cross-site request forgery (CSRF), cross-site scripting (XSS), and clickjacking. Yet, the use of these standard HTTP security headers barely cracks the single digits, much less the double digits. Helme is not merely chastising us for our inability to deploy these application security measures, he also provides helpful guidance on implementing them in an earlier post on his blog.

Inserting a header in the server’s HTTP response is typically transparent to the end-user and the application, and has the effect of strengthening the weakest point of any web application transaction—the browser.

The browser has two chief disadvantages when it comes to security:

  1. The browser must be compatible with every web site on the Internet
  2. The browser is subject to the decisions of the human driving it

The security-centric HTTP headers available empower the browser to make smarter security decisions for the human user.

Let’s dig into a few of my HTTP headers (percentage of sites in the Alexa top one million):

  • HTTP Strict Transport Security (1.2%)

Strict Transport Security leaps immediately to the front since the HSTS header is mandatory to achieve an A+ rating with Qualys’ SSL Labs. Upon receiving the HSTS header, the browser will refuse to load the specified domain over clear-text HTTP. Set the HSTS header for a long duration (6 months or greater), and only insert it via an already-established HTTPS session. Also, insert the HSTS header using the server configuration methods Helme covers, or by a proxy such as an ADC or a WAF device.

  • HTTPS Permanent Redirect (6.7%)

Related to the final point about HSTS above, but not strictly a header, it is important to pin all traffic to HTTPS. By sending a 301 (permanent) redirect to any browser attempting to reach the site via clear-text HTTP, we ensure encryption for all meaningful transactions. Encrypting HTTP transactions with TLS, the successor to SSL, makes it much more difficult to intercept and manipulate any of the security-centric HTTP headers we insert.

  • HTTP Public Key Pinning (0.02%)

Also related to TLS encryption, HPKP headers ensure the integrity of the TLS handshake. HPKP headers are also the least common of all the security-centric headers in Helme’s survey. Moxie Marlinspike has long covered the problem of authenticity in the TLS transaction, and has said the Certificate Authority system is utterly broken. The notion of a root trust in a Certificate Authority is utterly flawed, especially in the wake of the DigiNotar and Comodo compromises of the last few years. However, there are ways to bolster the verification of certificate authenticity beyond chains of trust to certificate authorities (CAs). public key pinning ensures that the browser has a valid copy of the certificate to compare to any certificate presented by a server. So, even the case of DNS poisoning, a compromised CA, or some other vector for a man-in-the-middle of the encrypted connection, the browser can compare and verify the pinned certificate with the certificate presented in the handshake. For more details, Yahoo penetration tester, Stuart Larsen, has a great talk on the topic of HPKP.

  • Content Security Policy (~2%)

Content security policy (CSP) headers come in a few different flavors, owing to a long time as an “experimental” header (XCSP and XWCSP). At BlackHat 2013, Qualys researchers Mike Shema and Vaagn Toukharian made a strong proposal for leveraging CSP as a mechanism for fighting CSRF. Cross-site request forgery generally requires an initial XSS attack vector along with some phishing to be successful, but the complicated nature of executing a CSRF attack is rewarded with authenticated access to the vulnerable web application. CSP headers fight this by instructing browsers where and how it can legitimately load content for the page. A nice feature of CSP headers is the “report only” option, which enables a slow-ramp to find out what origins the browser attempts load. Reviewing the reports can avail us of what “normal” looks like as well as alert us of abnormal attempts without blocking and causing a false positive.

  • X-Frame-Options (5.9%)

The XFO header is more widely deployed than most, because of the ease of deployment and the strength in mitigating clickjacking attacks, principally discovered (and named) by Jeremiah Grossman and RSnake of WhiteHat Security back in 2009. Clickjacking is particularly nasty since it causes a user to click on a transparent frame in the browser during their normal interactions with the web application. The most critical threat would be framing the login form so that clickjackers can intercept credentials. XFO headers instruct the browser when and if to allow any framing. The only catch here is that some sites may still(!) be using frames, which would make XFO headers somewhat untenable. That being said, I doubt that 94.1% of the top one million web sites are still using frames for any legitimate, intended purpose. We can do better.

We only covered the top five HTTP response modifications that enable better application security.

However, the benefits of implementing them are significant, and include:

  • Ensures the browser to only load content via encrypted connections
  • Forces the browser to verify the authenticity of the certificate presented
  • Prevents most XSS, CSRF, and other common phishing and malware vectors
  • Prevents most methods of clickjacking

The net result is improved application security without the need for signature-based detections, application code changes, or changes in user experience (UX). Due to application dependencies or operational obstacles, we may not be able to implement Helme’s detailed instructions for modifying common application servers like IIS and nginx. However, we still have the opportunity to implement these security measures via common proxies such as the application delivery controller (ADC), load-balancer, or web application firewall (WAF). Anything we can do to strengthen the weakest link in application security, the browser, is worth it. And according to Helme’s survey, 99% of us are leaving that security value on the table. Let’s get to work.[su_box title=”About Brian A. McHenry” style=”noise” box_color=”#336588″]Brian_McHenryAs a Security Solutions Architect at F5 Networks, Brian McHenry focuses on web application and network security. McHenry acts as a liaison between customers, the F5 sales team, and the F5 product teams, providing a hands-on, real-world perspective. Prior to joining F5 in 2008, McHenry, a self-described “IT generalist”, held leadership positions within a variety of technology organizations, ranging from startups to major financial services firms.

Twitter: @bamchenry[/su_box]

Brian_McHenry
Brian A. McHenry

As a Senior Security Solutions Architect at F5 Networks, Brian McHenry focuses on web application and network security. McHenry acts as a liaison between customers and F5 product teams, providing a hands-on, real-world perspective. He is a regular contributor on InformationSecurityBuzz.com, a co-founder of BSidesNYC, and a speaker at AppSecUSA, BC Aware Day, GoSec Montreal, and the Central Ohio Infosec Summit, among others. Prior to joining F5 in 2008, McHenry, a self-described IT generalist, held leadership positions within a variety of technology organizations, ranging from startups to major financial services firms.

  • Brian A. McHenry
    The WAF Is Not Enough
  • Brian A. McHenry
    Access Management, With A Side Order Of Identity
  • Brian A. McHenry
    The Internet of Thingbots
  • Brian A. McHenry
    Black Hat USA 2017: Bigger and Better (?)

The opinions expressed in this post belong to the individual contributors and do not necessarily reflect the views of Information Security Buzz.

Share. Facebook Twitter LinkedIn Email Copy Link

Related Posts

Visual data is the blind spot in enterprise security: that’s about to change

May 4, 20267 Mins Read

AppSec is dead, long live AI security

April 29, 20265 Mins Read

Making stolen data worthless: why security must start with the data

March 30, 20265 Mins Read
ISB-Bora-Side-Bar

 
ISB-Bora-Side-Bar
Black ISB Logo

Information Security Buzz is an independent resource that provides the experts’ comments, analysis, and opinion on the latest Cybersecurity news and topics

X (Twitter) LinkedIn Facebook RSS

Working With Us

  • About Us
  • Advertise With Us
  • Contact Us

Write For Us

  • How To Contribute

The Pages

  • Privacy Policy
  • Cookie Policy
  • AI Policy
  • Terms & Conditions
  • Copyright Notice

Information Security Buzz and all its contents are copyright © 2014-2025. All rights reserved. All third-party trademarks are recognized.

Type above and press Enter to search. Press Esc to cancel.

Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}