OWASP Secure Headers Project

=Main=



{| style="padding: 0;margin:0;margin-top:10px;text-align:left;" |-
 * valign="top" style="border-right: 1px dotted gray;padding-right:25px;" |

OWASP Secure Headers Project
OWASP Secure Headers Project involves setting headers from the server is easy and often doesn't require any code changes. Once set, they can restrict modern browsers from running into easily preventable vulnerabilities. OWASP Secure Headers Project intends to raise awareness and use of these headers.

Introduction
HTTP headers are well known and also despised. Seeking the balance between usability and security developers implement functionality through the headers that can make your more versatile or secure application. But in practice how the headers are being implemented? What sites follow the best implementation practices? Big companies, small, all or none?

Description
We aim to publish reports on header usage stats, developments and changes. Code libraries that make these headers easily accessible to developers on a range of platforms. Data sets concerning the general usage of these headers.

Licensing
OWASP Secure Headers is free to use. It is licensed under the Apache 2.0 license.


 * valign="top" style="padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;" |

What is the OWASP Secure Headers Project?
OWASP Secure Headers Project provides:


 * Security best practices for HTTP headers
 * Security tools for HTTP headers

Project Leader
Ricardo Iramar

Project Contributors
Jim Manico

Alexandre Menezes

Related Projects

 * List of useful HTTP headers


 * valign="top" style="padding-left:25px;width:200px;" |

Quick Links

 * hsecscan

Email List
Project Email List

News and Events

 * [14 Dec 2015] Reborning from the ashes

Classifications

 * }

=Headers=

A list of headers related to security and how to implement them properly.


 * HTTP Strict Transport Security (HSTS)
 * Public Key Pinning Extension for HTTP (HPKP)
 * X-Frame-Options
 * X-XSS-Protection
 * X-Content-Type-Options
 * Content-Security-Policy

HTTP Strict Transport Security (HSTS)
HTTP Strict Transport Security (HSTS) is a web security policy mechanism which helps to protect websites against protocol downgrade attacks and cookie hijacking. It allows web servers to declare that web browsers (or other complying user agents) should only interact with it using secure HTTPS connections, and never via the insecure HTTP protocol. HSTS is an IETF standards track protocol and is specified in RFC 6797. A server implements an HSTS policy by supplying a header (Strict-Transport-Security) over an HTTPS connection (HSTS headers over HTTP are ignored).

Best Practices

 * Apache
 * Edit your apache configuration file and add the following to your VirtualHost.


 * nginx
 * Edit your nginx configuration file and add the following snippet.


 * lighttpd
 * Edit your lighttpd configuration file and add the following snippet.


 * IIS

Public Key Pinning Extension for HTTP (HPKP)
HTTP Public Key Pinning (HPKP) is a security mechanism which allows HTTPS websites to resist impersonation by attackers using mis-issued or otherwise fraudulent certificates. (For example, sometimes attackers can compromise certificate authorities, and then can mis-issue certificates for a web origin.) The HTTPS web server serves a list of public key hashes, and on subsequent connections clients expect that server to use 1 or more of those public keys in its certificate chain.

Example
Public-Key-Pins: pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; report-uri="http://example.com/pkp-report"; max-age=10000; includeSubDomains

Best Practices

 * Apache
 * Edit your apache configuration file and add the following to your VirtualHost.


 * nginx
 * Edit your nginx configuration file and add the following snippet.


 * lighttpd
 * Edit your lighttpd configuration file and add the following snippet.


 * IIS

X-Frame-Options
X-Frame-Options response header improve the protection of web applications against Clickjacking. It declares a policy communicated from a host to the client browser on whether the browser must not display the transmitted content in frames of other web pages.

Best Practices

 * Apache
 * Add this line below into your site's configuration to configure Apache to send X-Frame-Options header for all pages.


 * nginx
 * Add snippet below into configuration file to send X-Frame-Options header.


 * lighttpd
 * Add snippet below into configuration file to send X-Frame-Options header.


 * IIS

X-XSS-Protection
This header enables the Cross-site scripting (XSS) filter.

Best Practices
Add appropriate snippet into configuration file.


 * Apache


 * nginx


 * lighttpd


 * IIS

X-Content-Type-Options
Setting this header will prevent MSIE from interpreting files as something else than declared by the content type in the HTTP headers.

Best Practices
Add appropriate snippet into configuration file.


 * Apache


 * nginx


 * lighttpd


 * IIS

