Difference between revisions of "Transport Layer Protection Cheat Sheet"
|Line 30:||Line 30:|
[[Image:Asvs_cryptomodule.gif|thumb|350px|right|Cryptomodule Parts and Operation]]
[[Image:Asvs_cryptomodule.gif|thumb|350px|right|Cryptomodule Parts and Operation]]
== FIPS 140-2 Validated Cryptomodule ==
Revision as of 16:39, 14 October 2009
- 1 Introduction
- 2 Providing Transport Layer Protection with SSL/TLS
- 2.1 Benefits
- 2.2 Basic Requirements
- 2.3 SSL vs. TLS
- 2.4 When to Use a FIPS 140-2 Validated Cryptomodule
- 2.5 Secure Server Design
- 2.5.1 Rule - Use TLS for All Login Pages and All Authenticated Pages
- 2.5.2 Rule - Use TLS on Any Networks (External and Internal) Transmitting Sensitive Data
- 2.5.3 Rule - Do Not Provide Non-TLS Pages for Secure Content
- 2.5.4 Rule - Do Not Perform Redirects from Non-TLS Page to TLS Login Page
- 2.5.5 Rule - Do Not Mix TLS and Non-TLS Content
- 2.5.6 Rule - Use "Secure" Cookie Flag
- 2.6 Server Certificate & Protocol Configuration
- 2.6.1 Rule - Use an Appropriate Certificate Authority for the Application's User Base
- 2.6.2 Rule - Only Support Strong Cryptographic Ciphers
- 2.6.3 Rule - Only Support Strong Protocols
- 2.6.4 Rule - Establish a Strong Private Key for the Server
- 2.6.5 Rule - Use a Certificate That Supports All Available Domain Names
- 2.7 Client (Browser) Configuration
- 2.7.1 Rule - Verify the Certificate was Issued by a Trusted Certificate Authority
- 2.7.2 Rule - Verify the Certificate is Within the Validity Period
- 2.7.3 Rule - Verify the Certificate Common Name Matches the Domain Name
- 2.7.4 Rule - Perform Certificate Revocation List (CRL) Checking
- 2.7.5 Rule - Ensure the Trusted Root Store Contains Only Trusted Entries
- 2.7.6 Rule - Deny Connections if Any TLS Related Errors are Encountered
- 2.8 Additional Controls
- 3 Providing Transport Layer Protection for Back End and Other Connections
- 4 Related Articles
- 5 Authors and Primary Editors
This article provides a simple model to follow when implementing transport layer protection for an application. Although the concept of SSL is known to many, the actual details and security specific decisions of implementation are often poorly understood and frequently result in insecure deployments. This article establishes clear rules which provide guidance on securely designing and configuring transport layer security for an application. This article is focused on the use of SSL/TLS between a web application and a web browser, but that we also encourage the use of SSL/TLS or other network encryption technologies, such as VPN, on back end and other non-browser based connections.
An architectural decision must be made to determine the appropriate method to protect data when it is being transmitted. The most common options available to corporations are Virtual Private Networks (VPN) or a SSL/TLS model commonly used by web applications. The selected model is determined by the business needs of the particular organization. For example, a VPN connection may be the best design for a partnership between two companies that includes mutual access to a shared server over a variety of protocols. Conversely, an Internet facing enterprise web application would likely be best served by a SSL/TLS model.
For each security model, there are several security considerations which must be properly addressed in order to provide effective transport layer security. This security cheat sheet will focus on security considerations when the SSL/TLS model is selected. This is a frequently used model for publicly accessible web applications and many thick client applications.
Providing Transport Layer Protection with SSL/TLS
The primary benefit of transport layer security is the protection of web application data from unauthorized disclosure and modification when it is transmitted between clients (web browsers) and the web application server, and between the web application server and back end and other non-browser based enterprise components.
The server validation component of TLS provides authentication of the server to the client. If configured to require client side certificates, TLS can also play a role in client authentication to the server. However, in practice client side certificates are not often used in lieu of username and password based authentication models for clients.
TLS also provides two additional benefits that are commonly overlooked; integrity guarantees and replay prevention. A TLS stream of communication contains built-in controls to prevent tampering with any portion of the encrypted data. In addition, controls are also built-in to prevent a captured stream of TLS data from being replayed at a later time.
It should be noted that TLS provides the above guarantees to data during transmission. TLS does not offer any of these security benefits to data that is at rest. Therefore appropriate security controls must be added to protect data while at rest within the application or data stores.
The basic requirements for using TLS are: access to a Public Key Infrastructure (PKI) in order to obtain certificates, access to a directory or an Online Certificate Status Protocol (OCSP) responder in order to check certificate revocation status, and agreement/ability to support a minimum configuration of protocol versions and protocol options for each version.
SSL vs. TLS
The terms, Secure Socket Layer (SSL) and Transport Layer Security (TLS) are often used interchangeably. SSL v3.1 is equivalent to TLS v1.0. Different versions of SSL and TLS are supported by modern web browsers and by most modern web frameworks and platforms. For the purposes of this cheat sheet we will refer to the technology generically as TLS. In no situations should SSL version 3.0 or earlier be used.
When to Use a FIPS 140-2 Validated Cryptomodule
If the web application may be the target of determined attackers (for example, if it is accessible on the Internet), it is strongly advised to use TLS services that are provided by FIPS 140-2 validated cryptomodules that are operating in either an approved or an allowed mode of operation. Simply put, using a FIPS 140-2 validated cryptomodule provides a greater chance that the cryptomodule is providing the services that you are expecting from it.
A cryptomodule, whether it is a software library or a hardware device, basically consists of three parts:
- Components that implement cryptographic algorithms (symmetric and asymmetric algorithms, hash algorithms, random number generator algorithms, and message authentication code algorithms)
- Components that call and manage cryptographic functions (inputs and outputs include cryptographic keys and so-called critical security parameters)
- A physical container around the components that implement cryptographic algorithms and the components that call and manage cryptographic functions
The security of a cryptomodule and its services (and the web applications that call the cryptomodule) depend on the correct implementation and integration of each of these three parts.
While most developers understand that implementing cryptographic algorithms correctly is a hard thing to do, many do not realize that calling and managing cryptographic functions and their inputs and outputs, and ensuring the secure construction of the physical container around the components, are equally important in determining the security of a cryptomodule and its services. These are the things that FIPS 140-2 compliance helps with.
In order to leverage the benefits of TLS it is important to use a TLS service (e.g. library, web framework, web application server) which has been FIPS 140-2 validated. Furthermore, the TLS service must be used according to its FIPS 140-2 security policy. This means installing, configuring, and operating the TLS service in either an approved or an allowed mode.
Secure Server Design
Rule - Use TLS for All Login Pages and All Authenticated Pages
The login page and all subsequent authenticated pages must be exclusively accessed over TLS. The initial login page, referred to as the "login landing page", must be served over TLS. Failure to utilize TLS for the login landing page allows an attacker to modify the login form action, causing the user's credentials to be posted to an arbitrary location. Failure to utilize TLS for authenticated pages after the login enables an attacker to view the unencrypted session ID and compromise the user's authenticated session.
Rule - Use TLS on Any Networks (External and Internal) Transmitting Sensitive Data
All networks, both external and internal, which transmit sensitive data must utilize TLS or an equivalent transport layer security mechanism. It is not sufficient to claim that access to the internal network is "restricted to employees". Numerous recent data compromises have shown that the internal network can be breached by attackers. In these attacks, sniffers have been installed to access unencrypted sensitive data sent on the internal network.
Rule - Do Not Provide Non-TLS Pages for Secure Content
All pages which are available over TLS must not be available over a non-TLS connection. An attacker executing a man in the middle attack may modify a user's request such that the requested URL is no longer HTTPS but instead HTTP. The attacker could then view all of the user's data as they communicate with the site over unencrypted HTTP.
Rule - Do Not Perform Redirects from Non-TLS Page to TLS Login Page
A common practice is to redirect users that have requested a non-TLS version of the login page to the TLS version (e.g. http://site.com/login redirects to https://site.com/login). Unfortunately, this practice creates an additional attack vector. A man-in-the-middle attack enables the attacker to intercept the redirect response and modify or replace the redirection with a site of the attacker's choosing. This allows the attacker to easily perform phishing attacks or inject scripts or malicious content into the page returned to the user.
Ultimately, this issue is the responsibility of the user since the website cannot prevent the user from initially typing http://site.com/login (versus https). However, a responsible website should display a security warning message to the user whenever the non-TLS login page is requested. This security warning should urge the user to always type "HTTPS" into the browser or bookmark the secure login page.
Rule - Do Not Mix TLS and Non-TLS Content
A page that is available over TLS must not contain any content that is provided over unencrypted HTTP, including content from unrelated third party sites. Even if the primary page is available over TLS, an attacker could intercept the non-TLS portion and inject malicious content into the user's page, or steal the user's session cookie that is transmitted with any non-TLS requests (if the cookie's 'secure' flag is not set. See the next rule.).
Rule - Use "Secure" Cookie Flag
The "Secure" flag must be set for all user cookies. Failure to use the "secure" flag enables an attacker to access the session cookie by tricking the user's browser into submitting a request to an unencrypted page on the site. This attack is possible even if the server is not configured to offer HTTP content since the attacker is monitoring the requests and does not care if the server responds with a 404 or doesn't respond at all.
Server Certificate & Protocol Configuration
Rule - Use an Appropriate Certificate Authority for the Application's User Base
An application user must never be presented with a warning that the certificate was signed by an unknown or untrusted authority. The application's user population must have access to the public certificate of the certificate authority which issued the server's certificate. For Internet accessible websites, the most effective method of achieving this goal is to purchase the TLS certificate from a recognize certificate authority. Popular Internet browsers already contain the public certificates of these recognized certificate authorities.
Internal applications with a limited user population can use an internal certificate authority provided its public certificate is securely distributed to all users. However, remember that all certificates issued by this certificate authority will be trusted by the users. Therefore, utilize controls to protect the private key and ensure that only authorized individuals have the ability to sign certificates.
The use of self signed certificates is never acceptable. Self signed certificates negate the benefit of end-point authentication and also significantly decrease the ability for an individual to detect a man-in-the-middle attack.
Rule - Only Support Strong Cryptographic Ciphers
The strength of the encryption used within a TLS session is determined by the encryption cipher negotiated between the server and the browser. In order to ensure that only strong cryptographic ciphers are selected the server must be modified to disable the use of weak ciphers. It is recommended to configure the server to only support strong ciphers. Special Paper 800-52 provides examples of strong ciphers and are listed in the table below.
|Cipher Suite||Authentication||Key Establishment||Encryption||Digest|
Additional cipher information can be obtained within the US Security Requirements for Cryptographic Modules (FIPS 140-2).
Rule - Only Support Strong Protocols
Weaknesses have been identified with older SSL protocols. The recommended protocols are TLS1.0, TLS 1.1 and TLS 1.2. In no situation should SSL 2.0 be enabled on the server. It is also recommended to disable SSL 3.0 if possible. SSL 3.0 would only be necessary when the intended audience of the web application uses a client browser that does not support TLS.
The following browsers support at least TLS 1.0. The earilest version supporting TLS is listed below.
- Internet Explorer in IE7 (also supported in IE6, but disabled by default)
- Firefox 2.0
- Chrome 1.0
- Apple Safari (version unknown)
- Opera 5
Rule - Establish a Strong Private Key for the Server
The private key used to generate the cipher key should be at least 1024 bits long. In addition, the private key should be unique for each certificate requested. The private key should be stored in a secure location to prevent disclosure to unauthorized individuals.
Rule - Use a Certificate That Supports All Available Domain Names
A user should never be presented with a domain mismatch certificate error. If the application is available at both www.site.com and site.com then an appropriate certificate must be selected to accommodate both situations. The presence of domain mismatch errors desensitizes users to TLS error messages and increases the possibility an attacker could launch a convincing man-in-the-middle attack.
Client (Browser) Configuration
The following rules for client configuration encompass items controlled by the browser and those decided by the user. Applications that utilize thick clients must incorporate all of these rules to ensure only secure connections are established.
The following certificate checking rules will be automatically performed by the web browser each time a TLS connection is initiated with a web site. If a particular check fails an error message will likely be displayed to the user. The particular browser and individual browser settings can impact how the error messages and warnings to the user are handled.
- The certificate was issued by a trusted certificate authority.
- The certificate is within the validity period (e.g. not expired and not before the beginning date).
- The name listed in the certificate matches the domain name.
- The certificate has not been revoked.
Rule - Verify the Certificate was Issued by a Trusted Certificate Authority
Confirm that the web server certificate is signed by a trusted certificate authority. A trusted certificate authority is any certificate authority who's public key is present within the trusted root certificates on the local machine. Many trusted root certificates are installed when the browser is initially installed to the operating system.
Rule - Verify the Certificate is Within the Validity Period
Confirm that the web server certificate is not expired and is not being used before the certificate's validity period has begun. This check often uses the machines local clock and is ineffective in situations where the clock is not accurate.
Rule - Verify the Certificate Common Name Matches the Domain Name
Confirm that the common name listed within the certificate matches the domain name of the requested site. This check must consider wild card certificates such as *.site.com.
Rule - Perform Certificate Revocation List (CRL) Checking
Browsers or thick client applications must be configured to regularly check certificate revocation lists (CRL) for all certificate authorities in the trusted root store. It is highly recommended to check the CRL over an encrypted channel such as TLS. In addition, consider denying all certificates from a particular certificate authority if revocation information cannot be obtained after a reasonable number of attempts.
Rule - Ensure the Trusted Root Store Contains Only Trusted Entries
The trusted root store must be reviewed and the public certificates of untrusted certificate authorities must be removed. If the public certificate of an untrusted certificate authority is present in the trusted root store then any certificates issued by this authority would be trusted by the browser. In this situation, an attacker could create a legitimate TLS certificate for a site that they do not own. The attacker could then execute a man-in-the-middle attack and the browser would not issue any alerts since the issuing certificate authority is within the trusted root store.
Rule - Deny Connections if Any TLS Related Errors are Encountered
If any TLS related errors are encountered, then a user should stop and cancel connections to the target site. Similarly, a thick client application should drop the TLS connection if any errors are encountered. The complexity and creativity of TLS related man-in-the-middle attacks makes it extremely difficult to determine if a TLS related error message is safe to ignore.
Extended Validation Certificates
Extended validation certificates (EV Certificates) require more intensive investigation into the requesting party. The purpose of EV certificates is to provide the user with greater assurance that the owner of the certificate is a verified legal entity for the site. Browsers with support for EV certificates distinguish an EV certificate from a regular certificate by coloring a portion of the URL in green. High value websites should consider the use of EV certificates to enhance customer confidence in the certificate. It should also be noted that EV certificates do not provide any greater technical security for the TLS. The purpose of the EV certificate is to increase user confidence that the target site is indeed who it claims to be.
Client Side Certificates
Client side certificates can be used with TLS to prove the identity of the client to the server. Referred to as "two-way TLS", this configuration requires the client to provide their certificate to the server, in addition to the server providing their's to the client. If client certificates are used, ensure that the same validation of the client certificate is performed by the server, as indicated for the validation of server certificates above. In addition, the server should be configured to drop the TLS connection if the client certificate cannot be verified or is not provided.
The use of client side certificates is relatively rare currently due to the complexities of certificate generation, safe distribution, client side configuration, certificate revocation and reissuance, and the fact that clients can only authenticate on machines where their client side certificate is installed. Such certificates are typically used for very high value connections that have small user populations.
Providing Transport Layer Protection for Back End and Other Connections
Although not the focus of this cheat sheet, it should be stressed that transport layer protection is necessary for back connections and any other connection where sensitive data is exchanged or where user identity is established. Failure to implement an effective and robust transport layer security will expose sensitive data and undermine the effectiveness of any authentication or access control mechanism.
Secure Internal Network Fallacy
The internal network of a corporation is not immune to attacks. Many recent high profile compromises, where thousands of sensitive customer records were compromised, have been perpetrated by attackers that have gained internal network access and then utilized sniffers to capture unencrypted data as it traversed the internal network.
SSL Labs - SSL Server Rating Guide
Authors and Primary Editors
Michael Coates - email@example.com
Dave Wichers - firstname.lastname@example.org