TL;DR: Go to cve-demo.psolomatin.com in Safari on a Mac. Click through the certificate warning, then click “Show Certificate.” Browser crash, every time. This is macOS Safari specific. Safari on iPhone is fine. Chrome is fine on anything. Here’s what happened.
Intro
Everything started this morning when I was googling something during my coffee routine and ended up on a website that threw Safari’s usual “I don’t trust this” certificate warning. So I clicked “Show Certificate” out of habit just to see who was trying to talk to me. Safari crashed. I reopened it, went back and clicked “Show Certificate” again. Crashed. Did it a third time just to be sure I wasn’t losing my mind. Three for three.
The responsible thing to do at this point would have been to close the tab and get on with my coffee. Instead I decided to investigate immediately.
“It’s probably just a bad cert, right?”
Clearly something about this specific certificate was wrong. But what? The obvious first guess: it’s malformed somehow and Safari’s parser trips over it. Certificates break in well-known ways, so I started by checking those: there’s a site called badssl.com that serves every kind of broken TLS certificate you can imagine. Self-signed, expired, wrong hostname, all of it.
None of them crashed Safari. So it wasn’t just “a bad certificate” in general. It was this certificate, specifically.
The problem
Here’s the bug, stated plainly before the whole story: Safari’s certificate viewer crashes whenever a certificate’s Subject or Issuer contains an attribute value encoded with the ASN.1 string type NUMERICSTRING. It doesn’t matter which attribute carries it or what the value says. The moment that one rarely-used text encoding shows up anywhere in the name, Safari dies trying to display it. The common ones (UTF8String, PrintableString, IA5String) are all fine.
It took a while to narrow it down to exactly that. Here’s how.
How I found it
A certificate can carry a lot more than just a domain name: organization, address, a pile of country-specific identifiers I’d never heard of. The original had several of these that a normal certificate doesn’t bother with. So I asked Claude to generate self-signed certificates and add those fields back one at a time, testing each on localhost:
- A plain, boring certificate → fine.
- Add the same “Certificate Transparency” proof the real cert had → fine.
- Add a pile of extra domain names and revocation URLs → fine.
- Add Cyrillic text in the organization field → fine.
- Add a completely made-up, nonsense identifier field → fine.
Then I added OGRN, a field from the original certificate and Russia’s company registration number, to the subject line. Instant crash. Russia’s rules for commercial certificates require OGRN (company registration number) and separately INN (tax ID). It’s not about whose number it is: a fake registration number crashed it the same as a real one.
My first guess was that Safari has a buggy code path specifically for OGRN’s label. Wrong: while comparing certificates from different organizations I found two with the exact same registration number, one crashing, one not. Same OID, same value, down to the digit. The only difference was how the value was encoded. One certificate tagged it NUMERICSTRING. The other tagged it UTF8STRING.
I confirmed it by forcing a completely made-up attribute to NUMERICSTRING: same crash. The same attribute tagged PrintableString or IA5String instead: fine, both times. NUMERICSTRING is the one thing every crash has in common. It’s also a fossil of a type that almost nothing uses anymore, so it makes sense nobody caught this: the common types are battle-tested, this one isn’t.
For the curious: under the hood, the crash happens inside Swift’s memory-safety plumbing (the part that checks you’re not reading and writing the same piece of memory from two places at once), while Safari tries to render that field’s label. Something hands it a pointer that looks valid enough to pass a sanity check, but isn’t. The browser faceplants.
I tried to pin down the exact line of code. Part of Safari’s certificate handling is open source, including the X.509 parser, so I went looking for how it converts ASN.1 string types into something Swift can render. Not there: that code only decodes, it doesn’t format. The actual crash is in AppKit, Apple’s UI framework, which isn’t published anywhere. So I know which type triggers it. I can’t read the code that’s getting it wrong.
LDR X9, [X0] ; grab a pointer
CBZ X9, <skip> ; is it null? nope, looks fine
LDR X12, [X10] ; ...reads it anyway. it was garbage. crash.
What I know for sure: show Safari a NUMERICSTRING, and it falls over.
The punchline is that NUMERICSTRING isn’t some obscure, crafted edge case. It’s a real encoding choice some certificate authorities actually make and it shows up on live currently valid certificates today.
Try it yourself
I set up a tiny subdomain with exactly this certificate, so you don’t have to go hunting for a business certificate of your own. (again macOS Safari only, rest seems to be unaffected)
Click through the warning, click “Show Certificate,” and watch Safari tap out. Nothing is sent anywhere when it crashes. Your browser just dies quietly…
How scary is it to publish this?
I presume the scope is quite limited: this is a crash, not a data-theft situation. No user information is exposed and nothing is sent anywhere. No remote control, nothing. The worst case is an annoying browser restart.
I reported it to Apple anyway since a reproducible memory-safety issue is worth fixing even when the practical impact is limited. So far I’ve only received the automatic acknowledgment that review typically takes about a week. I’ll update this post once I hear more.
Anyway check your certificates if you issue some.