Content-Security-Policy
Content Security Policy requires careful tuning and precise definition of the policy. If enabled, CSP has significant impact on the way browser renders pages (e.g., inline JavaScript disabled by default and must be explicitly allowed in policy). CSP prevents a wide range of attacks, including Cross-site scripting and other cross-site injections.

Best Practices
Add appropriate snippet into configuration file.


 * Apache


 * nginx


 * lighttpd


 * IIS

High-Tech Bridge Web Security Scanner
An online service that will retrieve and analyze headers syntax and proper configuration. It will be able for instance to highlight Public-Key-Pins that matches one certificate of the chain or if Content-Security-Policy contains values that could be unsafe or too permissive.

Site: https://www.htbridge.com/websec/

hsecscan
A security scanner for HTTP response headers.

Github: https://github.com/riramar/hsecscan

securityheaders.io
There are services out there that will analyse the HTTP response headers of other sites but I also wanted to add a rating system to the results. The HTTP response headers that this site analayses provide huge levels of protection and it's important that sites deploy them. Hopefully, by providing an easy mechanism to assess them, and further information on how to deploy missing headers, we can drive up the usage of security based headers across the web.

Site: https://securityheaders.io

report-uri.io
When a site deploys a Content Security Policy or HTTP Public Key Pinning, the browser will enforce the security policies declared by the site. This is great as it offers visitors more protection but the only problem is, the host doesn't know that there's a problem. The browser will block malicious content, such as an XSS attack, but the host wouldn't know anything about it and as such, can't resolve the problem. This is the problem that report-uri.io fixes. With your own unique reporting endpoint the browser can send a violation report to us and you can monitor exactly what is happening on your site. You can see what security policies are being triggered, where and why.

Site: https://report-uri.io

secureheaders
secure_headers is a library for ruby with a global config, per request overrides, and rack milddleware that enables you customize your application settings.

Github: https://github.com/twitter/secureheaders

Security Header Injection Module (SHIM)
SHIM is a HTTP module that provides protection for many vulnerabilities by injecting security-specific HTTP headers into ASP.NET web applications.

Site: https://shim.codeplex.com

http_hardening
Puppet module to enable, configure and manage secure http headers in web servers.

Github: http_hardening

Forge: http_hardening at forge | puppetlabs

=FAQs=


 * What is HTTP header?
 * HTTP header fields are components of the header section of request and response messages in the Hypertext Transfer Protocol (HTTP). They define the operating parameters of an HTTP transaction.


 * Is there a standard for HTTP headers?
 * A core set of fields is standardized by the Internet Engineering Task Force (IETF) in RFCs 7230, 7231, 7232, 7233, 7234, and 7235. The permanent registry of header fields and repository of provisional registrations are maintained by the IANA. Additional field names and permissible values may be defined by each application. Non-standard header fields were conventionally marked by prefixing the field name with X- but this convention was deprecated in June 2012 because of the inconveniences it caused when non-standard fields became standard. An earlier restriction on use of Downgraded- was lifted in March 2013.

= Acknowledgements =

Contributors
OWASP Secure Headers Project is developed by a worldwide team of volunteers. The primary contributors to date have been:


 * Ricardo Iramar
 * Jim Manico
 * Alexandre Menezes

= Road Map and Getting Involved =

2016 Priorities

To Do
OWASP Secure Headers Project intends to raise awareness and usage of headers sent by the server that can increase security. We'll aim to bring this about by:


 * Producing open source, easily implemented, well documented code libraries that enable these headers for a variety of platforms. We'll prioritize creating and publicizing Node.JS, PHP, Ruby, and Java, but will eventually reach out towards edge cases like Go, Python and others. The key is to make this accessible as possible to developers.


 * Improve constantly hsecscan tool to detect bad practices and provide link to the best practices above.


 * Perform public to scan websites using hsecscan and view stats regarding these headers. Automated scanning of the top 1m sites on the web; filtering of said sites to view stats across industries and countries; published database dumps for public consumption/tools; scanning of individual sites; comparing multiple scanned sites.


 * Consistent reports regarding this secure headers, their usage, any changes to existing headers.

Involvement in the development and promotion of OWASP Secure Headers Project is actively encouraged! You do not have to be a security expert in order to contribute. If you want to help send an email to [mailto:ricardo.iramar@owasp.org ricardo.iramar@owasp.org].

Doing

 * Including how to set properly secure headers on IIS.

Done

 * Creating secure best practices implementations including how to set properly secure headers on the most common platforms (eg. Apache, NGINX and Lighttpd).