最近在做路由器安全审计,为starlink的路由审计继续做准备工作。
假设我们已经获得了路由器的root权限,接下来要通过云主机上安装和配置Tinyproxy代理服务器,并将路由器上的流量透明地转发到代理服务器上,然后实现HTTP和HTTPS劫持来修改用户请求的目标网站。
卫星网络安全方面,代理服务器同样可以用于加密和保护用户的流量,以确保敏感数据在通过卫星网络传输时不被窃取或篡改。此外,在某些情况下,代理服务器也可以用于控制和监视网络流量,以便进行安全审计和调查。故将本文作为卫星网络安全的基础文章来介绍。
一、如何配置路由器
1. 首先,在路由器的telnet界面中创建一个新的链,用于处理代理流量:
iptables -t nat -N proxy_chain
2. 接下来,将所有从局域网发出的HTTP(80端口)和HTTPS(443端口)流量重定向到新创建的链:
iptables -t nat -A PREROUTING -i br0 -p tcp --dport 80 -j proxy_chain
iptables -t nat -A PREROUTING -i br0 -p tcp --dport 443 -j proxy_chain
其中,br0是局域网接口的名称。需要将其替换为路由器上实际的接口名称。
3. 在proxy_chain链中,设置规则将流量重定向到云主机上的Tinyproxy代理服务器:
iptables -t nat -A proxy_chain -p tcp -j DNAT --to-destination xx.xx.xx.xx:3128
二、如何配置云主机
1. 在Ubuntu上安装Tinyproxy:
sudo apt-get update
sudo apt-get install tinyproxy
2. 编辑Tinyproxy配置文件:
sudo nano /etc/tinyproxy/tinyproxy.conf
确保以下配置选项设置正确即可,Port 3128与路由器的网络出口xx.xx.xx.xx填写正确:
# Port: Specify the port which tinyproxy will listen on. Please note
# that should you choose to run on a port lower than 1024 you will need
# to start tinyproxy using root.
#
Port 3128
# Allow: Customization of authorization controls. If there are any
# access control keywords then the default action is to DENY. Otherwise,
# the default action is ALLOW.
#
# The order of the controls are important. All incoming connections are
# tested against the controls based on order.
#
Allow 127.0.0.1
Allow ::1
Allow 192.168.50.0/24
Allow 192.168.0.0/24
Allow 192.168.1.0/24
Allow xxx.xxx.xxx.xxx
3. 重启Tinyproxy服务:
sudo systemctl restart tinyproxy
4. 现在,通过路由器连接到Internet的所有设备的流量都会先转发到云主机上,再由云主机代为访问所有的互联网流量。
三、HTTP&HTTPS劫持
本文介绍的路由器到云主机的网络代理实现花费了不少时间,所以路由器HTTP&HTTPS的劫持将放在下篇继续介绍,有兴趣的读者可以继续关注。
四、其他资料
更多关于卫星安全的学习资料可以从下方获取:
https://github.com/MasterTaiBai/Sat-Hacking
Sat-Hacking愿景:成为一名合格的卫星黑客需要长时间的学习和实践。只有通过持续的努力,掌握各种卫星安全知识和技能,才能真正成为一个专业的卫星白帽子。
在此祝愿安全爱好者及从业人员都能够取得成功,实现自己的梦想,为网络安全贡献自己的力量!