Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brook 加密传输协议中,客户端收到的信息不可靠 #1117

Closed
RPRX opened this issue Jan 8, 2023 · 1 comment
Closed

Brook 加密传输协议中,客户端收到的信息不可靠 #1117

RPRX opened this issue Jan 8, 2023 · 1 comment

Comments

@RPRX
Copy link

RPRX commented Jan 8, 2023

你好,这个漏洞类似于 shadowsocks/shadowsocks-org#183

Brook 加密传输协议 中 TCP 双向的加密参数、协议结构相似,且服务端返回给客户端的是一条完全独立的加密流,这使得对客户端的攻击成为可能:中间人可以把返回流替换成以往记录的请求流或返回流,或即时交换两条返回流等,客户端无法在解密时发现异常,会把完全错误的信息返回给上层应用。要解决该漏洞,返回流以某种方式关联请求流即可,比如 HKDF 的 info 改为请求流的第一个 nonce。

UDP 包同理,但问题更多一些,举例较麻烦,不展开。总之,建议 UDP 请求包内加入基于源二元组的唯一标识符(顺便实现了端口复用),返回包也带上它,并且也加上时间戳校验。但请求包与返回包的明文格式不能完全相同,需要有一个字段来区分它们。

@RPRX
Copy link
Author

RPRX commented Jan 9, 2023

以上仅为对 Brook “加密传输协议”设计上的修复建议,anti-censorship 的设计与实践是另一个话题,此处未讨论

建议修改 HKDF 的默认 info,这样服务端可以同时支持新旧两个协议

Repository owner locked and limited conversation to collaborators Apr 8, 2023
@txthinking txthinking converted this issue into discussion #1164 Apr 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant