<!-- This site is running CAOS for WordPress -->
{"id":171,"date":"2024-01-02T13:53:15","date_gmt":"2024-01-02T13:53:15","guid":{"rendered":"https:\/\/protocolguard.com\/resources\/?p=171"},"modified":"2024-11-20T13:46:22","modified_gmt":"2024-11-20T13:46:22","slug":"what-is-expect-ct","status":"publish","type":"post","link":"https:\/\/protocolguard.com\/resources\/what-is-expect-ct\/","title":{"rendered":"What is Expect-CT HTTP header?"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div>\n<p>Bad guys are always looking for ways to exploit websites and steal some personal data, and even more, but luckily out there exists a pretty handy tool known as Expect-CT. This is an HTTP header used to boost the security of the website you&#8217;re browsing, helping you to have a safer online experience. The name &#8220;Expect-CT&#8221; comes from &#8220;Expect Certificate Transparency&#8221;.<\/p>\n\n\n\n<p>So, what does Expect-CT do exactly? When your browser connects to a site, this security header ensures that the certificates, which are like the website&#8217;s digital identification tags, are not counterfeit. Basically, Expect-C will double-check every virtual handshake between your browser and the site you&#8217;re browsing, confirming that you&#8217;re interacting with the real one.<\/p>\n\n\n\n<p>In this article we will take a deep look into the Expect-CT header and we will make clear how it actively contributes to creating a more secure online experience for users.<\/p>\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\">What is the Expect-CT HTTP header?<\/h2>\n\n\n\n<p>Expect-CT is a web security protocol designed to enhance the integrity of digital certificates used by websites. This is extremely important in Internet security, because certificates act as identification cards for websites, which helps your browser to trust them.<\/p>\n\n\n\n<p>The main function of Expect-CT is to enforce transparency in the deployment of these certificates. When your browser connects to a website, the header dictates that the presented certificates are not only valid but also have been publicly logged in recognized certificate transparency logs. These logs serve as a public record, verifying that the certificates have gone through the proper validation processes.<\/p>\n\n\n\n<p>Thanks to this level of transparency, Expect-CT helps to mitigate the risk of potential security threats, becoming a great security measure against malicious third parties that attempt to use counterfeit certificates to impersonate legitimate websites.<\/p>\n\n\n\n<p>Regarding it, <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Headers\/Expect-CT\" target=\"_blank\" rel=\"noopener\">Mozilla<\/a> says that &#8220;The Expect-CT header lets sites opt in to reporting and\/or enforcement of Certificate Transparency requirements.&#8221;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The function of Expect-CT<\/h3>\n\n\n\n<p>Expect-CT works by requiring websites to declare their certificate transparency expectations through an HTTP header. This helps ensure that certificates are properly logged in public CT logs, minimizing the risk of unauthorized or malicious certificate issuance.<\/p>\n\n\n\n<p>Expect-CT has a few specific standards, let&#8217;s take a look at them.<\/p>\n\n\n\n<p><strong>Enforcement through HTTP header:<\/strong><\/p>\n\n\n\n<p>As we have already explained, Expect-CT is implemented through an HTTP header that web servers send in their responses. This header includes information about the expected transparency behavior regarding certificates for the given domain.<\/p>\n\n\n\n<p><strong>Directive and reporting:<\/strong><\/p>\n\n\n\n<p>The header contains a directive specifying the Certificate Transparency (CT) policy that is expected. This policy tells if the website requires that all issued certificates are logged in public CT logs.<\/p>\n\n\n\n<p>Websites can also include a &#8220;report-uri&#8221; parameter in the header, where it&#8217;s possible to specify a URI if the browser requires to send reports, in case it encounters certificate-related issues. This is very helpful for the monitoring and analysis of potential fake certificate incidents.<\/p>\n\n\n\n<p><strong>Preloading:<\/strong><\/p>\n\n\n\n<p>Websites can choose to enhance their security by being &#8220;preloaded&#8221; into web browsers. This means they are included in a list of websites that require CT enforcement by default, regardless of the presence of the Expect-CT header. This is known as the HTTP Strict Transport Security (<a href=\"https:\/\/protocolguard.com\/resources\/what-is-hsts\/\">HSTS<\/a>) preload list.<\/p>\n\n\n\n<p><strong>Certificate Transparency logs:<\/strong><\/p>\n\n\n\n<p>Certificate Transparency logs are public logs that record certificate information. When a certificate is issued, it is expected to be added to these logs by the CA. Browsers, when encountering this header, verify that the presented certificate is indeed logged in the CT logs.<\/p>\n\n\n\n<p><strong>Handling violations:<\/strong><\/p>\n\n\n\n<p>If a browser encounters a certificate that violates the CT policy, it can take corrective actions. This may include preventing the connection or issuing a report to a specified URI.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Expect-CT deprecation<\/h3>\n\n\n\n<p>Is it deprecated? Well, it is, but at the same time, it isn&#8217;t. The main concern with Expect-CT is its initial design for Chromium-based browsers. While these browsers still provide support, a significant shift occurred with Chromium version 107: Certificate Transparency (CT) is now automatically enforced, which renders the mentioned header useless. Due to this, many consider it deprecated.<\/p>\n\n\n\n<p>If you choose to implement it on your website, you can do so. As previously mentioned, some major browsers continue to support it. It&#8217;s important to note that deploying it alongside browsers that enforce CT by default will simply result in redundancy.<\/p>\n\n\n\n<p><a href=\"https:\/\/webtechsurvey.com\/response-header\/expect-ct\" target=\"_blank\" rel=\"noopener\">Webtechsurvey reports that 0,22%<\/a> of websites still use it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Expect-CT browser support<\/h3>\n\n\n\n<p>As we have already mentioned, Expect-CT is a header that only works under Chromium-based browsers, so major browsers like Safari and Firefox do not support it. Others like Chrome, Edge and Opera <a href=\"https:\/\/caniuse.com\/mdn-http_headers_expect-ct\" target=\"_blank\" rel=\"noopener\">still support it<\/a>, though.<\/p>\n\n\n\n<p>Google Chrome added support for it starting with version 64 in early September 2017, and was the first major browser to include it. A couple of weeks later Opera started to support it too. Finally, Microsoft Edge included support for the header in 2020, a lot later than the other two. The rest of major browsers like Apple Safari and Mozilla Firefox are not compatible with this feature.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Expect-CT directives<\/h2>\n\n\n\n<p>The Expect-CT header includes a few directives that provide instructions on how the browser should handle certificate-related issues. Here are the key directives:<\/p>\n\n\n\n<p><strong>&#8220;enforce&#8221; directive:<\/strong><\/p>\n\n\n\n<p>The enforce directive makes the browser enforce the Certificate Transparency policy for the specified host. This means that the browser will only connect to the website if the presented SSL\/TLS certificate has been properly logged in public Certificate Transparency logs.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">enforce<\/pre>\n\n\n\n<p><strong>&#8220;max-age&#8221; directive:<\/strong><\/p>\n\n\n\n<p>The max-age directive defines the time (in seconds) for which the browser should remember the Certificate Transparency policy. During this period, the browser will continue to enforce the policy without checking the header again.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">max-age=31536000<\/pre>\n\n\n\n<p><strong>&#8220;report-uri&#8221; directive:<\/strong><\/p>\n\n\n\n<p>The report-uri directive lets us specify a URI where the browser should send reports if it encounters certificate-related issues, such as a certificate that violates the Certificate Transparency policy.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">report-uri=\"https:\/\/domain.com\/report\"<\/pre>\n\n\n\n<p><strong>&#8220;report-to&#8221; directive:<\/strong><\/p>\n\n\n\n<p>Similar to report-uri, the report-to directive (based on Reporting API) defines a reporting group that specifies where the browser should send the reports.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">report-to=\"group-name\"<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Expect-CT examples<\/h2>\n\n\n\n<p>Now let&#8217;s see a few examples of how this header can be configured with different directives:<\/p>\n\n\n\n<p><strong>Enforcing CT with a specific max-age:<\/strong> this example enforces Certificate Transparency and sets a max-age of 30 days (in seconds). Browsers will enforce the CT policy for this domain for the specified duration.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Expect-CT: enforce, max-age=2592000<\/pre>\n\n\n\n<p><strong>Enforcing CT with reporting:<\/strong> this one enforces Certificate Transparency and includes a report-uri where browsers should send reports if they encounter certificate-related issues.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Expect-CT: enforce, report-uri=\"https:\/\/example.com\/report\"<\/pre>\n\n\n\n<p><strong>Enforcing CT with the reporting API:<\/strong> in this example, Certificate Transparency is enforced and it uses the report-to directive, specifying a reporting group for more advanced reporting using the Reporting API.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Expect-CT: enforce, report-to=\"group name\"<\/pre>\n\n\n\n<p><strong>Non-enforcing directive:<\/strong> this example doesn&#8217;t enforce Certificate Transparency but includes a report-uri for monitoring purposes. Browsers will not reject connections based on CT compliance.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Expect-CT: report-uri=\"https:\/\/domain.com\/report\"<\/pre>\n\n\n\n<p><strong>Enforcing CT with a short max-age for testing:<\/strong> during testing, a short max-age can be useful. This example enforces CT and sets a max-age of 10 minutes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Expect-CT: enforce, max-age=600<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">How to configure Expect-CT<\/h2>\n\n\n\n<p>Enabling this feature in your server is pretty easy. Let&#8217;s see how to do this in popular web servers like Apache and Nginx.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Enabling Expect-CT in Apache<\/h3>\n\n\n\n<p>Open your Apache configuration file (for example httpd.conf or your site&#8217;s virtual host file), you can use a text editor like nano or vim.<\/p>\n\n\n\n<p>Add the following line to your VirtualHost block to enable it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Header always set Expect-CT \"enforce, max-age=31536000, report-uri=https:\/\/example.com\/report\"<\/pre>\n\n\n\n<p>Remember to customize the parameters based on your specific requirements, the parameters above are just an example.<\/p>\n\n\n\n<p>Save the configuration file and restart Apache to apply the changes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl restart apache2<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Setting up Expect-CT in Nginx<\/h3>\n\n\n\n<p>Open your Nginx configuration file (for example nginx.conf or your domain&#8217;s .conf file).<br>Add the following line in your server block to enable it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">add_header Expect-CT \"enforce, max-age=31536000, report-uri=https:\/\/example.com\/report\";<\/pre>\n\n\n\n<p>Don&#8217;t forget to customize the parameters based on your specific requirements, the parameters we have used are just an example.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"69\" src=\"https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/expect-ct.jpg\" alt=\"Expect-CT set in Nginx\" class=\"wp-image-174\" title=\"Expect-CT set in Nginx\" srcset=\"https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/expect-ct.jpg 450w, https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/expect-ct-300x46.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Save the configuration file, test your Nginx config and restart it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nginx -t\nsystemctl restart nginx<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">How to configure Expect-CT on IIS<\/h3>\n\n\n\n<p>Let&#8217;s see how to add the Expect-CT header on the IIS webserver.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the IIS Manager and select the website where you want to enable the Expect-CT header.<\/li>\n\n\n\n<li>Now access HTTP Response Headers and add a new header with the following:\n<ul class=\"wp-block-list\">\n<li>Name: Expect-CT<\/li>\n\n\n\n<li>Value: enforce, max-age=31536000, report-uri=https:\/\/example.com\/report<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Remember to customize the parameters based on your requirements.<\/li>\n\n\n\n<li>Now save the changes and restart the IIS site.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Testing Expect-CT<\/h2>\n\n\n\n<p>It\u2019s very easy to test your site, just follow the steps below:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Access our <a href=\"https:\/\/protocolguard.com\/\">web security scanner<\/a>.<\/li>\n\n\n\n<li>Input your domain in the scan box.<\/li>\n\n\n\n<li>Tick the two boxes below (\u2018Clear cache\u2019 and \u2018Follow redirects\u2019).<\/li>\n\n\n\n<li>Click the Scan button.<\/li>\n\n\n\n<li>Now scroll down to the \u2018HTTP Security Headers\u2019 section and check the \u2018Expect-CT\u2019 results: a \u2018Passed\u2019 in green is good. However, if you get a \u2018Failed\u2019 in red, you must update your current settings.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1252\" height=\"357\" src=\"https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/Expect-CT-test-results.webp\" alt=\"Expect-CT test results\" class=\"wp-image-487\" title=\"Expect-CT test results\" srcset=\"https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/Expect-CT-test-results.webp 1252w, https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/Expect-CT-test-results-300x86.webp 300w, https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/Expect-CT-test-results-1024x292.webp 1024w, https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/Expect-CT-test-results-768x219.webp 768w\" sizes=\"auto, (max-width: 1252px) 100vw, 1252px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Expect-CT FAQ<\/h2>\n\n\n\n<p>Before closing our article, let&#8217;s answer some common questions related to this header.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What are the benefits of using Expect-CT?<\/h3>\n\n\n\n<p>It helps prevent various certificate-related attacks, such as certificate misissuance and man-in-the-middle attacks. Also, by enforcing CT, website owners can ensure that only certificates issued through transparent and trustworthy processes are accepted by browsers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What should I consider when setting up Expect-CT?<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Choose an appropriate CT policy that balances security and compatibility with your website&#8217;s requirements.<\/li>\n\n\n\n<li>Configure the reporting to receive violation reports generated by browsers when they encounter certificates that violate the Expect-CT policy. These reports can provide valuable information about potential security issues.<\/li>\n\n\n\n<li>Also, test the Expect-CT setup to ensure compatibility with all browsers and devices used by your website visitors.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>Expect-CT is an HTTP header used to boost online security. Its full name, Expect Certificate Transparency, hints at its job: making your online experience safer. When your browser connects to a site, this security tool checks if the site&#8217;s certificate is genuine.<\/p>\n\n\n\n<p>It works by making sure that certificates presented by websites are not only valid but also publicly logged in special certificate logs. This transparency helps prevent potential security threats, stopping bad guys from using fake certificates to pose as real websites.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bad guys are always looking for ways to exploit websites and steal some personal data, and even more, but luckily out there exists a pretty handy tool known as Expect-CT. This is an HTTP header used to boost the security of the website you&#8217;re browsing, helping you to have a safer online experience. The name [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":434,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-171","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-http-security"],"uagb_featured_image_src":{"full":["https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/What-is-Expect-CT-HTTP-header.webp",1200,628,false],"thumbnail":["https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/What-is-Expect-CT-HTTP-header-150x150.webp",150,150,true],"medium":["https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/What-is-Expect-CT-HTTP-header-300x157.webp",300,157,true],"medium_large":["https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/What-is-Expect-CT-HTTP-header-768x402.webp",768,402,true],"large":["https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/What-is-Expect-CT-HTTP-header-1024x536.webp",1024,536,true],"1536x1536":["https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/What-is-Expect-CT-HTTP-header.webp",1200,628,false],"2048x2048":["https:\/\/protocolguard.com\/resources\/wp-content\/uploads\/2024\/01\/What-is-Expect-CT-HTTP-header.webp",1200,628,false]},"uagb_author_info":{"display_name":"ProtocolGuard Research Team","author_link":"https:\/\/protocolguard.com\/resources\/author\/researchadmin\/"},"uagb_comment_info":0,"uagb_excerpt":"Bad guys are always looking for ways to exploit websites and steal some personal data, and even more, but luckily out there exists a pretty handy tool known as Expect-CT. This is an HTTP header used to boost the security of the website you&#8217;re browsing, helping you to have a safer online experience. The name&hellip;","_links":{"self":[{"href":"https:\/\/protocolguard.com\/resources\/wp-json\/wp\/v2\/posts\/171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/protocolguard.com\/resources\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/protocolguard.com\/resources\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/protocolguard.com\/resources\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/protocolguard.com\/resources\/wp-json\/wp\/v2\/comments?post=171"}],"version-history":[{"count":1,"href":"https:\/\/protocolguard.com\/resources\/wp-json\/wp\/v2\/posts\/171\/revisions"}],"predecessor-version":[{"id":687,"href":"https:\/\/protocolguard.com\/resources\/wp-json\/wp\/v2\/posts\/171\/revisions\/687"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/protocolguard.com\/resources\/wp-json\/wp\/v2\/media\/434"}],"wp:attachment":[{"href":"https:\/\/protocolguard.com\/resources\/wp-json\/wp\/v2\/media?parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/protocolguard.com\/resources\/wp-json\/wp\/v2\/categories?post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/protocolguard.com\/resources\/wp-json\/wp\/v2\/tags?post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}