Latest Posts (20 found)

The race to secure record-like information for domains

It’s sort of surprising, but we’re still figuring out how to secure simple, record-like information for domain names in an application-accessible way. Think about it. How would you bind the following to a domain name? Importantly, how would you secure it? Since we’re talking about domain names, lets start with DNS. The classic solution adds configuration as TXT records: Notice that we use an underscored subdomain label to make it clear we aren’t talking about a hostname. The protocol name is then repeated to make it abundantly clear this record is related to the protocol. As is, we can’t claim this solution is secure. DNS-based network interference is trivial and widespread. The best practice for securing DNS records is DNSSEC, which uses cryptographic signing. I’m not going to debate the security properties of DNSSEC in this post. There are strong opinions on both sides and the most helpful answer likely depends on the context in which you work. For the sake of this blog post I’ll wave my hands and call this “secure enough” to side-step the issue. In any case, the rest of the post doesn’t depend on a favorable or unfavorable assessment of the security properties of DNSSEC. Even the strongest supporters of DNSSEC need to face the reality that DNSSEC isn’t widely adopted. There’s no single answer that quantifies DNSSEC adoption. At Fox Loop Software I collect adoption metrics for various Internet protocols; we just released the first dashboard . Our approach highlights that adoption rates vary widely depending on which cohort you measure. For example, here are the adoption rates of DNSSEC signed MX records among second-level domain names that accept email: From the perspective of an application developer, it is not reasonable to expect that a customer domain name will support DNSSEC. Until this changes, application developers must use alternate solutions if they need security. If my application is web-based then there’s a pretty obvious solution as I already have an HTTPS secured endpoint. I can use the HTTPS .well-known approach ( RFC 8615 ). These records are secured by HTTPS. The developer experience is excellent: adding a record could be as easy as dropping a file in a web server directory. Fetching records is a simple HTTP GET request. But not everything is a web-based application. Can we extend this solution to other protocols? Email is a very old protocol, predating not only TLS but the entire Internet as well. Over time all sorts of additions have been bolted on to modernize and maintain the protocol. Many of these additions added new DNS TXT records, such as SPF, DKIM, and DMARC. These records can be secured by DNSSEC but do not require it, so tampering of these records is unmitigated or otherwise tolerated. Let’s look past these examples to a problem that clearly requires a secure record. Email has an awkward problem, which is how hostnames are managed. When a message transfer agent (MTA) relays an email it needs to discover the destination MTA. This is solved using an MX record, which specifies the target MTA’s domain name. I’ve measured that around 80% of domains host their email on a different domain name, often using providers like Google or Microsoft. When sending an email, the MTA will discover a chain from the user’s email address to the receiving MTA’s TLS certificate, like this: The sending MTA now needs to decide if it trusts the connection. Unfortunately, smtp.provider.com, as seen in the TLS certificate, does not match example.com, as provided in the email address. The only link between the two domain names is an MX record, which typically unsigned and therefor insecure. Without trustworthy information, certificate validation cannot succeed and the sending MTA must skip validation. Lack of certificate validation means that receiving MTAs can use a self-signed, expired, or even a certificate with the wrong name; the sending MTA does not care. This approach is known as “opportunistic encryption” and it provides strong protection against passive eavesdropping. But without a way to validate the receiving MTA’s TLS certificate, active attacks remained unmitigated. Email cannot enforce authenticated MTA-to-MTA transit encryption until this hostname mis-match problem is solved in a secure way. Many email security conversations focus on end-to-end encryption. It is a great solution to many of the security problems facing email, but it doesn’t fully address the problem being discussed here. Message relaying requires the MTA to know the recipient’s email address. This is known as “envelope information” and it cannot be end-to-end encrypted. Methods like PGP encryption can not and do not protect this information, as they only encrypt the message body. The only way to protect this information from network-level attackers is to ensure the message is delivered to the correct MTA, which requires authenticated transit encryption. When I first encountered this issue I was surprised as there is no analogous problem on the web. The issue relates to the semantic difference between a CNAME and an MX record. A CNAME record pointing at a web hosting provider’s server is a matter of identity and that server can get a TLS certificate to prove it. An MX record does not permit the target email server to get a corresponding TLS certificate. A web browser is able to compare the name in the TLS certificate with the name shown in the address bar and can expect these to strictly match. An MTA doesn’t compare the name in the TLS certificate with the domain name in the “to” address as a mismatch is typically expected. Further, email is sent asynchronously so there are no humans involved in MTA-to-MTA communications. While web browsers can show a certificate warning message to allow users to make their own security decisions, an MTA is all on its own. Email providers often tout support for transit encryption but the lack of certificate validation makes email traveling between MTAs about as secure as a user browsing the web while always clicking through invalid certificate warnings. Interestingly, email has adopted two solutions to this problem: a DNSSEC-based approach and an HTTPS .well-known approach. This give us a unique opportunity to compare these approaches head-to-head as they attempt to solve the same problem. The DNSSEC approach is SMTP DNS-based Authentication of Named Entities (DANE) ( RFC 7672 ), which was standardized in 2015. DANE requires DNSSEC signing in both the customer and email provider’s DNS zones for the protection to have full effect. DANE adds the TLSA DNS record. Here’s an example: This record indicates that the MTA-to-MTA connection can use authenticated encryption. Specifically, this record indicates that the receiving MTA should provide a TLS certificate with a public key digest of “6111A…”. Validating this pinned certificate does not depend on the certificate authority (CA) system. SMTP DANE signals that it should be possible to cryptographically validate the chain from the domain name in the email address to the domain name on the receiving MTA’s TLS certificate. One key benefit of DNSSEC, which we’ll revisit, is that blocking of a signed record can be distinguished from a non-existent policy. When the TLSA record does not exist, the authoritative DNS server should provide a signed proof of non-existence (NSEC). This acts as a fail safe: if DNSSEC is enabled and the sender cannot determine the DANE policy, then the sender can conclude that it is not safe to send the message as network interference may be present. Email providers realized that slow adoption of DNSSEC was delaying authenticated transit encryption between MTAs. They looked at what other tools were available and found inspiration from the HTTPS .well-known approach. Standardized in 2018, SMTP MTA Strict Transport Security (MTA-STS) ( RFC 8461 ) provides an HTTPS-based solution. Here’s what it looks like: Notice that the mta-sts subdomain is used instead of the bare domain. This best practice stems from the need to isolate security policies from whatever website lives at the bare domain; often a marketing website which may not have a security posture suitable for cross-protocol policies like MTA-STS. To distinguish any pre-existing use of the mta-sts subdomain the “_mta-sts” TXT record must also be set. Finally, policy caching was added as a partial mitigation of intermittent network interference. Like DANE, MTA-STS signals that the sender should strictly authenticate TLS. The MX record is duplicated in the MTA-STS policy, relying on HTTPS to secure the link. MTA-STS requires the receiving MTA to have a TLS certificate issued by a well-trusted CA. An MTA-STS policy document is fairly unchanging, making it well-suited for inexpensive, widely available, and highly scalable static web hosting. Many domain owners implement MTA-STS by adding the subdomain to an existing web server, as a virtual host, although it turns out this isn’t always a good idea. The TLS certificate renewal process is an obvious point of failure for MTA-STS. When a user-facing website goes down users complain, support tickets are filed, and the certificates are quickly renewed. The MTA-STS policy server fails open when it’s certificate expires. Senders will fall back to using opportunistic encryption and users won’t notice any disruption. As such an expired TLS certificate on an MTA-STS policy server can go unnoticed. To address this lack of visibility, TLS Reporting ( RFC 8460 ) was created, which allows email servers to share deliverability reports with each other. Another problem, which I think is an even larger issue, are web servers that block email servers from accessing their MTA-STS policy. You’ve probably noticed a sharp rise in bots, scrapers, and other unwanted automated traffic impacting the web. In the rush to protect web servers from these ills many sites inadvertently blocked access to their MTA-STS policy. An email server fetching an MTA-STS policy can look a lot like unwanted traffic: it’s automated and its coming from data center IP ranges. Misapplying security policies intended to protect user-facing websites from unwanted bot traffic degrades API-like interfaces. One unique benefit of SMTP DANE is that the policy cannot be blocked without the sender noticing. An MTA-STS policy server can be blocked just like any other web server and this blocking cannot easily be distinguish from a non-existent policy. While MTA-STS caching can protect against intermittent network-level blocking of the policy server, the first email sent to a domain is always vulnerable due to an empty cache. The effectiveness of MTA-STS in preventing an on-path attacker from intercepting email is questionable if the same on-path attacker can block the sender from discovering the MTA-STS policy. By these measures, DANE seems like the stronger option. DANE’s reliance on DNSSEC signing is its major weakness. Measurements show that 0.9-1.2% of domain names that receive email have DANE support, which doesn’t provide much practical protection yet. Worse, large providers like gmail.com lack DNSSEC support, so the per-user impact may be larger. Unless DNSSEC adoption can grow among large email providers, DANE can only be a partial solution. In contrast, HTTPS is very widely adopted making MTA-STS familiar to practitioners, even with these challenges. The web has blazed a path that MTA-STS can likely follow. HTTP Strict Transport Security (HSTS) ( RFC 6769 ) is essentially MTA-STS for the web (or visa-versa). HSTS is similarly vulnerable when the cache is empty. Web browsers mitigate this issue using a preload list, which ships in the browser. Out-of-the-box, the web browser knows that popular websites, like wikipedia.com, strictly use HTTPS. While there are challenges with HSTS, like the size of the list , this may have marginal impact for a server-side technology like email. I think MTA-STS can copy this solution. There are unknowns, like who would build an MTA-STS preload list, why we trust them to do so, and the exact semantics needed for a domain to be added. In any case, I think we should wait on increased MTA-STS adoption before we take those next steps. The adoption rates of MTA-STS and SMTP DANE tell an important story about how application protocols can secure domain information in practice. The fact that email has both a DNSSEC and an HTTPS approach gives us a way to spectate. Current measurements show that MTA-STS has overtaken DANE among the top-ranked domain names. Given the importance of protecting messages, including envelope information which cannot be end-to-end encrypted, these results are disappointing. Prior work shows that TLS downgrade attacks on email are widespread . With the slow adoption of email security protocols since that study, the situation is unlikely to have improved. We can and should do better. These SMTP DANE and MTA-STS measurements will be published quarterly. Subscribe to the newsletter to follow the trends. MTA-STS isn’t the only protocol that works this way. OpenPGP Web Key Directory (WKD) ( draft-koch-openpgp-webkey-service-22 ) uses an HTTPS .well-known approach to secure PGP key distribution, facilitating end-to-end encryption of message bodies. The WKD “advanced method”, seen above, follows the best practice of using a protocol-specific subdomain. The analogous DNSSEC-based approach is OPENPGPKEY ( RFC 7929 ). Unfortunately, the SHA-256 hash does not provide meaningful privacy. Use of this protocol can leak the email addresses of your correspondents to passive network-level eavesdroppers. This highlights the importance of encryption, not just signing. Other protocols like Mail AutoConfig ( draft-ietf-mailmaint-autoconfig-07 ) simplify the process of setting up an email client and similar applications. Again we see this protocol follow the security best practice of using a protocol-specific subdomain. There are over 100 registered .well-known URIs , showing the popularity of this approach. Many of these tolerate lower security properties and use the bare domain name instead of a protocol-specific subdomain. While I’ve thus far framed the discussion as a competition, DNSSEC and HTTPS .well-known are actually complementary. We don’t need one approach to defeat the other: we’ll see ecosystem improvements as both solutions are adopted, side-by-side. HTTPS .well-known can offload large policy documents and allow rapid experimentation, avoiding the size limits of UDP packets and the slow process of adding new DNS record types. DNSSEC can sign the CAA record, providing improved security during TLS certificate issuance. DANE could even replace the CAs entirely, a topic of renewed interest after the recent eMudhra mishap . After all, we wouldn’t need the CAs if we had a secure DNS . I see complementary nature of DNSSEC and HTTPS .well-known emphasized in another draft, Domain Authority (DA): A DNS-Designated Service Endpoint for Domain Information ( draft-swaminathan-da-00 ), which seeks to standardize the use of HTTPS to add capabilities to domain names beyond what DNS can natively support. While I think the current draft is too ambitious in scope, it provides a great summary of the benefits an HTTPS-based policy retrieval layer can provide beyond DNS. Unfortunately, we still have an insecure DNS. But progress in the domain name ecosystem is not blocked by DNS. MTA-STS shows that an HTTPS approach is immediately usable. Hello! I'm Robert Alexander, a DevSecOps consultant available for contract work . This blog features some of my work and thoughts on software, the cloud, and security. You can subscribe to my posts with your favorite RSS client and follow me on Mastodon . If you'd like to show your appreciation and help support my writing, you can do so via this link.

0 views

UUIDv7 doesn't have the properties you think it does

