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

[DNS Attack!] 要是网站自己有域名解析到127.0.0.1,是不是firefox扩展就不能实现屏蔽了? #1

Open
yilksd opened this issue Nov 20, 2021 · 2 comments
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@yilksd
Copy link

yilksd commented Nov 20, 2021

比如腾讯就有

@garywill
Copy link
Owner

I checked MDN https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest

webrequest-flow
Not until onHeadersReceived addon can see IP.
Before it addon can only see URL.
So, if addon built only with current webRequest API, it can't.

Conlusion:
When addon see a domain URL web subresource http://evil.url:<you-LAN-port> is resolved to 127.0.0.1, the 127.0.0.1:<my-LAN-port> request has already been done by browser.

(I think we can talk to Mozilla about that)

Before them implement a proper API, there may be a workaround:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/dns/resolve
We could combine our current method with dns.resolve() with offline flag. (not sure, maybe. Need more research and tests.)

比如腾讯就有

有具体的吗?现在腾讯用它来干什么?

@yilksd
Copy link
Author

yilksd commented Nov 20, 2021

看来如果想堵住这个漏洞,用浏览器扩展来实现不太合适。本地的dns 服务器软件可能更合适些,就是把除了localhost等已知
合理的可以解析到127.0.0.0/24, 169.254.0.0/16,100.64.0.0/16,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16的域名之外的域名都禁止解析到这些ip 。

有具体的吗?现在腾讯用它来干什么?
https://www.zhihu.com/question/34568587/answer/2008749222

@garywill garywill changed the title 要是网站自己有域名解析到127.0.0.1,是不是firefox扩展就不能实现屏蔽了? [DNS Attack!] 要是网站自己有域名解析到127.0.0.1,是不是firefox扩展就不能实现屏蔽了? Jan 16, 2022
@garywill garywill added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants