Project

General

Profile

SIMtrace » History » Version 31

laforge, 02/19/2016 10:48 PM
add link to mailing list and shop

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 31 laforge
 * Implement MITM
41 1 laforge
42
== Hardware ==
43 17 laforge
44 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.
45
46 31 laforge
Now we have a dedicated PCB design.  The schematics and Gerber files are released as open source hardware and can be produced by everyone.
47
48
However, those of you who are not interested in building it from scratch can buy a complete factory-produced, tested and flashed PCB assembly from http://shop.sysmocom.de/products/simtrace
49
50 27 laforge
More details are available at [wiki:SIMtrace/Hardware]
51 4 laforge
52 1 laforge
== Firmware ==
53
54 28 laforge
The firmware for the AT91SAM7S device was written by reusing a lot of the code for the [http://www.openpcd.org/ OpenPCD]
55
RFID reader.  Details are available at [wiki:SIMtrace/Firmware].
56 24 tsaitgaist
57 1 laforge
58 5 laforge
== Host PC Software ==
59
60 6 tsaitgaist
The {{{simtrace}}} program is part of the git://git.osmocom.org/simtrace.git repository. It will bind to the USB device
61 5 laforge
and send GSMTAP frames using UDP/IPv4 to localhost:4729.
62 6 tsaitgaist
63 14 tsaitgaist
=== Preconditions ===
64 1 laforge
65 14 tsaitgaist
[wiki:libosmocore] and headers (simtrace_usb.h) from the firmware.
66
67
additional packages :
68 6 tsaitgaist
{{{
69 26 tsaitgaist
sudo apt-get install libusb-1.0-0-dev
70 7 tsaitgaist
}}}
71 1 laforge
72 6 tsaitgaist
=== Compiling it ===
73
74 1 laforge
{{{
75 14 tsaitgaist
git clone git://git.osmocom.org/simtrace.git
76 21 tsaitgaist
cd simtrace/host/
77 6 tsaitgaist
make
78
}}}
79
80
=== Using it ===
81
82
Simply start '''simtrace'''.
83 13 tsaitgaist
It will send the GSMTAP frames to UDP/IPv4 localhost:4729.
84 1 laforge
85
It will also print hexdumps of the frames to the console, looking like this:
86 6 tsaitgaist
{{{
87 1 laforge
sudo ./simtrace
88
APDU: (9):  a0 a4 00 00 02 6f 07 9f 0f
89
APDU: (22):  a0 c0 00 00 0f 00 00 00 09 6f 07 04 00 15 00 15 01 02 00 00 91 78
90
APDU: (9):  a0 a4 00 00 02 6f 38 9f 0f
91
APDU: (22):  a0 c0 00 00 0f 00 00 00 09 6f 38 04 00 15 00 55 01 02 00 00 91 78
92
APDU: (16):  a0 b0 00 00 09 ff 3f ff ff 00 00 3f 03 00 91 78
93
APDU: (9):  a0 a4 00 00 02 6f ad 9f 0f
94
APDU: (8):  a0 b0 00 00 01 00 91 78
95
APDU: (9):  a0 a4 00 00 02 6f 07 9f 0f
96
APDU: (16):  a0 b0 00 00 09 08 49 06 20 11 49 00 11 06 91 78
97
APDU: (9):  a0 a4 00 00 02 6f 7e 9f 0f
98
APDU: (18):  a0 b0 00 00 0b ff ff ff ff 64 f0 00 ff fe 00 03 91 78
99
APDU: (9):  a0 a4 00 00 02 6f 78 9f 0f
100
APDU: (9):  a0 b0 00 00 02 00 01 91 78
101
APDU: (9):  a0 a4 00 00 02 6f 74 9f 0f
102 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
103
APDU: (9):  a0 a4 00 00 02 6f 20 9f 0f
104
APDU: (16):  a0 b0 00 00 09 ff ff ff ff ff ff ff ff 07 91 78
105
APDU: (9):  a0 a4 00 00 02 6f 30 9f 0f
106 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
107
}}}
108
109
== Wireshark integration ==
110
111 6 tsaitgaist
There is an experimental patch, also part of the simtrace.git package.  You will have to apply this against the latest
112 1 laforge
[wiki:wireshark] developer version.
113
114
[[Image(wireshark-sim.png)]]
115
116
Protocol parsing is far from being complete, patches are always welcome!
117 31 laforge
118
== Contact / Mailing List ==
119
120
For any development or usage related questions, there is a mailinglist [mailto:simtrace@lists.osmocom.org], you can subscribe/unsubscribe to it at http://lists.osmocom.org/mailman/listinfo/simtrace and read the archives at http://lists.osmocom.org/pipermail/simtrace/
121
122
Please kindly observe our [http://openbsc.osmocom.org/trac/wiki/MailingListRules Mailing List Rules]
Add picture from clipboard (Maximum size: 48.8 MB)