In the third Mr.Robot episode a character inserted a Micro-SD card in a smartphone in order to root it and gain information, so I thought maybe someone could fit a root-kit on a Sim-card. Would that be possible to achieve in terms of the space available on a Sim-Card?
2 Answers
Some SIM cards have a capacity for 128KB (or more) of storage, easily large enough for a small exploit, perhaps a rootkit plus remote execution vulnerability. Conceptually, phones have a sandbox that protect them from the SIM's data, but there are known vulnerabilities that can be exploited. Technically, these cards aren't supposed to contain executable code (they should contain only data), but there's nothing prohibiting this rule. After all, they are basically small processors with permanent storage (Software-on-a-Chip, or SoC).
One such article that I found suggests that the sandbox can be defeated, and also that no carriers have bothered to patch this exploit, simply because "nobody's using it." Admittedly, this article is already two years old, but for most vendors, that's almost as good as yesterday in terms of carriers, who rarely spend time patching even critical exploits, much less exploits that supposedly aren't used in the wild.
A well-versed hacker, such as Mr. Robot is supposed to be, could easily write code that could exploit a phone, even if it hadn't been previously rooted. Of course, if the phone were already jailbroken, perhaps to enable a custom OS or unlock features such as tethering or changing carriers, the exploit might be even easier. Mind you, I'm not aware of an explicit exploit that exists in the wild, only example/proof-of-concepts, but it appears that the author of Mr. Robot has bothered to do their homework within the realm of possible. Please keep in mind that Mr. Robot, like almost all television shows, are science fiction, usually based on fact, but not historical evidence.
It's also well-known that a hacker that has physical access to almost any system basically has full control of the system. For example, a hacker can easily crack all Windows passwords using Linux-on-a-disc, and a hacker with sufficient knowledge and resources could hack any phone, even one with full encryption enabled (but this is a very specialized, and very costly technique).
-
1“Technically, these cards aren't supposed to contain executable code (they should contain only data)” — No, SIM cards always contain code. It's supposed to perform some crypto operations with a key that doesn't leave it. There can be applications running on a SIM, you'll find them sometimes on basic phones (feature phones and then smartphones mostly killed that). Commented Jul 18, 2015 at 8:20
The fast answer is - no, not without using exploits. The reason is not the space in SIM card, but permission. As you receive your SIM card from mobile operator this card have quite good security and will not permit you (easy) to install applications inside.
Moreover (based on my humble knowledge) SIM card do not have access to the phone filesystem and can't do changes there (please someone to correct me if I am wrong). The standard way of operations is phone (OS) send command to the SIM card, get the result and do some operations, based on the result (for example verify PIN, check if operator which signal is strogest is in FPLMN and so on)
And usually the size of smartcard domain where you can (eventually) install some portlet is quite small