I’m going to call it. UUIDv7 is weird. Most blog posts about UUIDv7 tout these benefits: But none of these properties are strictly held. Certain RFC compliant implementations of UUIDv7 violate these properties to extreme degrees. The only useful property UUIDv7 appears to strictly provide is uniqueness and therefore collision resistance. I’ve already discussed how UUIDv7 IDs can be guessable , so this post explores the other properties. Superficially, it seems that embedding a timestamp in the ID can remove the need to track the creation time in a separate database column, providing marginally more efficient database operations. If you need to list things ordered by creation time very often, it’s useful if the primary index gives that behavior, removing the need for another index. Unfortunately, the timestamp embedded in a UUIDv7 ID may not relate to the object creation time. The Postgres docs for helpfully warn that “the extracted timestamp is not necessarily exactly equal to the time the UUID was generated”. RFC 9562 allows implementations to alter the timestamp field, using values that aren’t strictly derived from the system clock. This relates to the tension between UUID monotonicity and timestamp accuracy. In certain scenarios, the difference between the timestamp and the current time can be arbitrarily large. Implementations MAY alter the actual timestamp. — RFC 9562 §6.1 This specification makes no requirement or guarantee about how close the clock value needs to be to the actual time. — RFC 9562 §6.1 … implementations MAY increment the timestamp ahead of the actual time … — RFC 9562 §6.2 Incrementing the timestamp ahead of the system clock is an interesting problem. If the generator is seeing so much load that a counter field is regularly overflowing then the timestamp could accelerate into the future. Using a sufficiently large counter would be wise and the RFC says the minimum size SHOULD be 12 bits. A counter overflow would require a pretty aggressive creation rate, over 4,096 IDs per millisecond per node, which is beyond the limits of many systems. This overflow becomes relevant, however, if the timestamp freezes; which I’ll discuss in a later section. One prominent implementation that increments the timestamp is the Python standard library’s UUIDv7. The increment happens only in certain circumstances, like when the counter overflows. Unfortunately, the generator can get stuck in an increment cycle if the clock ever jumps backwards and the timestamp can race ahead of the system time by an arbitrarily large amount. Here’s a simple example: Which gives: We expect the difference to be 3600 seconds (one hour) as the implementation refuses to allow the embedded timestamp to jump backwards and we expect the difference to decrease as the system clock catches up to the frozen timestamp. But when the load is above one ID per millisecond the difference will increase without bound. At lower loads it will take longer for the system clock to catch the timestamp, but we don’t see the runaway effect. The related issue shows Python developers reasoning that this is consistent with the RFC, is consistent with other implementations, and that there isn’t “much we can do” on a “flawed system”. I think these points are correct as I see this same behavior in other implementations. Nevertheless, it would be helpful if existing UUIDv7 implementations could handle system clock jumps without runaway behavior. There are many real-world examples of clocks jumping backwards, even decades out of sync in time-sensitive environments. Embedding the timestamp in the ID means that you cannot share the ID without also sharing the timestamp. It’s pretty difficult to think of an example where this really matters. One example could be a user profile page that doesn’t disclose when the account was created, but the UUIDv7 ID in the URL leaks the high-precision timestamp. This issue would typically be very low on my list of security concerns because I find much more severe problems when I do security assessments. Nevertheless, there are contexts where this matters and engineering resources would be focused on addressing it. If you’re in the latter camp, be wary of UUIDv7 leaking metadata. This section is even more pedantic, so skip ahead if you’ve had enough. Briefly: UUIDv7 IDs provide some sort of rough order, which may be suitable for your requirements. When I was reading the UUIDv7 RFC I was surprised to see it describing a method for creating IDs across different nodes that are monotonically ordered. This was proven impossible back in the 1970s , and lead to the development of vector clocks and similar technology. At a high level, the problem is that system clocks cannot be synchronized to a suitable precision. Ordering things by timestamp only works if you know precisely what time it is. Any uncertainty in the time results in uncertainty of event ordering. Succinctly: Timestamps are only time-ordered if you know what time it is and you don’t know what time it is. For this reason, similar ID formats claim to be nearly sorted. It seems odd that UUIDv7 makes a stricter claim and does not deliver on them. At the very least, the challenges of synchronizing clocks across systems make the millisecond and especially the sub-millisecond timestamps quite suspect. But even on a single node, using a single implementation, UUIDv7 IDs are not strictly monotonic. The easiest way to get out-of-order UUIDv7 IDs is to use an implementation that uses a millisecond timestamp without a counter. This approach trivially generates out-of-order IDs inside a small for loop . So no, there’s nothing in the UUIDv7 specification that would ensure the IDs are strictly monotonically increasing. Specific implementations may do better than others (with sub-millisecond timestamps, counters, well-synchronized clocks, etc), but we’ve known since the 1970s that this problem is not strictly solvable. In UUIDv7’s favor, roughly ordered IDs are still quite useful. So don’t rip UUIDv7 out of your systems just yet. Just be wary of what assumptions you have. The RFC has lots of discussion about the handling of clocks that jump backwards. Timestamps are only time-ordered if clocks tick forwards, so special care is needed. We’ve already discussed one mitigation: tracking the last generated timestamp to ensure that an earlier timestamp is never used. To do this safely you’ll need to write the last used timestamp to persistent storage, such that you can read it again after a system reboot or a process restart. I’ve looked at several UUIDv7 implementations I couldn’t find one that writes timestamps to persistent storage. So implementers seems disinterested in addressing the issue and they generate out-of-order IDs when a process restart follows a clock jumping backwards. Looking at real-world clock synchronization problems, you’ll find many examples of clocks getting set to future dates . When this happens, the backwards jump would align the timestamp to the actual time, but a last-used-timestamp guard would force timestamps to use keep using that incorrect timestamp until the system clock catches up. If the system clock takes a long time to catch up, you may start experiencing counter rollovers. My mental model for UUIDv7 is that it’s a mash-up of a bunch of different ideas which implementations are free to choose as they see fit. There’s a wide variance of properties that UUIDv7 implementations can provide, with varying degrees of certainty they can successfully provide those properties. If you’re building your own implementation you can likely build something that has the properties you need. But most of us want to reach for an off-the-shelf version, especially when standard libraries provide an implementation, so we’re generally at the mercy of someone else’s implementation decisions. Implementations can change over time, making broad changes to their behavior while still being RFC compliant. Distributed systems may have multiple implementations across their subsystems, each with distinct properties. The only thing you can really expect is strong collision avoidance and ID uniqueness. Be sure to ask these questions when picking a UUIDv7 implementation: Unfortunately, this sort of analysis is much more difficult than building an RFC compliant generator. Authors of UUIDv7 generators may not know the answers to these questions and may themselves be surprised that the RFC does handle this for them. Hello! I'm Robert Alexander, a DevSecOps consultant available for contract work . This blog features some of my work and thoughts on software, the cloud, and security. You can subscribe to my posts with your favorite RSS client and follow me on Mastodon . If you'd like to show your appreciation and help support my writing, you can do so via this link. monotonically increasing IDs a helpful timestamp of when the object was created; and unguessable IDs Is the implementation compliant with the RFC? What additional properties does this implementation guarantee? Under what limits can those guarantees be met? Are there any assumptions required for these properties to hold, such as having an accurate system clock? Under what conditions will the implementation alter the timestamp? How guessable are the generated IDs?

0 views

Why was time.gov off by one round-trip time?

In the United States, the National Institute of Standards and Technology (NIST) maintains the official U.S. time reference. NIST distributes this reference to enable all sorts of applications from meteorology to GPS satellites. Programmers are probably most familiar with distributing time using the network time protocol (NTP), which NIST supports by operating several NTP servers. NIST also runs the beautiful time.gov website which provides an official time reference via a web page. Its an easy way to check the time if you don’t trust the clock on your computer’s taskbar. On a recent project I needed a trustworthy clock and time.gov was a convenient option. To validate that the provided reference was accurate, I opened time.gov in two browser windows side-by-side, but found that the provided clock offset estimates disagreed by a margin larger than I could tolerate. When I compared to another source, an NTP client, I found even more disagreement. I dismissed time.gov as an option, but the inconsistency of the estimates kept bugging me. My intuition told me that more precision should be possible so I had to circle back to figure out what was broken. This blog post explains the issue and how NIST fixed it. For the sake of clarity: the issue described in this post affects the clocks displayed on the time.gov website only, not any of NIST’s other time services. Before I dig into the time.gov implementation, I’ll give an overview of how NTP works. I’ll simplify things for the sake of brevity; there are great explainers elsewhere if you want an accurate deep dive. In the NTP protocol, the server responds with the current timestamp. This timestamp is accurate at the time it was generated, but the client doesn’t see it immediately. It takes time for the response to reach the client, which causes the timestamp to grow stale. The NTP client needs to estimate how much the time elapsed since the timestamp was generated. It does this by measuring the round-trip time (RTT) of the request, which includes both network latency and server processing time. Adjusting the server-provided timestamp using these metrics can produce a very good estimate of the current time. While it is possible for the request and response to take different amounts of time to travel the network, its reasonable to predict that the network delay is the same in both directions. As such, the network delay experienced by the NTP response can be estimated as half of the round-trip time. There’s a lot more to know about NTP: it uses UDP, the response contains multiple timestamps, multiple requests are used, and statistical analysis is performed. The time.gov bug was significant enough that we can ignore those details and use this simpler model. The time.gov website synchronized time over HTTP, using JavaScript to perform the requests . The core functionality performed an HTTP request and collected timing information using “new Date()”. Like NTP, time.gov sends multiple timestamps, but the difference between these is rounded to zero milliseconds and doesn’t impact calculation. So we will continue to ignore that detail. The calculated offset is displayed to the user and the website display is updated by adjusting the local time with the offset. The JavaScript looks like a reasonable approximation of NTP and it’s believable that it could produce the correct time. The issue time.gov was facing happened at the network level. Opening time.gov loads a bunch of resources from the time.gov domain, including the HTML, JavaScript, and CSS. The network request to fetch the timestamp also uses the time.gov domain. For performance reasons web browsers typically send multiple HTTP requests over a single connection. However, the HTTP responses from time.gov all contained the header, which told the web browser to immediately close every connection. Each time the web browser requested a resource from time.gov, it did so over a new network connection, which required TCP handshake and TLS setup. The JavaScript code assumed that, like NTP, a single network round-trip occurred. Unfortunately, the header forced three round-trips to occur. This incorrect assumption was the root cause of the time.gov issue. As the diagram shows, the server generated the timestamp after two-and-a-half round trips while the client’s guess fell near one-and-a-half. This miscalculation caused a full round trip time of error, more error than if they hadn’t adjusted for network delay at all! Interestingly, the estimate occurred before the HTTP part of the network request began. We know the server didn’t tell us the time before we asked, so this can’t be correct. In practice the situation could be even worse as each round trip can take a different amount of time. In the following example, the TCP handshake and TLS setup took much longer than the HTTP round trip. This caused time.gov to estimate that the server timestamp was generated before the TLS session was established. Network round trips were often fast enough that the error was difficult to notice. Close examination of the network behavior revealed the issue. I see two approaches that could help fix this issue. First would be to change the connection header to . This would allow the web browser to keep the connection open longer, reducing the time-synchronization HTTP request to a single network round trip in most circumstances. This is the approach used by the National Research Council (NRC) Canada web clock . But it’s not a perfect solution. During the initial synchronization, the NRC web clock app is able to use an existing connection. However, this web clock resynchronizes periodically. Later synchronizations are delayed long enough that the earlier connections have already closed, which means a fresh network connection must be created. You can see this behavior by watching the clock: the offset estimate and the estimated network delay change somewhat dramatically after a minute or two. So both the NIST and NRC web clocks are impacted by this bug. The extra network round trips wouldn’t be a problem if we could just measure the HTTP portion of the network request. The “new Date()” approach is very coarse grained and measures much more than intended. An alternate approach uses PerformanceResourceTiming to collect precise network timing information. This interface was designed to provide accurate measurement of each part of the network request, allowing us to measure just the application layer; excluding DNS lookup, connection handshake, TLS initialization, and more. I built an experimental CDN-based web clock to validate the process, which had promising results. I reported the issue to both NIST (on March 17th) and NRC (a month later) with these suggestions. Around April 24th time.gov changed their HTTP headers, enabling keep-alive. I consider the core issue to be fixed as the “round trip” measurement no longer measures multiple round trips. In my testing, the time.gov estimates are now closer to those of NTP. Unfortunately, there are still too many things being measured in time.gov’s “new Date()” approach. Compare how the site estimates the network request duration as compared to Firefox’s network debugging tab and PerformanceResourceTiming’s measurement (more on that in the next section). In this example, the original measurement of 63 ms is still larger than the 49 ms shown in Firefox’s network timing panel and calculated from PerformanceResourceTiming. Here’s a client-side patch that changes time.gov to use PerformanceResourceTiming to calculate the clock offset. Pasting this JavaScript into the developer tools console will re-calculate the round-trip time based on a more precise measurement. It also adds error bounds, which should be included when generating estimates. Note: after ten minutes the page hard-refreshes and this patch is removed. Here’s what that looks like: Note: time.gov and ntpdig invert the sign of the computed offset. This example shows the modified time.gov can provide better precision. With that said, please do not consider my patch as a better “official time” as I provide no warranty. NIST should consider adjusting how time.gov measures network timing. These sorts of hard to diagnose issues lurk in every complex computer system. You know your software isn’t performing the way it should, but you can’t locate the problem. With so many architectural layers it can feel daunting to know where to start. As a DevOps consultant, I love guiding my clients to a deeper understanding of their software. Sometimes a single header is all that’s holding you back. The time.gov bug is a good example of how challenging things can get. The web application made assumptions about network behavior that didn’t hold up in the production environment. Local testing was unlikely to detect this issue as the development environment likely used different headers. It seems possible that the HTTP Connection header was modified some time after time.gov launched, perhaps by a network team changing load balancers or web application firewalls. It’s even possible that this issue did not reproduce on NIST networks, as the network path may traverse different middle boxes which provide different HTTP headers. A perfect storm of challenges that requires going back to first principles.

0 views

This blog post tells the time

