Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Flame malware, cert funk, ASN.1, and unicode for fun & APT-class network injection attacks on https...
This is a quick note to keep track of some work-in-process data relating to the forged 'Flame' certificates used as part of the Stuxnet attacks. I've bumped into Didier's analysis of those certs ( several times, and each time felt there was a piece we're all missing, right under our noses.
I think we've begun to understand what that piece is, now. As this is a partial post, not a full exposition, I'll go thin on the backstory. And jump right to the interesting bits.
Looking at the certs in question, there's obvious formatting issues in some of the fields - in terms of how they come out of a conventional de-pem'ing tool. That's always seemed particularly salient to me, but statistical work on those outputs got me nowhere. Now that I'm less ignorant of the underlying non-transitive parsing and encoding that can (and is) done in certs, I had a better idea where to look.
Based on other research cryptostorm has done for several months, I was curious to see what happens when we are careful to retain full data as we decode from the exact certs themselves. And indeed, we see that there's some surprises in the CRL fields, just for starters.
When we reverse this back this strings from hex/octet format:
We get this:
0¡0ž › ˜†J†J
Actually, that's not really what we get - much of the good stuff is (wisely) input-sanitized out by github before being uploaded (I suspect, anyhow). So, let's do a line-by-line analysis of the actual UTF-8 data coming out of that de-hexing. Thanks to Rishida's UniView ( an invaluable tool for such funky-spelunking, and leaving out standard characters (latin letters, numerical digits, punctuation), what we end up with is quite interesting, indeed:
‎0081 [control]
‎0081 [control]
‎009E [control]
‎0081 [control]
‎009B [control]
‎0081 [control]
‎0098 [control]
‎0086 [control]
‎0086 [control]
That's five quite rare control characters hidden in that one URL-ish blob of hex... not counting the inverted exclamation point, not sure what to make of that tbh :-)
I'd also point out that CRLs like this are fed right into the browser's guts, and from there to NSS (need to confirm the exact object flow here, of course)... pulled silently, and parsed behind-the scenes per MIME parameters on the local machine. When Flame was afoot, even Chrome still used CRLs... nowadays they are something of an abandonware on global scale, but even so countless tens of millions of CRL lookups happen silently, behind the scenes, on a daily basis even now.
What happens when control characters like that hit browsers, and NSS? I don't know... but we've seen some hints in the data gathered thus far that it's not good, whatever it is. That we find these characters in this level of APT-class attack code is... telling, perhaps. Or maybe simply suggestive, for now.
Whatever the case, having found this trove of interesting data in the fake Flame certs, I'll be quite surprised if we don't find that this vector is neither new, nor rare, nor of minor destructive power.
More to come, as time allows.
~ pj
{I've not echoed over the raw cert data; those keen to see the details are encouraged to avail themselves of Didier's copies, for now - we'll replicate to our fishycerts repository once all the write-ups are in process, formally}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment