Upgrading Fediverse Cryptography

Share

This is a discussion for Fediverse administrators and developers about getting ready for changes in the world of cryptography.

tl;dr don't panic; watch the SocialCG for updates; update your TLS certs; upgrade to supported dependencies and platforms; move to RFC 9421.

The technology world has been on a roller coaster over the last week or so with discussions of changes in the recommended algorithms for signing and encryption.

First, rumours swirled that AI labs had made a major discovery that invalidated an important algorithm in cryptography, perhaps even RSA.

Then, Anthropic announced that they'd made a theoretical breakthrough on post-quantum cryptography. Although it was a big discovery, it was not expected to have practical applications.

Just as everyone was feeling relief, the NSA published an advisory to move to post-quantum algorithms now. That has pushed people into major concerns once again.

The Fediverse and Cryptography

There are four main ways that cryptography is used on the Fediverse.

  • HTTPS. This is good old HTTP with TLS added on for security. All ActivityPub servers are required to support HTTPS for GET and POST requests. It's the main way we ensure encryption in flight.
  • HTTP Signatures. The main way we do authentication on the Fediverse is with cryptographic signing of every HTTP request. This is on top of TLS. We have two main ways this is done: with RFC 9421 HTTP Message Signatures, and with an incompatible older draft version of the same specification, draft-cavage-http-signatures-12.
  • Signed objects. This is used when sharing an ActivityPub object to a third party in a way that doesn't require retrieving the object. There are two main sub-structures for this: Linked Data Signatures 1.0, which is old, and Object Integrity Proofs.
  • End-to-end Encrypted Messaging (E2EE). This is to implement messaging in a way that is secure from any intermediary parties. The Social Web Community Group at the W3C is working to standardise the use of Messaging Layer Security (MLS) over ActivityPub.

There are probably a few more bits and places that Fediverse software uses interoperable encryption, on top of things like disk encryption which are implementation and server dependent.

I am only going to discuss the first two. The second two have somewhat more dedicated communities of developers and if you have implemented them, you should probably work directly with that community. It should also be entirely possible to turn them off in your code or on your server if needed.

The risks of change

So, what are the risks of changing recommendations for algorithms in the Fediverse? Here are the major ones.

  • Compromise. This is of course the worst case! People's private information being exposed to third parties, or their accounts being hijacked and the user being impersonated. We all want to avoid this! If there's any consolation here, it's that it's likely that attackers will probably spend the first few weeks or months looting the world's financial systems and retail commerce before they turn their eyes to reading and publishing our Fediverse DMs.
  • Exclusion. This is a case where a server or software package does not make a change fast enough, and other servers systematically shun it. That means losing some people from the Fediverse, and those people losing access to the world. We don't want this, either.
  • Incompatibility. If the developer community adopts different solutions to a change without cooperating, we risk fracturing the network into smaller, incompatible components. We might stitch it back together with multi-stack support in our software – making for more complex and thus error-prone code. Also not good!

So, how do we avoid these problems? Primarily by adopting a stance of proactive preparation and Fediverse-wide cooperation.

HTTPS

Here are some things to do around your support for TLS.

  • Upgrade your TLS certificates. The first thing that each Fediverse administrator should do is upgrade their TLS certificates to support post-quantum encryption. If you use certbot, there is a great guide from the EFF on how to upgrade. You can do this today, without upgrading your Fediverse server software.
  • Learn how your software loads its local certificates. For Fediverse developers, it's probably a good time to look into how your developer tools support different encryption algorithms for HTTP. If your server software loads TLS certs and keys to run HTTPS directly, do you know how to check if the key uses an unrecommended algorithm? This might be useful to know.
  • Learn how your software uses remote certificates. Every ActivityPub server also makes outgoing HTTPS requests. Do you know how your client library checks encryption algorithms used in remote server certificates? If you needed to, could you exclude certs that don't have a recommended algorithm supported? Check to see how to do that.
  • Get your dependencies into a supported range. I don't want to have to do this kind of check, and I'm sure you don't either. Hopefully, if there is a problem and these kinds of check become necessary, our upstream tool stacks will do this for us, and we can simply upgrade our tools. So: are you ready for that kind of upgrade if it needs to happen? Is the version of your HTTPS server and/or client library still in the supported range? If not, this is a good time to make that change.

It would be a pretty bad idea right now to jump the gun on making these changes today; this is the Incompatibility trap I mention above. So, please don't do that. The best move right now for developers is to be using up-to-date HTTP/HTTPS libraries for server and client support.

HTTP Message Signatures