Computer clock synchronization is a complicated process, requiring protocols like NTP and a specialized server to answer requests. In this post I explore a “serverless” method, which relies on widely available CDNs to distribute time. It’s the serverless time servers we didn’t realize we already had. This clock should display the correct time. If your device’s clock is set to the wrong time, it should tell you how far off the clock is set. The page starts the process by requesting a tiny asset through the Cloudflare CDN. As Cloudflare builds the response, an HTTP header transform rule adds timing information, like http.request.timestamp.sec , to the response headers. The client waits for the response and then analyzes the network request using the fine-grained metrics provided by performance resource timers . Finally, some math is applied to adjust for network delay. The PerformanceResourceTiming interface exposes detailed network timing information. This is similar to the web developer tools network tab, just accessible via JavaScript in the page. These metrics are extremely helpful to developers who are troubleshooting performance issues and will prove useful here. Notice that “sending” and “receiving” are both shown as zero milliseconds. The request and response used here are so small they likely fit in a single packet, so these events appear instantaneous. The only measurable part of the HTTP portion of the request is waiting for the network and the server to do their work. These detailed performance timing metrics help us address a major challenge of time distribution: any server provided timestamp has grown stale by the time it reaches the client. To account for this effect, the NTP protocol and similar software estimate the network round trip time. A good estimate for the network delay experienced by the response is “half the round trip time”, although this is not always accurate. Additional adjustment based on server processing delay further improves accuracy. Cloudflare helps us out by providing server-side timing information. The client generally can’t distinguish between network delay and server delay, so this information helps us estimate when the server generated the timestamp. This data includes metrics like cf.timings.origin_ttfb_msec which tells us how long the Cloudflare CDN waited on a response from Cloudflare Pages. At the end of all the measurement and the math, the clock display is an estimate. We’re guessing how much the server-provided timestamp aged before it reached the web browser. It’s an educated guess, informed by a lot of metrics, but there is uncertainty here. For a technique I’ve been calling serverless, I’ve sure talked about servers a lot. The term serverless really means that we’re not managing individual servers ourselves, the cloud hosting provider has abstracted those away. This setup uses Cloudflare Pages to host the tiny asset which this page fetches. The HTTP header transform rule is part of the CDN, we don’t even need Cloudflare Workers . So it’s just files I’ve pushed to GitLab, served by Cloudflare Pages, and some CDN configuration. Tons of servers, but abstracted away. Contrast this with NTP, where we’d need to run the NTP daemon and perhaps manage the underlying operating system. It feels “serverless” in comparison. The clock display includes error bounds, which describe the precision of the provided time. Network latency plays a big part here as we don’t know how long it took to reach Cloudflare or how long it took to get back. Network paths could be asymmetric or packet loss could cause unexpected delay in a single direction. While in normal cases we’d expect the server to process the request (and generate the timestamp) in the middle of our waiting period, in extreme cases those events could fall far to one side. This uncertainty, and the associated error bounds, are reduced when the network latency is lower, which plays into a strength of Cloudflare: their CDN points-of-presence are located geographically near major population centers. For most of us, network latency to Cloudflare is quite small. The performance resource timers also help us precisely estimate when Cloudflare processes the HTTP request as we can eliminate delays caused by DNS resolution, TCP handshake, and TLS session initialization. Precision could be improved by performing multiple requests and applying statistical analysis, but this page makes no such effort. In my testing I’ve often seen 60ms error bounds shown in the web clock. NTP clients, like the command line ntpdig has a much tighter estimate, closer to 6ms. This is an order of magnitude difference. While this method provides decent synchronization with the clock on Cloudflare CDN servers, we’ve got to consider how well synchronized that clock is with the official time. After all, if Cloudflare’s CDN servers provide the wrong timestamp it doesn’t matter how precisely we’ve synchronized, we’ll display the wrong time. Cloudflare’s CDN is not formally a time server, so we need to tread carefully when using it this way. I checked the accuracy against a couple sources. When I collected the ntpdig output shown above, my web clock reported I was behind by 130±70ms. These measurements are within each other’s error bounds, which shows agreement. I also checked using a GPS debugging app on my phone. GPS provides extremely accurate clocks and is likely the most accurate clock I can access. The clocks appeared to update in lock-step, again showing agreement. In this screenshot notice that my phone’s clock is ahead of the other clocks and this offset is detected by the web clock. In any case, it seems risky to depend on an unwitting time server, so without specific promises from Cloudflare I’d just consider this a demo. After all, the Internet doesn’t always know the right time . So far I’ve tested this on my laptop and phone, but I’d be interested to see how well it works for others. You can use tools like ntpdig or GPS debugging apps to compare. I’ve built a standalone web clock for that sort of testing. You may be surprised by how inaccurate your system time can be; slightly offset clocks are quite common. This is especially true when a device sleeps, suspends, or hibernates. When a computer’s CMOS battery is missing of failed, clocks can fall very far out of sync. I’d be curious to see what people discover (contact info at bottom). While the precision of this CDN-based method is relatively poor for a time synchronization protocol, it does offer some attractive features over current solutions. First and foremost: it’s web-native! NTP’s lack of security has been a growing concern. One replacement, Network Time Security (NTS), cryptographically authenticates information sent by the time server . The authenticated encryption of HTTPS similarly protects the CDN-based web clock approach. This avoids situations where an attacker-in-the-middle tampers with insecure NTP responses, messing up your system’s clock. There’s a lot of hazards here, unfortunately. Alternate time synchronization protocols have a history of mistakes, so its wise to be wary. Microsoft tried a TLS-based synchronization approach via Secure Time Seeding (STS). Their approach relied on time metadata in TLS connections, but most servers actually provide random data in the relevant field. This caused clock to reset to random times . In either case, this underscores the risks of getting a clock reference from systems that don’t realize they are being used as time servers. Closing on a more nostalgic note, NIST’s time.gov has a wonderfully retro clock widget . Unfortunately they no longer allow you to host it on your own site, probably due to server load. Here’s my own 88x31 badge, which is hereby MIT licensed. It makes use of SVG’s questionably ability to embed scripts in images.

0 views

Uptime of GitHub Pages alternatives

Many software developers feel we are at a source control inflection point. GitHub has reigned for over fifteen years, and we may be in the early days of an exodus. Developers have become increasingly disappointed with GitHub’s service, features, and overall direction. Blame is often directed to the buy-out by Microsoft, migration to Azure, Azure itself, or the intense focus on AI. Whatever the underlying reason, people are thinking about switching. This post measures the static website hosting uptime of various alternatives. First, a little background. Many source control hosting providers support website hosting. The core concept is that you can deploy a static website with little more than a git push. The ease of use is central to this product: developers just want a static website with minimal fuss. Since they already track their source code in a git repo, its easiest to launch a website from the same provider. Ease of use was central to my decision to host this blog on GitHub Pages. This post explores: All of these services provide a static website hosting free tier. I wanted to understand the reliability of these services before I migrated my content, so I created a simple test. I signed up for accounts on each service and deployed a test web page on each platform. The web pages are completely static, so they can be served from disk as-is or from a CDN cache. Finally, I created uptime monitors on UptimeRobot to detect downtime of these test pages. It’s been running for almost two years. The monitoring status page is public , so you can track how well these platforms perform over time. Here’s the monitoring status for each platform over the last ninety days: Some quick notes about the monitoring. Checks are performed at five minute intervals, so an outage that is shorter than that duration would either not be detected or would be reported as a five minute outage. The response timing for my test webpage on GitHub Pages was the best with an average response time over 100ms faster than all the others. The minimum response time was 6ms, which suggests that UptimeRobot is in the same data center as GitHub Pages. My monitor detected three outages over the last 23 months. Two were 404 Not Found errors, both happening on November 27th, 2024 and lasting ten minutes each. There was also a five minute DNS-related outage. GitHub was not to blame in this instance as I use a custom domain name and a third-party DNS provider. Focusing on the last full year, 2025, there were zero outages I could attribute to GitHub Pages. So my assessment of GitHub Pages test webpage uptime in 2025 is 100% . I was kind of surprised that GitHub Pages did so well here. Microsoft’s own status report shows occasionally issues with GitHub Pages. My custom monitor did not detect these. One explanation for the disagreement between these measurements is the presence of a third-party CDN. GitHub serves static assets for GitHub Pages through the Fastly CDN . I never change the test web pages, so I’m not testing the reliability of deployments. So in this instance, my custom monitor is really measuring Fastly, not any Microsoft-operated systems. GitLab Pages was the slowest platform I tested, with average response times over 300ms slower than GitHub Pages. GitLab had one large outage of twenty-five minutes and a short five minute outage. GitLab Pages appeared to have 99.994% uptime in 2025. This “four-nines” availability is excellent and is suitable for most websites. Bitbucket Cloud response times were middle-of-the-road. UptimeRobot detected twenty-eight periods of downtime for the Bitbucket Cloud test webpage. Nineteen of these were connection timeouts. The rest were 500-series HTTP status codes. Over 2025, the Bitbucket Cloud test webpage availability was measured as 99.936% uptime . This “three-nines” availability is excellent and is suitable for most websites. The Codeberg Pages test webpage had the second fastest response times. The Codeberg Pages test webpage had the worst availability with 489 periods of downtime. The longest of these nearly reaching seventeen hours. Over 2025, the Codeberg Pages test webpage availability was measured as 98.358% . This “one-nine” uptime is below availability targets of many websites. GitHub Pages took the top spot in this analysis, which wasn’t what I expected. Depending on your sensitivity to slow response times and availability, you may rank GitLab Pages or Bitbucket Cloud as the best alternative. It seems reasonable to measure GitLab Cloud latency from other locations, as the slow response times could be an artifact of the network path between GitLab and UptimeRobot. Codeberg Pages had the worst availability and appears unsuitable for all but the most outage tolerant of websites. If you need to use it, you could add a CDN of your own on top. Many CDNs are able to serve your websites even when the origin is down, thus hiding availability problems. This adds additional complexity, can impact privacy, and may carry extra costs. GitHub Pages Bitbucket Cloud Codeberg Pages ; and GitLab Pages

0 views

Does the Internet know what time is it?

