

MitM'ing my STB (IPTV with a set-top-box)
source link: https://www.tuicool.com/articles/EFfiQjZ
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

My ISP is offering IPTV with a set-top-box (STB) device which is connected to the provider network and the TV itself:
The only “user interface” for the STB is the remote control. I was curious to find out if the traffic between the STB and the provider is encrypted, so I decided to see what goes on the wire. The easiest way to do this is to create an ethernet bridge between the provider and the STB and then capture the traffic. I used my MacBook with a second USB Ethernet adapter. In OSX, an ethernet bridge is created like this:
ifconfig bridge1 create ifconfig bridge1 up ifconfig bridge1 addm en4 addm en5 sysctl -w net.inet.ip.forwarding=1
I used Wireshark to capture the traffic and to my surprise there was no encryption at all. They have been using RTSP to switch between TV channels:
Every channel has unique ID like ch12032017033910402807
. The ISP is also offering some paid channels (like HBO) which I am not subscribed to. However, I managed to find the complete list of channel IDs in the traffic dump, including the ones that I am not subscribed to. In other words, the entire security for the paid channels is done on the client side (by the STB) instead on the server side. And you can watch every channel as long as you know its ID.
At this point my first idea was to replace the STB with my own computer which can talk their protocol and play the entire set of channels. However, that would be a lot of work which is not fun doing. A better solution would be to create a man-in-the-middle between the STB and the provider which can modify the traffic and thus substitute some crappy channels with the paid channels. What a great opportunity to use my old Raspberry Pi!
The classic MitM with ARP spoofing didn’t work out because there was MAC filter on the provider side. Long story short, I created my own tool nfqsed which can transparently modify network traffic using a predefined set of substitution rules. I used my USB Ethernet adapter to turn my Raspberry Pi into an ethernet bridge. The built-in network adapter is connected to the provider and the USB adapter is connected to the STB. This is how it looks like from the top:
Below are the relevant config files on the Raspberry Pi which setup the networking and configure nfqsed to replace one TV channel with another:
/etc/network/interfaces
iface br0 inet static bridge_ports eth0 eth1 address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8 up iptables -A FORWARD -p tcp --destination-port 554 -j NFQUEUE --queue-num 0
/etc/rc.local
/home/pi/nfqsed/nfqsed -f /home/pi/rules.txt &
/home/pi/rules.txt
# Fen TV / HBO HD /ch13121216533621227255/ch12092914401822894191 # Folklor TV / HBO Comedy HD /ch11123010551095204329/ch12092914413728185379 # Tqnkov / Cinemax /ch11123010550900907719/ch11123010551005188322 # DM Sat / Cinemax 2 /ch11123010550925360552/ch11123010551067094950
Recommend
-
104
This story starts at the console debugging a coworker’s issue. They had gotten stuck trying to run bundle install . Try, and fail. Try, and fail. And the error was really weird: C...
-
98
Apple, others ban Kazakhstan’s MitM HTTPS certificate ...
-
117
MiTM漏洞影响所有Kubernetes版本 ...
-
97
What is a man-in-the-middle-attack?A man-in-the-middle (MitM) attack is a type of cyberattack in which communications between two parties is intercepted, often to steal login credentials or personal information, spy on victims, sabot...
-
105
「DHCP」- 仿冒攻击(中间人攻击,MITM Attack) 「DHCP」- 仿冒攻击(中间人攻击,MITM Attack) ...
-
82
MITM 与 HTTPS 流量劫持 VPS 硬盘挂之前,blog 里留了一篇文章,如何使用 redsocks + linux policy based routing 实现对手机 HTTPS 流量的劫持。具体方案懒得再写了。简单描述一下原理,后边的文章会需要引用。
-
73
MitM at the Edge: Abusing Cloudflare Workers Cloudflare Workers provide a powerful serverless solution to run code that sits between every HTTP request and response. In this post, we’ll see how an attacker compromisin...
-
11
What’s that magic computation in stb__RefineBlock? November 8, 2022 Back in 2007 I wrote my DXT1/5 (aka BC1/3) encoder rygdxt, originally for “fr-041: debris” (so it was...
-
26
JIO STB ATV 7 ...
-
11
ReyeeOS 1.204.1614 - MITM Remote Code Execution (RCE) ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK