Live data from Hacker News

Spotting base64 encoded JSON, certificates, and private keys

ergaster.org

11–20 of 135 posts

Re: Spotting base64 encoded JSON, certificates, and private keys

#12
post #8

I don't really love this. It just feels so wasteful. JWT does it as well. Even in this example, they are double base64 encoding strings (the salt). It's really too bad that there's really nothing quite like json. Everything speaks it and can write it. It'd be nice if something like protobuf was easier to write and read in a schemeless fashion.

We just need to sacrifice n*field_count to a header describing the structure. We also need to define allowed types.

Re: Spotting base64 encoded JSON, certificates, and private keys

#14
You can spot Base64 encoded JSON.

The PEM format (that begins with `-----BEGIN [CERTIFICATE|CERTIFICATE REQUEST|PRIVATE KEY|X509 CRL|PUBLIC KEY]-----`) is already Base64 within the body.. the header and footer are ASCII, and shouldn't be encoded[0] (there's no link to the claim so perhaps there's another format similar to PEM?)

You can't spot private keys, unless they start with a repeating text sequence (or use the PEM format with header also encoded).

[0]: https://datatracker.ietf.org/doc/html/rfc7468

Re: Spotting base64 encoded JSON, certificates, and private keys

#19

Isn't this obvious to anyone who has seen a few base64 encoded json strings or certificates? ey and LS are a staple.

IMO depends on your career. I did a lot of pentesting with Burp Suite so I was able to (forced to) pick it up.
Post reply on HN