Note: this is a pretty long article which does a deep dive into breaking some amateur crypto. I go on for quite a bit. Make a cup of tea before reading, and get ready to read some code!
This, then, is a post about a broken homegrown cryptosystem; namely, that used in CodeIgniter, pre-2.2. This version was current until the release of CodeIgniter 2.2, on the 5th of June, 2014, and you can still find sites on it today.
The attack described in the post depends on a lot of things to go right (or wrong, if you will); it’s not just that they used a bad cipher, but also the fact that they rolled their own session storage, and implemented a fallback, and a dozen other things. This is probably typical for most bugs of this class; a bunch of bad decisions which aren’t thought through find their logical conclusion in complete insecurity.
I use Snapchat. It’s an app where you can take a
photo or short (< 10 second) video and send it to your friends who use the
service; they’ll then be able to see it, once, before it disappears forever.
My circle of friends use it basically as an extension of weird Twitter – most
snaps I send and receive are strange angles of weird objects; the completely
mundane but somehow therapeutic (7 seconds of the camera pointed outside the
window of a tram, pointed at the ground moving below); or just closeups of
Curtis Stone’s face,
wherever we see him.
Of course, the promise that they won’t get retained is just that: a promise.
Since your phone receives this image and shows it to you at some point, it must
be downloaded by your phone. If it can be downladed by the phone, it can be
downloaded by something else. We decided to find out how.
As programmers, we spend a lot of time just carting data from one place to
another. Sometimes that’s the entire purpose of a program or library (data
conversion whatevers), but more often it’s just something that needs to happen
in the course of getting a certain task done. When we’re sending a request,
using a library, executing templates or whatever, it’s important to be 100%
clear on the format of the data, which is a fancy way of saying how the data is
encoded.
(computing) The way in which symbols are mapped onto bytes, e.g. in the
rendering of a particular font, or in the mapping from keyboard input into
visual text.
A conversion of plain text into a code or cypher form (for decoding by the
recipient).
I think these senses are a bit too specific—if your data is in a computer in
any form, then it’s already encoded. The keyboard doesn’t even have to come
into it.