Return to Video

36C3 - SIM card technology from A-Z

  • 0:19 - 0:26
    Herald: So our next talk is "SIM card
    technology from A to Z" and it's an in-
  • 0:26 - 0:35
    depth introduction of SIM card technology
    that not a lot of people know much about.
  • 0:35 - 0:44
    And our speaker, Harold, LeForge, as he's
    better known, is the founder of the Open
  • 0:44 - 0:50
    Source Mobile Communications Project. He
    is also a Linux kernel hacker. He has a
  • 0:50 - 0:54
    very long and impressive bio; and a
    Wikipedia page.
  • 0:54 - 0:59
    Harald (speaker): just means I'm old.
    Herald: So Harald Welte, please give him a
  • 0:59 - 1:04
    round of applause.
    Applause
  • 1:04 - 1:13
    Herald: All yours.
    Harald (speaker): Thanks a lot for the
  • 1:13 - 1:19
    introduction. As you can see on the title
    slide, I actually had to change the title
  • 1:19 - 1:23
    slightly, because I couldn't find a single
    acronym related to SIM cards that starts
  • 1:23 - 1:28
    with z, so now it's from a to x, not from
    a to z anymore - the SIM card
  • 1:28 - 1:32
    introduction. So the SIM card technology
    from A(PDU) to X(RES) which are two
  • 1:32 - 1:39
    acronyms in the context of SIM cards which
    we might get into or not. So, what are we
  • 1:39 - 1:44
    going to talk about in the next 45 or so
    minutes? What are the relevant
  • 1:44 - 1:49
    specifications and specification bodies?
    What kind of interfaces and protocols
  • 1:49 - 1:54
    relate to SIM cards? We're going to talk
    about the filesystem that exists in such
  • 1:54 - 2:01
    SIM cards, as well as the evolution of SIM
    cards from 2G to 5G. So that's basically
  • 2:01 - 2:11
    from what, 91 to 19, er 2018. We will talk
    about SIM Toolkit, Over The Air, a little
  • 2:11 - 2:17
    about about how to eSIMS as well, the
    embedded SIMs. Introduction about myself
  • 2:17 - 2:24
    was already given. So, yeah, people
    complained sometimes that my slides are
  • 2:24 - 2:28
    full of text and I need more diagrams. So
    I tried to improve.
  • 2:28 - 2:33
    laughter from the audience
    Harald laughs
  • 2:33 - 2:39
    Applause
    Harald: So this is actually, at one night
  • 2:39 - 2:43
    I thought, OK, let's actually try to
    create a DOTTY graph of all the specs and
  • 2:43 - 2:47
    how they cross reference each other. And
    this is what I've come up with and this is
  • 2:47 - 2:51
    only the SIM card relevant specs, not out
    of context, other specs that they may
  • 2:51 - 2:58
    refer to. So, yes, it's an interesting
    graph. The arrangement was done
  • 2:58 - 3:03
    automatically by DOTTY. So don't complain
    to me about that. Yeah.
  • 3:03 - 3:09
    Nevertheless, I will switch back to text
    and we will look at what kind of
  • 3:09 - 3:15
    specifications there are and spec bodies.
    So. Most importantly, probably about any
  • 3:15 - 3:20
    kind of chip card technology. We have the
    ISO, the International Standardization
  • 3:20 - 3:26
    Organization, which has a series of
    specifications about what they call ICCs,
  • 3:26 - 3:32
    which is integrated circuit cards. We also
    have the ITU, the International
  • 3:32 - 3:36
    Telecommunication Union, which has a
    series of specs related to telecom charge
  • 3:36 - 3:42
    cards. The title implies, that this is
    things that came before SIM cards. So we
  • 3:42 - 3:48
    talk about the cards you put into pay
    phones and things like that in the 80s.
  • 3:48 - 3:53
    There is of course, the 3G. Oh, sorry,
    there is of course ETSI, the European
  • 3:53 - 3:59
    Telecommunication Standardization
    Institute, which is the entity where GSM
  • 3:59 - 4:08
    was originally specified. GSM being the
    first digital telephony system that used
  • 4:08 - 4:11
    SIM cards.
    The best of my knowledge, at least not a
  • 4:11 - 4:17
    historian though. There's a 3GPP, the
    Third Generation Partnership Project,
  • 4:17 - 4:23
    which is where the GSM specs have been
    handed over to. In the preparation of the
  • 4:23 - 4:27
    3G specification process, because ETSI is
    a European entity and Chinese companies,
  • 4:27 - 4:31
    for example, or Chinese government cannot
    participate there, or Americans even, to
  • 4:31 - 4:35
    the extent that European companies can do.
    So it was lifted to an international new
  • 4:35 - 4:40
    group called the Third Generation
    Partnership Project. And they of course
  • 4:40 - 4:44
    inherited all the SIM card related
    specifications. And then we have like non-
  • 4:44 - 4:51
    telecom standardization entities such as
    the Global Platform Card Specification.
  • 4:51 - 5:00
    That's Global Platform is a body that
    specifies lots of aspects around Java
  • 5:00 - 5:04
    cards, specifically around to applet
    management, installation and so on Java
  • 5:04 - 5:08
    cards, which brings us to the next entity,
    which is not really a standardization
  • 5:08 - 5:12
    body, but it's a private company that used
    to be called Sun and now it's part of
  • 5:12 - 5:18
    Oracle, which defined the Java Card API
    runtime and the virtual machine of Java
  • 5:18 - 5:21
    cards.
    And last but not least, we have the GSM
  • 5:21 - 5:26
    Association, which is the vendor club of
    the operators. That doesn't really have to
  • 5:26 - 5:33
    do that much with SIM cards until the
    eSIM, where then suddenly a GSM A plays a
  • 5:33 - 5:40
    big role in the related specs and
    technology. So talking about these
  • 5:40 - 5:46
    standardization bodies. What is the SIM,
    actually? The SIM is the Subscriber
  • 5:46 - 5:53
    Identity Module. I mean probably anyone in
    here has one, likely more or at least has
  • 5:53 - 5:59
    had. It's quite ubiquitous. Every device
    with cellular connectivity during the last
  • 5:59 - 6:05
    whatever 20 or so years has a SIM, whether
    it's an actual card or whether it's
  • 6:05 - 6:11
    soldered in these days. SIM card hacking
    has a tradition in the CCC since at least
  • 6:11 - 6:16
    1998.
    I'm not sure how many people remember:
  • 6:16 - 6:23
    there was the Vodafone Germany SIM card
    cloning attack back then. It was in
  • 6:23 - 6:33
    German. It was titled "Von d2 privat zu D2
    pirat". And that was an attack that used
  • 6:33 - 6:39
    weaknesses and sort of brute forcing
    against the authentication mechanism to
  • 6:39 - 6:44
    recover the secret key, which is stored in
    the card. And then you could clone SIM
  • 6:44 - 6:48
    cards back then.
    That was then fixed in subsequent
  • 6:48 - 6:54
    technology generations. And also around
    that time you can find on the FTP server
  • 6:54 - 7:02
    of the CCC a SIM card simulator written in
    Turbo C using a season card. I'm not sure
  • 7:02 - 7:06
    how many people remember season cards.
    These were cards people used in the
  • 7:06 - 7:13
    context of cracking satellite TV
    encryption. Yeah, so. Meanwhile, of
  • 7:13 - 7:18
    course, the SIM technology stack has
    increased and the complexity has increased
  • 7:18 - 7:22
    like probably in any kind of technology.
    So let's recap, basically from the
  • 7:22 - 7:29
    beginning to today what SIM cards are and
    what they do in some degree of detail. If
  • 7:29 - 7:34
    we start historically with SIM cards,
    actually the predecessor to the SIM cards
  • 7:34 - 7:40
    that we know, is the chip card used in the
    C-Netz, which is an analog telephony
  • 7:40 - 7:46
    system that used to operate in Germany.
    There's actually an open source
  • 7:46 - 7:48
    implementation these days as part of
    Osmocom-Analog.
  • 7:48 - 7:54
    If you're interested in that, do check out
    a jolly at the vintage and retro
  • 7:54 - 8:02
    computing area. And before 1988, they only
    had a magnetic stripe cards, but in 1988
  • 8:02 - 8:09
    they introduced integrated circuit cards
    in this analog telephony system and in GSM
  • 8:09 - 8:14
    it was a chip card from the beginning. The
    concept of the SIM card means you store
  • 8:14 - 8:19
    the identity of the subscriber outside of
    the phone, which is very opposite to what
  • 8:19 - 8:24
    happened in the CDMA world in the US
    around that time where it was basically
  • 8:24 - 8:28
    inside the phone itself. But having the
    identity separate, of course, enables all
  • 8:28 - 8:34
    kinds of use cases that were relevant at
    that time.
  • 8:34 - 8:39
    We will get to that to some extent. In
    addition to the identity, and the identity
  • 8:39 - 8:44
    in this context means a cryptographic
    identity, there are all kinds of network
  • 8:44 - 8:49
    related parameters that are stored in the
    SIM card. Some of those are static,
  • 8:49 - 8:55
    meaning that they are provisioned or
    written by the operator into the card, or
  • 8:55 - 8:59
    of course by the SIM card manufacturer on
    behalf of the operator, but which are not
  • 8:59 - 9:03
    writable by the user that effect
    access control classes, which
  • 9:03 - 9:08
    means like, are you a normal user or are
    you an emergency service user which needs
  • 9:08 - 9:12
    higher priority to access the network,
    things like that. And there are lots of
  • 9:12 - 9:17
    dynamic parameters on the card, and
    dynamic means they get rewritten and
  • 9:17 - 9:22
    changed and modified and updated all the
    time. That's for example, the TIMSI, the
  • 9:22 - 9:27
    temporary identity that gets allocated by
    the network every so often. Also the
  • 9:27 - 9:35
    current actual air interface encryption
    key like KC and its successors in modern
  • 9:35 - 9:41
    generation technology. So they get updated
    and written all the time by the phone. And
  • 9:41 - 9:45
    some of the files are even updated and
    written by users, at least traditionally
  • 9:45 - 9:51
    or historically, like the phone book and
    the SMS that are stored on the card. It
  • 9:51 - 9:57
    was originally specified as a full credit
    card sized cards and it was intended to be
  • 9:57 - 10:01
    used in radios in rental cars or company
    shared cars.
  • 10:01 - 10:06
    So basically when you leave the car, you
    would remove your SIM card, the full sized
  • 10:06 - 10:13
    credit card sized card and somebody else
    would put their card in. And allegedly
  • 10:13 - 10:18
    there even were, I think, public GSM
    phones installed in German trains where
  • 10:18 - 10:21
    you could plug in a SIM card or something
    like that. But I personally haven't
  • 10:21 - 10:28
    witnessed that, since I was ignorant at
    that time, apparently, of that fact. So,
  • 10:28 - 10:36
    let's get to the mother of all smartcard
    specs, which is in German DIN EN ISO/IEC 7816
  • 10:36 - 10:44
    or short just ISO 7816 and maybe an
    anecdote how these specs come around. So
  • 10:44 - 10:50
    there's the ISO that specifies a certain
    spec, it gets an ISO number and then EN,
  • 10:50 - 10:56
    the European norm, whatever body, comes
    around and says, "oh, we will elevate this
  • 10:56 - 11:00
    international spec into a European
    standard". And they put an EN in front.
  • 11:00 - 11:04
    And then DIN, the German standard body,
    comes around, says, oh, we will elevate
  • 11:04 - 11:10
    this European norm into a German norm and
    we will put a DIN in front. So now in
  • 11:10 - 11:15
    Germany, we have DIN EN ISO/IEC 7816.
    And if you get the actual copy from DIN
  • 11:15 - 11:20
    it's quite funny. I didn't don't have it
    here, but actually you get a one page
  • 11:20 - 11:25
    additional paper on top, which translates
    the key technical phrases from English to
  • 11:25 - 11:30
    German. And that's the added value that
    you get from it become. Sorry. I mean,
  • 11:30 - 11:35
    it's just hilarious. The entire spec is in
    English, but then there's like this key
  • 11:35 - 11:39
    translated terms. So you know, that file
    means "Datei", for example, that's
  • 11:39 - 11:46
    extremely beneficial to the reader of such
    specifications. Anyway, so the title is
  • 11:46 - 11:50
    "Integrated Circuit Cards with contacts".
    chuckles
    I wonder, OK, they are contact
  • 11:50 - 11:57
    less now, but at least back then,
    cerainly, they didn't exist. And it has 15
  • 11:57 - 12:00
    parts by now.
    The most relevant parts are 1 through 4,
  • 12:00 - 12:04
    starting from the physical
    characteristics, going through the
  • 12:04 - 12:07
    mechanical dimensions and the location of
    the contacts, of course, it's a separate
  • 12:07 - 12:11
    part of the spec. And each of those specs
    are sold as a separate document, of
  • 12:11 - 12:15
    course. So the physical size you pay and
    if you want to know the location of the
  • 12:15 - 12:20
    contacts you have to pay to get another
    spec. And then there's part 3, which
  • 12:20 - 12:23
    covers the electronic signals and the
    transmission protocols. We will look at
  • 12:23 - 12:28
    that in some detail. And then there's part
    4, which is the inter-industry commands
  • 12:28 - 12:32
    for interchange, which I find very
    interesting. And I always thought they
  • 12:32 - 12:36
    should have met the international inter-
    industry commands for inter-working
  • 12:36 - 12:39
    information interchange. But apparently
    they didn't come up with that. And of
  • 12:39 - 12:45
    course, this all predates the Internet, so
    there's no Internet in there. Yeah. The
  • 12:45 - 12:49
    next relevant spec is GSM technical
    specification eleven dot eleven. Very easy
  • 12:49 - 12:55
    to memorize that number, which is the
    specification of the subscriber identity
  • 12:55 - 13:00
    module dash mobile equipment interface. So
    in GSM there is what's called a mobile
  • 13:00 - 13:04
    station, which is your phone, and it is
    comprised of two parts, the mobile
  • 13:04 - 13:08
    equipment, which is the hardware and the
    SIM, which is the SIM next to the mobile
  • 13:08 - 13:12
    equipment.
    And it interestingly, it doesn't just
  • 13:12 - 13:17
    refer to these ISO specs that I mentioned
    before, but it actually repeats like more
  • 13:17 - 13:23
    or less carbon copies large portions of
    these ISO specs with some amendments or
  • 13:23 - 13:29
    corrections or extensions. And again, it
    gives you the location of the contacts and
  • 13:29 - 13:33
    the mechanical size of the card and the
    electronic signals and the transmission
  • 13:33 - 13:38
    protocols and so on. But beyond these ISO
    standards, it also actually specifies what
  • 13:38 - 13:42
    makes the SIM a SIM and not any other
    contact card, which is the information
  • 13:42 - 13:48
    model, the file system on the card and the
    commands and protocols that you use on
  • 13:48 - 13:56
    this card. And last, with typo as usual on
    my slides, but not least, of course, how
  • 13:56 - 14:03
    to execute the GSM algorithm to to perform
    cryptographic authentication.
  • 14:03 - 14:08
    The physical smartcard interface is
    interesting. I mean if you've worked with
  • 14:08 - 14:14
    hardware or electronics or serial
    interfaces, I think it's rather exotic and
  • 14:14 - 14:20
    exotics always means interesting. So we
    have four relevant pins. We have a supply
  • 14:20 - 14:27
    voltage, not surprisingly. It can be 5, 3
    or 1.8 volts. Interesting, it's not 3.3
  • 14:27 - 14:32
    volt, it's 3.0 volts nominal.
    Not sure why. But anyway, that's how it
  • 14:32 - 14:37
    is. We have a clock line that provides a
    clock signal which initially needs to be
  • 14:37 - 14:42
    between 1 and 5 megahertz. So the phone
    provides power and clock. We have a reset
  • 14:42 - 14:47
    line which also makes sense; you want to
    reset the card and then we have one IO
  • 14:47 - 14:49
    line for bi-directional serial
    communication.
  • 14:49 - 14:54
    So you have RX and TX sharing one line and
    there is some nice diagrams about how
  • 14:54 - 15:01
    exactly the sequencing happens when you
    power it up, nothing really surprising.
  • 15:01 - 15:04
    There's an activation sequence and after
    the card is activated, the card will
  • 15:04 - 15:09
    unilaterally send what's called an ATR,
    the answer to reset. And that's just a
  • 15:09 - 15:13
    series of bytes which give some
    information about the card capabilities.
  • 15:13 - 15:19
    What protocols, what voltages, what clock
    rates beyond these initial activation ones
  • 15:19 - 15:25
    are supported. Now, after we've powered up
    the card, we have the bit transmission
  • 15:25 - 15:30
    level.
    And it's actually very much like a normal
  • 15:30 - 15:38
    UART. If you ever looked at RS232 or
    another UART a serial port, rather simple:
  • 15:38 - 15:45
    start byte, stop byte, parity, serial bit
    transmission. What's a bit interesting is
  • 15:45 - 15:52
    that we have a clock and the baud rate is
    divided from that clock, but it's still an
  • 15:52 - 15:56
    asynchronous transmission. So there is no
    phase relationship between the clock
  • 15:56 - 16:00
    signal and the baud rate that the data
    uses, which lots of people get wrong,
  • 16:00 - 16:04
    particularly lots of authors of Atmel
    microcontroller data sheets which claim
  • 16:04 - 16:09
    that it's a synchronous communication,
    which it is not. Yeah.
  • 16:09 - 16:13
    So the direction changes every so often to
    have acknowledgements back and forth and
  • 16:13 - 16:17
    to exchange data in both directions. And
    interestingly, a lot of the timings are
  • 16:17 - 16:21
    not specified very well, but I guess
    nobody cares about that, other than if you
  • 16:21 - 16:27
    want to implement a card reader, which I
    happen to have gone through this year.
  • 16:27 - 16:33
    Smart Card Communication: after we are
    able to transmit bytes between the card
  • 16:33 - 16:38
    and the reader, we have something called
    APDUs. The Application Protocol Data Unit
  • 16:38 - 16:43
    specified as per that ISO 7816-4. That's
    the inter-industry commands for
  • 16:43 - 16:51
    interchange. And an APDU consists of a
    couple of bytes. There's a class byte that
  • 16:51 - 16:55
    just specifies the class of command as an
    instruction byte which specifies the
  • 16:55 - 16:59
    specific instruction like read a file,
    write a file. We have some parameter bytes
  • 16:59 - 17:05
    whose meaning is relevant or is specific
    to the instruction, then we have a length
  • 17:05 - 17:09
    of a command and command data. We have an
    expected response length and response data.
  • 17:09 - 17:14
    And last but not least, a so-called status
    word and the status word basically, the
  • 17:14 - 17:19
    card tells whether the execution was
    successful or whether there was some error
  • 17:19 - 17:26
    and what kind of error there was and
    things like that. The APDUs are then split
  • 17:26 - 17:31
    into a lower layer transport protocol,
    which are called TPDUs.
  • 17:31 - 17:36
    There are two different commonly used
    protocols and two specific ones that are
  • 17:36 - 17:40
    used in the context of SIM cards ore are
    specified in the context of SIM cards, as
  • 17:40 - 17:46
    one called T=0. Which is most commonly
    used for SIM cards. Actually, I've never
  • 17:46 - 17:53
    seen anything else but T=0 used, but T=1
    is another protocol which according to the
  • 17:53 - 18:00
    specs, every phone needs to implement. And
    the card can choose if it does T=0 or T=1.
  • 18:00 - 18:05
    As again, I've never seen a card that does
    T=1, or at least that has only T=1, but
  • 18:05 - 18:10
    the specs would allow that. T=1 is more
    used in banking and crypto smart cards.
  • 18:10 - 18:16
    The difference mainly is T=1 is a block
    oriented transfer and T=0 is more a byte
  • 18:16 - 18:21
    oriented transfer. And T=1 has the
    advantage that it has CRC and checksumming,
  • 18:21 - 18:25
    so you get more protection
    against transmission errors which you
  • 18:25 - 18:34
    don't have in T=0. So the APDU gets mapped
    to TPDUs. Details I'll skip here and this
  • 18:34 - 18:37
    is just some examples, so you get an idea
    how this looks like.
  • 18:37 - 18:46
    So we have A0 A4 00 00 02 3F 00. The A0
    here is the class byte and A0 is SIM card
  • 18:46 - 18:52
    class. A4 is select file.
    So you're selecting a certain file on
  • 18:52 - 18:57
    which you want to operate. Two parameter
    bytes are 0, 02 is the length of the
  • 18:57 - 19:02
    command. And then you have two bytes of
    that length 3F 00, which is basically your
  • 19:02 - 19:07
    slash, your root directory. You want to
    change to the root directory of the file
  • 19:07 - 19:12
    system, is basically what that command
    says. And one hypothetical response is
  • 19:12 - 19:22
    just a status word 90 00, which means
    success. Yeah. Selecting a file. So we
  • 19:22 - 19:28
    have a file system on the card. Most smart
    cards do that. It's not a file system in
  • 19:28 - 19:34
    the context like you have a USB drive that
    you can mount, where you just have a block
  • 19:34 - 19:38
    abstraction or something.
    But the smart card filesystem itself runs
  • 19:38 - 19:43
    inside the card and you just talk to the
    filesystem and give it instructions. So if
  • 19:43 - 19:47
    you want to find an abstraction in PC
    technology, it's more like MTP or PTP over
  • 19:47 - 19:53
    USB where you don't have a block device,
    but you talk to another processor which
  • 19:53 - 19:58
    manages a file system and you can instruct
    it's like a remote file system access.
  • 19:58 - 20:02
    You have some similarities to normal file
    systems. I mean, there's a master file
  • 20:02 - 20:07
    which corresponds to a root directory in
    PC file systems. You have so called
  • 20:07 - 20:12
    dedicated files, which are sub directories
    and you have so called elementary files,
  • 20:12 - 20:18
    which are actual data containing files as
    we know them. Beyond that, there are lots
  • 20:18 - 20:26
    of specifics that we don't find PC file
    systems or operating system file systems.
  • 20:26 - 20:33
    We have what's called a transparent EF.
    That's an opaque stream of data like your
  • 20:33 - 20:36
    normal binary file on on any random
    operating system. But then we have
  • 20:36 - 20:42
    concepts like a linear fixed EF which
    contains fixed size records and you can
  • 20:42 - 20:47
    seek against it. Get me the 15th
    record in that file and the file has a
  • 20:47 - 20:50
    record size of whatever 24 bytes for
    example. And then you have something
  • 20:50 - 20:56
    called a cyclic EF where they have a ring
    buffer of records and you have
  • 20:56 - 21:00
    incrementable files which contain
    monotonically incrementing counters and
  • 21:00 - 21:05
    things that are apparently important for
    charging or things like that.
  • 21:05 - 21:14
    Each file has access control conditions
    that define who can read and or modify and
  • 21:14 - 21:20
    or well, there's no delete, but there's
    something called invalidate the file. And
  • 21:20 - 21:26
    who is basically expressed in context of
    which PIN was used to authenticate that
  • 21:26 - 21:30
    entity, which performs the operation.
    So as a user, you have a PIN1 and some
  • 21:30 - 21:36
    people will remember you also have a PIN2,
    that probably nobody's used since the 90s.
  • 21:36 - 21:40
    And the operator has something called an
    ADM PIN, administrative pin, which gives
  • 21:40 - 21:47
    better or higher privileges in terms of
    filesystem permissions on those files. The
  • 21:47 - 21:54
    kind of commands we see, well, select file
    from the example. We have read record,
  • 21:54 - 21:58
    update records. I guess I don't need to
    say anything about that. Similarly, read
  • 21:58 - 22:05
    binary, update binary. And then we have
    commands like CHV commands, where CHV is
  • 22:05 - 22:11
    the cardholder verification which is ETSI
    language for a pin. Not sure why they
  • 22:11 - 22:17
    don't call it PIN. So there's change PIN,
    disable PIN or enable PIN commands. Which
  • 22:17 - 22:21
    is actually what your phone performs, if
    you, say, you disable the PIN or you
  • 22:21 - 22:25
    change the PIN then exactly those commands
    are issued to the card and last but not
  • 22:25 - 22:30
    least, run GSM algorithm. Remember, this
    is still the 2G only SIM. We haven't yet
  • 22:30 - 22:35
    gone beyond 2G, yet at this point in the
    slides. There is actually not that many
  • 22:35 - 22:41
    more. That's that's really it. Now let's
    look at the file system hierarchy. We have
  • 22:41 - 22:46
    the MF, the root file system and then we
    have something called DF_TELECOM. And the
  • 22:46 - 22:49
    hex numbers in parentheses are the
    identifiers that are actually used on the
  • 22:49 - 22:54
    protocol level. We have something called
    DF_GSM, which is the GSM directory
  • 22:54 - 23:02
    containing GSM related parameters. And if
    EF_ICCID where ICCID is the card unique
  • 23:02 - 23:07
    identifier that's stored on the card. And
    if you expand that into more details, you
  • 23:07 - 23:11
    get these kind of graphs. And this is one
    is actually taken from one of the specs.
  • 23:11 - 23:18
    And you see there's also an Iridium
    directory or a, uh, whatever that one was,
  • 23:18 - 23:21
    a Global Star directory.
    And all kinds of people operating
  • 23:21 - 23:26
    different telephony system have basically
    their own directories in that scheme. But
  • 23:26 - 23:33
    on GSM, we find those two mainly, maybe
    some sub directories. Yeah, so when 3G
  • 23:33 - 23:42
    came around something happened, as I said,
    the specifications were shifted from ETSI
  • 23:42 - 23:49
    to a 3GPP. But of course, chip cards in
    the context of telecom have use cases
  • 23:49 - 23:55
    outside of cellular telephony. So,
    actually, the specs were split in that
  • 23:55 - 24:00
    area. So there's something new called the
    UICC, the Universal Integrated Circuit
  • 24:00 - 24:06
    Card, because the previous one was not
    universal, apparently. And that part of
  • 24:06 - 24:10
    the specs remained with ETSI and continues
    to be developed. And there is the USIM
  • 24:10 - 24:18
    application on top of the UICC, which is
    what specifies the 3GPP relevant part and
  • 24:18 - 24:25
    that gets implemented in something called
    an ADF, an application dedicated file, ADF
  • 24:25 - 24:30
    USIM.
    In ADF you can also select or enter using
  • 24:30 - 24:36
    a select command similar to a normal DF.
    The difference mainly is that the
  • 24:36 - 24:40
    identifiers on much longer and thus other
    details, but from a user point of view
  • 24:40 - 24:46
    that's how it looks like. So we have a
    split of the core Universal ICC and on top
  • 24:46 - 24:52
    an USIM application. And if you have a SIM
    card that can be used with 2G and with 3G,
  • 24:52 - 24:56
    then you basically have the classic SIM
    card and in addition you have a USIM
  • 24:56 - 25:00
    application on the card.
    And actually there are some cards that
  • 25:00 - 25:05
    only work with 3G or later technology and
    don't have 2G mode, because the operator
  • 25:05 - 25:09
    doesn't have a 2G network. So you only
    have a USIM application and you don't have
  • 25:09 - 25:16
    the classic SIM anymore on the card. When
    4G/LTE came around, actually there was no
  • 25:16 - 25:20
    strict requirement to change anything in
    the SIM card and you can just use a normal
  • 25:20 - 25:27
    USIM, UMTS SIM, a 3G card on LTE networks.
    It's the same authentication key agreement
  • 25:27 - 25:33
    mechanism. They have added some additional
    files that are completely optional. Mostly
  • 25:33 - 25:40
    like optimizing some bits and there are
    some optional new IMS application. IMS is
  • 25:40 - 25:47
    the IP multimedia system which is 3GPP
    language for voice over IP or VoLTE,
  • 25:47 - 25:53
    right? So IMS is the IP multimedia system,
    which is what is used to implement VoLTE
  • 25:53 - 25:58
    where VoLTE is not a specification term
    but more a marketing term and that's
  • 25:58 - 26:01
    optionally on the SIM card.
    You can have an ISIM an application which
  • 26:01 - 26:05
    stores parameters relevant to the IP
    multimedia system such as SIP user
  • 26:05 - 26:09
    identities and SIP service and things like
    that. But if that ISIM application doesn't
  • 26:09 - 26:13
    exist, there is a fallback mechanism by
    which the identifiers are computed based
  • 26:13 - 26:17
    on the IMSI and and so on and so on. So
    it's not really necessary to have a
  • 26:17 - 26:26
    specific 4G SIM, but it's possible to have
    that. Once we go to 5G, 5G actually reuses
  • 26:26 - 26:33
    the existing 3G and 4G USIM cards. Again,
    some new optional files have been
  • 26:33 - 26:38
    introduced and there is one feature which
    I guess everyone in here wants to have,
  • 26:38 - 26:44
    which would require a new SIM card or
    change SIM card, which is that the SUCI,
  • 26:44 - 26:50
    the Subscriber Concealed Identifier, can
    be computed inside the SIM card or by the
  • 26:50 - 26:55
    phone.
    And if it is computed inside the SIM card,
  • 26:55 - 27:00
    then the SIM of course has to have support
    for doing that computation and that is
  • 27:00 - 27:05
    something that needs explicit SIM card
    support. In absence of that, everything
  • 27:05 - 27:09
    else you can use an existing 4G SIM card
    even on 5G networks. Nothing really
  • 27:09 - 27:16
    changed there, fundamentally.
    OK, now looking at the cards, more on the
  • 27:16 - 27:21
    physical side and from the hardware and we
    will look at the software, the operating
  • 27:21 - 27:28
    systems and so on and the various things
    you can do with SIM cards later on. We
  • 27:28 - 27:32
    have, of course, the processor core that
    many different vendors and architectures,
  • 27:32 - 27:38
    traditionally lots of 8051 derivatives
    inside smart cards. These days we also
  • 27:38 - 27:45
    actually find a lot ??? ARM cores, quite
    often so-called SC cores. There's an SC000
  • 27:45 - 27:50
    and then a SC100 and an SC300 and SC is
    for Secure Core.
  • 27:50 - 27:54
    So it's not a normal Cortex core or
    something like that, but it's a secure
  • 27:54 - 27:58
    core and it's so secure that ARM doesn't
    even disclose what is secure about it
  • 27:58 - 28:04
    other than that it is secure. And so the
    documentation for sure is securely kept
  • 28:04 - 28:12
    away from anyone who would want to read
    it. So, for these chips, the smartcard
  • 28:12 - 28:16
    chips used in SIM cards or generally smart
    card chips themselves, often you cannot
  • 28:16 - 28:20
    even find a similar thing, simple one page
    data sheet which tells you the main
  • 28:20 - 28:27
    features. Even that is already under NDA.
    You have built-in RAM and built-in ROM, at
  • 28:27 - 28:32
    least a bootloader normally, but possibly
    also the OS or parts of the OS, but that
  • 28:32 - 28:37
    is increasingly uncommon. So modern cards,
    most of them only have flash and the
  • 28:37 - 28:41
    entire operating system is in flash, so
    you can update everything. And then
  • 28:41 - 28:45
    applications on top of that and we will
    look at applications later when we talk
  • 28:45 - 28:50
    about the software.
    And unfortunately, contrary to the crypto
  • 28:50 - 28:55
    smartcards where it's possible to have
    higher prices and therefore have, you
  • 28:55 - 29:01
    know, rather expensive products, SIM cards
    are mostly selected purely by cost these
  • 29:01 - 29:06
    days due to the prepaid boom. I mean, it
    was different when GSM was introduced. If
  • 29:06 - 29:10
    you, if every subscriber has to get a
    subscription and there's going to be
  • 29:10 - 29:14
    hundreds of Euros or Marks of whatever in
    revenue, then you can invest a lot of
  • 29:14 - 29:19
    money in a SIM card, but prepaid cards
    that get thrown away on a daily basis you
  • 29:19 - 29:23
    can only pay cents for the card and then
    you need to pay another a couple of cents
  • 29:23 - 29:29
    for the Java card for the Java VM patent
    royalties and so on and so on. But
  • 29:29 - 29:35
    basically you cannot afford to pay money
    for SIM cards anymore. So that also
  • 29:35 - 29:39
    explains why a lot of SIM cards today,
    even though it's technically available,
  • 29:39 - 29:43
    they don't have hardware crypto, but they
    actually implement it in software, because
  • 29:43 - 29:48
    it's cheaper. And then of course, yeah,
    well, you have time of execution, things
  • 29:48 - 29:53
    and whatnot.
    So in terms of software, you have a Card
  • 29:53 - 29:59
    Operating System. Cards that don't have an
    operating system are memory cards which
  • 29:59 - 30:07
    are not sufficient for SIM card use cases.
    And in the crypto smartcard area, it's the
  • 30:07 - 30:16
    operating systems are typically well known
    and documented to some part, at least. In
  • 30:16 - 30:20
    SIM cards it's slightly different. So
    almost nobody ever mentions what kind of
  • 30:20 - 30:27
    operating system is on the SIM card and
    even the SIM card vendors. It's not very,
  • 30:27 - 30:32
    you know, not something they would put on
    their marketing, or on their homepage or
  • 30:32 - 30:35
    something, what exactly kind of operating
    systems are on there.
  • 30:35 - 30:38
    The SIM card offering system also from
    the central network point of view as an
  • 30:38 - 30:43
    implementation detail, because all the
    relevant parts are specified standardised
  • 30:43 - 30:48
    interfaces and what operating system
    people use on the card, well, it's the
  • 30:48 - 30:53
    operator's choice. It doesn't really
    matter from that point of view. In early
  • 30:53 - 30:58
    SIM cards, I presume they were rather
    monolithic, so you didn't really have a
  • 30:58 - 31:02
    separation between an operating system and
    SIM application. Today the software's
  • 31:02 - 31:07
    become more modular. We have this
    abstraction between the operating system
  • 31:07 - 31:13
    and applications. And traditionally, even
    when that separation already existed, the
  • 31:13 - 31:16
    operating system was very hardware
    dependent, non-portable and the
  • 31:16 - 31:22
    applications were very OS-dependent and
    non-portable. And that has changed a bit
  • 31:22 - 31:30
    due to the introduction of Java cards into
    the SIM card area, which is not required.
  • 31:30 - 31:35
    There there's no requirement anywhere that
    the SIM card must be a Java card, but in
  • 31:35 - 31:39
    practice, most SIM cards are Java cards
    because they have certain, at least
  • 31:39 - 31:45
    perceived, advantages and are the norm by
    now. And the Java cards themselves have
  • 31:45 - 31:53
    been independently developed of SIM cards.
    Of course, Java is a Sun technology, so
  • 31:53 - 31:59
    Sun is behind that. And the first actual
    cards that were produced in 96, so much
  • 31:59 - 32:05
    later than SIM cards came out by
    Schlumberger which is now part of Gemalto.
  • 32:05 - 32:13
    And um, yeah, we have redundant lines in
    this presentation. And so, the Java cards,
  • 32:13 - 32:18
    most of them implement a global platform
    specifications, which then specify vendor
  • 32:18 - 32:25
    independent management of the cards and
    the applications on it. And the Java that
  • 32:25 - 32:29
    you use to write such cards, don't ever
    think it is real Java! I mean, if you show
  • 32:29 - 32:34
    that to any Java developer, he will
    probably disappear very quickly as we have
  • 32:34 - 32:38
    a very weird constrained subset of Java
    with a special on-card virtual machine,
  • 32:38 - 32:42
    which is not a normal virtual machine. You
    have a runtime environment that's not the
  • 32:42 - 32:46
    normal runtime environment. You have a
    special binary format which is not a char
  • 32:46 - 32:50
    file.
    And the idea is that you have portability
  • 32:50 - 32:57
    of card applications, which makes sense,
    of course. But one could have done that
  • 32:57 - 33:02
    with, you know, whatever other standards
    as well. Wouldn't necessarily need a
  • 33:02 - 33:08
    virtual machine for that. Yeah, I said
    there's no functional requirement that a
  • 33:08 - 33:12
    SIM card must be a Java card, but in
    reality that's the case. I think the
  • 33:12 - 33:16
    portability is the driver here. So, if an
    operator develops some application that
  • 33:16 - 33:21
    runs on a SIM card, you know, every year
    or so they do a new tender or they have a
  • 33:21 - 33:25
    new SIM card supplier or something like
    that, they want to run their application
  • 33:25 - 33:32
    on the current and the future and the next
    future future SIM card and not rewrite all
  • 33:32 - 33:37
    of that from scratch or have that
    rewritten from scratch all the time.
  • 33:37 - 33:44
    And interestingly, both 3GPP and ETSI
    specify Java APIs and Java packages, which
  • 33:44 - 33:48
    are specifically available on Java cards
    that also are SIM cards. So basically you
  • 33:48 - 33:52
    have SIM card specs and you have Java
    card specs and if you have both of them
  • 33:52 - 33:59
    together, you also have SIM card Java API
    specs for what kind of additional API's
  • 33:59 - 34:05
    applications on the card can use in order
    to affect SIM relevant aspects of the
  • 34:05 - 34:12
    card. Which brings us to one of the
    strange historic developments called SIM
  • 34:12 - 34:20
    Toolkit or later Card Application Toolkit,
    which is sort of an ability to offer
  • 34:20 - 34:24
    applications with UI and menu on the
    phone, right?
  • 34:24 - 34:30
    I mean the card of course doesn't have any
    user interface, but the card can sort of
  • 34:30 - 34:36
    request like show a menu and offer
    multiple choices and things like that.
  • 34:36 - 34:40
    Some people will have seen it on some
    phones. You have this SIM toolkit menu
  • 34:40 - 34:46
    somewhere. And I mean, I think in Germany
    never really took off much in terms of
  • 34:46 - 34:50
    actual applications. I mean, you could
    probably subscribe to some very expensive
  • 34:50 - 34:58
    premium SMS services. If you were really
    bored, but in other regions, this has been
  • 34:58 - 35:07
    very successful and very organized, had a
    real impact on society. Kenya is always
  • 35:07 - 35:13
    the, I think the prime example for that,
    where MPESA, the mobile payment
  • 35:13 - 35:17
    system, implemented at least initially
    based on card application toolkit
  • 35:17 - 35:22
    applications, basically overtook the
    banking sector. At some point everybody
  • 35:22 - 35:26
    did their wire transfers that way, even
    people who didn't even have a bank account
  • 35:26 - 35:31
    and it basically replaced or substituted
    large amounts of the everyday banking
  • 35:31 - 35:37
    needs of people. So there are exceptions.
    Some additional instructions that we have
  • 35:37 - 35:44
    in terms of APDUs, details I will not look
    into these. The next step after SIM
  • 35:44 - 35:49
    toolkit is the so-called proactive SIM. If
    we look at the SIM card communication as
  • 35:49 - 35:52
    it is specified, or smartcard
    communication in general, it's always the
  • 35:52 - 35:58
    reader, in this context the phone, that
    sort of sends an instruction to the phone,
  • 35:58 - 36:02
    to the card and the card responds. So the
    card is always the slave in the
  • 36:02 - 36:07
    communication and it doesn't have any
    possibility to trigger something by
  • 36:07 - 36:10
    itself.
    And that was sort of worked around by the
  • 36:10 - 36:17
    proactive SIM specifications where a
    command or a request from the card is
  • 36:17 - 36:23
    piggy-backed into responses to the
    commands from their phone to the card, and
  • 36:23 - 36:29
    then basically that the SIM card can
    request the phone to poll the card every
  • 36:29 - 36:33
    so often, so the phone can ask for "do you
    have a new command for me now?" and the
  • 36:33 - 36:38
    card can say yes or no. In this way, they
    work around this restriction.
  • 36:38 - 36:42
    And it's not only polling that can be
    requested, but it can be event
  • 36:42 - 36:46
    notifications. And event notifications can
    be loss of network coverage, registration
  • 36:46 - 36:54
    to a new cell, opening of a web browser
    and like are you making a mobile
  • 36:54 - 36:56
    originated call, are you sending an SMS or
    not?
  • 36:56 - 37:00
    So all these kind of events can be sent to
    the SIM card, so that the SIM card can do
  • 37:00 - 37:07
    whatever with it. I think that not many
    useful applications beyond steering of
  • 37:07 - 37:12
    roaming or roaming control, by basically
    depending on where you register and what
  • 37:12 - 37:16
    kind of cells you have, and even the
    measurement reports on what is the signal
  • 37:16 - 37:21
    strength that can be fed into the SIM
    card, which then can basically decide what
  • 37:21 - 37:30
    to do. But yeah, I think it's all rather
    exotic and very few, like relevant or good
  • 37:30 - 37:36
    use cases of this.
    The next step is Over-The-Air-technology
  • 37:36 - 37:41
    (OTA), which is the ability for the
    operator to transparently communicate with
  • 37:41 - 37:45
    the SIM card in the field. With the
    traditional non-OTA capable SIM card, the
  • 37:45 - 37:49
    operator or the SIM card manufacturer
    writes at manufacturing time (at so-called
  • 37:49 - 37:53
    personalization time of the card), and
    then it's with the subscriber. And if the
  • 37:53 - 37:57
    operator ever wants to fix something or
    change something, they have to send a new
  • 37:57 - 38:03
    plastic card. With OTA, they can be
    updated. It's based on proactive SIM
  • 38:03 - 38:13
    technology and by now, there are many
    different communication channels how some
  • 38:13 - 38:17
    back end system at the operator can can
    interact with a card inside the phone of
  • 38:17 - 38:22
    the subscriber. The classic channel is
    SMS-PP, which is the SMS as you know, it
  • 38:22 - 38:29
    just officially called SMS point-to-point.
    It's also possible over SMS-CB, the cell-
  • 38:29 - 38:33
    broadcast-SMS, which I find very
    interesting, bulk updates to SIM cards via
  • 38:33 - 38:39
    cell broadcast, which also would mean that
    they all have a shared key for
  • 38:39 - 38:45
    authenticating these updates. It's also
    specified for USSD from release 7 on most
  • 38:45 - 38:49
    of the specs. And then there's something
    new, at that point, called BIP, the
  • 38:49 - 38:54
    "bearer independent protocol" that works
    over circuit-switch-data and GPRS. Here
  • 38:54 - 38:58
    are some spec numbers if anyone is
    interested. And now, since release 9, that
  • 38:58 - 39:04
    means since LTE is around, also over
    HTTPS. I'll get to that in a couple of
  • 39:04 - 39:07
    separate slides. There's actually a TLS
    implementation in
  • 39:07 - 39:14
    SIM cards these days, believe it or not.
    So the cryptographic security mechanisms
  • 39:14 - 39:17
    set are specified, but of course the
    detailed use is up to the operator so the
  • 39:17 - 39:21
    operator may choose whether or not to use
    measures of authentication, or whether or
  • 39:21 - 39:26
    not to use encryption, or whether or not
    to use counters for replay protection. And
  • 39:26 - 39:30
    this is basically one area where a lot of
    the security research and the
  • 39:30 - 39:34
    vulnerabilities published in the last
    decade or so have been happening, e.g.
  • 39:34 - 39:37
    cards were not properly configured, or
    they had implementation weaknesses, or you
  • 39:37 - 39:42
    had some sort of oracles that you could
    query when interacting with those cards as
  • 39:42 - 39:50
    an attacker. One of the use cases of Over-
    The-Air is RFM, not RTFM, it's RFM,
  • 39:50 - 39:54
    "Remote-File-Management". It was
    introduced in release 6 and the number of
  • 39:54 - 40:02
    typos is embarrassing. A common use case
    of Over-The-Air: It allows you to read or
  • 40:02 - 40:07
    update files in the file system remotely,
    and you can use that, for example, for the
  • 40:07 - 40:11
    preferred or forbidden roaming operator
    lists. That's a very legitimate use case
  • 40:11 - 40:15
    for that. There's also an ancient example
    that I always like. I think Vodafone
  • 40:15 - 40:19
    Netherlands once advertised that the
    operator can take a backup of your phone
  • 40:19 - 40:25
    book on the SIM card. I think it's an
    early manifestation of cloud computing
  • 40:25 - 40:33
    before it even existed. In any case, it's
    certainly a feature that everyone in here
  • 40:33 - 40:38
    would like to have. Of course it's
    irrelevant by now because nobody has
  • 40:38 - 40:43
    contacts on SIM cards anymore. The next is
    RAM which is not "Random Access Memory",
  • 40:43 - 40:48
    it's "Remote Application Management". It
    was also introduced in the same release
  • 40:48 - 40:54
    with the same typo, and it allows
    installation and/or removal of
  • 40:54 - 40:58
    applications on the card, and applications
    in terms of Java card then means Java
  • 40:58 - 41:03
    cardlets. For example, you could update or
    install new multi IMSI-applications, which
  • 41:03 - 41:10
    is one very creative way of using SIM
    cards in more recent years, or new Sim-
  • 41:10 - 41:13
    Toolkit-Applications.
    So a multi-IMSI application, in case
  • 41:13 - 41:18
    somebody hasn't heard of that yet, is
    basically a SIM card that changes its
  • 41:18 - 41:24
    IMSI depending on where your currently
    roam, in order to do a sort of least cost
  • 41:24 - 41:31
    roaming agreement for the operator because
    if he uses his is real own IMSI, then
  • 41:31 - 41:34
    maybe the roaming costs would be more
    extensive than if he used some kind of
  • 41:34 - 41:38
    borrowed IMSI from another operator that
    then gets provisioned there, which has a
  • 41:38 - 41:42
    better roaming agreement and would work
    around ridiculous roaming charges - at
  • 41:42 - 41:47
    least between the operators, of course,
    not towards the user. And now we get to
  • 41:47 - 41:58
    the sort of premium feature of modern SIM
    cards where, of course. you can still do
  • 41:58 - 42:04
    SMS over LTE, but it's sort of this added-
    on kludge. USSD I think doesn't exist
  • 42:04 - 42:07
    anymore because of the circuit-switch-
    feature. So you need some kind of new
  • 42:07 - 42:14
    transport channel of how to talk to the
    SIM card. In release 9 they came up with
  • 42:14 - 42:19
    something called over the air over HTTPS
    which is specified in global platform 2.2
  • 42:19 - 42:25
    amendment B. You have to get that specific
    amendment as a separate document, it's at
  • 42:25 - 42:34
    least free of charge. Actually it uses
    HTTP, nice and good, and then it uses
  • 42:34 - 42:40
    something called PSK-TLS, that I've never
    heard of before, "pre-shared-keys with
  • 42:40 - 42:44
    TLS". I mean, I'm not a TLS expert, as you
    can probably guess, but I don't think
  • 42:44 - 42:50
    anyone ever with a normal browser would
    want to use pre-shared-keys. But it exists
  • 42:50 - 42:54
    in the specs and there are several
    different cipher-modes that I've listed
  • 42:54 - 42:59
    here which are permitted for Over-The-Air
    of HTTPS. Which subset to use is of course
  • 42:59 - 43:03
    up to the operator because it's his SIM
    card talking to his server so they can do
  • 43:03 - 43:08
    whatever they want there. The interesting
    part is that the IP in the TCP is
  • 43:08 - 43:14
    terminated in the phone, and then whatever
    is inside the TCP stream gets passed to
  • 43:14 - 43:19
    the card which implements the TLS and the
    HTTP inside. Then, inside HTTP you
  • 43:19 - 43:24
    actually have hex string representations
    of the APDUs that the card normally
  • 43:24 - 43:29
    processes. So you have this very
    interesting stack of different
  • 43:29 - 43:33
    technologies and if you look at how
    exactly they use HTTP, you ask yourself
  • 43:33 - 43:37
    why did they bother with HTTP in the first
    place if they modify it beyond
  • 43:37 - 43:45
    recognition? But we'll see. So the way how
    this is implemented, interestingly, is
  • 43:45 - 43:57
    that the card implements and HTTP client
    that performs HTTP-POST. So your card
  • 43:57 - 44:01
    somehow by some external mechanism gets
    triggered: "Oh, you must connect to your
  • 44:01 - 44:05
    management server now because the
    management server wants something from
  • 44:05 - 44:11
    you". And then the card does an HTTP-POST
    over TLS with pre-shared-keys to the
  • 44:11 - 44:16
    management server and then in the post
    response there is a hex-encoded APDU for
  • 44:16 - 44:20
    the card to be executed by the card. Then,
    you have tons of additional HTTP-headerrs
  • 44:20 - 44:25
    I'm not going to explain. The CRLF is just
    a copy and paste error. But you see there
  • 44:25 - 44:32
    is all kinds of X-Admin-headers and it
    will completely not work with normal HTTP. So why
  • 44:32 - 44:37
    use HTTP in that context, I don't really
    know. Yeah, I thought I had an example
  • 44:37 - 44:42
    here, but I didn't put it up, I thought
    it's too much detail. But in the end, if
  • 44:42 - 44:50
    you look at this, you'll need to write
    your own heavily modified HTTP-server
  • 44:50 - 44:58
    anyway. but you have HTTP in there. Okay.
    Another technology, it's sort of random, I
  • 44:58 - 45:02
    didn't really know where to put it in
    terms of ordering, is this S@T.
  • 45:02 - 45:07
    technology, which is something really
    strange that's specified outside of the
  • 45:07 - 45:10
    specification bodies that I mentioned
    before.
  • 45:10 - 45:13
    It's another.., I'm just mentioning it
    because it's another vector that has more
  • 45:13 - 45:20
    recently been exploited. Another
    vulnerability. Where, actually, let's say
  • 45:20 - 45:27
    you don't want to run. You don't want to
    write a Java application to run on the
  • 45:27 - 45:32
    card, but you still want to use SIM
    Toolkit. So your card, most likely inside
  • 45:32 - 45:39
    a Java VM implements a VM for another
    bytecode, which is this S@T bytecode which
  • 45:39 - 45:42
    gets basically pushed from the server into
    the card.
  • 45:42 - 45:47
    So the card can then instruct your phone
    to display some menu to you. Hmm. Okay.
  • 45:47 - 45:52
    Uh. Very exciting technology. I'm sure
    there was a use case for it at some point.
  • 45:52 - 45:57
    I haven't really figured it out. So there
    is something called an S@T browser which
  • 45:57 - 46:01
    runs inside the card. As I said, most
    likely that browser is implemented in Java
  • 46:01 - 46:05
    running inside the Java VM. It's not a web
    browser, of course. It just called a
  • 46:05 - 46:12
    browser and it parses this binary format
    which then creates SIM Toolkit menus or
  • 46:12 - 46:16
    whatever. So yeah, I haven't really looked
    into detail. It's too strange even to look
  • 46:16 - 46:25
    at it. Last but not least, we have
    something called the eSIM and Which many
  • 46:25 - 46:32
    people may know as a particular. How can I
    say particularly dominant in
  • 46:32 - 46:38
    the Apple universe where the SIM card is
    no longer a replaceable or exchangable
  • 46:38 - 46:44
    plastic card with contacts. But it's
    actually soldered into the device. This
  • 46:44 - 46:49
    package, a form factor, is called MFF2,
    the machine form factor. Not sure why it's
  • 46:49 - 46:57
    two, I've never seen a one before and it's
    a very small like 8 pin package SMD
  • 46:57 - 47:01
    package that gets sold on a circuit board.
    And of course, at that point you have to
  • 47:01 - 47:05
    have some mechanism by which the actual
    profile, meaning the user identity, the
  • 47:05 - 47:09
    keys and all the configuration parameters
    and so on can be updated or replaced
  • 47:09 - 47:14
    remotely. And that in a way that will work
    between different operators which are
  • 47:14 - 47:19
    competing in the industry and which don't
    really want to, you know, replace those
  • 47:19 - 47:24
    profiles, at least not inherently. And
    this is why this is managed by the GSMA as
  • 47:24 - 47:31
    an umbrella entity of all the operators.
    And it specifies an amazing number of
  • 47:31 - 47:36
    acronyms. And trust me if I say that it is
    an amazing number of acronyms on how the
  • 47:36 - 47:40
    cryptography and how the different
    entities and how the different interfaces
  • 47:40 - 47:44
    work and all the different roles and the
    parties and each implementation of each
  • 47:44 - 47:50
    party needs to be certified and approved
    and so on and so on. And in the end, you
  • 47:50 - 47:54
    have a system by which after a letter of
    approval be
  • 47:54 - 47:59
    tween operators and a new identity from a
    new operator can be downloaded in the card
  • 47:59 - 48:05
    in a cryptographically secure way. So at
    least is the intent of the specification.
  • 48:05 - 48:11
    I am not the person to judge on that and
    replace the profile, but it's not that
  • 48:11 - 48:16
    like you as the owner of the device can do
    that. But it's just all the operators that
  • 48:16 - 48:21
    are part of the club and are approved and
    certified by GSMA. Can actually add and or
  • 48:21 - 48:26
    remove profiles and thus facilitate the
    transition from operator A to operator B
  • 48:26 - 48:30
    in those cards. They don't only exist in
    the soldered form factor. You can also
  • 48:30 - 48:35
    actually buy plastic cards that allow
    that. It's mostly used in like IoT
  • 48:35 - 48:40
    devices, which I still call machine to
    machine. The old marketing term for that.
  • 48:40 - 48:46
    So some random cellularly interconnected
    device that you want to remotely update.
  • 48:46 - 48:55
    And as a final slide, the CCC event SIM
    cards that are around here. If you use the
  • 48:55 - 48:59
    cellular networks, they are Java SIM and
    USIM cards. They support Over-The-Air and
  • 48:59 - 49:05
    the, not the random update, but the
    remote application management. The remote
  • 49:05 - 49:09
    file management at least via SMS-PP
    haven't tested anything else. It did for
  • 49:09 - 49:14
    sure do not support HTTPS yet. And if
    you're interested in playing with any of
  • 49:14 - 49:18
    that and writing your own Java applet,
    there's even a Hello World one around for
  • 49:18 - 49:22
    several years that you can use as a
    starting point. You can get the keys for
  • 49:22 - 49:27
    your specific card from the GSM team and
    then you can play with all of this in a
  • 49:27 - 49:33
    way that normally only the operator can do
    with the card. Some hyperlinks which are
  • 49:33 - 49:38
    actually hyperlinks on those slides. So
    you have to look at the PDF to see them.
  • 49:38 - 49:44
    Yeah. And that brings me to the last slide
    and I'm very happy to see questions.
  • 49:44 - 49:54
    Thanks.
    Herald: Thank you. Thank you so much.
  • 49:54 - 50:00
    Actually, talks like this one is one of
    the main reasons I go to Congress, because
  • 50:00 - 50:07
    sometimes I just take a dive into a topic
    I know nothing about and it's presented by
  • 50:07 - 50:11
    a person with literally decades of
    experience in the field.
  • 50:11 - 50:16
    So it's amazing. And we have time for
    questions. So keep them coming. And the
  • 50:16 - 50:21
    first one is microphone number 4.
    Microphone 4: What you say makes me want
  • 50:21 - 50:29
    to have a firewall between my phone and my
    SIM card. Is there a firewall?
  • 50:29 - 50:34
    Harald: Not to my knowledge, really. I
    mean, there are some vendors of
  • 50:34 - 50:41
    specifically secure telephones that say,
    well, we have a firewall sort of built-in.
  • 50:41 - 50:45
    Not sure to what extent and what detail,
    but not as a separate product or a
  • 50:45 - 50:51
    separate device. At some time people
    developed so-called interposer SIM cards,
  • 50:51 - 50:56
    which you can slide between the SIM card
    and the phone, but that doesn't really
  • 50:56 - 51:01
    work with you know Nano-SIM cards and so
    on anymore. And those interposers those
  • 51:01 - 51:08
    were mostly used to avoid, you know, SIM
    locking and so on. But of course with such
  • 51:08 - 51:13
    a device you could of course implement a
    firewall. Keep in mind that almost all of
  • 51:13 - 51:17
    the communication. I mean the OTA may be
    encrypted, but all of the communication
  • 51:17 - 51:20
    between the phone and the card is
    completely unauthenticated and
  • 51:20 - 51:24
    unencrypted. So you can actually intercept
    and modify that as much as you want. And
  • 51:24 - 51:28
    there's actually a project I forgot to
    mention in more detail. That's the
  • 51:28 - 51:32
    osmocon project called SIM Trace,
    which is a device that you can actually
  • 51:32 - 51:36
    put as a man in the middle to trace the
    communication between card and phone.
  • 51:36 - 51:41
    Herald: Thank you. Mic one.
    Microphone 1: Could you please elaborate a
  • 51:41 - 51:48
    little bit about the SIM Checker attack
    because the telephone provider said it's
  • 51:48 - 51:54
    only possible if you have S@T browser on
    the SIM card and most claim they don't
  • 51:54 - 52:04
    have. So do you have a feeling how many of
    SIM cards have a S@T browser and which are
  • 52:04 - 52:10
    attackable or which other applications are
    attackable by the SIM Checker attack?
  • 52:10 - 52:17
    Harald: I'm not involved in those attacks,
    so I cannot really comment on that in
  • 52:17 - 52:22
    detail. But I know there is a tool
    available, an open source tool that is
  • 52:22 - 52:26
    made available by SR Labs, which allows
    you to test cards. So if you want to check
  • 52:26 - 52:30
    different cards, you can use that SIM
    tester. I think it's linked from the slide
  • 52:30 - 52:36
    here. Yeah, the SR Labs SIM tester. That's
    a Java application. I don't have any
  • 52:36 - 52:42
    figures or knowledge about this. In terms
    of the figures you're asking for. Sorry.
  • 52:42 - 52:48
    Herald: Thank you. Let's take a question
    from the Internet next. Hi, Internet
  • 52:48 - 52:53
    people.
    Signal Angel: There was a question, Can
  • 52:53 - 52:56
    the eSIM can be seen as back to the roots,
    especially compared to what the U.S.
  • 52:56 - 53:03
    market had in the early time?
    Harald: Um. Well, that refers to the
  • 53:03 - 53:08
    situation that the identity is hardwired
    into the phone and not replaceable. And I
  • 53:08 - 53:15
    think. No, not really, because it can be
    replaced and it can be replaced by any of
  • 53:15 - 53:19
    the operate like the normal commercial
    operators. Of course, it means you cannot
  • 53:19 - 53:28
    use such a device in, let's say, a private
    GSM network or in a campus network for 5G,
  • 53:28 - 53:34
    which apparently everybody needs these
    days now. So there are limitations for
  • 53:34 - 53:39
    such use cases. But in terms of the normal
    phones switching between operator A and
  • 53:39 - 53:46
    operator B. That's exactly what the system
    is trying to solve. It's just that if
  • 53:46 - 53:53
    you're not part of the club, you've lost.
    Herald: Thank you. The person behind Mic 5
  • 53:53 - 53:58
    has a very nice hat and we're all
    about fashion here. So the next question
  • 53:58 - 54:00
    goes to you.
    Harald: Nobody told me that.
  • 54:00 - 54:06
    Microphone 5: not understandable's
    mentor said not a Google one? And my
  • 54:06 - 54:13
    question was answered, I think because I
    wanted to know what prevents a POC from
  • 54:13 - 54:19
    providing an eSIM.
    Harald: A profile for an eSIM. Yes, that's
  • 54:19 - 54:23
    exactly the problem that it needs in order
    to install it. It needs to be approved and
  • 54:23 - 54:27
    signed and so on and so on. And you need
    to be part of that GSMA process. So first
  • 54:27 - 54:31
    of all, you would have to technically
    implement all of that, which is doable in
  • 54:31 - 54:34
    all specs of public. But then you need to
    get it certified, which is maybe
  • 54:34 - 54:39
    less doable. And then finally since
    you're not a GSMA member and not an
  • 54:39 - 54:42
    operator. You cannot become a GSMA member
    and you don't have the funds for it
  • 54:42 - 54:47
    anyway. So that is certainly not going to
    work. But the POC could provide an actual
  • 54:47 - 54:50
    like a physical eSIM chip. So if somebody
    wants to
  • 54:50 - 54:57
    do a hot air rework. That's easy, and I
    mean, you can buy them just like
  • 54:57 - 55:01
    other SIM cards and then you have your
    identity inside. But of course, that
  • 55:01 - 55:03
    doesn't really solve your problem, I
    suppose.
  • 55:03 - 55:07
    Microphone 5: Okay.
    Herald: Thank you. No more people in cool
  • 55:07 - 55:11
    hats. So you'll keep picking at random.
    Mic 7, please.
  • 55:11 - 55:18
    Microphone 7: Thanks for the amazing talk.
    Um, I have a question about the flash
  • 55:18 - 55:25
    file system on the cards. I've already
    worked with the cards on the file system
  • 55:25 - 55:32
    level due for some files, you need to
    specify this. You would need to load. Do
  • 55:32 - 55:40
    you need to do like a authentication tango
    provides a CH view like the PIN one and
  • 55:40 - 55:46
    then you only have access to some of the
    files. And since cheap flash is built into
  • 55:46 - 55:52
    those devices, my question is whether they
    are cheap hardware or software tricks to
  • 55:52 - 55:59
    access the files or modify the files which
    are usually locked behind the PIN.
  • 55:59 - 56:05
    Harald: Not that I'm aware of. And if I
    would say they are rather specific to the
  • 56:05 - 56:11
    given OS or whatever on the cards and as
    so many out there. So I think it's
  • 56:11 - 56:16
    unlikely in terms of write cycles, you can
    typically buy between one hundred thousand
  • 56:16 - 56:20
    five hundred thousand write cycle flash in
    SIM card chips. That's sort of what the
  • 56:20 - 56:25
    industry sells. But then of course you
    have all kinds of weird leveling and then
  • 56:25 - 56:30
    there are algorithms and SIM card
    operating systems even go as far as to
  • 56:30 - 56:35
    like you can specify which files are more
    like the update frequencies. So it will
  • 56:35 - 56:39
    use different algorithms for managing the
    flash there. But an interesting anecdote
  • 56:39 - 56:46
    for that if we have the minute. And I was
    involved openmoko. Some people may
  • 56:46 - 56:53
    remember that was an open source
    smartphone in 2007. And, um, there
  • 56:53 - 56:58
    actually we had a bug in the baseband
    which would constantly keep rewriting some
  • 56:58 - 57:05
    files on the flash of the SIM card. And
    actually we had some early adopters use us
  • 57:05 - 57:09
    where the SIM cards got broken basically
    by constantly hammering them with write
  • 57:09 - 57:18
    access. So, um. Yeah. But nothing that
    I know about any kind of, um. Access
  • 57:18 - 57:23
    class bypass or something like that.
    Microphone 7: Thank you.
  • 57:23 - 57:28
    Herald: Microphone 6, which I often
    neglect because the lights are blinding me
  • 57:28 - 57:31
    when I look that way.
    Microphone 6: Um, thanks for the helpful
  • 57:31 - 57:38
    talk. I have a twofold question. Um, so if
    I understand correctly your talk, it is
  • 57:38 - 57:43
    impossible to know the code that's
    running on the same, right? So I have this
  • 57:43 - 57:50
    twofold question is about going further,
    is there something buried in the specs to
  • 57:50 - 57:53
    understand more concretely, this
    protocols?
  • 57:53 - 57:58
    And is there any way to dump the code
    that's running on the SIMs?
  • 57:58 - 58:06
    Harald: In terms of documentation, beyond
    the specs, there is one document that I
  • 58:06 - 58:09
    always like very much to recommend, which
    is also linked here. Yes, the so-called
  • 58:09 - 58:13
    SIM Alliance Stepping Stones. No idea why
    it's called that way, but that's how it's
  • 58:13 - 58:17
    called, there's a hyperlink. So if you
    work on the slides, you can download it.
  • 58:17 - 58:20
    That's a rather nice overview document
  • 58:20 - 58:23
    about all the different specs
    and how it ties together.
  • 58:23 - 58:30
    So I can recommend that. And in
    terms of towards to dump the code on the
  • 58:30 - 58:36
    SIM card. I mean, yes, of course. Tools
    exist, but those tools are highly specific
  • 58:36 - 58:42
    to the given smartcard operating system
    and or chip. And I'm not aware of any such
  • 58:42 - 58:47
    tools ever having leaked. I mean, I get
    such tools for the cards that I in the
  • 58:47 - 58:56
    company that I work, I work with. But
    yeah, of course, the SIM cards out in the
  • 58:56 - 59:00
    field should be locked down from such
    tools and they are highly specific to the
  • 59:00 - 59:03
    given OS and SIM.
    Microphone 6: OK.
  • 59:03 - 59:07
    Herald: Thank you.
    Harald: So maybe one addition to that,
  • 59:07 - 59:16
    it's normally made in a way that basically
    if you want to sort of reset the card or
  • 59:16 - 59:20
    something. So there's always sort of once
    the card is in the operational lifecycle
  • 59:20 - 59:25
    state, which is when you use it normally
    if you ever want to bypass some
  • 59:25 - 59:30
    restriction or you want to sort of do
    something that is not permitted by the
  • 59:30 - 59:34
    spec, by the by the permissions anymore,
    you have to sort of recycle the card and
  • 59:34 - 59:38
    get it back into the so-called
    personalization lifecycle state. And most
  • 59:38 - 59:42
    often that is done with a complete wipe,
    at least off the file system or with a
  • 59:42 - 59:46
    complete wipe of the operating system. So
    you're back to the bootloader of the card
  • 59:46 - 59:48
    and then you can basically start to
    recreate the card.
  • 59:48 - 59:53
    But it's typically implemented in a way
    that it always is together with an erase.
  • 59:53 - 60:00
    So they tried at least to make it safe.
    There's a question there, but not at the
  • 60:00 - 60:03
    microphone. Oh there is a microphone. Oh,
    sorry. But yeah, your job. Sorry
  • 60:03 - 60:08
    Herald: Yeah, I think the person behind
    Mic 4 has been standing there for ages.
  • 60:08 - 60:15
    Microphone 4: You mentioned that the
    card can instruct the phone to open the
  • 60:15 - 60:23
    website, but I have never seen this and
    I've seen use cases where I think it would
  • 60:23 - 60:29
    be useful to do this. So is this
    not supported in most OSes or why?
  • 60:29 - 60:36
    Harald: It's a good question, actually. If
    you read all those specs, like especially
  • 60:36 - 60:41
    these proactive SIM specs and so on. I
    always have the original: OK it's all very
  • 60:41 - 60:46
    interesting, but I've never seen anything
    like that anywhere." So I completely agree
  • 60:46 - 60:52
    with you. Whether or not it's supported by
    the phones is a good question. And I think
  • 60:52 - 60:56
    without trying, there's no way to know. So
    you would actually have to write on a
  • 60:56 - 61:01
    small extend a Hello World app and to to
    do that and see and do a testing with
  • 61:01 - 61:09
    various phones. I would fear that since
    it's a feature that's specified but rarely
  • 61:09 - 61:13
    used, a lot of devices will not support it
    or not support it properly because it's
  • 61:13 - 61:17
    never tested, because nobody's ever asked
    about testing it. But that's just my
  • 61:17 - 61:23
    guess.
    Herald: Thank you, Mic 1.
  • 61:23 - 61:29
    Microphone 1: OK. Hello. Um, my question
    is, when you have an eSIM and you want
  • 61:29 - 61:36
    to provisioning it. Could it be done with
    TR-069 or something similar?
  • 61:36 - 61:43
    Harald: No. That's a completely different
    set of protocols that are used for that.
  • 61:43 - 61:49
    And that's that relates to this,
    global platform, 2.2 and XP, I think
  • 61:49 - 61:53
    it was. Yeah, I don't find it right now.
    But there's this spec that specifies all
  • 61:53 - 61:56
    the different interfaces and protocols
    that are used between the elements and
  • 61:56 - 62:01
    it's completely different. I think
    also the requirements are very different
  • 62:01 - 62:04
    because you have these multiple
    stakeholders. So you have the original
  • 62:04 - 62:09
    card issuer, the original operator, then
    you have other operators. And it's not
  • 62:09 - 62:14
    like a single entity that just wants to
    provision its devices, but it's sort of a
  • 62:14 - 62:19
    multi stakeholder approach where you want
    to make sure that even in like a
  • 62:19 - 62:23
    competition between operators still this
    is possible and that people for trust in
  • 62:23 - 62:27
    the system, that even if the original
    issuing operator doesn't like the other
  • 62:27 - 62:31
    operator, it still will work and it will
    even work in 10 years from now or
  • 62:31 - 62:35
    something in where it's in the field. So I
    think the requirements are different.
  • 62:35 - 62:43
    Herald: Thank you. That was the last
    question of the last talk of the day.
  • 62:43 - 62:47
    Harald: Luckily, not the last day.
    Herald: Not the last day, the first day.
  • 62:47 - 62:50
    So there's three more days ahead of us.
    Thank you.
  • 62:50 - 62:56
    Applause
  • 62:56 - 63:18
    Music
Title:
36C3 - SIM card technology from A-Z
Description:

more » « less
Video Language:
English
Duration:
01:03:23

English subtitles

Revisions