Wiki » History » Version 13
tsaitgaist, 07/10/2018 07:16 PM
add sniff application
1 | 1 | tsaitgaist | h1. Osmocom SIMtrace 2 |
---|---|---|---|
2 | |||
3 | 8 | laforge | Osmocom SIMtrace 2 is a software, firmware and hardware system for passively tracing SIM-ME communication between the SIM card and the mobile phone, and remote SIM operation. |
4 | 9 | tsaitgaist | While it was designed for SIM-ME communication, it supports all ISO 7816 smart-cards using the T=0 protocol (the most common case). |
5 | 1 | tsaitgaist | |
6 | 12 | tsaitgaist | It is a followup of the "SIMtrace project":/project/simtrace/Wiki, providing more functionalities (e.g. remote SIM operation) and supporting multiple boards (e.g. SIMtrace with SAM3S, "sysmoQMOD":https://www.sysmocom.de/products/sysmoqmod/index.html). |
7 | 1 | tsaitgaist | |
8 | h2. Hardware |
||
9 | |||
10 | 10 | tsaitgaist | The SIMtrace 2 firmware supports several boards. |
11 | The firmware is written for an "ATSAM3S4B":https://www.microchip.com/wwwproducts/en/ATSAM3S4B micro-controller. |
||
12 | 1 | tsaitgaist | |
13 | 12 | tsaitgaist | Note: The SAM3S is meanwhile labelled as _not recommended for new designs_ by Atmel. However, there are plenty of hardware and software compatible upgrade options, including SAM4S. The upgrade is possible in the future. |
14 | 1 | tsaitgaist | |
15 | 12 | tsaitgaist | h3. SIMtrace v2 |
16 | 1 | tsaitgaist | |
17 | 10 | tsaitgaist | !{width:20%}simtrace-board-mini.jpg! |
18 | 9 | tsaitgaist | |
19 | 10 | tsaitgaist | The main purpose of this board is to sniff the communication between a phone and a SIM card (or any card reader and smart-card). |
20 | 1 | tsaitgaist | |
21 | 12 | tsaitgaist | This is the same circuit board as the previous "SIMtrace v1":/project/simtrace/wiki/SIMtrace_Hardware, with the exception that the "ATSAM3S4B":https://www.microchip.com/wwwproducts/en/ATSAM3S4B micro-controller replaces the old "AT91SAM7S64":https://www.microchip.com/wwwproducts/en/AT91SAM7S64. Since the SAM3S is pin compatible with the SAM7S, any SIMtrace v1 board can be converted into a SIMtrace v2 board simply by replacing the micro-controller. |
22 | 1 | tsaitgaist | |
23 | 10 | tsaitgaist | Note: This hardware is "open source":https://git.osmocom.org/simtrace/tree/hardware. |
24 | 1 | tsaitgaist | |
25 | h3. sysmoQMOD |
||
26 | |||
27 | !{width:25%}sysmoqmod.png! |
||
28 | |||
29 | The SAM3S micro-controller with SIMtrace 2 firmware is also used on the "sysmoQMOD":https://www.sysmocom.de/products/sysmoqmod/index.html board to provide remote SIM operation capabilities. |
||
30 | |||
31 | Note: This hardware is not open source. |
||
32 | |||
33 | h2. Firmware |
||
34 | |||
35 | 10 | tsaitgaist | The SIMtrace 2 firmware source code is available in "git":https://git.osmocom.org/simtrace2/. |
36 | It is currently under active development and we recommend to [[Flashing|flash]] the new firmware images to profit from the latest bug fixes and added functionalities. |
||
37 | 1 | tsaitgaist | |
38 | The SIMtrace 2 firmware is a complete rewrite and *can only be flashed on hardware with SAM3S* ARM Cortex-M3-based micro-controllers. |
||
39 | 12 | tsaitgaist | *The SIMtrace 2 firmware is not compatible with the older "SIMtrace v1":/project/simtrace/wiki/SIMtrace_Hardware using SAM7S ARM7TDMI-based micro-controllers.* |
40 | 1 | tsaitgaist | |
41 | 12 | tsaitgaist | h3. trace |
42 | 1 | tsaitgaist | |
43 | 12 | tsaitgaist | The trace application firmware allow to sniff the communication between a phone and a SIM card (or any card reader and smart-card). |
44 | It is intended for the [[Wiki#SIMtrace v2|SIMtrace v2 hardware]] and its function is analog to the "SIMtrace v1":/projects/simtrace/wiki/SIMtrace_Firmware. |
||
45 | 10 | tsaitgaist | |
46 | 12 | tsaitgaist | The sniffing is completely passive. It uses the RST, ATR, PPS (baud rate tested with F/D up to 512/32), and WT (waiting timeout) to properly parse the ISO 7816-3 TPDUs. |
47 | Currently only the T=0 protocol is supported since this is the most common protocol used (we haven't seen T=1 in use). |
||
48 | |||
49 | 10 | tsaitgaist | !{width:25%}simtrace_and_phone.jpg! |
50 | |||
51 | The application firmware to be flashed using [[Flashing#DFU|DFU]] is attachment:simtrace-trace-dfu.bin. |
||
52 | |||
53 | 13 | tsaitgaist | h3. Development |
54 | |||
55 | To compile the firmware using the source code, or participate in the development, please refer to the instructions provided in the "README":https://git.osmocom.org/simtrace2/tree/firmware/README.txt . |
||
56 | |||
57 | 10 | tsaitgaist | h2. Flashing |
58 | 11 | tsaitgaist | |
59 | 1 | tsaitgaist | The [[Wiki#Firmware|firmware images]] can be flashed as described [[Flashing|here]]. |
60 | |||
61 | |||
62 | h2. Host PC Software |
||
63 | |||
64 | 13 | tsaitgaist | The SIMtrace 2 host PC software are available in the "simtrace2 git":https://git.osmocom.org/simtrace2/. |
65 | |||
66 | h3. Preconditions |
||
67 | |||
68 | [[libosmocore:]] and libusb. |
||
69 | |||
70 | to install both packages: |
||
71 | <pre> |
||
72 | sudo apt-get install libusb-1.0-0-dev libosmocore-dev |
||
73 | </code></pre> |
||
74 | |||
75 | h3. Compiling it |
||
76 | |||
77 | <pre> |
||
78 | git clone git://git.osmocom.org/simtrace2.git |
||
79 | cd simtrace2/host/ |
||
80 | make |
||
81 | </pre> |
||
82 | |||
83 | h3. Accessing it |
||
84 | |||
85 | Add udev rules so to be able to use SIMtrace 2 devices and access the device as non-root user: |
||
86 | <pre> |
||
87 | # add current user to plugdev group (user needs to re-login for this change to take effect) |
||
88 | sudo adduser $USERNAME plugdev |
||
89 | # grant access permission to SIMtrace 2 for plugdev group |
||
90 | sudo wget --output-file=/etc/udev/rules.d/99-simtrace2.rules https://git.osmocom.org/simtrace2/plain/host/99-simtrace2.rules |
||
91 | # reload udev rules |
||
92 | sudo udevadm control --reload-rules |
||
93 | sudo udevadm trigger |
||
94 | </pre> |
||
95 | |||
96 | h3. Applications |
||
97 | |||
98 | h4. simtrace2-list |
||
99 | |||
100 | @simtrace2-list@ allows to list all SIMtrace 2 compatible devices: |
||
101 | <pre> |
||
102 | ./simtrace2-list |
||
103 | USB matches: 1 |
||
104 | 1d50:60e3 Addr=4, Path=2-2.3, Cfg=1, Intf=0, Alt=0: 255/1/0 (SIMtrace Sniffer) |
||
105 | </pre> |
||
106 | |||
107 | This is useful when you have multiple devices (such as with the [[Wiki#sysmoQMOD]]) and have to specific with device to use by the other applications. |
||
108 | |||
109 | h4. simtrace2-sniff |
||
110 | |||
111 | This will use the [[Wiki#trace|trace]] firmware and retrieve the sniffed phone-SIM communication. |
||
112 | The activity will be shown on the consol output: |
||
113 | <pre> |
||
114 | ./simtrace2-sniff |
||
115 | simtrace2-sniff - Phone-SIM card communication sniffer |
||
116 | (C) 2010-2017 by Harald Welte <laforge@gnumonks.org> |
||
117 | (C) 2018 by Kevin Redon <kredon@sysmocom.de> |
||
118 | |||
119 | Using USB device 1d50:60e3 Addr=4, Path=2-2.3, Cfg=1, Intf=0, Alt=0: 255/1/0 (SIMtrace Sniffer) |
||
120 | Entering main loop |
||
121 | Card state change: reset hold |
||
122 | Card state change: reset release |
||
123 | ATR: 3b 9f 96 80 1f c7 80 31 a0 73 be 21 13 67 43 20 07 18 00 00 01 a5 |
||
124 | PPS: ff 10 96 79 |
||
125 | PPS: ff 10 96 79 |
||
126 | Fi/Di switched to 512/32 |
||
127 | TPDU: a0 a4 00 00 02 3f 00 9f 22 |
||
128 | TPDU: a0 a4 00 00 02 7f 20 9f 22 |
||
129 | TPDU: a0 a4 00 00 02 6f 46 9f 0f |
||
130 | TPDU: a0 b0 00 00 11 81 43 43 43 20 45 76 65 6e 74 ff ff ff ff ff ff ff 90 00 |
||
131 | Card state change: reset hold |
||
132 | </pre> |
||
133 | |||
134 | The TPDU will also be sent the GSMTAP frames to UDP/IPv4 localhost:4729. |
||
135 | This also allows to analyze the communication in wireshark using the GSM SIM dissector. |
||
136 | !{width:50%}wireshark-sim.png! |