
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Fri, 10 Apr 2026 15:36:57 GMT</lastBuildDate>
        <item>
            <title><![CDATA[How We Design Features for Wrangler, the Cloudflare Workers CLI]]></title>
            <link>https://blog.cloudflare.com/how-we-design-features-for-wrangler/</link>
            <pubDate>Tue, 17 Sep 2019 15:55:00 GMT</pubDate>
            <description><![CDATA[ The most recent update to Wrangler, version 1.3.1, introduces important new features for developers building Cloudflare Workers — from built-in deployment environments to first class support for Workers KV. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>The most recent update to Wrangler, <a href="https://github.com/cloudflare/wrangler/releases/tag/v1.3.1">version 1.3.1</a>, introduces important new features for developers building <a href="https://workers.cloudflare.com">Cloudflare Workers</a> — from built-in deployment environments to first class support for <a href="https://developers.cloudflare.com/workers/reference/storage/overview/">Workers KV</a>. Wrangler is Cloudflare’s first officially supported CLI. Branching into this field of software has been a novel experience for us engineers and product folks on the Cloudflare Workers team.</p><p>As part of the 1.3.1 release, the folks on the Workers Developer Experience team dove into the thought process that goes into building out features for a CLI and thinking like users. Because while we wish building a CLI were as easy as our teammate Avery tweeted...</p><blockquote><p>If I were programming a CLI, I would simply design it in a way that is not controversial and works for every type of user.</p><p>— avery harnish (@SmoothAsSkippy) <a href="https://twitter.com/SmoothAsSkippy/status/1166842441711980546?ref_src=twsrc%5Etfw">August 28, 2019</a></p></blockquote><p>… it brings design challenges that many of us have never encountered. To overcome these challenges successfully requires deep empathy for users across the entire team, as well as the ability to address ambiguous questions related to how developers write Workers.</p>
    <div>
      <h2>Wrangler, meet Workers KV</h2>
      <a href="#wrangler-meet-workers-kv">
        
      </a>
    </div>
    <p>Our new KV functionality introduced a host of new features, from creating KV namespaces to bulk uploading key-value pairs for use within a Worker. This new functionality primarily consisted of logic for interacting with the Workers KV API, meaning that the technical work under “the hood” was relatively straightforward. Figuring out how to cleanly represent these new features to Wrangler users, however, became the fundamental question of this release.</p><p>Designing the invocations for new KV functionality unsurprisingly required multiple iterations, and taught us a lot about usability along the way!</p>
    <div>
      <h2>Attempt 1</h2>
      <a href="#attempt-1">
        
      </a>
    </div>
    <p>For our initial pass, the path originally seemed so obvious. (Narrator: It really, really wasn’t). We hypothesized that having Wrangler support familiar commands — like ls and rm — would be a reasonable mapping of familiar command line tools to Workers KV, and ended up with the following set of invocations below:</p>
            <pre><code># creates a new KV Namespace
$ wrangler kv add myNamespace									
	
# sets a string key that doesn't expire
$ wrangler kv set myKey=”someStringValue”

# sets many keys
$ wrangler kv set myKey=”someStringValue” myKey2=”someStringValue2” ...

# sets a volatile (expiring) key that expires in 60 s
$ wrangler kv set myVolatileKey=path/to/value --ttl 60s

# deletes three keys
$ wrangler kv rm myNamespace myKey1 myKey2 myKey3

# lists all your namespaces
$ wrangler kv ls

# lists all the keys for a namespace
$ wrangler kv ls myNamespace

# removes all keys from a namespace, then removes the namespace		
$ wrangler kv rm -r myNamespace</code></pre>
            <p>While these commands invoked familiar shell utilities, they made interacting with your KV namespace a lot more like interacting with a filesystem than a key value store. The juxtaposition of a well-known command like <code>ls</code> with a non-command, <code>set</code>, was confusing. Additionally, mapping preexisting command line tools to KV actions was not a good 1-1 mapping (especially for <code>rm -r</code>; there is no need to recursively delete a KV namespace like a directory if you can just delete the namespace!)</p><p>This draft also surfaced use cases we needed to support: namely, we needed support for actions like easy bulk uploads from a file. This draft required users to enter every KV pair in the command line instead of reading from a file of key-value pairs; this was also a non-starter.</p><p>Finally, these KV subcommands caused confusion about actions to different resources. For example, the command for listing your Workers KV namespaces looked a lot like the command for listing keys within a namespace.</p><p>Going forward, we needed to meet these newly identified needs.</p>
    <div>
      <h2>Attempt 2</h2>
      <a href="#attempt-2">
        
      </a>
    </div>
    <p>Our next attempt shed the shell utilities in favor of simple, declarative subcommands like <code>create</code>, <code>list</code>, and <code>delete</code>. It also addressed the need for easy-to-use bulk uploads by allowing users to pass a JSON file of keys and values to Wrangler.</p>
            <pre><code># create a namespace
$ wrangler kv create namespace &lt;title&gt;

# delete a namespace
$ wrangler kv delete namespace &lt;namespace-id&gt;

# list namespaces
$ wrangler kv list namespace

# write key-value pairs to a namespace, with an optional expiration flag
$ wrangler kv write key &lt;namespace-id&gt; &lt;key&gt; &lt;value&gt; --ttl 60s

# delete a key from a namespace
$ wrangler kv delete key &lt;namespace-id&gt; &lt;key&gt;

# list all keys in a namespace
$ wrangler kv list key &lt;namespace-id&gt;

# write bulk kv pairs. can be json file or directory; if dir keys will be file paths from root, value will be contents of files
$ wrangler kv write bulk ./path/to/assets

# delete bulk pairs; same input functionality as above
$ wrangler kv delete bulk ./path/to/assets</code></pre>
            <p>Given the breadth of new functionality we planned to introduce, we also built out a taxonomy of new subcommands to ensure that invocations for different resources — namespaces, keys, and bulk sets of key-value pairs — were consistent:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2UyT0JmQEJSq3ejZTtQkaO/e12c5b3fd7b93b48004067ef096a30cf/Attempt2Diagram.png" />
            
            </figure><p>Designing invocations with taxonomies became a crucial part of our development process going forward, and gave us a clear look at the “big picture” of our new KV features.</p><p>This approach was closer to what we wanted. It offered bulk put and bulk delete operations that would read multiple key-value pairs from a JSON file. After specifying an action subcommand (e.g. <code>delete</code>), users now explicitly stated which resource an action applied to (<code>namespace</code> , <code>key</code>, <code>bulk</code>) and reduced confusion about which action applied to which KV component.</p><p>This draft, however, was still not as explicit as we wanted it to be. The distinction between operations on <code>namespaces</code> versus <code>keys</code> was not as obvious as we wanted, and we still feared the possibility of different <code>delete</code> operations accidentally producing unwanted deletes (a possibly disastrous outcome!)</p>
    <div>
      <h2>Attempt 3</h2>
      <a href="#attempt-3">
        
      </a>
    </div>
    <p>We really wanted to help differentiate where in the hierarchy of structs a user was operating at any given time. Were they operating on <code>namespaces</code>, <code>keys</code>, or <code>bulk</code> sets of keys in a given operation, and how could we make that as clear as possible? We looked around, comparing the ways CLIs from kubectl to Heroku’s handled commands affecting different objects. We landed on a pleasing pattern inspired by Heroku’s CLI: colon-delimited command namespacing:</p>
            <pre><code>plugins:install PLUGIN    # installs a plugin into the CLI
plugins:link [PATH]       # links a local plugin to the CLI for development
plugins:uninstall PLUGIN  # uninstalls or unlinks a plugin
plugins:update            # updates installed plugins</code></pre>
            <p>So we adopted <code>kv:namespace</code>, <code>kv:key</code>, and <code>kv:bulk</code> to semantically separate our commands:</p>
            <pre><code># namespace commands operate on namespaces
$ wrangler kv:namespace create &lt;title&gt; [--env]
$ wrangler kv:namespace delete &lt;binding&gt; [--env]
$ wrangler kv:namespace rename &lt;binding&gt; &lt;new-title&gt; [--env]
$ wrangler kv:namespace list [--env]
# key commands operate on individual keys
$ wrangler kv:key write &lt;binding&gt; &lt;key&gt;=&lt;value&gt; [--env | --ttl | --exp]
$ wrangler kv:key delete &lt;binding&gt; &lt;key&gt; [--env]
$ wrangler kv:key list &lt;binding&gt; [--env]
# bulk commands take a user-generated JSON file as an argument
$ wrangler kv:bulk write &lt;binding&gt; ./path/to/data.json [--env]
$ wrangler kv:bulk delete &lt;binding&gt; ./path/to/data.json [--env]</code></pre>
            <p>And ultimately ended up with this topology:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1lL9YrgjMs0VX3vXm31lcP/fd71a9cee1e23752913113bed2960d5b/Attempt3Diagram.png" />
            
            </figure><p>We were even closer to our desired usage pattern; the object acted upon was explicit to users, and the action applied to the object was also clear.</p><p>There was one usage issue left. Supplying <code>namespace-id</code>s--a field that specifies which Workers KV namespace to perform an action to--required users to get their clunky KV <code>namespace-id</code> (a string like <code>06779da6940b431db6e566b4846d64db</code>) and provide it in the command-line under the <code>namespace-id</code> option. This <code>namespace-id</code> value is what our Workers KV API expects in requests, but would be cumbersome for users to dig up and provide, let alone frequently use.</p><p>The solution we came to takes advantage of the <code>wrangler.toml</code> present in every Wrangler-generated Worker. To publish a Worker that uses a Workers KV store, the following field is needed in the Worker’s <code>wrangler.toml</code>:</p>
            <pre><code>kv-namespaces = [
	{ binding = "TEST_NAMESPACE", id = "06779da6940b431db6e566b4846d64db" }
]</code></pre>
            <p>This field specifies a Workers KV namespace that is bound to the name <code>TEST_NAMESPACE</code>, such that a Worker script can access it with logic like:</p>
            <pre><code>TEST_NAMESPACE.get(“my_key”);</code></pre>
            <p>We also decided to take advantage of this <code>wrangler.toml</code> field to allow users to specify a KV binding name instead of a KV namespace id. Upon providing a KV binding name, Wrangler could look up the associated <code>id</code> in <code>wrangler.toml</code> and use that for Workers KV API calls.</p><p>Wrangler users performing actions on KV namespaces could simply provide <code>--binding TEST_NAMESPACE</code> for their KV calls let Wrangler retrieve its ID from <code>wrangler.toml</code>. Users can still specify <code>--namespace-id</code> directly if they do not have namespaces specified in their <code>wrangler.toml</code>.</p><p>Finally, we reached our happy point: Wrangler’s new KV subcommands were explicit, offered functionality for both individual and bulk actions with Workers KV, and felt ergonomic for Wrangler users to integrate into their day-to-day operations.</p>
    <div>
      <h2>Lessons Learned</h2>
      <a href="#lessons-learned">
        
      </a>
    </div>
    <p>Throughout this design process, we identified the following takeaways to carry into future Wrangler work:</p><ol><li><p><b>Taxonomies of your CLI’s subcommands and invocations are a great way to ensure consistency and clarity</b>. CLI users tend to anticipate similar semantics and workflows within a CLI, so visually documenting all paths for the CLI can greatly help with identifying where new work can be consistent with older semantics. Drawing out these taxonomies can also expose missing features that seem like a fundamental part of the “big picture” of a CLI’s functionality.</p></li><li><p><b>Use other CLIs for inspiration and validation</b>. Drawing logic from popular CLIs helped us confirm our assumptions about what users like, and learn established patterns for complex CLI invocations.</p></li><li><p><b>Avoid logic that requires passing in raw ID strings</b>. Testing CLIs a lot means that remembering and re-pasting ID values gets very tedious very quickly. Emphasizing a set of purely human-readable CLI commands and arguments makes for a far more intuitive experience. When possible, taking advantage of configuration files (like we did with <code>wrangler.toml</code>) offers a straightforward way to provide mappings of human-readable names to complex IDs.</p></li></ol><p>We’re excited to continue using these design principles we’ve learned and documented as we grow Wrangler into a one-stop <a href="https://workers.cloudflare.com">Cloudflare Workers</a> shop.</p><p>If you’d like to try out Wrangler, <a href="https://github.com/cloudflare/wrangler">check it out on GitHub</a> and let us know what you think! We would love your feedback.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5CFtKpaVci96ko4xuzfFSW/1ccc3afb9f1fa313c89ed82769bd0743/WranglerCrab-1.png" />
            
            </figure> ]]></content:encoded>
            <category><![CDATA[Wrangler]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Cloudflare Workers KV]]></category>
            <category><![CDATA[Serverless]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Developers]]></category>
            <category><![CDATA[Developer Platform]]></category>
            <guid isPermaLink="false">4ezmggl8GGox1Mv6DWV62H</guid>
            <dc:creator>Ashley M Lewis</dc:creator>
            <dc:creator>Gabbi Fisher</dc:creator>
        </item>
        <item>
            <title><![CDATA[Securing Certificate Issuance using Multipath Domain Control Validation]]></title>
            <link>https://blog.cloudflare.com/secure-certificate-issuance/</link>
            <pubDate>Tue, 18 Jun 2019 13:00:00 GMT</pubDate>
            <description><![CDATA[ Trust on the Internet is underpinned by the Public Key Infrastructure (PKI). PKI grants servers the ability to securely serve websites by issuing digital certificates, providing the foundation for encrypted and authentic communication.  ]]></description>
            <content:encoded><![CDATA[ <p></p><p>This blog post is part of <a href="/welcome-to-crypto-week-2019/">Crypto Week 2019</a>.</p><p>Trust on the Internet is underpinned by the Public Key Infrastructure (PKI). PKI grants servers the ability to securely serve websites by issuing digital certificates, providing the foundation for encrypted and authentic communication.</p><p>Certificates make HTTPS encryption possible by using the public key in the certificate to verify server identity. HTTPS is especially important for websites that transmit sensitive data, such as banking credentials or private messages. Thankfully, modern browsers, such as Google Chrome, flag websites not secured using HTTPS by marking them “Not secure,” allowing users to be more security conscious of the websites they visit.</p><p>This blog post introduces a new, free tool Cloudflare offers to CAs so they can further secure certificate issuance. But before we dive in too deep, let’s talk about where certificates come from.</p>
    <div>
      <h3>Certificate Authorities</h3>
      <a href="#certificate-authorities">
        
      </a>
    </div>
    <p>Certificate Authorities (CAs) are the institutions responsible for issuing certificates.</p><p>When issuing a certificate for any given domain, they use Domain Control Validation (DCV) to verify that the entity requesting a certificate for the domain is the legitimate owner of the domain. With DCV the domain owner:</p><ol><li><p>creates a DNS resource record for a domain;</p></li><li><p>uploads a document to the web server located at that domain; OR</p></li><li><p>proves ownership of the domain’s administrative email account.</p></li></ol><p>The DCV process prevents adversaries from obtaining private-key and certificate pairs for domains not owned by the requestor.  </p><p>Preventing adversaries from acquiring this pair is critical: if an incorrectly issued certificate and private-key pair wind up in an adversary’s hands, they could pose as the victim’s domain and serve sensitive HTTPS traffic. This violates our existing trust of the Internet, and compromises private data on a potentially massive scale.</p><p>For example, an adversary that tricks a CA into mis-issuing a certificate for gmail.com could then perform TLS handshakes while pretending to be Google, and exfiltrate cookies and login information to gain access to the victim’s Gmail account. The risks of certificate mis-issuance are clearly severe.</p>
    <div>
      <h3>Domain Control Validation</h3>
      <a href="#domain-control-validation">
        
      </a>
    </div>
    <p>To prevent attacks like this, CAs only issue a certificate after performing DCV. One way of validating domain ownership is through HTTP validation, done by uploading a text file to a specific HTTP endpoint on the webserver they want to secure.  Another DCV method is done using email verification, where an email with a validation code link is sent to the administrative contact for the domain.</p>
    <div>
      <h3>HTTP Validation</h3>
      <a href="#http-validation">
        
      </a>
    </div>
    <p>Suppose Alice <a href="https://www.cloudflare.com/learning/dns/how-to-buy-a-domain-name/">buys</a> the domain name aliceswonderland.com and wants to get a dedicated certificate for this domain. Alice chooses to use Let’s Encrypt as their certificate authority. First, Alice must generate their own private key and create a certificate signing request (CSR). She sends the CSR to Let’s Encrypt, but the CA won’t issue a certificate for that CSR and private key until they know Alice owns aliceswonderland.com. Alice can then choose to prove that she owns this domain through HTTP validation.</p><p>When Let’s Encrypt performs DCV over HTTP, they require Alice to place a randomly named file in the <code>/.well-known/acme-challenge</code> path for her website. The CA must retrieve the text file by sending an HTTP <code>GET</code> request to <code>http://aliceswonderland.com/.well-known/acme-challenge/&lt;random_filename&gt;</code>. An expected value must be present on this endpoint for DCV to succeed.</p><p>For HTTP validation, Alice would upload a file to <code>http://aliceswonderland.com/.well-known/acme-challenge/YnV0dHNz</code></p><p>where the body contains:</p>
            <pre><code>curl http://aliceswonderland.com/.well-known/acme-challenge/YnV0dHNz

GET /.well-known/acme-challenge/YnV0dHNz
Host: aliceswonderland.com

HTTP/1.1 200 OK
Content-Type: application/octet-stream

YnV0dHNz.TEST_CLIENT_KEY</code></pre>
            <p>The CA instructs them to use the Base64 token <code>YnV0dHNz</code>. <code>TEST_CLIENT_KEY</code> in an account-linked key that only the certificate requestor and the CA know. The CA uses this field combination to verify that the certificate requestor actually owns the domain. Afterwards, Alice can get her certificate for her website!</p>
    <div>
      <h3>DNS Validation</h3>
      <a href="#dns-validation">
        
      </a>
    </div>
    <p>Another way users can validate domain ownership is to add a DNS TXT record containing a verification string or <i>token</i> from the CA to their domain’s resource records. For example, here’s a domain for an enterprise validating itself towards Google:</p>
            <pre><code>$ dig TXT aliceswonderland.com
aliceswonderland.com.	 28 IN TXT "google-site-verification=COanvvo4CIfihirYW6C0jGMUt2zogbE_lC6YBsfvV-U"</code></pre>
            <p>Here, Alice chooses to create a TXT DNS resource record with a specific token value. A Google CA can verify the presence of this token to validate that Alice actually owns her website.</p>
    <div>
      <h3>Types of BGP Hijacking Attacks</h3>
      <a href="#types-of-bgp-hijacking-attacks">
        
      </a>
    </div>
    <p>Certificate issuance is required for servers to securely communicate with clients. This is why it’s so important that the process responsible for issuing certificates is also secure. Unfortunately, this is not always the case.</p><p>Researchers at Princeton University recently discovered that common DCV methods are vulnerable to attacks executed by network-level adversaries. If Border Gateway Protocol (BGP) is the “postal service” of the Internet responsible for delivering data through the most efficient routes, then Autonomous Systems (AS) are individual post office branches that represent an Internet network run by a single organization. Sometimes network-level adversaries advertise false routes over BGP to steal traffic, especially if that traffic contains something important, like a domain’s certificate.</p><p><a href="https://www.princeton.edu/~pmittal/publications/bgp-tls-usenix18.pdf"><i>Bamboozling Certificate Authorities with BGP</i></a> highlights five types of attacks that can be orchestrated during the DCV process to obtain a certificate for a domain the adversary does not own. After implementing these attacks, the authors were able to (ethically) obtain certificates for domains they did not own from the top five CAs: Let’s Encrypt, GoDaddy, Comodo, Symantec, and GlobalSign. But how did they do it?</p>
    <div>
      <h3>Attacking the Domain Control Validation Process</h3>
      <a href="#attacking-the-domain-control-validation-process">
        
      </a>
    </div>
    <p>There are two main approaches to attacking the DCV process with BGP hijacking:</p><ol><li><p>Sub-Prefix Attack</p></li><li><p>Equally-Specific-Prefix Attack</p></li></ol><p>These attacks create a vulnerability when an adversary sends a certificate signing request for a victim’s domain to a CA. When the CA verifies the network resources using an <code>HTTP GET</code>  request (as discussed earlier), the adversary then uses BGP attacks to hijack traffic to the victim’s domain in a way that the CA’s request is rerouted to the adversary and not the domain owner. To understand how these attacks are conducted, we first need to do a little bit of math.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/55IOsCmOIvDukAEqazUFq9/2a480249d3d70e5a1b271367f9eeb719/Domain-Control-Validation-Process_1.5x.png" />
            
            </figure><p>Every device on the Internet uses an IP (Internet Protocol) address as a numerical identifier. IPv6 addresses contain 128 bits and follow a slash notation to indicate the size of the prefix. So, in the network address <b>2001:DB8:1000::/48</b>, “<b>/48</b>” refers to how many bits the network contains. This means that there are 80 bits left that contain the host addresses, for a total of 10,240 host addresses. The smaller the prefix number, the more host addresses remain in the network. With this knowledge, let’s jump into the attacks!</p>
    <div>
      <h4>Attack one: Sub-Prefix Attack</h4>
      <a href="#attack-one-sub-prefix-attack">
        
      </a>
    </div>
    <p>When BGP announces a route, the router always prefers to follow the more specific route. So if <b>2001:DB8::/32</b> and <b>2001:DB8:1000::/48</b> are advertised, the router will use the latter as it is the more specific prefix. This becomes a problem when an adversary makes a BGP announcement to a specific IP address while using the victim’s domain IP address. Let’s say the IP address for our victim, leagueofentropy.com, is <b>2001:DB8:1000::1</b> and announced as <b>2001:DB8::/32</b>. If an adversary announces the prefix <b>2001:DB8:1000::/48</b>, then they will capture the victim’s traffic, launching a <i>sub-prefix hijack attack</i>.</p><p>In an IPv4 attack, such as the <a href="/bgp-leaks-and-crypto-currencies/">attack</a> during April 2018, this was /24 and /23 announcements, with the more specific /24 being announced by the nefarious entity. In IPv6, this could be a /48 and /47 announcement. In both scenarios, /24's and /48's are the smallest blocks allowed to be routed globally. In the diagram below, <b>/47</b> is Texas and <b>/48</b> is the more specific Austin, Texas. The new (but nefarious) routes overrode the existing routes for portions of the Internet. The attacker then ran a nefarious DNS server on the normal IP addresses with DNS records pointing at some new nefarious web server instead of the existing server. This attracted the traffic destined for the victim’s domain within the area the nefarious routes were being propagated. The reason this attack was successful was because a more specific prefix is always preferred by the receiving routers.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1u8kdog1lBPYcQsjARPOkV/03c3da0661363f6fe10e589673c9aeab/1-Traditional-Equally-specific-Sub-Prefix-Attack-KC-0A-_3x.png" />
            
            </figure>
    <div>
      <h4>Attack two: Equally-Specific-Prefix Attack</h4>
      <a href="#attack-two-equally-specific-prefix-attack">
        
      </a>
    </div>
    <p>In the last attack, the adversary was able to hijack traffic by offering a more specific announcement, but what if the victim’s prefix is <b>/48</b> and a sub-prefix attack is not viable? In this case, an attacker would launch an <b>equally-specific-prefix hijack</b>, where the attacker announces the same prefix as the victim. This means that the AS chooses the preferred route between the victim and the adversary’s announcements based on properties like path length. This attack only ever intercepts a portion of the traffic.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3BKdC4cWYQO25VBryOZey1/828259a83952227bffd27fc4b655bc94/2-Traditional-EquallyPrefix-Attack-0A-KC_3x.png" />
            
            </figure><p>There are more advanced attacks that are covered in more depth in the paper. They are fundamentally similar attacks but are more stealthy.</p><p>Once an attacker has successfully obtained a bogus certificate for a domain that they do not own, they can perform a convincing attack where they pose as the victim’s domain and are able to decrypt and intercept the victim’s TLS traffic. The ability to decrypt the TLS traffic allows the adversary to completely Monster-in-the-Middle (MITM) encrypted TLS traffic and reroute Internet traffic destined for the victim’s domain to the adversary. To increase the stealthiness of the attack, the adversary will continue to forward traffic through the victim’s domain to perform the attack in an undetected manner.</p>
    <div>
      <h3>DNS Spoofing</h3>
      <a href="#dns-spoofing">
        
      </a>
    </div>
    <p>Another way an adversary can gain control of a domain is by spoofing DNS traffic by using a source IP address that belongs to a DNS nameserver. Because anyone can modify their packets’ outbound IP addresses, an adversary can fake the IP address of any DNS nameserver involved in resolving the victim’s domain, and impersonate a nameserver when responding to a CA.</p><p>This attack is more sophisticated than simply spamming a CA with falsified DNS responses. Because each <a href="https://www.cloudflare.com/learning/dns/what-is-dns/">DNS query</a> has its own randomized query identifiers and source port, a fake DNS response must match the DNS query’s identifiers to be convincing. Because these query identifiers are random, making a spoofed response with the correct identifiers is extremely difficult.</p><p>Adversaries can fragment User Datagram Protocol (UDP) DNS packets so that identifying DNS response information (like the random DNS query identifier) is delivered in one packet, while the actual answer section follows in another packet. This way, the adversary spoofs the DNS response to a legitimate DNS query.</p><p>Say an adversary wants to get a mis-issued certificate for victim.com by forcing packet fragmentation and spoofing DNS validation. The adversary sends a DNS nameserver for victim.com a ICMP "fragmentation needed" packet with a small Maximum Transmission Unit, or maximum byte size. This gets the nameserver to start fragmenting DNS responses. When the CA sends a DNS query to a nameserver for victim.com asking for victim.com’s TXT records, the nameserver will fragment the response into the two packets described above: the first contains the query ID and source port, which the adversary cannot spoof, and the second one contains the answer section, which the adversary can spoof. The adversary can continually send a spoofed answer to the CA throughout the DNS validation process, in the hopes of sliding their spoofed answer in before the CA receives the real answer from the nameserver.</p><p>In doing so, the answer section of a DNS response (the important part!) can be falsified, and an adversary can trick a CA into mis-issuing a certificate.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7LqZ3us0OcigAJXbwPyIbf/656eba59808bab008b5694eb195525c2/DNS-Spoofing_3x.png" />
            
            </figure>
    <div>
      <h3>Solution</h3>
      <a href="#solution">
        
      </a>
    </div>
    <p>At first glance, one could think a Certificate Transparency log could expose a mis-issued certificate and allow a CA to quickly revoke it. CT logs, however, can take up to 24 hours to include newly issued certificates, and certificate revocation can be inconsistently followed among different browsers. We need a solution that allows CAs to proactively prevent this attacks, not retroactively address them.</p><p>We’re excited to announce that Cloudflare provides CAs a free API to leverage our global network to perform DCV from multiple vantage points around the world. This API bolsters the DCV process against BGP hijacking and off-path DNS attacks.</p><p>Given that Cloudflare runs 175+ datacenters around the world, we are in a unique position to perform DCV from multiple vantage points. Each datacenter has a unique path to DNS nameservers or HTTP endpoints, which means that successful hijacking of a BGP route can only affect a subset of DCV requests, further hampering BGP hijacks. And since we use RPKI, we actually sign and verify BGP routes.</p><p>This DCV checker additionally protects CAs against off-path, DNS spoofing attacks. An additional feature that we built into the service that helps protect against off-path attackers is DNS query source IP randomization. By making the source IP unpredictable to the attacker, it becomes more challenging to spoof the second fragment of the forged DNS response to the DCV validation agent.</p><p>By comparing multiple DCV results collected over multiple paths, our DCV API makes it virtually impossible for an adversary to mislead a CA into thinking they own a domain when they actually don’t. CAs can use our tool to ensure that they only issue certificates to rightful domain owners.</p><p>Our multipath DCV checker consists of two services:</p><ol><li><p>DCV agents responsible for performing DCV out of a specific datacenter, and</p></li><li><p>a DCV orchestrator that handles multipath DCV requests from CAs and dispatches them to a subset of DCV agents.</p></li></ol><p>When a CA wants to ensure that DCV occurred without being intercepted, it can send a request to our API specifying the type of DCV to perform and its parameters.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6yKDxJFYuvSllzdqYBDWfx/8c7e27f099e2bf94b54df5bf1810e9f6/Mulitpath-DCV_3x.png" />
            
            </figure><p>The DCV orchestrator then forwards each request to a random subset of over 20 DCV agents in different datacenters. Each DCV agent performs the DCV request and forwards the result to the DCV orchestrator, which aggregates what each agent observed and returns it to the CA.</p><p>This approach can also be generalized to performing multipath queries over DNS records, like Certificate Authority Authorization (CAA) records. CAA records authorize CAs to issue certificates for a domain, so spoofing them to trick unauthorized CAs into issuing certificates is another attack vector that multipath observation prevents.</p><p>As we were developing our multipath checker, we were in contact with the Princeton research group that introduced the proof-of-concept (PoC) of certificate mis-issuance through BGP hijacking attacks. Prateek Mittal, coauthor of the <i>Bamboozling Certificate Authorities with BGP</i> paper, wrote:</p><blockquote><p>“Our analysis shows that domain validation from multiple vantage points significantly mitigates the impact of localized BGP attacks. We recommend that all certificate authorities adopt this approach to enhance web security. A particularly attractive feature of Cloudflare’s implementation of this defense is that Cloudflare has access to a vast number of vantage points on the Internet, which significantly enhances the robustness of domain control validation.”</p></blockquote><p>Our DCV checker follows our belief that trust on the Internet must be distributed, and vetted through third-party analysis (like that provided by Cloudflare) to ensure consistency and security. This tool joins our <a href="/introducing-certificate-transparency-and-nimbus/">pre-existing Certificate Transparency monitor</a> as a set of services CAs are welcome to use in improving the accountability of certificate issuance.</p>
    <div>
      <h3>An Opportunity to Dogfood</h3>
      <a href="#an-opportunity-to-dogfood">
        
      </a>
    </div>
    <p>Building our multipath DCV checker also allowed us to <a href="https://en.wikipedia.org/wiki/Eating_your_own_dog_food"><i>dogfood</i></a> multiple Cloudflare products.</p><p>The DCV orchestrator as a simple fetcher and aggregator was a fantastic candidate for <a href="https://developers.cloudflare.com/workers/">Cloudflare Workers</a>. We <a href="/generating-documentation-for-typescript-projects/">implemented the orchestrator in TypeScript</a> using this post as a guide, and created a typed, reliable orchestrator service that was easy to deploy and iterate on. Hooray that we don’t have to maintain our own <code>dcv-orchestrator</code>  server!</p><p>We use <a href="https://developers.cloudflare.com/argo-tunnel/">Argo Tunnel</a> to allow Cloudflare Workers to contact DCV agents. Argo Tunnel allows us to easily and securely expose our DCV agents to the Workers environment. Since Cloudflare has approximately 175 datacenters running DCV agents, we expose many services through Argo Tunnel, and have had the opportunity to load test Argo Tunnel as a power user with a wide variety of origins. Argo Tunnel readily handled this influx of new origins!</p>
    <div>
      <h3>Getting Access to the Multipath DCV Checker</h3>
      <a href="#getting-access-to-the-multipath-dcv-checker">
        
      </a>
    </div>
    <p>If you and/or your organization are interested in trying our DCV checker, email <a>dcv@cloudflare.com</a> and let us know! We’d love to hear more about how multipath querying and validation bolsters the security of your certificate issuance.</p><p>As a new class of BGP and IP spoofing attacks threaten to undermine PKI fundamentals, it’s important that website owners advocate for multipath validation when they are issued certificates. We encourage all CAs to use multipath validation, whether it is Cloudflare’s or their own. Jacob Hoffman-Andrews, Tech Lead, Let’s Encrypt, wrote:</p><blockquote><p>“BGP hijacking is one of the big challenges the web PKI still needs to solve, and we think multipath validation can be part of the solution. We’re testing out our own implementation and we encourage other CAs to pursue multipath as well”</p></blockquote><p>Hopefully in the future, website owners will look at multipath validation support when selecting a CA.</p> ]]></content:encoded>
            <category><![CDATA[Crypto Week]]></category>
            <category><![CDATA[Cryptography]]></category>
            <category><![CDATA[DNS]]></category>
            <category><![CDATA[BGP]]></category>
            <category><![CDATA[TLS]]></category>
            <category><![CDATA[CFSSL]]></category>
            <category><![CDATA[HTTPS]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Speed & Reliability]]></category>
            <guid isPermaLink="false">142PyPkCaDGbaxHJsIruoK</guid>
            <dc:creator>Dina Kozlov</dc:creator>
            <dc:creator>Gabbi Fisher</dc:creator>
        </item>
        <item>
            <title><![CDATA[Monsters in the Middleboxes: Introducing Two New Tools for Detecting HTTPS Interception]]></title>
            <link>https://blog.cloudflare.com/monsters-in-the-middleboxes/</link>
            <pubDate>Mon, 18 Mar 2019 17:47:50 GMT</pubDate>
            <description><![CDATA[ The practice of HTTPS interception continues to be commonplace on the Internet. This blog post discusses types of monster-in-the-middle devices and software, and how to detect them. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>The practice of HTTPS interception continues to be commonplace on the Internet. HTTPS interception has encountered scrutiny, most notably in the 2017 study “<a href="https://jhalderm.com/pub/papers/interception-ndss17.pdf">The Security Impact of HTTPS Interception</a>” and the United States Computer Emergency Readiness Team (US-CERT)  <a href="https://www.us-cert.gov/ncas/alerts/TA17-075A">warning</a> that the technique weakens security. In this blog post, we provide a brief recap of HTTPS interception and introduce two new tools:</p><ol><li><p><a href="https://github.com/cloudflare/mitmengine">MITMEngine</a>, an open-source library for HTTPS interception detection, and</p></li><li><p><a href="https://malcolm.cloudflare.com/">MALCOLM</a>, a dashboard displaying metrics about HTTPS interception we observe on Cloudflare’s network.</p></li></ol><p>In a basic HTTPS connection, a browser (client) establishes a TLS connection directly to an origin server to send requests and download content. However, many connections on the Internet are not directly from a browser to the server serving the website, but instead traverse through some type of proxy or middlebox (a “monster-in-the-middle” or MITM). There are many reasons for this behavior, both malicious and benign.</p>
    <div>
      <h3>Types of HTTPS Interception, as Demonstrated by Various Monsters in the Middle</h3>
      <a href="#types-of-https-interception-as-demonstrated-by-various-monsters-in-the-middle">
        
      </a>
    </div>
    <p>One common HTTPS interceptor is TLS-terminating forward proxies. (These are a subset of all forward proxies; non-TLS-terminating forward proxies forward TLS connections without any ability to inspect encrypted traffic). A TLS-terminating forward proxy sits in front of a client in a TLS connection, transparently forwarding and possibly modifying traffic from the browser to the destination server. To do this, the proxy must terminate the TLS connection from the client, and then (hopefully) re-encrypt and forward the payload to the destination server over a new TLS connection. To allow the connection to be intercepted without a browser certificate warning appearing at the client, forward proxies often require users to install a root certificate on their machine so that the proxy can generate and present a trusted certificate for the destination to the browser. These root certificates are often installed for corporate managed devices, done by network administrators without user intervention.</p>
    <div>
      <h2>Antivirus and Corporate Proxies</h2>
      <a href="#antivirus-and-corporate-proxies">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/lQlpoDWmUQ7mvaOQjOCzR/cf1df0af814a7ba373072b727102c5dd/my-stapler-_2x.png" />
            
            </figure><p>Some legitimate reasons for a client to connect through a forward proxy would be to allow antivirus software or a corporate proxy to inspect otherwise encrypted data entering and leaving a local network in order to detect inappropriate content, malware, and data breaches. The Blue Coat data loss prevention tools offered by Symantec are one example. In this case, HTTPS interception occurs to check if an employee is leaking sensitive information before sending the request to the intended destination.</p>
    <div>
      <h2>Malware Proxies</h2>
      <a href="#malware-proxies">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2VTM6e5HggvoJsREQ4t2BX/3670abf896ee660c9aef85f658346fff/business-sasquatch_2x.png" />
            
            </figure><p>Malicious forward proxies, however, might insert advertisements into web pages or <a href="https://www.cloudflare.com/learning/security/what-is-data-exfiltration/">exfiltrate private user information</a>. Malware like <a href="https://www.us-cert.gov/ncas/alerts/TA15-051A">Superfish</a> insert targeted ads into encrypted traffic, which requires intercepting HTTPS traffic and modifying the content in the response given to a client.</p>
    <div>
      <h2>Leaky Proxies</h2>
      <a href="#leaky-proxies">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4sW8l4AlgtkLvFVsF0RiYe/94b9c16eb8fc3ad8bf47596c4817dbc7/blabbermouth_2x.png" />
            
            </figure><p>Any TLS-terminating forward proxy--whether it’s well-intentioned or not--also risks exposing private information and opens the door to spoofing. When a proxy root certificate is installed, Internet browsers lose the ability to validate the connection end-to-end, and must trust the proxy to maintain the security of the connection to ensure that sensitive data is protected. Some proxies re-encrypt and forward traffic to destinations using less secure TLS parameters.</p><p>Proxies can also require the installation of vendor root certificates that can be easily abused by other malicious parties. In November 2018, a type of Sennheiser wireless headphones required the user to install a <a href="https://arstechnica.com/information-technology/2018/11/sennheiser-discloses-monumental-blunder-that-cripples-https-on-pcs-and-macs/">root certificate which used insecure parameters</a>. This root certificate could allow any adversary to impersonate websites and send spoofed responses to machines with this certificate, as well as observe otherwise encrypted data.</p><p>TLS-terminating forward proxies could even trust root certificates considered insecure, like Symantec’s CA. If poorly implemented, any TLS-terminating forward proxy can become a widespread attack vector, leaking private information or allowing for response spoofing.</p>
    <div>
      <h2>Reverse Proxies</h2>
      <a href="#reverse-proxies">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/10jWDwqO36EovaMh7yezP0/8cbc6e9d12d744f1e6f294944ce788a0/speedy-_2x.png" />
            
            </figure><p>Reverse proxies also sit between users and origin servers. Reverse proxies (such as Cloudflare and <a href="https://www.cloudflare.com/cloudflare-vs-akamai/">Akamai</a>) act on behalf of origin servers, caching static data to improve the speed of content delivery and offering security services such as DDoS mitigation. Critically, reverse proxies do not require special root certificates to be installed on user devices, since browsers establish connections directly to the reverse proxy to download content that is hosted at the origin server. Reverse proxies are often used by origin servers to improve the security of client HTTPS connections (for example, by enforcing strict security policies and using the <a href="/rfc-8446-aka-tls-1-3/">newest security protocols like TLS 1.3</a>). In this case, reverse proxies are intermediaries that provide better performance and security to TLS connections.</p>
    <div>
      <h2>Why Continue Examining HTTPS Interception?</h2>
      <a href="#why-continue-examining-https-interception">
        
      </a>
    </div>
    <p><a href="/understanding-the-prevalence-of-web-traffic-interception/">In a previous blog post, we argued that HTTPS interception is prevalent on the Internet</a> and that it often degrades the security of Internet connections. A server that refuses to negotiate weak cryptographic parameters should be safe from many of the risks of degraded connection security, but there are plenty of reasons why a server operator may want to know if HTTPS traffic from its clients has been intercepted.</p><p>First, detecting HTTPS interception can help a server to identify suspicious or potentially vulnerable clients connecting to its network. A server can use this knowledge to notify legitimate users that their connection security might be degraded or compromised. HTTPS interception also increases the attack surface area of the system, and presents an attractive target for attackers to gain access to sensitive connection data.</p><p>Second, the presence of content inspection systems can not only weaken the security of TLS connections, but it can hinder the <a href="/why-tls-1-3-isnt-in-browsers-yet/">adoption of new innovations and improvements to TLS</a>.  Users connecting through older middleboxes may have their connections downgraded to older versions of TLS the middleboxes still support, and may not receive the security, privacy, and performance benefits of new TLS versions, even if newer versions are supported by both the browser and the server.</p>
    <div>
      <h2>Introducing MITMEngine: Cloudflare’s HTTPS Interception Detector</h2>
      <a href="#introducing-mitmengine-cloudflares-https-interception-detector">
        
      </a>
    </div>
    <p>Many TLS client implementations can be uniquely identified by features of the Client Hello message such as the supported version, cipher suites, extensions, elliptic curves, point formats, compression, and signature algorithms. The technique introduced by “<a href="https://jhalderm.com/pub/papers/interception-ndss17.pdf">The Security Impact of HTTPS Interception</a>” is to construct TLS Client Hello <i>signatures</i> for common browser and middlebox implementations. Then, to identify HTTPS requests that have been intercepted, a server can look up the signature corresponding to the request’s HTTP User Agent, and check if the request’s Client Hello message matches the signature. A mismatch indicates either a spoofed User Agent or an intercepted HTTPS connection. The server can also compare the request’s Client Hello to those of known HTTPS interception tools to understand which interceptors are responsible for intercepting the traffic.</p><p>The <a href="https://caddyserver.com/docs/mitm-detection">Caddy Server MITM Detection</a> tool is based on these heuristics and implements support for a limited set of browser versions. However, we wanted a tool that could be easily applied to the broad set of TLS implementations that Cloudflare supports, with the following goals:</p><ul><li><p>Maintainability: It should be easy to add support for new browsers and to update existing browser signatures when browser updates are released.</p></li><li><p>Flexibility: Signatures should be able to capture a wide variety of TLS client behavior without being overly broad. For example, signatures should be able to account for the <a href="https://tools.ietf.org/html/draft-davidben-tls-grease-01">GREASE</a> values sent in modern versions of Chrome.</p></li><li><p>Performance: Per-request MITM detection should be cheap so that the system can be deployed at scale.</p></li></ul><p>To accomplish these goals, the Cryptography team at Cloudflare developed <a href="https://github.com/cloudflare/mitmengine">MITMEngine</a>, an open-source HTTPS interception detector. MITMEngine is a Golang library that ingests User Agents and TLS Client Hello fingerprints, then returns the likelihood of HTTPS interception and the factors used to identify interception. To learn how to use MITMEngine, check out the project on GitHub.</p><p>MITMEngine works by comparing the values in an observed TLS Client Hello to a set of known browser Client Hellos. The fields compared include:</p><ul><li><p>TLS version,</p></li><li><p>Cipher suites,</p></li><li><p>Extensions and their values,</p></li><li><p>Supported elliptic curve groups, and</p></li><li><p>Elliptic curve point formats.</p></li></ul><p>When given a pair of User Agent and observed TLS Client Hello, MITMEngine detects differences between the given Client Hello and the one expected for the presented User Agent. For example, consider the following User Agent:</p>
            <pre><code>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/47.0.2526.111 Safari/537.36</code></pre>
            <p>This User Agent corresponds to Chrome 47 running on Windows 7. The paired TLS Client Hello includes the following cipher suites, displayed below as a hex dump:</p>
            <pre><code>0000  c0 2b c0 2f 00 9e c0 0a  c0 14 00 39 c0 09 c0 13   .+./.... ...9....
0010  00 33 00 9c 00 35 00 2f  00 0a                     .3...5./ ..</code></pre>
            <p>These cipher suites translate to the following list (and order) of 13 ciphers:</p>
            <pre><code>TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (0x009e)
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0xc00a)
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)
TLS_DHE_RSA_WITH_AES_256_CBC_SHA (0x0039)
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (0xc009)
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013)
TLS_DHE_RSA_WITH_AES_128_CBC_SHA (0x0033)
TLS_RSA_WITH_AES_128_GCM_SHA256 (0x009c)
TLS_RSA_WITH_AES_256_CBC_SHA (0x0035)
TLS_RSA_WITH_AES_128_CBC_SHA (0x002f)
TLS_RSA_WITH_3DES_EDE_CBC_SHA (0x000a)</code></pre>
            <p>The reference TLS Client Hello cipher suites for Chrome 47 are the following:</p>
            <pre><code>0000  c0 2b c0 2f 00 9e cc 14  cc 13 c0 0a c0 14 00 39   .+./.... .......9