Time is one of those things that is significantly harder to deal with than you’d naively expect. Its common in computing to assume that computers know the current time. After all, there are protocols like NTP for synchronizing computer clocks, and they presumably work well and are widely used. Practically speaking, what kinds of hazards lie hidden here? I’ll start this post with some questions: Some quick definitions: I just checked the system time of my laptop against time.gov , which reports a -0.073s offset. So for a N=1 sample size, I’m cautiously optimistic. There are research papers, like Spanner, TrueTime & The CAP Theorem , that describe custom systems that rely on atomic clocks and GPS to provide clock services with very low, bounded error. While these are amazing feats of engineering, they remain out of reach for most applications. What if we needed to build a system that spanned countless computers across the Internet and required each to have a fairly accurate clock? I wasn’t able to find a study that measured clock offset in this way. There are, however, a number of studies that measure clock skew (especially for fingerprinting). Many of these studies are dated, so it seems like now is a good time for a new measurement. This post is my attempt to measure clock offsets, Internet-wide. When processing HTTP requests, servers fill the HTTP Date header . This header should indicate “the date and time at which the message originated”. Lots of web servers generate responses on-the-fly, so the Date header reveals the server’s clock in seconds. Looks pretty good. I’ll use this as the basis for the measurements. Unfortunately, there are a bunch of challenges we’ll need to deal with. First, resources may get cached in a CDN for some time and the Date header would reflect when the resource was generated instead of the server’s current time reference. Requesting a randomized path will bypass the CDN, typically generating a 404 error. Unfortunately, I found some servers will set the Date header to the last modified time of the 404 page template. I considered performing multiple lookups to see how the Date header advances between requests, but some websites are distributed, so we’d be measuring a different system’s clock with each request. The safest way to avoid this hazard is to only consider Date headers that are offset to the future, which is the approach we’ll use. HTTP responses will take some time to generate; sometimes spanning a couple seconds. We can’t be sure when the Date header was filled, but we know it was before we got the response. Since we only want to measure timestamps that are from the future, we can subtract the timestamp in the date header from when we received the response. This gives a lower bound for the underlying clock offset. When performing broad Internet scans you’ll find many servers have invalid or expired TLS certificates. For the sake of collecting more data I’ve disabled certificate validations while scanning. Finally, our own system clock has skew. To minimize the effect of local clock skew I made sure I had a synchronization service running (systemd-timesyncd on Debian) and double checked my offset on time.gov. All offset measurements are given in whole seconds, rounding towards zero, to account for this challenge. The measurement tool is mostly a wrapper around this Golang snippet: For performance reasons, the code performs a HTTP HEAD request instead of the heavier GET request. Starting in late-November I scanned all domain names on the Tranco top 1,000,000 domains list (NNYYW) . I scanned slowly to avoid any undesired load on third-party systems, with the scan lasting 25 days. Of the million domain names, 241,570 systems could not be measured due to connection error such as timeout, DNS lookup failure, connection refusal, or similar challenges. Not all the domains on the Tranco list have Internet-accessible HTTPS servers running at the apex on the standard port, so these errors are expected. Further issues included HTTP responses that lacked a Date header (13,098) or had an unparsable Date header (102). In all, 745,230 domain names were successfully measured. The vast majority of the measured domains had an offset of zero (710,189; 95.3%). Date headers set to the future impacted 12,717 domains (1.7%). Date headers set to the past will be otherwise ignored, but impacted 22,324 domains (3.0%). The largest positive offset was 39,867,698 seconds, landing us 461 days in the future (March 2027 at scan time). If we graph this we’ll see that the vast majority of our non-negative offsets are very near zero. We also observe that very large offsets are possible but quite rare. I can’t make out many useful trends from this graph. The large amount of data points near zero seconds skews the vertical scale and the huge offsets skew the horizontal scale. Adjusting the graph to focus on 10 seconds to 86,400 seconds (one day) and switching offsets to a log scale provides this graph: This curve is much closer to my expectations. I can see that small offsets of less than a minute have many observances. One thing I didn’t expect were spikes at intervals of whole hours, but it makes a lot of sense in hindsight. This next graph shows the first day, emphasizing data points that exactly align to whole hour offsets. The largest spikes occur at one, three, and nine hours with no clear trend. Thankfully, geography seems to explain these spikes quite well. Here are the top-level domains (TLDs) of domains seen with exactly one hour offset: Germany (.DE), Czech Republic (.CZ), Sweden (.SE), Norway (.NO), Italy (.IT), and Belgium (.BE) are all currently using Central European Time, which uses offset UTC+1. TLDs of domains seen with exactly three hour offset: The country-code top-level domain (ccTLD) for Russia is .RU and Moscow Standard Time is UTC+3. TLDs of domains with exactly nine hour offset: South Korea (.KR) and Cocos (Keeling) Islands (.CC) follow UTC+9. So I strongly suspect these whole-hour offset spikes are driven by local time zones. These systems seem to have set their UTC time to the local time, perhaps due to an administrator who set the time manually to local time, instead of using UTC and setting their timezone. While this type of error is quite rare, impacting only 49 of the measured domain names (0.007%), the large offsets could be problematic. Another anomalous datapoint at 113 seconds caught my attention. Almost all of the data points at the 113 second offset are for domain names hosted by the same internet service provider using the same IP block. A single server can handle traffic for many domain names, all of which will have the same clock offset. We’ll see more examples of this pattern later. Knowing that we have some anomalous spikes due to shared hosting and spikes at whole hour intervals due to timezone issues, I smoothed out the data to perform modeling. Here’s a graph from zero to fifty-nine minutes, aggregating ten second periods using the median. I added a power-law trend line, which matches the data quite well (R 2 = 0.92). I expected to see a power-law distribution, as these are common when modeling randomized errors, so my intuition feels confirmed. The average clock offset, among those with a non-negative offset, was 6544.8 seconds (about 109 minutes). The median clock offset was zero. As with other power-law distributions, the average doesn’t feel like a useful measure due to the skew of the long tail. The HTTP Date header measurement has proven useful for assessing offsets of modern clocks, but I’m also interested in historical trends. I expect that computers are getting better at keeping clocks synchronized as we get better at building hardware, but can we measure it? I know of some bizarre issues that have popped up over time, like this Windows STS bug , so its even possible we’ve regressed. Historical measurements require us to ask “when was this timestamp generated?” and measure the error. This is obviously tricky as the point of the timestamp is to record the time, but we suspect the timestamp has error. Somehow, we’ve got to find a more accurate time to compare each timestamp against. It took me a while to think of a useful dataset, but I think git commits provide a viable way to measure historical clock offsets. We’ve got to analyze git commit timestamps carefully as there’s lots of ways timestamps can be out of order even when clocks are fully synchronized. Let’s first understand how “author time” and “commit time” work. When you write some code and it, you’ve “authored” the code. The git history at this point will show both an “author time” and “commit time” of the same moment. Later you may merge that code into a “main” branch, which updates the “commit time” to the time of the merge. When you’re working on a team you may see code merged in an order that’s opposite the order it was written, meaning the “author times” can be out of chronological order. The “commit times”, however, should be in order. The Linux kernel source tree is a good candidate for analysis. Linux was one of the first adopters of git, as git was written to help Linux switch source control systems. My local git clone of Linux shows 1,397,347 commits starting from 2005. It may be the largest substantive project using git, and provides ample data for us to detect timestamp-based anomalies. I extracted the timing and other metadata from the git history using: Here’s a graph of the “commit time”, aggregating 1000 commit blocks using various percentiles, showing that commits times are mostly increasing. While there’s evidence of anomalous commit timestamps here, there are too few for us find meaningful trends. Let’s keep looking. Here’s a graph of the “author time” showing much more variation: We should expect to see author times vary, as it takes differing amounts of time for code to be accepted and merged. But there are also large anomalies here, including author times that are decidedly in the future and author times that pre-date both git and Linux. We can get more detail in the graph by zooming into the years Linux has been developed thus far: This graph tells a story about commits usually getting merged quickly, but some taking a long time to be accepted. Certain code taking longer to review is expected, so the descending blue data points are expected. There are many different measurements we could perform here, but I think the most useful will be “author time” minus “commit time”. Typically, we expect that code is developed, committed, reviewed, approved, and finally merged. This provides an author time that is less than the commit time, as review and approval steps take time. A positive value of author time minus commit time would indicate that the code was authored in the future, relative to the commit timestamp. We can’t be sure whether the author time or the commit time was incorrect (or both), but collectively they record a timestamp error. These commits are anomalous as the code was seemingly written, committed, then traveled back in time to be merged. We’ll refer to these commits as time travelling commits, although timestamp errors are very likely the correct interpretation. Looking at the Linux git repo, I see 1,397,347 commits, of which 1,773 are time travelling commits. This is 0.127% of all commits, a somewhat rare occurrence. Here’s a graph of these timestamp errors: There are some fascinating patterns here! Ignoring the marked regions for a moment, I notice that offsets below 100 seconds are rare; this is quite unlike the pattern seen for HTTP Date header analysis. I suspect the challenge is that there is usually a delay between when a commit is authored and when it is merged. Code often needs testing and review before it can be merged; those tasks absorb any small timestamp errors. This will make modeling historical clock offset trends much more difficult. The region marked “A” shows many errors below 100 seconds, especially along linear spikes. There appears to be two committers in this region, both using “de.ibm.com” in their email address. The majority of authors in region A have “ibm.com” in their email address. So these anomalies appear to be largely due to a single company. These commits appear to have the author timestamp rewritten to a (mostly) sequential pattern. Here are the commits for two of the days: The author dates here are perfectly sequential, with one second between each commit. The commit dates also increase, but more slowly, such that the difference between author date and commit date increases with later commits. I suspect these timestamps were set via some sort of automation software when processing a batch of commits. The software may have initially set both author and commit timestamps to the current time, but then incremented the author timestamp by one with each subsequent commit while continuing to use the current time for the commit timestamp. If the software processed commits faster than one per second, we’d see this pattern. I don’t think these timestamps are evidence of mis-set clocks, but rather an automated system with poor timestamp handling code. The region marked “B” shows many errors near a 15.5 hour offset (with several exactly on the half-hour mark). Looking at the email addresses I see several “com.au” domains, suggesting some participants were located in Australia (.AU). Australia uses several time zones, including UTC+8, UTC+8:45, UTC+9:30, UTC+10, UTC+10:30, and UTC+11… but nothing near 15.5 hours. The GitHub profiles for one of the committers shows a current timezone of UTC-5. This suggests that an author in Australia and a committer in the Americas both mis-set their clocks, perhaps combining UTC+10:30 and UTC-5 to to reach the 15.5 hour offset. We saw examples of timezone related clock errors when looking at the HTTP Date header; this appears to be an example of two timezone errors combining. The region marked “C” shows many error around 30 to 260 days, which are unusually large errors. The committer for each of these is the same email address, using the “kernel.org” domain name. If we render the author and committer timestamps we’ll see this pattern: I notice that the day in the author timestamp usually matches the month in the committer timestamp, and when it doesn’t it’s one smaller. When the author day and the committer month match, the author month is less than or the same as the committer day. The days in the author timestamp vary between one and nine, while the days in the commit timestamp vary between eight and twenty-one. This suggests that the author timestamp was set incorrectly, swapping the day and month. Looking at these commits relative to the surrounding commits, the commit timestamps appears accurate. If I fix the author timestamps by swapping the day and month, then the data points are much more reasonable. The author timestamps are no longer after the commit timestamps, with differences varying between zero and thirty-six days, and an average of nine days. So it seems these author timestamps were generated incorrectly, swapping month and day, causing them to appear to travel back in time. Git has had code for mitigating these sorts of issues since 2006, like this code that limits timestamps to ten days in the future . I’m not sure why the commits in region “C” weren’t flagged as erroneous. Perhaps a different code path was used? Region “C” doesn’t appear to be related to a mis-set system clock, but instead a date parsing error that swapped day and month. This type of error is common when working between different locales, as the ordering of month and day in a date varies by country . Finally, the region marked “D” shows a relatively sparse collection of errors. This may suggest that git timestamp related errors are becoming less common. But there’s an analytical hazard here: we’re measuring timestamps that are known to time travel. It’s possible that this region will experience more errors in the future! I suspect region “A” and “C” are due to software bugs, not mis-set clocks. Region “B” may be due to two clocks, both mis-set due to timezone handling errors. It seems unwise to assume that I’ve caught all the anomalies and can attribute the rest of the data points to mis-set clocks. Let’s continue with that assumption anyway, knowing that we’re not on solid ground. The Linux kernel source tree is an interesting code base, but we should look at more projects. This next graph counts positive values of “author time” minus “commit time” for Linux, Ruby, Kubernetes, Git, and OpenSSL. The number of erroneous timestamps is measured per-project against the total commits in each year. It’s difficult to see a trend here. Linux saw the most time travelling commits from 2008 through 2011, each year above 0.4%, and has been below 0.1% since 2015. Git had zero time travelling commits since 2014, with a prior rate below 0.1%. Digging into the raw data I notice that many time travelling commits were generated by the same pair of accounts. For Kubernetes, 78% were authored by [email protected] and merged by [email protected] , although these were only one second in the future. These appear to be due to the “Kubernetes Submit Queue”, where the k8s-merge-robot authors a commit on one system and the merge happens within GitHub. For Ruby, 89% were authored by the same user and committed by [email protected] with an offset near 30 seconds. I attempted to correct for these biases by deduplicating commit-author pairs, but the remaining data points were too sparse to perform meaningful analysis. Time travelling usually reaches its peak two to four years after a project adopts source control, ramping up before, and generally falling after. This hints at a project management related cause to these spikes. I’ll speculate that this is due to developers initially using Git cautiously as it is new to them, then as they get comfortable with Git they begin to build custom automation systems. These new automation systems have bugs or lack well-synchronized clocks, but these issues are addressed over time. I don’t think I can make any conclusion from this data about system clocks being better managed over time. This data doesn’t support my expectation that erroneous timestamps would reduce over time, and I’ll call this a “negative result”. There’s too many challenges in this data set. This analysis explored timestamps impacted by suspected mis-set clocks. HTTP scanning found that 1.7% of domain names had a Date header mis-set to the future. Web server offsets strongly matched a power-law distribution such that small offsets were by far the most common. Git commit analysis found up to 0.65% of commits (Linux, 2009) had author timestamps in the future, relative to the commit timestamp. No clear historical trend was discovered. Timestamps with huge offsets were detected. The largest Linux commit timestamp was in the year 2085 and the largest HTTP Date header was in the year 2027. This shows that while small timestamps were most common, large errors will occur. Many underlying causes were proposed while analyzing the data, including timezone handling errors, date format parsing errors, and timestamps being overwritten by automated systems. Many data points were caused by the same group, like IP address blocks used by many domains or Git users (or robots) interacting with multiple commits. Deduplicating these effects left too few data points to perform trend analysis. Synchronizing computer clocks and working with timestamps remains a challenge for the industry. I’m sure there are other data sets that support this kind of measurement. If you’ve got any, I’d love to hear what trends you can discover! How often are computer clocks set to the wrong time? How large do these offsets grow? Can we model clock offsets, and make predictions about them? Are out-of-sync clocks a historical concern that we’ve largely solved, or is this still a concern? Clock skew : the rate at which a clock deviates from a one-second-per-second standard, often measured in parts per million Clock offset : the difference between the displayed time and Coordinated Universal Time (UTC), often measured in seconds

0 views

Discovering the indieweb with calm tech

When social media first entered my life, it came with a promise of connection. Facebook connected college-aged adults in a way that was previously impossible, helping to shape our digital generation. Social media was our super-power and we wielded it to great effect. Yet social media today is a noisy, needy, mental health hazard. They push distracting notifications, constantly begging us to “like and subscribe”, and trying to trap us in endless scrolling. They have become sirens that lure us into their ad-infested shores with their saccharine promise of dopamine. How can we defeat these monsters that have invaded deep into our world, while still staying connected? A couple weeks ago I stumbled into a great browser extension, StreetPass for Mastodon . The creator, tvler , built it to help people find each other on Mastodon. StreetPass autodiscovers Mastodon verification links as you browse the web, building a collection of Mastodon accounts from the blogs and personal websites you’ve encountered. StreetPass is a beautiful example of calm technology . When StreetPass finds Mastodon profiles it doesn’t draw your attention with a notification, it quietly adds the profile to a list, knowing you’ll check in when you’re ready. StreetPass recognizes that there’s no need for an immediate call to action. Instead it allows the user to focus on their browsing, enriching their experience in the background. The user engages with StreetPass when they are ready, and on their own terms. StreetPass is open source and available for Firefox , Chrome , and Safari . Inspired by StreetPass, I applied this technique to RSS feed discovery. Blog Quest is a web browser extension that helps you discover and subscribe to blogs. Blog Quest checks each page for auto-discoverable RSS and Atom feeds (using links) and quietly collects them in the background. When you’re ready to explore the collected feeds, open the extension’s drop-down window. The extension integrates with several feed readers, making subscription management nearly effortless. Blog Quest is available for both Firefox and Chrome . The project is open source and I encourage you to build your own variants. I reject the dead Internet theory: I see a vibrant Internet full of humans sharing their experiences and seeking connection. Degradation of the engagement-driven web is well underway, accelerated by AI slop. But the independent web works on a different incentive structure and is resistant to this effect. Humans inherently create, connect, and share: we always have and we always will. If you choose software that works in your interest you’ll find that it’s possible to make meaningful online connections without mental hazard. Check out StreetPass and Blog Quest to discover a decentralized, independent Internet that puts you in control. Edward Armitage: The Siren (1888)

0 views

Oops, my UUIDs collided!

This post is part of a collection on UUIDs . Universally Unique Identifiers (UUIDs) are handy tool for a distributed systems architect. The provide a method by which a distributed system can generate IDs without meaningful risk of duplicates. These tools are very widely used and do their job quite well. This post describes instances where UUID generation fails to provide uniqueness, known as a UUID collision. This mystical event is mathematically so unlikely that you can often dismiss it in a hand-wave, yet collisions occur. This post provides specific real-world examples of collisions and explains what went wrong. When using UUIDv4, you need to be sure that your random number generator is working properly. If you use a weak source of entropy, you’ll harm your collision resistance. The UUID spec indicates that you SHOULD use a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG) to mitigate this concern. But it allows fallbacks when a CSPRNG is not available. The JavaScript standard includes Math.random(), a simple random number generator. Math.random() is not a secure random number generator and should not be used in security sensitive contexts. But the quality of Math.random() output can be surprisingly poor , making it especially unsuitable for use in UUID generation. There are several different JavaScript runtimes and each can implement Math.random() differently. This article describes collisions of randomized ID (although not UUIDs) when using the MWC1616 implementation in the V8 implementation of JavaScript. The post describes real-world collisions and highlights how bad random number generators can be. Thankfully, V8 has since switched xorshift128+, which produces better randomness. A UUID implementation that was vulnerable to this issue was the JavaScript uuid library (I’ll call it uuidjs to avoid confusion). uuidjs release before 7.0 would use a CSPRNG when available, but fall back to Math.random() otherwise. This concern was disclosed as a security vulnerability (CVE-2015-8851) and the fallback was removed. But uuidjs users experienced an even worse class of collision. GoogleBot, a JavaScript enabled web crawler, is known to use an implementation of Math.random() that always starts from the same seed. This is an intentional design decision by Google so that the crawler won’t consider client-side dynamic content as a change to the underlying page content. Some users of uuidjs found that GoogleBot was sending network requests containing colliding UUIDs . If you search Google for the UUIDs listed in the bug report you’ll find a diverse set of websites are impacted by this issue. UUIDv4 5f1b428b-53a5-4116-b2a1-2d269dd8e592 appears on many websites If you search for this UUID on other search engines you may only see the uuidjs issue (and perhaps this blog post). This specific UUID is an artifact of how Google indexes web pages. In summary, you may experience UUID collisions if your random number generator is a poor source of entropy. Real world random number generators can be comically broken. I accidentally experienced a UUID collisions when I was an intern. I was writing some C++ code that defined a couple COM objects . Each COM object needs to have a unique class ID (CLSID) and Microsoft uses a UUID for this (note: Microsoft calls them GUIDs). The natural thing to do when creating yet another COM object is to copy the source code of an existing one. I copy/pasted some code and forgot to change the CLSID, resulting in a collision. Forgetting to change a hard coded UUID is a common issue, and not just for interns. Users have found BIOS UUID collisions for the ID “03000200-0400-0500-0006-000700080009”. The issue appears to be a hardware vendor that ships devices with this hardcoded UUID with the expectation that OEMs will change it. The OEM doesn’t change it, and users experience UUID collisions. If you reuse a UUID, you’re obviously going to have a collision. What if we introduce an adversary to the system? If you accept UUIDs from outside your sphere of trust and control then you may encounter UUIDs that are generated with the intent of collision. As my internship example shows, the attacker doesn’t need to do anything complicated, they just send the same UUID twice. Any client-side generation of UUIDs is at risk of this class of collision. As always, use caution when handling untrusted data. Unfortunately, UUIDv3 and UUIDv5 have not aged well. These get their collision resistance entirely from cryptographic hash functions and the underlying functions have long been broken. Historically, it made sense to think about MD5 and SHA-1 hashes as unpredictable values and you could model their collision resistance as random sampling (the birthday paradox again). But once collisions could be forced, it was no longer safe to model them in that way. A malicious user who can control the inputs to these hash functions could trigger a collision. Since the UUIDv3 and UUIDv5 algorithms simply append the namespace to name, it’s trivial to generate UUID collisions from existing hash collisions. I haven’t seen an example of this being demonstrated, so here goes. UUIDv3 collision example This prints: UUIDv5 collision example This prints: Credit goes to Marc Stephens for the underlying MD5 collision and the authors of the SHATTERED paper for the underlying SHA-1 collision. UUID collisions are a fun topic because the first thing you learn about UUIDs is that they are guaranteed to be unique. Looking at how UUIDs can collide in practice is a good overview of the sort of problems that pop up in software development. Broken dependencies, error-prone developers, hard-coded values, weak cryptography, and malicious inputs are familiar dangers. UUIDs are not immune.

