Project

General

Profile

SIMtrace » History » Version 30

tsaitgaist, 02/19/2016 10:48 PM
add function image

1 1 laforge
[[PageOutline]]
2
= Osmocom SIMtrace =
3
4
Osmocom SIMtrace is a software and hardware system for passively tracing SIM-ME communication between the SIM card and the mobile phone.
5
6 18 laforge
It looks a bit like this:
7 30 tsaitgaist
[[Image(simtrace_functions.png, align=right,33%)]]
8 18 laforge
{{{
9
#!graphviz
10
digraph G{
11
  //rankdir = LR;
12
  Phone -> SIMtrace [label = "Flexi-PCB cable"];
13
  SIMtrace -> SIM;
14
  SIMtrace -> PC [label = "USB cable"];
15 1 laforge
16 18 laforge
  SIMtrace [ label = "SIMtrace hardware" ];
17
}
18
}}}
19
20 29 laforge
When connected to a phone, it looks like this:
21
22
23 30 tsaitgaist
[[Image(simtrace_and_phone.jpg, align=center,50%)]]
24 29 laforge
25 18 laforge
It works by utilizing the T=0 capable USART of the USB-attached AT91SAM7 microcontroller.
26
27 1 laforge
The USART passively receives the bytes as they are exchanged on the ISO 7816-3 / TS 11.11 interface between SIM and phone.
28
The received bytes are sent via USB to the PC, where a program called {{{simtrace}}} on the PC gathers data from the USB device,
29
parses the APDUs and forwards them via [wiki:GSMTAP] to the [wiki:wireshark] protocol analyzer.
30
31
== Features ==
32
 * Completely passive scanner
33 17 laforge
 * RST and ATR detection
34 1 laforge
 * Auto-bauding with PPS / PTS support
35
 * Segmentation of APDUs
36
37
== TODO ==
38
 * Check for parity errors
39
 * Verify TCK / PCK check-bytes
40
41
== Hardware ==
42 17 laforge
43 1 laforge
The first implementations used an Olimex SAM7-P64 development board with some of the I/O lines hooked up to the mechanical SIM card adapters from [wiki:RebelSIM_Scanner]. If the RebelSIM scanner is used, connect the USB even if just the lines are used. It needs to be powered, else the real reader will often fail to initialize the card.
44
45 30 tsaitgaist
Now we have a dedicated board.
46 27 laforge
More details are available at [wiki:SIMtrace/Hardware]
47 4 laforge
48 1 laforge
== Firmware ==
49
50 28 laforge
The firmware for the AT91SAM7S device was written by reusing a lot of the code for the [http://www.openpcd.org/ OpenPCD]
51
RFID reader.  Details are available at [wiki:SIMtrace/Firmware].
52 24 tsaitgaist
53 1 laforge
54 5 laforge
== Host PC Software ==
55
56 6 tsaitgaist
The {{{simtrace}}} program is part of the git://git.osmocom.org/simtrace.git repository. It will bind to the USB device
57 5 laforge
and send GSMTAP frames using UDP/IPv4 to localhost:4729.
58 6 tsaitgaist
59 14 tsaitgaist
=== Preconditions ===
60 1 laforge
61 14 tsaitgaist
[wiki:libosmocore] and headers (simtrace_usb.h) from the firmware.
62
63
additional packages :
64 6 tsaitgaist
{{{
65 26 tsaitgaist
sudo apt-get install libusb-1.0-0-dev
66 7 tsaitgaist
}}}
67 1 laforge
68 6 tsaitgaist
=== Compiling it ===
69
70 1 laforge
{{{
71 14 tsaitgaist
git clone git://git.osmocom.org/simtrace.git
72 21 tsaitgaist
cd simtrace/host/
73 6 tsaitgaist
make
74
}}}
75
76
=== Using it ===
77
78
Simply start '''simtrace'''.
79 13 tsaitgaist
It will send the GSMTAP frames to UDP/IPv4 localhost:4729.
80 1 laforge
81
It will also print hexdumps of the frames to the console, looking like this:
82 6 tsaitgaist
{{{
83 1 laforge
sudo ./simtrace
84
APDU: (9):  a0 a4 00 00 02 6f 07 9f 0f
85
APDU: (22):  a0 c0 00 00 0f 00 00 00 09 6f 07 04 00 15 00 15 01 02 00 00 91 78
86
APDU: (9):  a0 a4 00 00 02 6f 38 9f 0f
87
APDU: (22):  a0 c0 00 00 0f 00 00 00 09 6f 38 04 00 15 00 55 01 02 00 00 91 78
88
APDU: (16):  a0 b0 00 00 09 ff 3f ff ff 00 00 3f 03 00 91 78
89
APDU: (9):  a0 a4 00 00 02 6f ad 9f 0f
90
APDU: (8):  a0 b0 00 00 01 00 91 78
91
APDU: (9):  a0 a4 00 00 02 6f 07 9f 0f
92
APDU: (16):  a0 b0 00 00 09 08 49 06 20 11 49 00 11 06 91 78
93
APDU: (9):  a0 a4 00 00 02 6f 7e 9f 0f
94
APDU: (18):  a0 b0 00 00 0b ff ff ff ff 64 f0 00 ff fe 00 03 91 78
95
APDU: (9):  a0 a4 00 00 02 6f 78 9f 0f
96
APDU: (9):  a0 b0 00 00 02 00 01 91 78
97
APDU: (9):  a0 a4 00 00 02 6f 74 9f 0f
98 2 laforge
APDU: (23):  a0 b0 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 91 78
99
APDU: (9):  a0 a4 00 00 02 6f 20 9f 0f
100
APDU: (16):  a0 b0 00 00 09 ff ff ff ff ff ff ff ff 07 91 78
101
APDU: (9):  a0 a4 00 00 02 6f 30 9f 0f
102 1 laforge
APDU: (22):  a0 c0 00 00 0f 00 00 00 f0 6f 30 04 00 11 00 55 01 02 00 00 91 78
103
}}}
104
105
== Wireshark integration ==
106
107 6 tsaitgaist
There is an experimental patch, also part of the simtrace.git package.  You will have to apply this against the latest
108 1 laforge
[wiki:wireshark] developer version.
109
110
[[Image(wireshark-sim.png)]]
111
112
Protocol parsing is far from being complete, patches are always welcome!
Add picture from clipboard (Maximum size: 48.8 MB)