0010  c0 09 c0 13 00 33 00 9c  00 35 00 2f 00 0a         .....3.. .5./..</code></pre>
            <p>Looking closely, we see that the cipher suite list for the observed traffic is shorter than we expect for Chrome 47; two cipher suites have been removed, though the remaining cipher suites remain in the same order. The two missing cipher suites are</p>
            <pre><code>TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (0xcc14)
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcc13)</code></pre>
            <p>Chrome prioritizes these two ChaCha ciphers above AES-CBC ciphers--a good choice, given that <a href="/padding-oracles-and-the-decline-of-cbc-mode-ciphersuites/">CBC (cipher block chaining) mode is vulnerable to padding oracle attacks</a>. It looks like the traffic we received underwent HTTPS interception, and the interceptor potentially didn't support ChaCha ciphers.</p><p>Using contextual clues like the used cipher suites, as well as additional User Agent text, we can also detect which software was used to intercept the HTTPS connection. In this case, MITMEngine recognizes that the fingerprint observed actually matches a fingerprint collected from Sophos antivirus software, and indicates that this software is likely the cause of this interception.</p><p>We welcome contributions to MITMEngine. We are particularly interested in collecting more fingerprints of MITM software and browser TLS Client Hellos, because MITMEngine depends on these reference fingerprints to detect HTTPS interception. Contributing these fingerprints is as simple as opening <a href="https://www.wireshark.org/">Wireshark</a>, capturing a pcap file with a TLS Client Hello, and submitting the pcap file in a PR. More instructions on how to contribute can be found in the <a href="https://github.com/cloudflare/mitmengine">MITMEngine documentation</a>.</p>
    <div>
      <h2>Observing HTTPS Interception on Cloudflare’s Network with MALCOLM</h2>
      <a href="#observing-https-interception-on-cloudflares-network-with-malcolm">
        
      </a>
    </div>
    <p>To complement MITMEngine, we also built a dashboard, <a href="https://malcolm.cloudflare.com/">MALCOLM</a>, to apply MITMEngine to a sample of Cloudflare’s overall traffic and observe HTTPS interception in the requests hitting our network. Recent MALCOLM data incorporates a fresh set of reference TLS Client Hellos, so readers will notice that percentage of "unknown" instances of HTTPS interception has decreased from Feburary 2019 to March 2019.</p><p>In this section of this blog post, we compare HTTPS interception statistics from MALCOLM to the 2017 study “<a href="https://jhalderm.com/pub/papers/interception-ndss17.pdf">The Security Impact of HTTPS Interception</a>”. With this data, we can see the changes in HTTPS interception patterns observed by Cloudflare over the past two years.</p><p>Using MALCOLM, let’s see how HTTPS connections have been intercepted as of late. This MALCOLM data was collected between March 12 and March 13, 2019.</p><p>The 2017 study found that 10.9% of Cloudflare-bound TLS Client Hellos had been intercepted. MALCOLM shows that the number of interceptions has increased by a substantial amount, to 18.6%:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/308RiVWeL9fqieIEzt7DsR/1de5978ad5319a33e0f6d670a2fbf69c/1.png" />
            
            </figure><p>This result, however, is likely inflated compared to the results of the 2017 study. The 2017 study considered all traffic that went through Cloudflare, regardless of whether it had a recognizable User Agent or not. MALCOLM only considers results with recognizable User Agents that could be identified by <a href="https://github.com/avct/uasurfer">uasurfer</a>, a Golang library for parsing User Agent strings. Indeed, when we don’t screen out TLS Client Hellos with unidentified User Agents, we see that 11.3% of requests are considered intercepted--an increase of 0.4%. Overall, the prevalence of HTTPS interception activity does not seem to have changed much over the past two years.</p><p>Next, we examine the prevalence of HTTPS interception by browser and operating system. The paper presented the following table. We’re interested in finding the most popular browsers and most frequently intercepted browsers.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3HJcWioFHJY1gSjUGbM0Fo/aa06678c9b4cac6d7c4a71b4a601c39c/2-1.png" />
            
            </figure><p>MALCOLM yields the following statistics for all traffic by browsers. MALCOLM presents mobile and desktop browsers as a single item. This can be broken into separate views for desktop and mobile using the filters on the dashboard.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6ueWD4onXq5T1fTh2ZULTt/746be2f8618fe4c3979ba6f8bc4ac61c/3.png" />
            
            </figure><p>Chrome usage has expanded substantially since 2017, while usage of Safari, IE, and Firefox has fallen somewhat (here, IE includes Edge). Examining the most frequently intercepted browsers, we see the following results:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2DoOG6gtyJKloQ6f7N2YM/a7259a93ac04c0a687cc6c9865dbefa1/NC5wbmc-.png" />
            
            </figure><p>We see above that Chrome again accounts for a larger percentage of intercepted traffic, likely given growth in Chrome’s general popularity. As a result, HTTPS interception rates for other browsers, like Internet Explorer, have fallen as IE is less frequently used. MALCOLM also highlights the prevalence of other browsers that have their traffic intercepted--namely, UCBrowser, a browser common in China.</p><p>Now, we examine the most common operating systems observed in Cloudflare’s traffic:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/33AywIjUylFoFgSgdXG0LX/97790997880300e3cd9ed30a0101c0d1/6.png" />
            
            </figure><p>Android use has clearly increased over the past two years as smartphones become peoples’ primary device for accessing the Internet. Windows also remains a common operating system.</p><p>As Android becomes more popular, the likelihood of HTTPS interception occurring on Android devices also has increased substantially:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7D4pH8O2VNOUfPZLiV6bV9/1ea61b5d21caa3d35b65ab5f0dcf33af/aW1hZ2UucG5n.png" />
            
            </figure><p>Since 2017, Android devices have overtaken those of Windows as the most intercepted.</p><p>As more of the world’s Internet consumption occurs through mobile devices, it’s important to acknowledge that simply changing platforms and browsers has not impacted the prevalence of HTTPS interception.</p>
    <div>
      <h2>Conclusion</h2>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>Using MITMEngine and MALCOLM, we’ve been able to continuously track the state of HTTPS interception on over 10% of Internet traffic. It’s imperative that we track the status of HTTPS interception to give us foresight when deploying new security measures and detecting breaking changes in security protocols. Tracking HTTPS interception also helps us contribute to our broader mission of “helping to build a better Internet” by keeping tabs on software that possibly weakens good security practices.</p><p>Interested in exploring more HTTPS interception data? Here are a couple of next steps:</p><ol><li><p>Check out <a href="https://malcolm.cloudflare.com/">MALCOLM</a>, click on a couple of percentage bars to apply filters, and share any interesting HTTPS interception patterns you see!</p></li><li><p>Experiment with <a href="https://github.com/cloudflare/mitmengine">MITMEngine</a> today, and see if TLS connections to your website have been impacted by HTTPS interception.</p></li><li><p>Contribute to MITMEngine!</p></li></ol><p></p> ]]></content:encoded>
            <category><![CDATA[HTTPS]]></category>
            <category><![CDATA[Malware]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Speed & Reliability]]></category>
            <category><![CDATA[Research]]></category>
            <guid isPermaLink="false">1Pl12Ah2e26vZxqTeuN3vm</guid>
            <dc:creator>Gabbi Fisher</dc:creator>
            <dc:creator>Luke Valenta</dc:creator>
        </item>
        <item>
            <title><![CDATA[Tracing Soon-to-Expire Federal .gov Certificates with CT Monitors]]></title>
            <link>https://blog.cloudflare.com/tracing-soon-to-expire-federal-gov-certificates-with-ct-logs/</link>
            <pubDate>Wed, 23 Jan 2019 09:13:59 GMT</pubDate>
            <description><![CDATA[ As of December 22, 2018, parts of the US Government have “shut down” because of a lapse in appropriation.  ]]></description>
            <content:encoded><![CDATA[ <p>As of December 22, 2018, parts of the US Government have “shut down” because of a lapse in appropriation. The shutdown has caused the furlough of employees across the government and has affected federal contracts. An unexpected side-effect of this shutdown has been the expiration of TLS certificates on some .gov websites. This side-effect has emphasized a common issue on the Internet: the usage of expired certificates and their erosion of trust.</p><p>For an entity to provide a secure website, it needs a valid <a href="https://www.cloudflare.com/application-services/products/ssl/">TLS certificate</a> attached to the website server. These TLS certificates have both start dates and expiry dates. Normally certificates are renewed prior to their expiration. However, if there’s no one to execute this process, then websites serve expired certificates--a poor security practice.</p><p>This means that people looking for government information or resources may encounter alarming error messages when visiting important .gov websites:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/JWkU4QPny2yCHCF0ddOvo/36f3a3cc60f50843456a51f1256f079c/cert_expired.png" />
            
            </figure><p>The content of the website hasn’t changed; it’s just the cryptographic exchange that’s invalid (an expired certificate can’t be validated). These expired certificates present a trust problem. Certificate errors often dissuade people from accessing a website, and imply that the site is not to be trusted. Browsers purposefully make it difficult to continue to an insecure website by hiding the “proceed” option under an “Advanced Settings/Actions” button. In the example above, people seeking aid in the wake of a natural disaster may not be able to access government websites with crucial information.</p><p>Converse to the situation above, some Internet users may get desensitized to certificate error messages. Seeing expired certificates on otherwise trusted websites will teach users to dismiss certificate errors and bypass them even when a certificate (and website) is genuinely unsafe. Moreover, keys should be rotated on a regular basis to minimize the amount of traffic made vulnerable by a key breach. To use expired certificates is to extend the use of a public-private key pair beyond its expected lifetime, and opens up more traffic to potential snooping.</p>
    <div>
      <h3>Tracking Expired .gov Certificates Using Certificate Transparency Monitors</h3>
      <a href="#tracking-expired-gov-certificates-using-certificate-transparency-monitors">
        
      </a>
    </div>
    <p><a href="https://techcrunch.com/2019/01/17/federal-https-domains-expire-government-shutdown/">TechCrunch recently published a list</a> of soon-to-expire certificates for .gov domains. To create this list, they iterated over a dataset of all federal .gov domains furnished by 18F, the federal government’s digital services unit. For each .gov domain on the list, they pulled its certificate and checked its expiration date. They then filtered out the state and local government .gov domains.</p><p>Relying on 18F for this list, however, introduces a single point of failure. What if 18F’s list was not up-to-date? What if 18F was shut down? What if 18F’s list is not conclusive? (Their list actually does not include .gov subdomains). One organization alone cannot be the provider of all truth about federal .gov sites. Third-party collections of .gov certificates would bolster the thoroughness and availability of expired certificate information.</p><p>Cloudflare's Certificate Transparency (CT) monitor, <a href="http://merkle.town">Merkle Town</a>, is one such third-party. Around the same time as TechCrunch did its research, Cloudflare used Merkle Town to find .gov certificates under imminent expiration. CT monitors are one part of the Certificate Transparency ecosystem. Certificate Transparency <b>Logs</b> are used to store all issued certificates on the Internet and hold Certificate Authorities accountable for the certificates they issue. This means that CT logs hold all issued .gov certificates, so one can consult them for an exhaustive list. Certificate Transparency <b>Monitors</b>, on the other hand, help keep the CT logs accountable as well as make their raw bulk data useful to the general public. In addition to Merkle Town, <a href="https://crt.sh/">crt.sh</a> and <a href="https://sslmate.com/certspotter/">Cert Spotter</a> are other examples of monitors.</p>
    <div>
      <h3>The Nitty-Gritty</h3>
      <a href="#the-nitty-gritty">
        
      </a>
    </div>
    <p>All the certificates that our monitor extracts from crawling CT logs are stored in an <a href="https://en.wikipedia.org/wiki/Apache_HBase">HBase</a> table. HBase is a database similar to Google’s Bigtable, and is designed for storing large amounts of data and running <a href="https://en.wikipedia.org/wiki/MapReduce">MapReduce</a> jobs. Using the MapReduce model, we wrote a small amount of code to look at each row of the database, parse the stored certificate and check if (1) it’s valid for a domain ending in “.gov” and (2) will expire in the next two months.</p><p>If (1) and (2) are true, the hostname, the name of the issuing certificate authority, and the expiration date were output.</p><p>Once the code was deployed, it took 90 minutes to scan over 1 billion unique certificates stored in all CT logs. This means that it was processing roughly 200,000 certificates per second!</p><p>The MapReduce job gave us an initial and comprehensive list. But just because a certificate was issued by a CA doesn’t mean that it’s being served. We did a second pass over the first list, this time actually contacting each domain and trying to complete a TLS handshake and observing if the old certificate was still being served. If so, the hostname was kept in the final list. If the handshake succeeded but a new certificate was being served, we discarded the hostname. If the handshake failed, the hostname was excluded and the error message was noted.</p><p>In our final dataset, we filter out .gov domains that correspond to state and local governments, as well as those federal government domains that appear to have been funded by earlier appropriations.</p><p><a href="https://docs.google.com/spreadsheets/d/1noWXyWA3PKHZ79F8HlE3AdX7HCscMrY8UKObYjUiZTI/edit?usp=sharing">Our results can be found here</a>.</p>
    <div>
      <h3>Unexpected Mis-Configurations</h3>
      <a href="#unexpected-mis-configurations">
        
      </a>
    </div>
    <p>As expected, a significant number of hostnames were excluded by the second pass because they had updated their certificates already. Another smaller number of hostnames were also excluded because those websites were unreachable or no longer operational. However, we also found many more hostnames than we expected with mis-configured TLS, even though they’re websites that seem to be for public consumption.</p><p>An example of this is <a href="https://cableplant.boulder.noaa.gov">https://cableplant.boulder.noaa.gov</a> which currently fails to load with this error:</p><blockquote><p>An error occurred during a connection to cableplant.boulder.noaa.gov. SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG</p></blockquote><p>A subtler issue we found was with <a href="https://www.indianaffairs.gov/">https://www.indianaffairs.gov/</a> and <a href="https://www.volunteer.gov/">https://www.volunteer.gov/</a>. Our script was unable to validate the certificate chain for these websites, even though these websites seem to load fine in a browser. The reason is that these websites omit parts of their certificate chain which are necessary to verify that the certificate comes from a publicly trusted authority.</p><p>To improve page load times, browsers will often cache partial certificate chains on-disk. So even if a website does not send all of the necessary certificates, the browser may find what it needed in its cache, which has been well-populated by previous browsing activity. This is still just <b>cache</b>, though. It cannot be relied upon. In my case, after clearing my browser history, both of the websites above become inaccessible, same as for the script.</p>
    <div>
      <h3>How Can Domains Stop Presenting Expired Certificates?</h3>
      <a href="#how-can-domains-stop-presenting-expired-certificates">
        
      </a>
    </div>
    <p>The presence of .gov expired certificates means that either (1) .gov certificates are manually renewed, or (2) .gov certificates cost money to renew, and the shutdown prevented spending on this important web security measure.</p><p><a href="https://www.cloudflare.com/application-services/solutions/certificate-lifecycle-management/">Automatic certificate issuance</a> has become a standard for many domains, and services like Cloudflare offer automatic certificate renewal when you use <a href="https://www.cloudflare.com/ssl/">Universal SSL</a> or get a Cloudflare-issued certificate. CAs like Let’s Encrypt also offer automatic certificate renewal, which works as long as you run the certbot daemon on your webserver. Furthermore, automatic certificate renewal is free with both of these approaches.</p><p>Automating certificate renewals makes expired certificates and mis-configured TLS a problem of the past. We hope that this interesting blip with a few .gov certificates has encouraged domain owners to automate their certificate handling. If you haven’t automated your domain’s certificate renewal, try Universal SSL or Cloudflare certificates today!</p><p><i>Many thanks to Alissa Starzak for her help in filtering .gov domains for this blog post.</i></p> ]]></content:encoded>
            <category><![CDATA[Politics]]></category>
            <category><![CDATA[TLS]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Certificate Transparency]]></category>
            <guid isPermaLink="false">2VrdkIKoAUkcr4YHi0n8DW</guid>
            <dc:creator>Gabbi Fisher</dc:creator>
            <dc:creator>Brendan McMillion</dc:creator>
        </item>
        <item>
            <title><![CDATA[Real URLs for AMP Cached Content Using Cloudflare Workers]]></title>
            <link>https://blog.cloudflare.com/real-urls-for-amp-cached-content-using-cloudflare-workers/</link>
            <pubDate>Tue, 13 Nov 2018 19:33:00 GMT</pubDate>
            <description><![CDATA[ As Cloudflare Workers matures, we continue to push ourselves to develop and deploy important features using them. Today, we’re excited to announce support for HTTP signed exchanges, generated by Cloudflare Workers! ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5zK61KytdjS5NqmHTcWfrX/25a160e62d1bf1058ef6b61558fe9f60/amp-share-copy_4x.png" />
            
            </figure><p>Today, we’re excited to announce our solution for arguably the biggest issue affecting Accelerated Mobile Pages (AMP): the inability to use real origin URLs when serving AMP-cached content. To allow AMP caches to serve content under its origin URL, we implemented HTTP signed exchanges, which extend authenticity and integrity to content cached and served on behalf of a publisher. This logic lives on <a href="https://www.cloudflare.com/products/cloudflare-workers/">Cloudflare Workers</a>, meaning that adding HTTP signed exchanges to your content is just a simple Workers application away. Publishers on Cloudflare can now take advantage of AMP performance and have AMP caches serve content with their origin URLs. We're thrilled to use Workers as a core component of this solution.</p><p>HTTP signed exchanges are a crucial component of the emerging Web Packaging standard, a set of protocols used to package websites for distribution through optimized delivery systems like Google AMP. This announcement comes just in time for Chrome Dev Summit 2018, where our colleague Rustam Lalkaka spoke about our efforts to advance the Web Packaging standard.</p>
    <div>
      <h3>What is Web Packaging and Why Does it Matter?</h3>
      <a href="#what-is-web-packaging-and-why-does-it-matter">
        
      </a>
    </div>
    <p>You may already see the need for Web Packaging on a daily basis. On your smartphone, perhaps you’ve searched for Christmas greens, visited 1-800-Flowers directly from Google, and have been surprised to see content served under the URL <a href="https://google.com/amp/1800flowers.com/blog/flower-facts/types-of-christmas-greens/amp">https://google.com/amp/1800flowers.com/blog/flower-facts/types-of-christmas-greens/amp</a>. This is an instance of AMP in action, where Google serves cached content so your desired web page loads faster.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6kgYK09foa4H185JC2AaO4/26c0a7ef1039fd33516c1653bb7d2f70/ezgif-noAMP.gif" />
            
            </figure><p>Visiting 1-800 Flowers through AMP without HTTP signed exchange</p><p>Google cannot serve cached content under publisher URLs for clear security reasons. To securely present content from a URL, a <a href="https://www.cloudflare.com/application-services/products/ssl/">TLS certificate</a> for its domain is required. Google cannot provide 1-800-Flowers’ certificate on the vendor’s behalf, because it does not have the corresponding private key. Additionally, Google cannot, and should not be able to, sign content using the private key that corresponds to 1-800-Flowers’ certificate.</p><p>The inability to use original content URLs with AMP posed some serious issues. First, the google.com/amp URL prefix can strip URLs of their meaning. To the frustration of publishers, their content is no longer directly attributed to them by a URL (let alone a certificate). The publisher can no longer prove the integrity and authenticity of content served on their behalf.</p><p>Second, for web browsers the lack of a publisher’s URL can call the integrity and authenticity of a cached webpage into question. Namely, there’s no clear way to prove that this response is a cached version of an actual page published by 1-800-Flowers. Additionally, cookies are managed by third-party providers like Google instead of the publisher.</p><p>Enter Web Packaging, a <a href="https://github.com/WICG/webpackage">collection of specifications</a> for “packaging” website content with information like certificates and their validity. The <a href="https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html">HTTP signed exchanges specification</a> allows third-party caches to cache and service HTTPS requests with proof of integrity and authenticity.</p>
    <div>
      <h3>HTTP Signed Exchanges: Extending Trust with Cryptography</h3>
      <a href="#http-signed-exchanges-extending-trust-with-cryptography">
        
      </a>
    </div>
    <p>In the pre-AMP days, people expected to find a webpage’s content at one definitive URL. The publisher, who owns the domain of the definitive URL, would present a visitor with a certificate that corresponds to this domain and contains a public key.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6GeUoh4OBPc3gUuywTcGAE/651a5a6638d6eef794fc9bf6462983db/step-one_4x.png" />
            
            </figure><p>The publisher would use the corresponding private key to sign a cryptographic handshake, which is used to derive shared symmetric keys that are used to encrypt the content and protect its integrity.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/39tMMzRKPaWwXidW4fxyDw/edaf20ec675376ec08c0a9069a794d02/step-2_4x.png" />
            
            </figure><p>The visitor would then receive content encrypted and signed by the shared key.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2rOJWcnNjs0ps5CFQIDvZI/60fb1846557c2f9587e4d555ce03151a/step-3_4x.png" />
            
            </figure><p>The visitor’s browser then uses the shared key to verify the response’s signature and, in turn, the authenticity and integrity of the content received.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/17OtcMYs9DYkDblDZVcQj5/54cda01c719370ebf2546ca0d3652f2d/step-4_4x.png" />
            
            </figure><p>With services like AMP, however, online content may correspond to more than one URL. This introduces a problem: while only one domain actually corresponds to the webpage’s publisher, multiple domains can be responsible for serving a webpage. If a publisher allows AMP services to cache and serve their webpages, they must be able to sign their content even when AMP caches serve it for them. Only then can AMP-cached content prove its legitimacy.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/70Tx1Lvaj6AIDzjWUJPuXi/c1d9d474af8f2e1bb50aa0a6a145a9c5/step-4-copy-4_4x.png" />
            
            </figure><p>HTTP signed exchanges directly address the problem of extending publisher signatures to services like AMP. This <a href="https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html">IETF draft</a> specifies how publishers may sign an HTTP request/response pair (an exchange). With a signed exchange, the publisher can assure the integrity and authenticity of a response to a specific request even before the client makes the request. Given a signed exchange, the publisher authorizes intermediates (like Google’s AMP Cache) to forward the exchanges; the intermediate responds to a given request with the corresponding response in the signed HTTP request/response pair. A browser can then verify the exchange signature to assert the intermediate response’s integrity and authenticity.</p><p>This is like handing out an answer key to a quiz signed by the instructor. Having a signed answer sheet is just as good as getting the answer from the teacher in real time.</p>
    <div>
      <h3>The Technical Details</h3>
      <a href="#the-technical-details">
        
      </a>
    </div>
    <p>An HTTP signed exchange is generated by the following steps.First, the publisher uses <a href="https://tools.ietf.org/id/draft-thomson-http-mice-03.txt">MICE</a> (Merkle Integrity Content Encoding) to provide a concise proof of integrity for the response included in the exchange. To start, the response is split into blocks of some record size bits long. Take, for example, a message ABCD, which is divided into record-size blocks A, B, C, and D. The first step to constructing a proof of integrity is to take the last block, D, and compute the following:</p>
            <pre><code>proof(D) = SHA-256(D || 0x0)</code></pre>
            <p>This produces proof(D). Then, all consequent proof values for blocks are computed as follows:</p>
            <pre><code>proof(C) = SHA-256(C || proof(D) || 0x1)
proof(B) = SHA-256(B || proof(C) || 0x1)
proof(A) = SHA-256(A || proof(B) || 0x1)</code></pre>
            <p>The generation of these proofs build the following tree:</p>
            <pre><code>      proof(A)
         /\
        /  \
       /    \
      A    proof(B)
            /\
           /  \
          /    \
         B    proof(C)
                /\
               /  \
              /    \
             C    proof(D)
                    |
                    |
                    D</code></pre>
            <p>As such, proof(A) is a 256-bit digest that a person who receives the real response should be able to recompute for themselves. If a recipient can recompute a tree head value identical to proof(A), they can verify the integrity of the response they received. In fact, this digest plays a similar role to the tree head of a <a href="/introducing-certificate-transparency-and-nimbus/">Merkle Tree</a>, which is recomputed and compared to the presented tree head to verify the membership of a particular node. The MICE-generated digest is stored in the Digest header of the response.</p><p>Next, the publisher serializes the headers and payloads of a request/response pair into <a href="https://tools.ietf.org/html/rfc7049">CBOR</a> (Concise Binary Object Representation). CBOR’s key-value storage is structurally similar to JSON, but creates smaller message sizes.</p><p>Finally, the publisher signs the CBOR-encoded request/response pair using the private key associated with the publisher’s certificate. This becomes the value of the sig parameter in the HTTP signed exchange.</p><p>The final HTTP signed exchange appears like the following:</p>
            <pre><code>sig=*MEUCIQDXlI2gN3RNBlgFiuRNFpZXcDIaUpX6HIEwcZEc0cZYLAIga9DsVOMM+g5YpwEBdGW3sS+bvnmAJJiSMwhuBdqp5UY=*;  
integrity="digest/mi-sha256";  
validity-url="https://example.com/resource.validity.1511128380";  
cert-url="https://example.com/oldcerts";  
cert-sha256=*W7uB969dFW3Mb5ZefPS9Tq5ZbH5iSmOILpjv2qEArmI=*;  
date=1511128380; expires=1511733180</code></pre>
            <p>Services like AMP can send signed exchanges by using a new HTTP response format that includes the signature above in addition to the original response.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/30wTgi8lZo4TnZN0nsg73U/6de57d124bdd34b656633929962221b0/step-4-copy-3_4x.png" />
            
            </figure><p>When this signature is included in an AMP-cached response, a browser can verify the legitimacy of this response. First, the browser confirms that the certificate provided in cert-url corresponds to the request’s domain and is still valid. It next uses the certificate’s public key, as well as the headers and body values of request/response pair, to check the authenticity of the signature, sig. The browser then checks the integrity of the response using the given integrity algorithm, digest/mi-sha256 (aka MICE), and the contents of the Digest header. Now the browser can confirm that a response provided by a third party has the integrity and authenticity of the content’s original publisher.</p><p>After all this behind-the-scenes work, the browser can now present the original URL of the content instead of one prefixed by google.com/amp. Yippee to solving one of AMP’s most substantial pain points!</p>
    <div>
      <h3>Generating HTTP Signed Exchanges with Workers</h3>
      <a href="#generating-http-signed-exchanges-with-workers">
        
      </a>
    </div>
    <p>From the overview above, the process of generating an HTTP signed exchange is clearly involved. What if there were a way to automate the generation of HTTP signed exchanges and have services like AMP automatically pick them up? With Cloudflare Workers… we found a way you could have your HTTP origin exchange cake and eat it too!</p><p>We have already implemented HTTP signed exchanges for one of our customers, <a href="https://www.1800flowers.com/">1-800-Flowers</a>. Code deployed in a Cloudflare Worker is responsible for fetching and generating information necessary to create this HTTP signed exchange.</p><p>This Worker works with Google AMP’s automatic caching. When Google’s search crawler crawls a site, it will ask for a signed exchange from the same URL if it initially responds with Vary: AMP-Cache-Transform. Our HTTP signed exchange Worker checks if we can generate a signed exchange and if the current document is valid AMP. If it is, that Vary header is returned. After Google’s crawler sees this Vary header in the response, it will send another request with the following two headers:</p>
            <pre><code>AMP-Cache-Transform: google
Accept: application/signed-exchange;v=b2</code></pre>
            <p>When our implementation sees these header values, it will attempt to generate and return an HTTP response with Content-Type: application/signed-exchange;v=b2.</p><p>Now that Google has cached this page with the signed exchange produced by our Worker, the requested page will appear with the publisher’s URL instead of Google’s AMP Cache URL. Success!</p><p>If you’d like to see HTTP signed exchanges in action on 1-800-Flowers, follow these steps:</p><ol><li><p>Install/open Chrome Beta for Android. (It should be version 71+).</p></li><li><p>Go to <a href="https://goo.gl/webpackagedemo">goo.gl/webpackagedemo</a>.</p></li><li><p>Search for “Christmas greens.”</p></li><li><p>Click on the 1-800-Flowers link -- it should be about 3 spots down with the AMP icon next to it. Along the way to getting there you should see a blue box that says "Results with the AMP icon use web packaging technology." If you see a different message, double check that you are using the correct Chrome Beta.An example of AMP in action for 1-800-Flowers:</p></li></ol>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5j6PfikkSSKXgrgSRmvYFh/9af3b955be231c64435517d2466af692/ezgif-w-amp.gif" />
            
            </figure><p>Visiting 1-800 Flowers through AMP with HTTP signed exchange</p>
    <div>
      <h3>The Future: Deploying HTTP Signed Exchanges as a Worker App</h3>
      <a href="#the-future-deploying-http-signed-exchanges-as-a-worker-app">
        
      </a>
    </div>
    <p>Phew. There’s clearly a lot of infrastructure for publishers to build for distributing AMP content. Thankfully Cloudflare has <a href="https://www.cloudflare.com/network/">one of the largest networks in the world</a>, and we now have the ability to execute JavaScript at the edge with <a href="https://www.cloudflare.com/network/">Cloudflare Workers</a>. We have developed a prototype Worker that generates these exchanges, on the fly, for any domain. If you’d like to start experimenting with signed exchanges, <a href="https://www.cloudflare.com/website-optimization/ampersand/">we’d love to talk</a>!</p><p>Soon, we will release this as a Cloudflare Worker application to our AMP customers. We’re excited to bring a better AMP experience to internet users and advance the Web Packaging standard. Stay tuned!</p>
    <div>
      <h3>The Big Picture</h3>
      <a href="#the-big-picture">
        
      </a>
    </div>
    <p>Web Packaging is not simply a technology that helps fix the URL for AMP pages, it’s a fundamental shift in the way that publishing works online. For the entire history of the web up until this point, publishers have relied on transport layer security (TLS) to ensure that the content that they send to readers is authentic. TLS is great for protecting communication from attackers but it does not provide any public verifiability. This means that if a website serves a specific piece of content to a specific user, that user has no way of proving that to the outside world. This is problematic when it comes to efforts to archive the web.</p><p>Services like the Internet Archive crawl websites and keep a copy of what the website returns, but who’s to say they haven’t modified it? And who’s to say that the site didn’t serve a different version of the site to the crawler than it did to a set of readers? Web Packaging fixes this issue by allowing sites to digitally sign the actual content, not just the cryptographic keys used to transport data. This subtle change enables a profoundly new ability that we never knew we needed: the ability to record and archive content on the Internet in a trustworthy way. This ability is something that is lacking in the field of online publishing. If Web Packaging takes off as a general technology, it could be the first step in creating a trusted digital record for future generations to look back on.</p><p>Excited about the future of Web Packaging and AMP? Check out <a href="https://www.cloudflare.com/website-optimization/ampersand/">Cloudflare Ampersand</a> to see how we're implementing this future.</p> ]]></content:encoded>
            <category><![CDATA[Serverless]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[JavaScript]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[AMP]]></category>
            <category><![CDATA[Developers]]></category>
            <category><![CDATA[HTTPS]]></category>
            <category><![CDATA[Mobile]]></category>
            <category><![CDATA[Programming]]></category>
            <category><![CDATA[Developer Platform]]></category>
            <guid isPermaLink="false">2vBadQs4BUhz2xKzJQ5Bll</guid>
            <dc:creator>Gabbi Fisher</dc:creator>
            <dc:creator>Avery Harnish</dc:creator>
        </item>
    </channel>
</rss>