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

Deno should block access to local network unless explicitly permitted #21227

Open
teleclimber opened this issue Nov 16, 2023 · 0 comments
Open
Labels
permissions related to --allow-* flags suggestion suggestions for new features (yet to be agreed)

Comments

@teleclimber
Copy link

Connecting to a local private IP without the user realizing it is quite straightforward in Deno: simply prompt the user for permission to a public domain that looks innocuous but that the attacker controls, and who has set the DNS records of that domain to point to the desired IP.

This isn't great for the attacker because they must know the IP beforehand. However there are some well known internal IPs that can serve juicy data for an attacker, like 169.254.169.254 (see here). So just for that reason it should not be so easy to do that in Deno.

However, what happens when wildcard subdomains #6532 or URLPatterns #17378 are usable in --allow-net?

Combine these with a cute DNS server controlled by the attacker that returns any desired IP for the A record, and the attacker can probe the entire network. Consider how this Plex DNS server works:

$ dig 10-10-10-10.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.plex.direct +short
10.10.10.10

source: https://words.filippo.io/how-plex-is-doing-https-for-all-its-users/

There are a number of factors combining to make a rather dangerous cocktail:

  • wildcards in --allow-net (not implemented but indications are a PR would be merged)
  • if you don't specify a port in --allow-net, Deno assumes you mean "any port you want". That's great for probing. the network!
  • Deno doesn't check the resolved IP to see if it's a reserved or private IP.

I think the user should be prompted again, or should explicitly allow access to an internal IP if a permitted public domain resolves to a private IP.

Furthermore, I think not specifying a port should imply it's 80 or 443. If you want something else, specify it. If you really want to allow any port it should be possible too, but has to be made explicit.

Thanks!

✌️

@crowlKats crowlKats added the suggestion suggestions for new features (yet to be agreed) label Nov 29, 2023
@bartlomieju bartlomieju added the permissions related to --allow-* flags label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
permissions related to --allow-* flags suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

No branches or pull requests

3 participants