It's possible for ActivityPub developers to get ready for changes at the message signature level today.

  • Support RFC 9421 for incoming requests. The old HTTP Signature draft, draft-cavage-12 doesn't support newer algorithms. As a developer community, it's probably not worthwhile for us to define how to backport changes to this old draft. So, you should be ready to support incoming requests using RFC 9421.
    It has a different format for the Signature header that you have to parse.
    Detecting whether a request uses RFC 9421 or draft-cavage-12 is not hard, since RFC 9421 uses a second HTTP header, Signature-Input. So, you can treat requests with that header as if they are RFC 9421-signed requests, and requests with a Signature but no Signature-Input as draft-cavage-12.
    There are good libraries for RFC 9421, so you don't have to implement everything yourself. See https://httpsig.org to find a recommended one for your platform.
  • Support multiple signing algorithms in RFC 9421. The final RFC 9421 standard RFC supports several algorithms, and has an algorithm registry for new ones as they arrive, including post-quantum algorithms. Make sure your code is agile enough to support 2 or more algorithms here. When an advisory comes out, it's a lot easier to just remove the discouraged algorithm from your support list, rather than having to re-implement everything with another algorithm. If you're really feeling cool, go ahead and implement all the available public-key algorithms.
  • Support RFC 9421 for outgoing requests. This is harder. It's not easy to determine if a remote server supports RFC 9421 or draft-cavage-12 or both. Almost every server on the Fediverse supports draft-cavage-12 today, so it's easiest and most compatible if you keep supporting it in your requests. But now is a good time to build the code path for making RFC 9421 requests instead. You can try enabling techniques like "double knocking" (RFC 9421 first, draft-cavage-12 next, or vice versa), but some servers don't do synchronous signature validation, so they don't give the reliable responses that make this work. You can also have a server-wide flag for using RFC 9421 exclusively, so you can have a tested code path that admins can turn on if they need to. Again, it's much easier to recommend a configuration switch for admins than to be learning how RFC 9421 requests are made when you're under schedule pressure.
  • Support authentication for multiple user keys. The W3C security community has developed mechanisms for declaring authentication keys for users. We should use that. See Authentication in the Controlled Identifiers 1.0 specification.
    I see this as one of the most likely gaps where we can get Incompatible solutions. Object Identity Proofs use the closely related but not identical assertionMethod property for public keys. We probably should use authentication for HTTP Message Signatures and assertionMethod for OIP. Some people aren't going to like having to do both. Please don't be dig in your heels on this; just support both.

There are a lot of Fediverse platforms that already support RFC 9421; see the RFC 9421 compatibility table on the ActivityPub HTTP Signature Task Force site.

Again, this is not a good time for panicking and removing old signature code. Wait until we know what we need to do, before jumping the gun and causing an incompatibility problem.

Communications

Coordination and cooperation when a big announcement comes out are going to be the best way that we avoid Exclusion and Incompatibility. Here are some ways to get ready for that right now.

  • Join the Social Web Community Group and the public-swicg mailing list. The SocialCG is open and free to join. It's the W3C's community group for ActivityPub extensions and profiles. In case of a big change, the ActivityPub HTTP Signature Task Force is likely to be the entity that will make recommendations on next steps for signing HTTP requests. It will post to the mailing list and through other SocialCG communications channels. If you really don't feel like it, follow the socialcg@w3c.social account.
  • Develop a channel for Developer-Administrator security updates. Developers, do you have a way to update admins who run your software if there is a security issue? This can be a mailing list, a dedicated Fediverse account, a chat server, or something else. If not, this would be a great time to set that up, and get admins to subscribe. And don't use it for any other purposes, like jokes or marketing. That is how admins unsubscribe.
  • Subscribe to the Developer security updates. If you're an admin, make sure you are subscribed to the security updates for your server software. If it doesn't exist, talk to the developers. Make sure the updates aren't snoozed or shuffled off to a side folder or whatever.
  • Upgrade to a recent version of your server software. For admins, if there's a 6.1.3 security release of your server software, it's going to be a lot easier for you to move to if you're on version 6.1.1 or 6.0.8 rather than a fork of 3.4.7. Take the time now to get your server software into the modern era, so if there's a security update, you've got a quick install rather than a big jump to make.

Final Note

I should note that I am not a cryptographer and none of this is advice on cryptographic algorithms. I can barely describe how RSA and ed25519 and ML-DSA work ("factors?", "ellipses?", "lattices?").

Fortunately, to support encryption and signing in ActivityPub, you shouldn't have to be a cryptographer. We can use the algorithms that the cryptographers recommend when they recommend them, and we can stop using the ones they deprecate when they deprecate them.

Proactive preparation, coupled with some good coordination, can make any change less scary and impactful. We can handle big changes best when we work together.

Read more