0 views

Why UUIDs won't protect your secrets

This post is part of a collection on UUIDs . Indirect Object Reference (IDOR) occurs when a resource can be accessed directly by its ID even when the user does not have proper authorization to access it. IDOR is a common mistake when using a separate service for storing files, such as a publicly readable Amazon S3 bucket. The web application may perform access control checks correctly, but the storage service does not. Here’s vulnerable Django code which allows a user to view their latest billing statement: While Django ensures the user is logged in and only provides them with bills they own, S3 has no concept of Django users, and performs no such authorization checks. A simple attack would start from a known URL and increment the bill ID: The attacker can keep trying bill IDs, potentially accessing the entire collection of bills. What if we changed the Django model to use UUIDs for the primary key instead of an auto-increment? The new URLs will look like: my-bucket.us-east-1.s3.amazonaws.com/bill-9c742b6a-3401-4f3d-bee7-6f5086c6811f. UUIDs aren’t guessable, so the attacker can’t just “add one” to the URL to access other user’s files, right? Unfortunately, this is only a partial fix. Even when URLs are unguessable, that doesn’t mean an attacker can’t learn them. A classic example starts with a former employee who used their personal computer for work. Hopefully their user account was quickly disabled, blocking them from accessing the company’s web application. But sensitive URLs may still exist in their browser history. Even a non-technical attacker can pull off this attack, just by clicking through their browser history. Thankfully, many companies require employees to use company-issued devices when performing work, so this attack may be limited to former employees who violated that rule. The accidental leaking of URLs is probably a more reasonable concern. For example, if only managers are authorized to view bills you need to be careful not to leak the bill ID in other views where other employees have access. If you use secret UUIDs, think of them as toxic assets. They taint anything they touch. If they end up in logs, then logs must be kept secret. If they end up in URLs, then browser history must be kept secret. This is no small challenge. Another concern for leaked UUIDs is rotation. Whenever a secret key is compromised, leaked, or known to have been stored improperly, it should be changed. The same holds true for secret URLs. Make sure you have a way to rotate secret URLs, otherwise you may end up stuck in a compromised state. Again, no small challenge. If this sounds like a huge pain… it is. Let’s find a better solution. The best approach is to ensure every request for sensitive data is authorized. One fix is to route file access through the web application. Continuing our example, the user would access /api/bill/100 and the file would be streamed from the storage through the web app to the user’s browser. If the user tries to access /api/bill/101, where they lack authorization, the web application can deny the request. Make sure the storage bucket is private, such that access must route via the web app. This approach is a good quick fix, but there are other approaches to consider. If your storage provider is Amazon S3 you should consider pre-signed URLs . These URLs allow the browser to download the file directly from S3, without streaming through the web app. The URL contains a cryptographic signature with a short expiration date. These URLs are still sensitive, but the short expiration mitigates a number of concerns. Again, make sure the storage bucket is private. A key benefit of the pre-signed URL approach is that it offloads file access from your web application, reducing load on the application server. Let’s consider a well-known application that doesn’t follow this advice. YouTube, a popular video hosting service, allows uploaders to mark videos as “unlisted”. This is a compromise between public and private. The owner of the video can copy their video’s URL and share it out-of-band, like in a private chat room. This way, people in the private chat room can view the video, but the owner doesn’t need to grant them access one-at-a-time and the viewers don’t need to log in. In essence, anyone who knows the URL is considered authorized from YouTube’s perspective. YouTube visibility selection This approach uses unguessable URLs, which contain a random video ID, like . This appears to be 11 random alphanumeric characters, which offer around 64 bits of entropy. This is suitably unguessable, but the security is questionable. Once the URL is shared with others, the owner loses the ability to assert access control over the video. An authorized viewer can choose to share the URL with others. Users may expect that the video has proper access control restrictions and share the URL in a public-facing document, not realizing that leaking the URL leaks the video. Consider unlistedvideos.com, an index of unlisted YouTube videos. Users who discover unlisted videos can upload those URLs to the site, thus leaking the content to a broad audience. The large number of videos listed on the site shows the poor access control properties afforded by this access control method. If your unlisted content leaks to unauthorized viewers, you can regain control by marking the video as private. This prevents anyone from accessing the video, until you grant their account access. Of course, you probably chose to make the video unlisted to avoid needing to manage individual account access. You could also try re-uploading the video, marking it as unlisted, and sharing the new link, but the risk of a subsequent leak remains. Another example of this design appears later in this blog post, AWS billing estimates. AWS appears to use 160 bits of entropy to protect these URLs. Here’s the verbiage AWS uses when you create a share link. AWS billing share dialog Interestingly, I’m not seeing a way to delete a billing estimate once shared. The creator appears to lose all ability to manage access once the link is shared outside their sphere of control. Be very careful not to put sensitive data in your billing estimates. Unlisted content is an example of IDOR as an intentional security design. The uploader is expected to decide if unlisted offers the right security posture for their content. There are use cases where the effort needed to individually grant users access outweighs the risk of using unlisted. Not everyone is dealing in highly sensitive content, after all. OK, maybe you want to create something like YouTube unlisted content, despite these concerns. In that case, we should ignore security concerns related to “leaked URLs” as that is “by design”. Unlisted URLs are sort of like bearer tokens or API tokens which grant access to a single resource. Let’s focus on attacks that guess URLs and consider how guessable UUIDs actually are. UUIDv4 contains 122 random bits, much more than the 64 bits of a YouTube video ID, so there’s little to contest about UUIDv4 guessability. But what about newer formats like UUIDv7? UUIDv7 embeds a timestamp at the start such that the IDs generally increase over time. There’s some claimed benefits, such as improved write performance for certain types of databases. Unfortunately, the timestamp makes UUIDv7s easier to guess. The attacker needs to figure out the timestamp and then brute-force the random bits. Learning the timestamp may not be that difficult: users sometimes have access to metadata for resources they don’t have full permission to access. In our “latest bill” example, the bills are probably generated by a batch job kicked off by cron. As such, the bills are likely created one after another in a narrow time period. This is especially true if the attacker has the UUID of their own bill as a reference. An attacker may be able to guess a small window around when the target object’s UUID was created. Other UUID generation methods recommend creating UUIDs in large batches and then assigning them to resources, in order, as resources are created. With this approach, the UUID timestamp is loosely correlated with the resource creation timestamp, but doesn’t contain a high precision timestamp for the resource creation. This mitigates some classes of information leakage related to timestamps. Unfortunately, it also bunches UUIDs together very tightly, such that many IDs will share the exact same timestamp. Learning one UUID leaks the timestamp of the entire batch. At first glance, the random bits seem to save us. There are still 74 random bits in a UUIDv7; still more than a YouTube video ID. That’s 2 74 possible random suffixes (18,889,465,931,478,580,854,784). Well beyond what an attacker can reasonably brute-force over the Internet. I would end the blog post here, but UUIDv7 offers additional optional methods which we need to consider. The spec allows monotonic counters to be used when multiple UUIDs are created within the same timestamp. This ensures that IDs created by a single node are monotonically increasing, even within a single millisecond. The first UUID in a given timestamp uses a randomized counter value. Subsequent IDs in the same millisecond increment that counter by one. When the counter method is used, an attacker who learns one UUIDv7 can predict the counters of neighboring IDs by adding or subtracting one. A random suffix still exists, and that would still need to be brute-forced. Of note for Django users, Python 3.14 introduced UUIDv7 in the standard library. Python uses a 42-bit counter , which is the maximum width the spec allows. That means Python’s UUIDv7 only has 32 random bits, offering only 2 32 possible random suffixes (4,294,967,296). Four billion seems like a big number, but is it large enough? On average, this is 1,657 request per second averaged over a month. Is that possible? S3 claims it will automatically scale to “at least 5,500 GET requests per second”. On the attacker side, HTTP load testing tools easily scale this high. k6, a popular load testing too, suggests using a single machine unless you need to exceed 100,000 request per second. The attack fits within the systems limits and appears feasible. Adding a rate limiter would force the attacker to distribute their attack, increasing attacker cost and complexity. Cloud providers like Amazon S3 don’t offer rate limiting controls so you’ll need to consider a WAF. This changes the user-facing URL, so adding a WAF may break old URLs. There’s cost asymmetry here too. An attacker who guesses 2 32 S3 URLs will cost your service at least $1,700 on your AWS bill . If you don’t have monitoring set up, you may not realize you’re under attack until you get an expensive bill. The attackers cost could be as low as a single machine. I’m uneasy about the security here, as the attack appears technically feasible. But the attack doesn’t seem very attractive to an attacker, as they may not be able to target a specific resource. An application that had juicy enough content to be worth attacking in this way would probably worry about “URLs leaking”. In that case, unlisted URLs are a poor fit for the product and the fixes listed earlier should be used. Which renders the entire point moot as you should never end up here. But it’s not an entirely theoretical concern. If you search on GitHub, you can find examples of applications that use UUIDv7 IDs and the “public-read” ACL. The sensitivity of the data they store and the exact UUIDv7 implementation they use varies. Nevertheless, 32 random bits is too small to be considered unguessable, especially for a cloud service like S3 which lacks rate-limit controls. A common theme of UUIDv7 adoption is to avoid exposing the IDs publicly. One concern driving this trend relates to IDs leaking timing information, which can be sensitive in certain situations. A simple approach uses a random ID, perhaps UUIDv4, as the external ID and UUIDv7 as the database primary key. This can be done using a separate database column and index for the external ID. Another intriguing approach is UUIDv47 which uses SipHash to securely hash the UUIDv7 into a UUIDv4-like ID. SipHash requires a secret key to operate, so you’ll need to manage that key. Unfortunately, rotating the key will invalidate old IDs, which would break external integrations like old URLs. This may prevent systems from changing keys after a key compromise. Caveat emptor. Either of these approaches could help in our “unlisted URLs with UUIDv7” example. Postgres currently uses the “replace leftmost random bits with increased clock precision” method when generating UUIDv7 IDs. Postgres converts 12 of the random bits into extra timestamp bits. This means Postgres UUIDv7 timestamps have nanosecond granularity instead of millisecond. As such, Postgres UUIDv7s have 62 random bits, in the current implementation. So when it comes to UUIDv7 guessability, it really depends on what optional methods the implementation chooses. Be careful when adopting newer UUID versions as the properties and trade-offs are distinct from earlier versions. The authors of UUIDv7 knew about these guessability concerns and discuss them in RFC 9562. The spec offers a “monotonic random” counter method, which increments the counter by a random amount instead of one. While their solution would help mitigate this attack, I wasn’t able to find an implementation that actually uses it. RFC 9562: Universally Unique IDentifiers (UUIDs) (2024) Python uuid.uuid7 100,000,000 S3 requests per day k6 load generator Postgres UUIDv7 generator

0 views

The UUID collection

I’ve been getting back into blogging and am happy to share that my next group of blog posts will be a collection. When I write I often end up with a massive amount of content. I have a hard time keeping posts focused on a single theme; writing is thinking and there’s just so many fun angles to ponder! As a post is polished for publication, I trim sections to the “cutting room floor”. This time I had trouble letting go, and I spun a couple blog posts out. Presented here in no particular order and on no particular schedule. This collection covers UUIDs, especially collisions, guessability, and implementation quirks. Why UUIDs won’t protect your secrets : UUIDs and Indirect Object Reference

0 views

The most popular email providers

I downloaded the Tranco list of top domain names and ran DNS MX lookups to detect mail servers. I used the top 100,000 domain names, which should be a reasonably sample of large and popular sites. I found that 72% of the scanned domains had a mail server configured (MX record was present). Here are the most popular email hosting platforms, as of August 2025. I’ve aggregated by the second-level domain name of the MX records, then truncated to providers supporting at least 25 of the scanned domain names. Google and Microsoft grab the top spots, acting as email provider for about 60% of the email-enabled domains analyzed. A diverse group of hosting providers, registrars, email and security products form the long-tail. The scanning code is available on GitHub

0 views

Choosing Vim over VSCode

You’ve probably noticed that VSCode is very popular among programmers. As I drop into a Vim session, yet again, I wonder if I’m missing something. What keeps me coming back to Vim? Here’s the roughly same view as seen in VSCode versus Vim. I’m working on a python file (sql.py) which is reading some content written by a go file (sql.go) from another project. This is exploratory code for a project I’ve written about before . I have a SQLite shell open so I can explore the schemas and table content. And I usually keep an extra terminal open for one-off commands. It took me a couple tries to make a screenshot that was fair to VSCode. Initially, I had a terminal on the bottom of two side-by-side editor views. This left tons of white space at the ends of lines and made the terminal tiny. I had to look online to figure out how to move my VSCode buffer. I needed to click on “Terminal” and then a hidden menu would open. One of the alleged benefits of using an IDE like VSCode is the low learning curve and mouse-based controls, but that falls apart when things are hidden. Even after spending a couple minutes trying to size things, VSCode is still showing less information: The Vim screenshot even shows that I have another tab of my terminal editing my blog (using Vim). The density is much better, and much easier for me to control. You may have noticed that VSCode is complaining about errors in my Go code. VSCode is trying to be smart, so it’s linting my Go. This could be a helpful feature, but it’s confused about my workspaces. VSCode can’t figure out that ../feed2pages-action/sql.go uses ../feed2pages-action/util.go. So now I have these squiggly lines all over my code, because VSCode is wrong. Perhaps I should open two windows, one for each project, and put them side by side? This makes me wonder if the trend towards mono-repos is driven partly by people fighting with VSCode. I also notice that there are some badges on the left side of the screen trying to catch my attention. What could be so important? Ah, Microsoft wants me to restart VSCode for some updates. No thanks… I’m trying to write code. Writing code takes a lot of focus, eliminating noise is really important to me. I’ve built up a ton of muscle memory around Vim commands. So installing Vim keybindings is my go-to when ever I try a new IDE. This keeps me sane as I can and as with Vim proper. But the Vim plugin is always some weak subset of Vim, or conflicts with built-in IDE hotkeys. I’ve built up a ton of muscle memory around optimizing my views. I like to have a bunch of buffers open with the files I’m working on or referencing. Being able to quickly split a view in a way that makes sense to me is great. If I need to see more of a buffer I’ll it full size. On Vim this works with all buffers, including terminal buffers. But VSCode Vim doesn’t implement these. Editor views can support some Vim resizing commands, but not others. Terminal views don’t seem to support Vim commands at all. This means my terminal and editor views can’t intermix. If I want to resize the terminals, for example, I need to carefully hover over the tiny (three pixel?) border between views and then click and drag. Managing views on the screen is a pain with VSCode. My typical workflow starts by opening a shell. It gives me ready access to open files, check my git status, or use other tools. I’ve done lots of DevOps work where I need to interact with bare-bones remote systems over SSH, so shell command already flow from my fingers. Once I open Vim, I tend to to open a shell and then work from inside Vim. Remote development is where Vim shines. I could try to use VSCode Remote Development, but I wouldn’t want to use that to connect to a “production” system. So, I’m back to using the tools I can find on the system. Knowing Vim is really helpful because it’s almost always installed and it’s miles ahead of other pre-installed editors like Nano. It’s not for me. I’m pretty unimpressed with how LLMs have been marketed. They are an amazing technology, absolutely. But I think they are harmful in a lot of the ways people are trying to use them. A week back I came across a comment mentioning that the poster liked asking “Write a password generator” as an interview question. It’s easy until you realize you should account for archane rules like “no repeating letters”. I gave it to ChatGPT’s GPT-4o, the same model Copilot uses, to see if it could pass the interview. What stood out is that I kept needing to remind it of the rules . Eventually, I gave up as I ran out of GPT-4o credits (and I’m not gonna pay for this). The last output reverted a previous fix yet again. GPT-4o writes code that looks quite decent (especially for “interview coding”), but it really struggled to keep track of requirements and leaned on me to do careful code reviews. A human usually writes better code than what you see in the interview, but this is the best GPT can do. I’d be pretty upset if a junior developer kept sending me code reviews that added and removed previously discussed fixes, never producing all of them together. For a junior developer, I’d tolerate some back-and-forth as I’m training them to improve their craft. But for Copilot? I’m not interested in volunteering to train AI to write code, and the code quality isn’t enough to make it a fair trade. I totally understand the appeal for “boiler-plate” coding, or for people learning how to code. But as an experienced software developer it just slows me down. I’ve seen a number of editors grow popular and then wane. At various times I’ve seen Emacs, Eclipse, IntelliJ IDEA, Atom, SlickEdit, gedit, Notepad++, Sublime, NetBeans, Visual Studio, Xcode, IDLE, PyCharm, Android Studio, and more. Some of those aren’t around any more. I’m not worried about Vim getting eaten by a big tech company, or enshittified to feed advertising or AI ambitions. VSCode seems like easy mode, so I fully understand that people gravitate towards it. Vim has a steep learning curve, and honestly after around 12 years of using it I’m still learning ( to add things to the spell check dictionary is a recent one). I’m glad I invested time in learning Vim; it’s paid off. So I think others would similarly benefit if they started today. The file I’m working on (sql.py) shows 47 lines in VSCode versus 53 in Vim. I’m using the SQLite shell as a primary reference, so I put it in a big buffer in Vim I’m using sql.go as a secondary reference, so I put it in a small buffer in Vim VSCode keeps terminals and code separate, so I can’t optimize my view

