
SIM Cards Have Finally Been Hacked, and the Flaw Could Affect Millions of Phones - mdewinter
http://www.forbes.com/sites/parmyolson/2013/07/21/sim-cards-have-finally-been-hacked-and-the-flaw-could-affect-millions-of-phones/
======
tptacek
Karsten Nohl: also the real deal.

Here, for us, are the nut grafs:

 _In early 2011, Nohl’s team started toying with the OTA protocol and noticed
that when they used it to send commands to several SIM cards, some would
refuse the command due to an incorrect cryptographic signature, while a few of
those would also put a cryptographic signature on this error message._

 _With that signature and using a well known cryptographic method called
rainbow tables, Nohl was able to crack the encryption key on the SIM card in
about one minute. Carriers use this key to remotely program a SIM, and it is
unique to each card._

This is a little vague and I don't understand the OTA protocol like, at all,
but what it sounds like is that there is a case in some implementations of SIM
OTA where (a) errors for improperly signed messages are noisy, (b) those
errors include some of the plaintext of the improperly signed message, and (c)
the error message itself has a signature that is intended to be valid only for
the error.

Possible next steps: (i) you can table-solve for the signature (presumably
this is a MAC, not a signature) for your intended message due to the way
plaintext hits the error message, or (ii) you can table-solve for the
plaintext of a previously unknown ciphertext by taking that ciphertext,
flipping a bit to invalidate the signature, and collecting the error
signature.

~~~
ScottBurson
At one point he says that he thinks it will take the black hats six months or
so to figure out the exploit, but then, in the passage you have quoted, he
gives what sound (to my non expert ear) like fairly massive clues. Is it
possible he has revealed too much?

~~~
tptacek
Well, he's talking about it at Black Hat, right? Black Hat talks are usually
full-disclosure.

