天天看點

GSM:嗅探語音流量

GSM: Sniffing voice traffic

I wrap up the GSM series with a walkthrough on how to decrypt voice traffic. Voice is the way most people interact on a telecommunications network and therefore a major componenent of GSM traffic. I’ve explained a lot of the background on GSM communication in the previous posts so I’ll get right to it.

We will capture the traffic using the HackRF one and the call will take place between two Safaricom lines. The capture will take place on the downlink - that is the receiving end of the call. I’ll use a Blackberry as the receiving device so that I can easily get the TMSI and Kc.

Capturing the traffic

The values I get are:

ARFCN: 17 TMSI: 8D4812F8 Kc: 239E4C213612C000

I use the airprobe_rtlsdr_capture module of gr-gsm to capture the voice traffic. I begin the capture by running the following command:

<code>airprobe_rtlsdr_capture.py -a 17 -s 1000000 -g 40 -c voice_capture.cfile -T 150</code>

-a is the ARFCN, -s the sample rate in Hz, -g the gain, -c the output file and -T the duration of our capture in seconds.

I then make a call while the capture is in progress.

Decoding BCCH

As explained in the previous post, in idle mode the phone has to listen on the BCCH to detect traffic to be sent to it. Our aim here is to identify what SDCCH (Standalone Dedicated Control Channel) is used for our call setup.

We first start wireshark, monitor the loopback interface and then run the following command:

<code>airprobe_decode.py -c voice_capture.cfile -s 1000000 -a 17 -m BCCH -t 0</code>

voice_capture.cfile is the file with the voice traffic we captured. We then search for traffic specific to our TMSI by searching for it in wireshark packet details. we look for the paging request and inspect the Immediate Assignment that follows:

GSM:嗅探語音流量

Note that it’s SDCCH/8, Timeslot 1.

Decoding SDCCH

We now need to identify the ciphering mode the BTS tells the phone to use. We restart wireshark on the loopback interface and then run the following command specifying SDCCH8 and Timeslot 1:

<code>airprobe_decode.py -c voice_capture.cfile -s 1000000 -a 17 -m SDCCH8 -t 1</code>

We look for a Paging Response followed by a Ciphering Mode Command.

GSM:嗅探語音流量

We see that the algorithm in use is A5/1.

Decoding TCH

We now restart wireshark on the loopback interface and run the following command:

<code>airprobe_decode.py -c voice_capture.cfile -s 1000000 -a 17 -m SDCCH8 -t 1 -e 1 -k 0x23,0x9E,0x4C,0x21,0x36,0x12,0xC0,0x00</code>

-e 1 specifies the algorithm A5/1, -k 0x23,0x9E,0x4C,0x21,0x36,0x12,0xC0,0x00 specifies the Kc.

On wireshark we first look for the Call Control Setup traffic and we can actually see the calling party number as below.

GSM:嗅探語音流量

A bit down the capture we should see an Assignment command. We see that the voice call is assigned to Timeslot 7 and the Traffic Channel is full rate (TCH/F).

GSM:嗅探語音流量

Decoding the voice traffic

We can now finally decode the voice traffic by running the following command:

<code>airprobe_decode.py -c voice_capture.cfile -s 1000000 -a 17 -m TCHF -t 7 -e 1 -k 0x23,0x9E,0x4C,0x21,0x36,0x12,0xC0,0x00 -d FR -o speech.au.gsm</code>

-m TCHF specifies the traffic channel, -t 7 the TCH/F timeslot, -d FR specifies the voice codec of the channel as full rate, andspeech.au.gsm specifies the output file.

speech.au.gsm contains the voice traffic. We convert it to an audio file using toast as follows:

<code>toast -d speech.au.gsm</code>

We will get a file called speech.au which we can play back and listen to the captured voice call :).

Alternative method

The equivalent commands for the whole process starting from decoding BCCH to decoding voice are:

<code>./go.sh voice_capture.cfile 64 0B</code>

<code>./go.sh voice_capture.cfile 64 1S 239E4C213612C00001</code>

<code>./go.sh voice_capture.cfile 64 7T 239E4C213612C00001</code>

That concludes the GSM radio series for now. Till next time, happy hacking!

原文連結:https://www.ckn.io/blog/2016/01/25/gsm-sniffing-voice-traffic/
GSM:嗅探語音流量

本文轉自 K1two2 部落格園部落格,原文連結:http://www.cnblogs.com/k1two2/p/8484716.html  ,如需轉載請自行聯系原作者

繼續閱讀