wireguard over vless tcp 明文安全性探讨 #2542
Replies: 3 comments
-
Yes, the routing rules in Xray can theoretically function as a firewall in a sense. They control the flow of inbound and outbound traffic, similar to how a firewall operates. Thus, if you set up the rules correctly, you could prevent an attacker from using your VLESS TCP as a forwarder to their own server. |
Beta Was this translation helpful? Give feedback.
-
为什么vless要明文,使用tls加密不行吗 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
理想状态是wg客户端服务器直连,
但是如果运营商qos udp,那么就需要 wg走tcp隧道:
这个是网上普遍的教程
但是我强烈不推荐,因为让wg的加密失去意义,wg不仅是强加密,还有前向安全, 但是vless tcp 明文 ,外层没有加密,
攻击者直接可以透过 vless tcp 连接内网,这里假设xray和wg服务器在同一个机器上面
wg客户端endpoint假设是:127.0.0.1:20000
那么wg客户端所在设备 xray 配置文件如下:
{
"log": {
"loglevel": "debug"
},
"inbounds": [
{
"listen": "0.0.0.0",
"port": 20000,
"protocol": "dokodemo-door",
"settings": {
"address": "192.168.1.2",
"port": 51820,
"network": "udp"
},
"tag": "wg"
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
},
{
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "home.v6.test.com",
"port": 52220,
"users": [
{
"id": "c71c70ec2f20fa",
"encryption": "none"
}
]
}
]
},
"streamSettings": {
"network": "tcp"
},
"tag": "vless-tunnel"
}
],
"routing": {
"rules": [
{
"type": "field",
"inboundTag": [
"wg"
],
"outboundTag": "vless-tunnel"
}
]
}
}
假设 wg服务器监听:192.168.1.2:51820
那么 wg服务器 设备 xray 配置文件如下:
{
"log": {
"loglevel": "debug"
},
}
很明显,wg服务器 设备 xray 配置文件 52220端口暴露外网,
人家攻击者直接明文抓包vless tcp 即可 入侵内网
那么 xray 配置文件 路由规则限制只允许 wg流量 就安全了,
至少我目前的知识理解是这样,wg服务器 设备 xray 配置文件如下:
{
"log": {
"loglevel": "debug"
},
}
配置文件解读,其实就是在 第1节的基础上,增加了路由规则:
{
"type": "field",
"outboundTag": "free",
"port": "51820",
"network": "udp"
},
允许51829 udp端口的流量走freedom outbound
最后增加兜底规则:
{
"type": "field",
"outboundTag": "block",
"network": "tcp,udp"
}
屏蔽所有 tcp,udp流量
这样即使 攻击者直接明文抓包vless tcp 的uuid,
然后连接这个 vless tcp 52220 节点,是不能访问内网或者别的服务的 ,只能访问 udp 51820
后来发现虽然攻击者不能访问我的 vless tcp所在网络了,但是还是可以借助vless tcp在客户端端口转发到 别的udp 51820服务器,比如 attacker.wg.com:51820
因此仍然需要限定udp 51820服务器的目标地址:
{
"type": "field",
"outboundTag": "free",
"ip": ["192.168.1.2/32"],
"port": "51820",
"network": "udp"
},
后来思考了下,攻击者有没有可能通过链式代理 再次绕过我设置的路由规则,使用我的 vless tcp变成转发器转发攻击者自己的 attacker.wg.com:51820?此处如果有懂的大佬,还请告知 通过 xray的 路由规则是否能够变相作为防火墙
此处就不写配置文件了,如果要写其实就是基于第1节或者第二节基础上把 vless tcp修改为 vless tcp TLS 节点,
这样任意门转发 wg先走外层tls加密,然后再到内层 wg加密连接服务器,
这种虽然消耗加解密资源,但是最安全
Beta Was this translation helpful? Give feedback.
All reactions