~~~
uxp
Looks like it.
[https://www.blackhat.com/us-13/briefings.html#Nohl](https://www.blackhat.com/us-13/briefings.html#Nohl)

~~~
alx
He'll be presenting the same subject at OHM on 03/08/2013 too:
[https://program.ohm2013.org/event/169.html](https://program.ohm2013.org/event/169.html)

------
nicolas314
I have been working on OTA platforms for years with Mobile Network Operators
worldwide, and I have yet to meet one that is only using DES for OTA keys. All
the ones I know are using 3DES. Not sure where Nohl is getting his estimations
from. Half a billion SIMs? Show me the data.

For this attack to work remotely you need to send a binary SMS and be able to
read the SIM answer, which probably requires some privileged access to an
operator's SS7 network. Far from obvious. Since Network Operators are in
complete control of SMS traffic, blocking anything that has not been issued by
their own OTA platform is just a matter of configuring a filter on an SMS-C --
if not already done.

~~~
count
Would (root) access to a microcell work?

~~~
yaantc
Good question. SMS are transmitted over the NAS layer of the 3GPP stack, which
terminates beyond the cell (NB/eNB). There is NAS level security but I don't
know if it's end-to-end or only over the air link. Hopefully it's the former
but one should dig the specs at 3gpp.org to confirm.

------
jingo
Hurray for Java applets.

But seriously, there is a sunny side to this story: a user could load her own
programs onto her SIM. She could gretaly extend the functionality of her
phone... with programs that she trusts. Maybe even ones she wrote herself.

Imagine... an open platform. Oh gosh, that would be terrible, wouldn't it?

Otherwise this story highlights the concept of "minimum viable product" not in
the startup world, but as it exists among major industry manufacturers. For
example, if SIM manufacturers can get away with using DES, then why invest
their time and money in using stronger crypto? There are so many examples of
this type of thinking... it's certainly not limited to imlementations of
cryptography or SIM cards. No doubt, some would say this is simply Business
101... ask any used car salesman. But it's particularly acute in hardware and
software.

Do hardware and software worlds makers need higher standards and more serious
"quality control"? Beyond the cosmetic appearance of their work, no. Because
users are generally indifferent to all else. What they don't know won't hurt
them.

Did you know you can type encrypted messages directly with a text editor
called ed(1)? How cool is that? It's so easy. Who needs PGP?

It uses DES, but hey, DES is good enough for SIM cards, so...

~~~
mje__
I don't think this is a reasonable assessment at all. SIM manufacturers use
3DES, not DES, which - while not recommended for new systems - is still pretty
damn secure.

I don't think you've really understood the complexity of the SIM - there are
literally thousands and thousands of pages of specification, which means that
any sim will interoperate with any phone.

A SIM is not an "MVP" by any stretch of the imagination - it costs millions of
dollars to enter the market; there are stringent security and compatibility
controls, and no-one will consider selling you silicon unless you're ordering
millions of units per year.

~~~
jingo
You're right. DES repeated thrice is better than DES. But I wonder why 3DES is
not recommended for new systems? Hmmm....

You're wrong on the SIM as an MVP idea. I guess I'm not communicating clearly
enough. What I mean is the computer ("phone") itself, of which the smart card
subsystem (e.g. SIM card system) is a part, is of inferior quality. This is
only my opinion.

I understand there are barriers to entry in place. But how does that relate to
low quality, minimally viable products? I'll let you or someone else answer
that.

Maybe we need to remove the barriers, lower the cost of entry and lower the
complexity (simplify)? No, those sound like ignoble pursuits.

~~~
rdl
Not recommended for new systems: Mostly because it's slow (vs. AES), and 3DES
is effectively 112 bits, which is a bit weaker than you'd want for a new
system deployed today (which might be in service for...20-30 years?)

I don't know of any attacks on DES better than brute force and on 3DES better
than brute force w/ meet-in-the-middle.

~~~
KMag
The 64-bit block length is more of a problem than the 112-bit key length.

For instance, if 3DES were used in OFB mode, one would expect on average to
have a unique 64 GB keystream before entering a repeating 32 GB keystream. If
the attacker is able to choose the data being encrypted, CFB could have
similar limitations. With CBC mode, you'd expect only 32 GB of encrypted data
before you got your first self-collision in ciphertext. CTR mode with
perfectly random IVs does much better, at 64 exabytes. Even 64 EB isn't as big
as it used to be, especially for a key that can't be changed.

For many uses, you'd much rather have an ideal block cipher with a 128-bit
block and 112-bit keys than an ideal block cipher with a 64-bit block and
512-bit keys.

------
sentenza
It's a "known plaintext" attack on DES. Via google translate, here is an
article from Heise with more details:

[http://translate.google.com/translate?sl=auto&tl=en&js=n&pre...](http://translate.google.com/translate?sl=auto&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fwww.heise.de%2Fsecurity%2Fartikel%2FDES-
Hack-exponiert-Millionen-SIM-Karten-1920898.html)

~~~
tptacek
Unfortunately, "known plaintext" is just about the most general term you can
use to describe a crypto attack; it covers a huge number of different attack
scenarios.

~~~
sentenza
Sorry, I'm not a crypto guy. It seems that he sends an "Over The Air" SMS that
has an incorrect signature and then always recieves a response that he already
knows.

EDIT: Ok, I just read your other comment and must say that you probably
understand a million times more about this than me, so disregard this comment.

~~~
tptacek
Oh, sorry, I wasn't sniping at your comment!

------
Zoepfli
Article mentions "credit card java applets on SIM cards". I've never used one
of those, and I know nobody in the western world who does.

I always presumed that these sim java applets are crapware that is mercifully
hidden on todays smartphones.

It's also my impression that Mastercard and Visa paid a hefty stupidity tax by
thinking in the 2000s that it would be important to have their software on SIM
cards, not foreseeing that smartphone apps would just bypass that whole layer.

Anybody know of an application in the western world, on smart phones, where
these java applets are really used?

~~~
codebutler
Yes, ISIS uses SIM applets:
[http://en.wikipedia.org/wiki/Isis_(mobile_payment_system)](http://en.wikipedia.org/wiki/Isis_\(mobile_payment_system\))

Google Wallet uses the same type of applets but stored in the phone's SE
rather than the SIM card.

~~~
e12e
I know Telenor in Norway provides a service called BankID that is tied to
Telenor SIM cards -- but I don't know anything about the implementation
details (or how they've managed to lock the other providers out of the game).

BankID is a centralized service for authentication used by banks, and the
"other" implementation is based on a (browser) java applet.

------
nqzero
vaguely related question ... is it safe to insert an arbitrary sim card in a
phone ?

i want to try out some of the gsm mvnos in the states (eg airvoice, ptel and
h2o). an at&t or comcast or microsoft has a reputation that's worth billions,
so i "trust" them to only be semi-evil and at least semi-responsible. i don't
know much of these mvno companies, but assume they're living on the margins
and don't have too much to risk. could they, or an enterprising engineer
working for them, mess with the sim card to take something of value from me ?

~~~
e12e
I don't know much about SIM-cards, but in general I would say, no, it's not
safe. First there's the possibility of a problem with the phones interface to
the SIM-card (possibility of direct exploitation) -- secondly, it's the
possibility of putting "other stuff" on the SIM-card.

A friend of mine implemented a wifi-posistioning system that got power from
the phone's GSM signals (it wasn't using a full wifi stack, just enough to
broadcast an 802.11b frame that access points could pick up and triangulate).
It was used for positioning in museums, and the phones where used for guiding
information (so it wasn't a malicious hack) -- but it does illustrate that
there are many possibilities.

Put a flash storage chip on there, and record all GSM traffic for example?

------
aroman
What I'm curious about is what Nohl meant when he said that it would take six
months from the time of his presentation at Black Hat for crackers to develop
working exploits based on his findings. And if he is (as the article suggests)
working with the phone companies, why not simply wait until they've
implemented their patches (if they in fact need them)?

If indeed it is as simple to force a sim to run these malicious applets as
using some sort of rainbow-table-powered replay attack, what would be the
challenge? Or perhaps he was referring to the more lucrative aspect of
breaking out of the sim sandbox...

~~~
pbhjpbhj
> _what would be the challenge?_ //

Maybe creating the rainbow tables? [I'm not familiar with any of the details
here FWIW, just guessing as that seems the most likely thing that could be
estimated to take 6 months].

------
D9u

         *Verizon did not specify why its SIMs were not vulnerable*
    

I was under the impression that Verizon phones don't use SIM cards because
their network is CDMA instead of GSM.

~~~
otterley
Verizon's LTE phones have a SIM.

------
bcl
I don't understand the article's description of the sandbox vulnerability. On
the iPhone app sandboxing is done by iOS, not in the SIM. Does the reporter
just not understand, or is there another layer I'm not aware of?

~~~
pjmlp
This is at the SIM card level.

Most SIM cards are actually micro computers that communicate with the host
system for certificates, encryption and some provider specific information,
besides the common address stuff.

Usually the software is done in Assembly, C or JavaCard, with JavaCard use
getting increased in the last years.

The JavaCard exploits are related to the VMs running the system, which are
usually coded in a mix of Assembly and C. JavaCard VMs don't have a JIT due to
memory constraints.

------
gioele
A beautiful, although not really accurate, explanation of a buffer overflow:

> The way this works is somewhat complex, but Nohl’s virus essentially gave
> the infected Java software a command it could not understand or complete –
> eg. asking for the 12th item in a 10-item list, leading the software to
> forgo basic security checks and granting the virus full memory access, or
> “root,” in cyber security parlance.

------
muyuu
What are the implications?

Can't stand Forbes and their over the top ads, tldr would be appreciated.

~~~
straight_talk_2
Why don't you get an ad blocker - e.g. Ad Muncher is a great one.

~~~
muyuu
I prefer to allow sites to monetise their visits within reason. If they go
insane like Forbes then I just avoid them.

~~~
aw3c2
You can do that easily with any decent adblocker. You could disable it for all
sites but Forbes if you like.

Right now, you are just leeching other people's time.

~~~
muyuu
Thanks for the modbombing :-)

I'm not leeching other people's time more than any other comment. If you're
not interested proceed with the next post.

~~~
Dylan16807
Comments with insights to the article, that don't ask people for favors, are
not leeches. Your comment was a leech.

~~~
muyuu
Refer to GP for instructions.

You just wasted my time with your pointless comment. Well you didn't, I could
have chosen to ignore it.