0 views

MTA-STS Preload

SMTP MTA Strict Transport Security (MTA-STS) is a mechanism for securing email as it travels between mail servers. Similarly to DANE, MTA-STS signals to the sender that they should use TLS and should validate TLS certificates when sending messages. Without these tools, email is vulnerable to STARTTLS downgrade attacks. MTA-STS offers protection by caching the receiving domain’s policy, if any exists. Once the policy has been cached, the sender will continue to validate TLS certificates for the destination domain, through a “max_age” limit. However, if the policy has not been cached and an attacker blocks the MTA-STS lookup, then the connection remains vulnerable. This means that MTA-STS cannot protect the first message being sent to a domain, and cannot protect against an attacker who persistently blocks the policy lookup. A similar challenge exists on the web. When a user connects to a website and the website presents an invalid certificate (like a self-signed certificate) the browser doesn’t know if it’s safe to continue. Since it’s possible that a self-signed certificate is intentional, the browser asks the user for help. Unfortunately, users aren’t the best at knowing if it’s safe to continue: some will click through the warning, allowing an attacker-in-the-middle to intercept their traffic. The web addresses this problem with HTTP Strict Transport Security (HSTS). When a user connects to a website, the website includes an HSTS header that informs the browser that the website uses HTTPS and that the operators intend to keep their certificate valid. Once cached, the browser will refuse to connect to the website over unencrypted HTTP or when the certificate appears invalid. The user isn’t given an option to proceed as the browser is now confident that there’s a security problem. Unfortunately, web browsers can’t know the HSTS policy of a domain until they see the HSTS header. This means that the first request to a website is vulnerable. Generally, this isn’t a large problem. For many websites, users make many return visits from the same device, so the window of vulnerability is quite small. But there are enough websites with high threat models and specific use cases that prevent HSTS header caching (like a website you only access when setting up a new device). Web browsers address the first-connection vulnerability using the HSTS preload list, which is installed with the web browser. The preload list tracks websites that are well known to support HSTS and ensures that even the first connection is protected by HSTS. There are challenges with the preload list, like it’s size, but it’s a viable solution. Senders who are concerned about the vulnerability of the first message sent to a domain will want additional protection. As part of my project to measure MTA-STS adoption I ended up building a list of domains with support. I published the list in a GitHub repo and created a pull-request based workflow for adding additional domains. The list currently includes almost 3,000 domains. I reached out to Vladislav, the creator of the MTA-STS resolver for Postfix , and he pointed me towards a way to pre-warm the cache. First enable the setting in and then scan the domains with postmap. Here’s an example showing gmail.com being added to the cache (indented for clarity): This approach works great as it double checks if the domain still has MTA-STS support. You can warm your MTA-STS cache with this command, which downloads the latest preload list and processes each domain with postmap: You may want to run this command when setting up a new Postfix server or when enabling MTA-STS support for the first time. The one-liner can also be run as a cron job, if you’d like to keep your cache up to date as the preload list grows. MTA-STS supports policy delegation , where the MTA-STS DNS records use CNAME to point to records hosted by their email provider. Without policy delegation, a domain wishing to enable MTA-STS needs to host their MTA-STS policy document on their own. While a traditional web server could be used, static web hosting providers are also suitable . There are several companies that offer MTA-STS policy hosting: I’d like to see more mail providers add first-party support for MTA-STS policy hosting. It really simplifies adoption. A domain owner can enable MTA-STS by setting two DNS records; without needing to provide their own policy hosting. This would make the complexity of configuring MTA-STS similar to setting up SPF or DKIM records, easing the burden of enabling MTA-STS on a domain. EasyDMARC - easydmarc.pro Red Sift - ondmarc.com Mailhardener - mailhardener.com URIports - uriports.com Sendmarc - sdmarc.net mta-sts.tech - I’m unsure who runs this

0 views

The next stage of getlocalcert.net

Update: In exciting news, the getlocalcert.net project will continue under new management. I’m grateful to William Harrison for taking the lead on future development. Over the next month, I’ll be transferring domains, servers, and other project resources. There may be short periods of downtime during the transition, but users should be minimally disrupted. Please consider sponsoring William to support this next stage of the project. This post previously claimed the project would be shut down. The original post follows, with references to shut down removed. I started the getlocalcert.net project to explore two key ideas: The answer to both questions has been yes. Here’s some statistics. Since the July 2023 launch, around 900 users logged in with GitHub. Anonymous registration complicated measuring unique users, but I believe 2,000 unique users accessed the service. Those users created 3,500 zones and 450 TLS certificates ( 1 , 2 ). Around 370 of those were issued by Let’s Encrypt and 70 by ZeroSSL. The longest active subdomain was from the original launch, July 2023 . In all, 17 subdomains were were actively renewing their TLS certificates. It’s difficult to know exactly what the subdomains were used for, as they were only used on private networks, but keywords in the names provide some hints: I made signup as frictionless as possible, so 20% of users reaching the marketing page logged in with GitHub. But issuing a TLS certificate requires installing an ACME client, which requires more effort, and many users didn’t get that far. Since the project was focused on private domain usage, there was no need to support any public IP address ranges. Without public IP addresses there was little opportunty for users to host malware, phishing sites, or illegal content. To avoid spam email from these domains I configured PowerDNS to publicly host some default records , like a null MX record, a null DKIM, and an empty SPF list. This approach proved to be extremely effective. I was able to keep anonymous subdomain registration open, even without CAPTCHAs. Are public CA-issued certificates useful on private networks? Can I offer free and anonymous subdomain registrations without fighting spam?

0 views

Is email confidential in transit yet?

When I’ve talked to developers about the confidentiality of email in transit, between mail servers, I usually hear one of these responses: Which is it? In this post, I explore the current state of server-to-server transport encryption and examine the confidentiality challenges we still face. There’s a lot of areas to consider here, so I want to start by refining the scope. Email travels quite a bit: from the author of the message’s device to their mail server, between mail servers, and finally to the recipient’s device so they can read it. I’m focusing solely on the confidentiality of messages as they transit between mail servers. I won’t be covering: Google publicly tracks the volume of unencrypted email they send. As of 2024, they cite that 2% of the email they send is sent unencrypted. Similarly, Cloudflare reports that 6% of the email they receive is received unencrypted. These messages are vulnerable to passive eavesdropping. This contradicts the notion that everyone uses TLS so we’ve got to dig in further. Here’s the worst offenders, by volume, according to Google: Many of these domains are operated by financial institutions, or telecoms. If you decided to require TLS you’d be unable to send mail to the organizations on the right. Looking at the list, you may not know any of these companies, so maybe this doesn’t seem like a problem. But any large email provider sees a meaningful volume of unencrypted outbound email, so “mandatory TLS” still isn’t a reasonable default policy. While the progress to encrypt over 90% of email in transit has been a great success, TLS isn’t a complete solution. Most servers use opportunistic TLS as their default policy. In this mode senders blindly accept whatever certificates they receive. It doesn’t matter if the certificate is expired, self-signed, or for the wrong host name: the sender doesn’t verify the certificate. Opportunistic TLS is still a huge step forward, as it prevents passive eavesdropping, but it cannot protect against active attacks. I explored this issue and some of the solutions in a previous blog post . Even when sending servers support DANE and/or MTA-STS, they often need to send mail to domains that don’t. The most common fallback behavior continues to be opportunistic TLS, which doesn’t verify certificates. Most popular mail server software and services support TLS certificate verification as a non-default configuration option, so why not enable it? In 2018, EFF reported that about half of the mail servers supporting STARTTLS used self-signed certificates. There’s lots of documentation that cites widespread use of self-signed certificates, expired certificates, or certificates with mismatched host names. Verifying certificates wasn’t really an option earlier, but what about today? To learn more I scanned Cloudflare’s list of the top 1,000 domain names to: The project code is open source , so you can run your own analysis. Here’s a summary of key statistics: Of the 544 domains supporting email: This is exceptional progress. Unfortunately, I still can’t recommend TLS certificate verification as a default policy, as a small number of domains still lack STARTTLS and CA-issued certificates. MTA-STS and DANE remain the best options for securely authenticating mail servers. To answer this question, I downloaded the larger “top 100,000 domains” list from Cloudflare Radar. I scanned each domain to identify mail servers, DNSSEC support, DANE support, and MTA-STS support. Of the scanned domains, 65,244 supported email (I.E. had MX records). The code for this scanner is also open source. Of the domains supporting email: There’s lots of consolidation of email hosting providers. Here are the top providers seen during scanning: If you want inbound DANE support for your mail, you may need to shop around. Outlook began rolling out inbound DANE support in 2024. Domains need to opt-in to Outlook’s DANE support, so roll-out will take time. For each domain using outlook.com’s mail servers, I checked for TLSA records on the customer subdomain (I.E.: customer .mail.protection.outlook.com). None had DANE support enabled. Looking again at my list of 65,244 domain names: Edit: I had originally missed MTA-STS policy delegation (CNAME). I rescanned the domains and have updated the numbers with around 50 more domains. To support MTA-STS, a mail server needs to have a TLS certificate issued by a public CA. Thankfully, these are easy to find: Before you rush off to enable MTA-STS on your domain, remember that providers can change their TLS configuration. Ask your provider if they are committed to using valid, CA-issued TLS certificates long-term. Ideally, they should document this publicly. qq.com’s mxdomain.qq.com mail server’s certificate currently doesn’t match its host name, but all the other qq.com mail servers use trusted certificates. This issue won’t prevent you from using MTA-STS with qq.com, as the sender would switch to one of the other mail servers. But again, I’d recommend checking if your provider will commit to ongoing use of public CA-issued certificates first. While support for DANE and MTA-STS are both very low, MTA-STS was present on more domains. There isn’t a clear leader, as many of the MTA-STS policies weren’t in enforce mode. Since MTA-STS is a newer technology, 2018 for MTA-STS vs. 2012 for DANE ), MTA-STS adoption appears to be more rapid. The widespread use of public CA-issued certificates means that the majority of domains may be able eligible to enable inbound MTA-STS, without changing mail providers. One of the common responses to concerns about email confidentiality in transit is that server-to-server connections are sufficiently secure. Consolidation of email has lead to a large volume of email being sent between several major providers, like Google’s Workspace and Microsoft 365. Connections between the Microsoft Cloud and the Google Cloud are vastly different than user-to-server connections (where concerns like malicious WiFi routers exist). It seems possible that your email is secure, in practice, because the network routes between servers only includes trustworthy network operators. In 2015, a joint report by University of Michigan, Google, and University of Illinois, Urbana Champaign on STARTTLS stripping offered a chilling overview of observed attacks: Attackers are present. Admittedly, lots of email isn’t sensitive, so securing it provides little marginal value. Most email isn’t even wanted (estimates for spam range from 45% to 85% of all email). What if we drill down into messages that are obviously sensitive? Consider password reset emails. Email-backed accounts are extremely common on the web and an attacker could perform account takeover if they intercept password reset emails. I tested several services and found the same result: they don’t require TLS when sending password reset emails. One of the most sensitive services I can think of that uses password reset emails is Amazon AWS, so let’s consider their approach. I spun up a test mail server, disabled TLS, and signed up for an AWS account. I then clicked through the password reset flow a couple times. AWS always sent the password reset email in cleartext, without any encryption. Looking at the email headers, AWS used it’s own Amazon SES to deliver the password reset email. SES supports the TLS policy , but it’s not being used here. This leads me to believe that AWS chose not to require TLS for these sensitive messages. If you’re scratching your head, remember that multi-factor authentication (MFA) mitigates this issue. Amazon “strongly recommends” MFA for the root account. AWS has numerous high-quality MFA options, so I don’t think there’s a meaningful account takeover risk here… as long as you use MFA. I want to emphasize, AWS is not alone here. I couldn’t find a service that required or verified TLS for password reset emails. Knowing the history of email security this isn’t surprising, but at some point, I hope this would change. While the number of servers supporting TLS and server authentication has risen greatly, the number of senders requiring and validating TLS certificates is still very low. Adoption of DANE and MTA-STS are also low. Even seemingly high sensitivity email, like AWS root account password reset emails, remain vulnerable to 2002-era downgrade attacks. We can do better. If you run a mail provider that supports multiple domains, consider centrally hosting the MTA-STS policy server for your customer’s domains. You’ll need to issue certificates (likely using ACME HTTP-01) for each connected customer domain. This would further simplify the MTA-STS set up process (add an A record and a TXT record), bringing the overall complexity for customers in line with setting up DKIM and SPF. If you run a mail server, make sure you have a TLS certificate that supports server authentication. Consider enabling DNSSEC/DANE and MTA-STS for both inbound and outbound email. If you accept mail on your domain, consider adding inbound support for MTA-STS (if your mail provider can support it) and TLS-RPT . Jean’s MTA-STS guide is a great starting point. Finally, you may add your domain to the MTA-STS cache warming list . Investigate your logs to see what behaviors are present. How much of your email is encrypted? Can you find any evidence of downgrade attacks? How much mail would be impacted if you changed your TLS policies? If you use a hosted email provider, find out their transit security policy. Prompt them to adopt DANE or MTA-STS. Encourage them to report statistics about how many unencrypted messages they send and receive. Email should be confidential. It’s going to take more work to protect messages in transit. One challenge was deciding which CAs should be considered trusted. I used the list installed by Debian’s ca-certificates package . CA trust is a really important concern and there’s a variety of different trust stores you could pick, each of which contain some differences. I’m not sure if I picked the “best” trust store for this measurement, but any popular trust store was probably sufficient. Conversely, mail servers should select a CA that is widely trusted, such that any sender will be able to validate their certificate. The test server I used when checking AWS’s password reset emails was MTA-STS test system “B” described in an earlier blog post. This mail server had MTA-STS enabled, so senders supporting MTA-STS should not send it unencrypted email. As Amazon SES doesn’t support MTA-STS, the AWS password reset email was delivered anyway. Another experiment I ran considered if CAs require TLS certificates when using email-based domain control validation (DCV). They don’t . Everyone knows email isn’t secure While email is vulnerable, hop-to-hop connections between servers are secure enough Email is secure because every modern mail server uses TLS Message integrity (DKIM) User submission and retrieval of messages Denial of service and other attacks End-to-end message encryption (S/MIME and PGP) identify mail servers (when present) check for STARTTLS support; and check if the certificate was issued by a public CA 1,000 domain names checked 544 domains had MX records 99.3% had STARTTLS support (540 domains) 94.1% used valid certificates issued by a public CA (512 domains) 8% supported DNSSEC (5436 domains) 0.9% supported DANE (564 domains) 1.2% supported MTA-STS (792 domains) 0.7% used MTA-STS in ’enforce’ mode (415 domains) “in seven countries, more than 20% of all messages are actively prevented from being encrypted” “We identify 41,405 SMTP servers in 4,714 ASes and 193 countries that cannot protect mail from passive eavesdroppers due to STARTTLS corruption on the network.” “96% of messages sent from Tunisia to Gmail are downgraded to cleartext”

