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

I’ll speed through a lot of these steps as they are similar to the sniffing SMS traffic scenario. I’ll use the Absolute Radio Frequency Channel Number ARFCN in specifying the radio channel. GSM uses ARFCNs to represent the various frequencies the BTS and mobile device communicate on. I’ll use the ARFCN instead of the frequency in the commands I’ll run for variety as I’ve been using frequency in the previous posts. We begin by getting the ARFCN, TMSI and Kc from the Blackberry. On a Blackberry these are readily available from the engineering screen menu. The ARFCN is gotten by navigating to the Cell Identity submenu, the TMSI from theMobile Identity submenu and finally the Kc from the SIM Browser submenu.

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:

1
airprobe_rtlsdr_capture.py -a 17 -s 1000000 -g 40 -c voice_capture.cfile -T 150

-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:

1
airprobe_decode.py -c voice_capture.cfile -s 1000000 -a 17 -m BCCH -t 0

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:

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:

1
airprobe_decode.py -c voice_capture.cfile -s 1000000 -a 17 -m SDCCH8 -t 1

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

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

Decoding TCH

TCH is the Traffic Channel in GSM and is used to carry voice traffic and data. It could either be full rate TCH/F or half rate TCH/H. You can read up more on it here.

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

1
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

-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.

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).

Decoding the voice traffic

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

1
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

-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:

1
toast -d speech.au.gsm

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

Alternative method

Alternatively one could use the mainstream airprobe modules instead of gr-gsm with the same results. The original modules had issues with the HackRF and later GNU Radio versions. I however did some patching and you can clone the patched version from my Github here.

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

1
2
3
4
./go.sh voice_capture.cfile 64 0B
./go.sh voice_capture.cfile 64 1S 239E4C213612C00001
./go.sh voice_capture.cfile 64 7T 239E4C213612C00001
toast -d speech.au.gsm

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/

 
本文转自 K1two2 博客园博客,原文链接:http://www.cnblogs.com/k1two2/p/8484716.html   ,如需转载请自行联系原作者
相关文章
|
监控 安全 Linux
处理SIP的voip语音环境问题的方法
在VoIP的环境中,特别是基于SIP通信的环境中,我们经常会遇到一些非常常见的问题,例如,单通,30秒就断线,注册问题,回声等。这些问题事实上都有非常直接的排查方式和解决办法,用户可以按照一定的排查方式,工具非常高效地解决这些问题。但是,因为读者技术水平参差不齐,网络上的很多技术也不完整。笔者今天系统归纳了这些问题。根据一些用户的使用环境和用户经常遇到一些问题,我们列举了以下十个在SIP呼叫中经常遇到的问题,并且给出了相应的排查方式,用户可以按照这些方法来解决SIP通话中的这些问题,有关系统问题欢迎喂博主一起交流学习。这十个经典的问题包括: 不能注册或呼叫到SIP服务器端 30秒挂断呼叫的
|
传感器 机器学习/深度学习 编解码
手机侧信道窃听攻击
在本文中将重新探讨运动传感器对语音隐私的威胁,并提出了一种新型侧信道攻击AccelEve,它利用智能手机的加速度计来窃听同一智能手机中的扬声器。具体来说,它利用加速度计的测量值来识别扬声器发出的语音并重构相应的音频信号。本研究的设置允许语音信号通过共享母板在加速度计测量中始终产生强大的响应,从而成功解决了第一个局限,并使这种攻击渗透到现实生活中。关于采样率的限制,与普遍认知的相反,在最近的智能手机中观察到高达500Hz的采样率,几乎覆盖了成人语音的整个基本频带(85-255Hz)。
159 2
|
算法
基于CDMA全功能短信和图片发送,包括多用户,信道估计等
基于CDMA全功能短信和图片发送,包括多用户,信道估计等
164 0
基于CDMA全功能短信和图片发送,包括多用户,信道估计等
|
存储 应用服务中间件 网络性能优化
|
存储 负载均衡 安全
SIP的voip语音环境咬线或摘机状态什么处理
SIP的voip语音环境咬线或摘机状态什么处理
SIP的voip语音通话后30秒左右挂断呼叫怎么解决
SIP的voip语音通话后30秒左右挂断呼叫怎么解决
|
监控 安全 Linux
10个方法处理基于SIP的voip语音环境问题
在VoIP的环境中,特别是基于SIP通信的环境中,我们经常会遇到一些非常常见的问题,例如,单通,30秒就断线,注册问题,回声等。
PSTN接入设备
将来可能所有的语音信息都能装在IP数据包中,但目前仍有不少的语音信息必需通过PSTN进行转接,所以局域网电话系统必须具有连接PSTN的功能。能够完成这种连接PSTN网功能的设备称为PSTN接入网关(也称为接入交换机)。
PSTN接入设备
|
SQL 算法 网络协议
VOIP语音抓包、解码与带宽计算
最近接触到几种局域网的VOIP设备,Voice over Internet Protocol,决定对它内部通信研究一番,到底语音数据是怎么格式实时传输到对端。按照百度的解释,VoIP的基本原理是通过语音的压缩算法对语音数据编码进行压缩处理,然后把这些语音数据按 TCP/IP 标准进行打包,经过 IP 网络把数据包送至接收地,再把这些语音数据包串起来,经过解压处理后,恢复成原来的语音信号,从而达到由互联网传送语音的目的。