0 views

TLDs with novel behavior

ICANN recently reserved .internal for private use , sanctioning the use of the TLD for ad-hoc purposes. The decision solidifies .internal for this role, which it has long supported, albeit on unofficial capacity. The reservation was important as previous use was not sanctioned and was on shaky ground. Consider what happened to the .dev TLD. In 2017, programmers who used .dev for their internal development networks were shocked to find that their browsers suddenly required HTTPS . Google had registered .dev as a gTLD and enabled HSTS preload for the entire TLD. Realizing that their usage was akin to squatting, they had little choice but to migrate to new domain names. ICANN’s reservation of .internal protects the TLD from a similar fate. The modern web runs on HTTPS, and internal networks are no exception. Generating TLS certificates for .internal domains is fairly easy: The hard part is getting all the relevant devices and software to trust those certificates. System imaging and other provisioning tools are frequently used to pre-load the CA into to the numerous trust stores. Unfortunately, the provisioning process can be quite complicated and many organizations struggle here. In bring your-own-device environments, or when vendors and contractors connect with their own systems, the burden of updating trust stores falls to the end user. In many cases, incomplete rollout of the private CA leads to users clicking through certificate warning messages when connecting to internal sites. Another challenge of private CAs is that they are often able to issue certificates for all domain names. This is a huge security concern for any application trusting the private CA and a reason end users may avoid installing a private CA, if given the option. It’s sometimes possible to constrain private CAs, but you’ve got to do it carefully . First, be sure to use the name constraints extension to restrict your CA to a small domain subtree, like . You may need to switch to different CA generation software, as name constraint support is occasionally missing . Second, make sure the client software you’re using actually supports name constraints. Client-side support for name constraints has been growing, but it’s an optional extension, so it’s perfectly reasonable for software to ignore it. Private CAs are a pain to work with. If you run your internal network under a delegated TLD, like .com, then you can get a TLS certificate from a public CA. The process of getting a certificate from a public CA is easy, great automation tools exist, and it often doesn’t cost any money. You won’t be able to use the ACME HTTP protocol (which requires making your server publicly accessible, at least briefly), but the ACME DNS protocol works great on internal systems. Using a public CA is also transparent to the end user: their device trusts the public CA out of the box. If you already own a domain name then you can run your internal network off a subdomain, like internal.example.com, although you can register another dedicated domain. There are some free subdomain registration services, but domain names are cheap enough that it’s probably best to register your own. One of the biggest arguments against using public CAs for private networks is that the certificates you register end up in public certificate transparency logs. This means that anyone can list your internal host names. Consider these: That’s a little awkward. There are some mitigations, like using obscure names or wildcard certificates, but this is a problem worthy of careful consideration. A year ago, I built the getlocalcert.net service to explore and promote the use of public CAs for private networks. The service offers free subdomains, but constrains usage to private networks. I specifically focused on private networks as it dodges virtually all concerns of malicious use: it’s not possible to publicly host malware, illegal content, or to send spam with these subdomains. This narrow focus has allowed me to keep registration free and open. The getlocalcert service exposes some limited information on the public internet. The TXT record is available through public DNS, allowing certificate issuance via the ACME DNS verification method. This means that our subdomain are only usable for private/internal purposes, while still supporting public CAs. One limitation of getlocalcert is that it’s implemented as a subdomain registration service. As I mentioned earlier, it’s probably better to register your own domain name than to use someone else’s free subdomains. While our inclusion on the public suffix list blurs the line a little, getlocalcert is still only offering subdomains. But what if getlocalcert had it’s own gTLD? ICANN allows anyone to apply for a gTLD , although it’s a complicated process and costs over $200,000 in fees . There’s lots of activity in this space with almost two thousand applications currently tracked by ICANN. There’s several potentially suitable options, like .private. Users could register domains like example.private and my-house.private, which they’d operate on their private networks. Unlike with .internal, they’d be able to prove they uniquely own their domain name, so public CAs would be able to issue certificates. This approach could have minimal impact to existing use, especially if domain-wide settings like HSTS preload are not enabled. Most of the new gTLDs appear to be focused on vanity. Domain names like example.cool and example.discount aren’t functionally different from example-cool.com or example-discount.net. But we certainly could have TLDs that are functionally different. Presumably ICANN would reject a TLD that breaks too many norms, but a TLD serving a niche through constrained operation I won’t be pursuing a gTLD for getlocalcert, but the idea has been bouncing around in my head for a while now. make up a domain name, no registration needed then generate a self-signed certificate or create your own private certificate authority (CA) internal.office.com internal.espn.com internal.amazon.com internal.microsoft.com internal.baidu.com

0 views

SMTP Downgrade Attacks and MTA-STS

In this post, I audit several prominent mail providers to discover how they handle email encryption and show how MTA-STS can help improve email security. When SMTP was created it was cleartext only, as we hadn’t yet figured out transport layer security (TLS). When TLS was finally ready, we needed a way to phase TLS in. STARTTLS was created and offered opportunistic encryption. Basically, a mail sender could ask the destination mail server: “Do you support encryption?” If the reply was positive, then a TLS session would be established using the certificate the server provided. If not, then a cleartext SMTP session would be used. Anyone who’s studied network security will see a problem here. An active attacker-in-the-middle (AitM) can inject their own response, claiming that encryption isn’t supported and tricking the sender into using cleartext, and allowing the attacker to eavesdrop on the message. This is a classic downgrade attack. Even when the receiving mail server presents a TLS certificate, troubles abound. Consider the options a sending mail server has when it is presented with a TLS certificate it doesn’t trust. Maybe the hostname doesn’t match, it’s expired, or it’s signed by an unknown certificate authority (CA). Most mail senders chose the first option as it protects against passive AitM and ensures email is delivered. DANE’s TLSA record offers one possible improvement which leverages signed DNS records. Unfortunately, DNSSEC adoption has been slow. Measurement studies show that around 5% of domains currently use DNSSEC. Several large email providers like Gmail do not support DNSSEC . As such, other options are being considered. MTA-STS provides a way for mail servers to indicate that they will support encryption using a TLS certificate issued by a trusted certificate authority (CA). The policy includes a parameter that tells the sending mail server how long it should remember the policy. I won’t get into the full details of how MTA-STS works, as it involves several steps and is well documented elsewhere. I stood up a pair of Postfix mail servers and configured them with a catch-all email address and a mailbox_command that logs incoming messages to a database. The server A has a TLS certificate issued by Let’s Encrypt, a widely trusted public CA. The server B has TLS fully disabled. Both servers have an MTA-STS policy set to . These servers help me infer the sender policy by seeing which mail servers receive email. The sender cannot distinguish B’s intentionally misconfigured lack of TLS support from an AitM attack. A sender that properly implements MTA-STS should deliver mail to A and refuse to use an unencrypted connection with B. I picked six mail providers for testing. The first group are marketed to support MTA-STS: The second group includes other prominent mail providers, although these do not claim to support MTA-STS: During early testing, I sent an email from Gmail to the audit servers but found that Google delivered the message to both mail servers. Gmail has MTA-STS support, so this was surprising. Upon further research, I found that lazy caching was the problem: … fetch a new policy (perhaps asynchronously, so as not to block message delivery). RFC 8461 §5.1 When testing mail senders I needed to send multiple messages. The first would prime the cache and additional messages would be processed using the cached policy. This unfortunately means the first message sent to a domain could still be vulnerable to downgrade attacks, but this is intentionally permitted by the RFC for performance reasons. Using email for password reset or email verification has long been an industry standard. Magic links that directly log you into an account, avoiding passwords altogether, are also fairly popular. But are those sensitive messages getting delivered without encryption? These sorts of messages are often sent using transactional email providers, but I wasn’t able to find any hosted providers that offered MTA-STS support. It is possible to self-host Postfix and use an MTA-STS extension to do-it-yourself. Here’s the hosted providers I tested: Most transactional email providers support some combination of toggles for enabling TLS and/or certificate verification. These sort of toggles are difficult to enable, in practice, as some mail servers still don’t support TLS and many don’t use valid certificates. Google reports that 2% of the emails they send aren’t encrypted. It’s unclear how many of the encrypted connections used trusted certificates. Requiring TLS and fully verifying certificates would block potential customers, so many websites avoid these settings for business reasons. MTA-STS allows domains to opt-in to TLS verification while still allowing the sender to support mail servers with weaker security settings. This is the best of both worlds. I’ve also included a check for inbound MTA-STS policy, for completeness. Here’s what I found: Surprisingly, Tuta Mail consistently sent the message to both mail servers. I don’t see any requests reaching the MTA-STS policy server, so there’s no indication that the feature has been implemented. Their marketing material clearly mentions MTA-STS support, and the feature is marked as completed in their issue tracker, but perhaps only inbound MTA-STS is supported. Otherwise, MTA-STS support matched product documentation. What happens when you send an email and the message can’t be delivered due to MTA-STS? You’ll receive a message like these indicating that there’s a problem: This timely feedback is critical for helping the user understand what happened to the email they sent. Outlook only notifies the user when the message fully fails, after 24 hours. Awkwardly, this email contains a typo and doesn’t mention that a TLS verification issue prevented delivery. Hopefully, the user experience improves over time. To help others audit MTA-STS, I’m open sourcing the project code and allowing others to use the hosted audit tool (although I don’t plan to keep it online long-term). It uses Docker Compose and assumes DigitalOcean as the hosting provider. Substitute your own domain names and other settings where needed. There are four other postfix servers I haven’t mentioned, which help audit some other related concerns. Check the code for full details. While the audit infrastructure is online you can generate test email addresses and see sender information (not content) for any received email. Messages are being logged, so don’t expect any privacy for messages you send here. Run the audit.sh tool to get started: This shows that Yahoo delivered email to both the A and the B server. If you receive email on your own domain, consider enabling MTA-STS. Increased adoption of MTA-STS will help encourage mail senders to add support. Check with your email provider to learn how you can get started. Here’s the official documentation for the mail providers I’ve tested: Protonmail doesn’t claim to support MTA-STS for custom domains, but others have offered solutions: The general process for enabling inbound MTA-STS is well documented too: Fastmail and Yahoo use certificates from DigiCert, a trusted CA, so they could enable inbound MTA-STS without much work. You should always set up TLSRPT when enabling MTA-STS, so be sure to enable that as well. MTA-STS provides a promising approach to strengthening SMTP security. Unfortunately adoption by major providers is low. The lack of MTA-STS support by hosted transactional email providers exposes the password reset emails of countless websites vulnerable to downgrade attacks and snooping. Everyone should encourage transactional email providers to adopt MTA-STS. Google provides the best user experience for messages that have been delayed or failed due to MTA-STS. Notifying the user about the problem quickly, and providing several updates was very helpful. Implementers should be sure to consider how they communicate MTA-STS induced behaviors to their users. HSTS is a similar technology that helps us secure websites. HSTS uses a preload list which allows web browsers to ship with a list of domain names that are well-known to support HSTS. SMTP used to have the STARTTLS policy list, but this shut down in favor of MTA-STS . Like HSTS, the MTA-STS RFC doesn’t specify which certificate authorities should be used when validating a certificate. The server is promising to use a certificate that the client (I.E. web browser, or connecting mail server) will trust. This centralizes the decision of which CAs to trust in the hands of the popular web browsers (like Chrome) and popular mail providers (like Gmail). Web browsers have rapidly dropped support for CAs after security incidents, so mail servers need to keep track of which CAs the senders trust and adjust when needed. There’s a ton of extra information I’m collecting with this test framework: Future research could build on this foundation. Finally, here’s a TLSRPT report from Microsoft. You can see that I tried a couple different configurations, but Microsoft correctly rejected the connection. Send using the untrusted certificate Downgrading to cleartext; or Refuse to send the message Outlook.com Proton Mail Outlook.com Using Apache Using GitHub Pages TLSRPT - Aggregate reports from mail senders about failed messages HTTP logs showing MTA-STS policy file fetching Logs indicate that Proton Mail uses , hinting that they run a Postfix stack IPv6 support

0 views

One year of getlocalcert.net

Since 2012, Freenom acted as the domain name registrar for several free top level domains including .cf, .ga, .gq, .ml, and .tk. Unfortunately, at the start of 2023, it was pretty clear that Freenom was not doing well. Freenom was sued by Meta for ignoring abuse complaints and quickly halted new registrations . In early 2024, Freenom announced they were exiting the domain registration business . While this is a loss for anyone in the hobbyist and low-cost project space, there was a noticeable impact on phishing . By March 2024, many of the domains registered on these TLDs disappered. Spam and abuse are clearly challenges. Others who offer free subdomains, like FreeDNS at afraid.org , seem to address spam concerns by requiring users to solve captchas on every DNS entry update . These CAPTCHAs are seriously hard: Thankfully, even more options exist , so you can still find a free domain if you need one. Many of these use a GitHub Pull Request approach to manage registrations: One cool thing about this approach is that we can see how the abuse management process works: it’s just more pull requests. Of the ~4,200 domains hosted by .is-a.dev, there were only 15 issues tagged for abuse. That’s a pretty good ratio. I’ve always wanted to run a subdomain registration service but fears of battling spam always changed my mind. A useful approach to building hobbyist projects is to think about the things you want to build (like a domain name registration service) and the thing you don’t want to build (like tooling for fighting spam and abuse). Can you reduce the project’s scope to avoid the latter while still providing enough features to support at least a niche use case? For hobby projects, even a narrow use case will have tons of surface area to work on. You can always increase scope later, if you’d like. In early 2023, watching the fall of Freenom, I decided to build an alternative, but laser focused on a specific use case so as to avoid the spam concerns. getlocalcert.net is a (sub)domain registration service focused on private network use. Users can register up to five free subdomains of or with their GitHub account. We’re compatible with the ACME DNS-01 protocol and Let’s Encrypt. This mean you can get a free globally trusted wildcard TLS certificate for any web services you run. What makes getlocalcert unique is that we don’t host any , , , or DNS records publicly (other than , which points to ). This means you can’t use these domains for hosting websites or email publicly. Instead, you’ll need to host your own DNS records privately on your internal network. The decision to avoid hosting public DNS records was two fold. First, to avoid spam, malware, illegal content, or other questionable content from tainting the domain. I wanted to avoid playing whack-a-mole with take-down requests or needing to plaster the service with CAPTCHAs. Second, to keep the service focused on a single use case. There’s a ton of challenges to tackle with just the narrow scope I was considering. By focusing on a smaller scope, I avoided problems that felt intractable. With such a restricted starting place, you may wonder how getlocalcert is even useful. Here are the use cases I think are well suited. Many people go the private certificate authority (CA) route and use a top level domain like , , , , and others. But private CAs need to be installed on every system that will use the network… which is awkward when your friends come over and don’t want to install your trust root. Others struggle to install the private CAs on mobile devices. With getlocalcert, you can use free Let’s Encrypt certificates, which all your devices already trust. Consider getlocalcert if: If you’re testing HTTPS locally, try a domain, which always points to localhost. This lets your entire DevOps tools run using their own real domain and a trusted certificate, without needing to mess with DNS or private CAs. Consider getlocalcert if: You don’t need to register an account to use this workflow, the “instant subdomain” feature will provide you with a UUID subdomain. You may want a ACME DNS-01 Validation Domain . This is a really cool read, even if you don’t need this approach. Basically, you add a CNAME record that tells Let’s Encrypt (and others) to validate your domain via a “throwaway” domain. If the “throwaway” domain has a better API for updating DNS entries, you enable automation. The best part is that with CAA Records you don’t need to trust your “throwaway” domain’s DNS server. Consider getlocalcert if: There’s a couple tools that provide easy validation domains, including acme-dns (open source, self-hosted) and Certify DNS (commercial). Check these out as well. I had a couple false starts when I started the project. My first pass tried to build something very minimal on top of afraid.org’s FreeDNS. Unfortunately, you’ll usually hit Let’s Encrypt’s rate limits if you try to register issue a TLS certificate with these one of these domains. This made it clear that I needed my own domain names and my own services. I took a hard look at CoreDNS for a while, but ended up choosing PowerDNS as the underlying DNS service. PowerDNS felt more mature, stable, and was quite easy to integrate with. I chose a Django stack to keep development productive and used server-side rendering as I didn’t want to pull out React for this project. I’ll probably reach for Alpine or HTMX if I need more interactivity. Generating TLS certificates with ACME is a complicated process. There’s lots of tools to choose from and a number of different approaches you could take. I spent about half the project effort building out the getting started documentation and validating the steps . I launched on July 11th, 2023 and gathered some interest on social media. Traffic spiked to a peak of 800 unique visits per hour. While the vast majority of these visitors didn’t create an account, I was excited to see that some users made it all the way through the funnel to TLS certificate issuance. I expected a steep drop off in engagement due to the complexity and niche focus, so I considered these results to be a win. So far in 2024, I’ve reached some important milestones. Thousands of domains have been registered, hundreds of certificates have been issued (340 from Let’s Encrypt, 60 from ZeroSSL). Our domain names were added to the public suffix list , so each subdomain is treated equivalently to any traditional domain by any tool that supports the list. I have a small but steady stream of sign ups, so usage is slowly trending upwards. On the operations side, it’s been fairly low maintainance. One breakage occurred due to Python’s PIP installer refusing to break externally managed python . This is a good change as using a venv is a much safer approach, but required Dockerfile changes to upgrade. Thankfully testing caught this issue. The first production outage occurred when upgrading PDNS versions due to a missed database migration. Automated testing didn’t catch this as it uses a fresh database each time which automatically used the newer schema. Downtime was about 45 minutes. Since the localcert.net domains require local DNS resolution, no lookup failures would have occurred. ACME DNS certificate issuance and renewal were impacted, but renewals should have retried successfully after a delay. Maintenance and updates have been quick and painless otherwise. On the feature side, my focus has been elsewhere, so the service is still very much an MVP. When I’m ready there’s a fairly lengthy TODO list of improvements waiting for me. To those who have given getlocalcert a try, thanks for being part of the journey, I hope you’ve built something awesome! If you’d like to share, I’d love to hear about it. you’ve got a private network of computers you run your own internal DNS resolver you want TLS certs on your internal web pages for HTTPS but you don’t want to pay for a domain name, set up a private Certificate Authority, or click-though self-signed certificate warning messages. you’re testing a web service you need to connect to it using HTTPS (sometimes existing client software requires HTTPS) but you don’t want to pay for a domain name, set up a private Certificate Authority, or click-though self-signed certificate warning messages. you have your own domain name you’d like to use ACME DNS-01 for certificate issuance (perhaps for a wildcard cert) but editing DNS entries on your existing DNS service is hard due to missing API support, bureaucracy, etc.

0 views

Moving to Hugo

I wrote my first blog post 10 years ago using Jekyll as a framework. I didn’t love the process. It took quite a bit of work to get something I liked. I felt like I was promised a quick-and-easy solution but found that I was sinking an unexpected amount of time into tweaking things. I recently started blogging again and chose to use plain HTML, without a framework. This ended up clicking for me. I found a small amount of CSS that got me something readable and then focused on writing. Using , , , , , , , , and little else got me enough basic formatting. When I occasionally wanted something more I had all of HTML at my disposal. I’ve done enough web programming that HTML flows from my fingers, so while HTML more verbose than the Markdown equivalent, it doesn’t impact writing speed for me. I have long memorized HTML’s syntax while I need to remember how Markdown does images ( ). Plain HTML has fast cycle times since there’s no build process to drop you out of flow. If you’ve written HTML before then plain HTML blogging has zero learning curve relative to any framework you could choose. This was surprising to me, as HTML seems strictly worse than Markdown for blogging, but it somehow made it easier to focus on content. I think there’s a few key things that made this approach work. For one, I was starting from an empty blog, so I didn’t need to worry about fancy features like tag clouds, pagination, or plug-ins. Navigation would be simple, each post as a link to the homepage, and the home page links to each post in reverse chronological order. I also wasn’t too worried about each post having a consistent style. I adopted an archive-after-publishing mentality, each post would be self-contained with it’s own CSS, and I wouldn’t worry if some old post looked different from the latest. The biggest pain points were keeping things in sync. I had the title, publication date, and other metadata of each post duplicated in three places: the post itself, the homepage, and the RSS feed. This was annoying, but solvable with a little vigilance to clean things up. I discovered h-feeds recently, which could improve the situation. Instead of maintaining a separate RSS feed you’d annotate your blog posts and listing with microformats . These would carry equivalent information to an RSS feed, and h-feed compatible feed readers would be able to process these web pages directly. This keeps your blog DRY . But support for h-feeds is lacking, so a “legacy” RSS feed is still highly desired. I’ve been using Hugo for a couple other static sites recently and I’ve really liked the way it works. It’s blazing fast to render a site, so it won’t slow you down (this blog renders in 48ms). The primitives you work with (layouts, partials, frontmatter) are productive. There’s a learning curve, but I paid that cost already, so Hugo was now at a very clear advantage. My first plan was to drop all my old content under and just write new content. This wouldn’t quite work as Hugo was now in charge of my RSS feed and it wouldn’t know about the old content. A light alternative is to use a Hugo shortcode to embed the original plain HTML for each post. In the end I converted each post to Markdown manually keeping only small sections as unchanged plain HTML. I broke my rule and tweaked the CSS for my older posts to bring them under a common theme. An interesting side effect of this approach was that Hugo minified my old posts. So my pages should now load slightly faster than before. I needed to customize the RSS feed layout: I kept my original RSS feed’s GUIDs, so my old posts hopefully didn’t re-appear in your feed. I’ve added extra stuff like the source:blogroll element.

0 views

RSS Categories - In Practice

I’ve been building a directory of RSS feeds which has quickly grown to over a thousand feeds. To build the directory, I wrote a web crawler (open source) which fetches each feed, parses it to collect metadata, identifies OPML blogrolls , and spiders to each new feed it discovers. I’m hopeful the directory will expand as more people adopt OPML for their blogrolls. One challenge I needed to tackle was to figure out how the RSS (and Atom) spec is used in practice. There’s some instances where the spec is followed, some where the spec is vague, and others where the spec is not followed. The category tags of RSS are a good example of this. The category element is an optional sub-element of the channel and item elements. The spec for category is pretty short: is an optional sub-element of . It has one optional attribute, domain, a string that identifies a categorization taxonomy. The value of the element is a forward-slash-separated string that identifies a hierarchic location in the indicated taxonomy. Processors may establish conventions for the interpretation of categories. Two examples are provided below: You may include as many category elements as you need to, for different domains, and to have an item cross-referenced in different parts of the same domain. Right off the bat, we see “Processors may establish conventions for the interpretation of categories” . So the spec doesn’t have all the information we need to proceed. With over a thousand feeds in my dataset, I decided to look at what conventions I could deduce. A first observation was that elements are rarely present for the channel. Only about twenty in one thousand have any. My blog didn’t either… so I added one. Channel categories would be really useful for navigating a large directory of feeds, but they are too rare. Item categories, I.E. tags for individual posts, are more common with at least 25% of the feeds in my dataset using them. Another observation was that the content of the category element isn’t always intended for humans. For example, one blog uses numbers in the category and another uses URI fragments. One place where actual usage diverges from the spec is how forward slashes are used. For example, a post with the category should be interpreted as being about , which is a subcategory of . But it’s clearly not a subcategory. I wasn’t able to find any categories that were obviously using as a subcategory separator. I decided it would be best to assume that feeds don’t follow the spec, and subcategories aren’t a thing. You’ll notice that the attribute from the example above looks like a URL. However, the spec says that it’s just a string and there’s a comment at the end of the spec that explains this. In RSS 2.0, a provision is made for linking a channel to its identifier in a cataloging system, using the channel-level category feature, described above. For example, to link a channel to its Syndic8 identifier, include a category element as a sub-element of , with domain “Syndic8”, and value the identifier for your channel in the Syndic8 database. The appropriate category element for Scripting News would be . The Syndic8 database is defunct, but I was able to find an archived version . Here’s the link for Scripting News . The Syndic8 page shows a few other categories being used: DMOZ, NewsIsFree (NIF), and TX. Unfortunately, DMOZ shut down in 2017, NIF is currently full of affiliate links, and TX is too vague to identify. The archived syndic8 page. Syndic8 was nowhere to be found in my dataset. I turned to sourcegraph.com to see if I could find an example. This pointed to a 16-year-old example file : Cool, that matches the RSS spec and shows how the forward-slash was intended to be used. But I’m not seeing anything like that in use today. The domain attribute in my dataset was rarely present. When it was, it was always a URL. Awkwardly, the most commonly used URL, , throws a 404 error. An archive of the page shows that this was previously a password protected API. Blogger deprecated this API sometime around 2006. Blogs hosted on blogger.com continue to use this value, although the meaning isn’t defined in any of the docs (as far as I could find). Kinda odd. All of the others are URLs to a blog-specific categorization scheme. If you open the URL you’ll see all the posts on that blog in that category. So the domain is usually a link to more content in that category. I noticed that 5% of the feeds were podcasts. While podcasts use RSS for their format, they have a bunch of unique traits. For one, iTunes defined the element as the preferred way to set the category. This element stores the category as an attribute. Podcasts are required to have an , so this is present in all the podcast feeds I’ve found. There’s too much detail in the iTunes docs to go into it, but I found it interesting that iTunes uses a fixed set of categories . The categorization scheme is surprisingly small: only 120 categories. Large directories can have a huge number of categories: defunct DMOZ had over a million. The iTunes category system’s small size makes it easy to assign a category for your podcast (iTunes only lets you pick one). But it wouldn’t be suitable for blogs, or the web in general, it’s far too small. Another interesting trend is the use of hashtags either as categories or in the description of a feed. I don’t see any evidence that RSS tools directly support hashtags, so this may be bleed over of users familiar with them on other platforms. I was able to find around 700 examples of a hashtag being used in my dataset between categories. There’s no central authority on which hashtags should be used or what they mean. This potentially fragments naming as different people will choose different hashtags for related topics, but it ends up working well in practice. Writers gravitate towards popular hashtags to try to catch the attention of readers. Readers flock to popular hashtags because they see those being used. It’s an organic approach that trends towards a common naming system without central authority. Hashtags are sort of a good fit for RSS feed categorization. The lack of a central authority matches the federated nature of RSS feeds. When RSS was being developed, the idea that you could centrally define a taxonomy for the entire web was considered possible. Today, few online directories exist and they are tiny compared to major search engine indexes. My current approach is: Using this model, here’s the most popular categories in my dataset: As expected, without a consistent taxonomy we have some duplicated elements, like Technology, technology, and tech. You can see all the results at RSS Blogroll Network Violate the RSS spec: don’t treat forward-slashes as subcategory separators Use alternate categorization elements, like Scan descriptions for hashtags, use these as categories if none were specified If a channel still doesn’t have any categories, use the categories of the most recent post

0 views