9 ms·
How Ethereum can be stolen through DNS rebinding
- deleted 9y ago[deleted]
- foodislove 9y agoI once lost bitcoins in my Mt Gox account when I clicked on a dodgy popup while logged into my account. This specific problem is easily mitigated. However, for most people who dabble in cryptocurrencies, they don't realize relying on security and setting defaults is just asking for trouble.
- captn3m0 9y ago>PS: This has been reported to the ethereum foundation but they don’t consider it a valid vulnerability. How are DNS rebinding attacks not a valid vulnerability?
- sneak 9y agoThe user chose to run an unauthenticated service on localhost. Anything on localhost (eg a browser) can access it without authentication. The vulnerability is allowing the service to run without authentication.
- shawnz 9y agoYes, the same-origin policy is just meant to prevent one website from accessing/using the cookies of another website. It is not designed to prevent web applications from accessing network resources.
- Drdrdrq 9y agoThis is not how I understood OP - victim just happens to visit attacker.com, everything else is up to attacker. Or am I missing something?
- scottydelta 9y agoThe victim needs to be running a local geth node(with his wallet unlocked for hacker to actually steal funds) which will give the attacker the wallet addresses atleast.
- tscs37 9y agoThey are but it's not a problem of the ethereum foundation. Rather, it's a problem of DNS resolvers and browsers.
- tinus_hn 9y agoHaving a service accepting commands with no authorization is a vulnerability. If there are multiple users on the machine they can empty each other’s wallets.
- tscs37 9y agoLocalhost is, to some extend, a trusted context. Additionally this requires not having a password on your wallet.
- tinus_hn 9y agoIn most cases, especially ones like this, that trust is misplaced and dangerous.
- tscs37 9y agoThat's more fault of the browser to allow an untrusted context to access a trusted context while circumventing the usual protections (ie, CORS; SOP)
- tinus_hn 9y agoThese ‘protections’ do not provide a ‘trusted context’ and cannot defend you from another user on the same computer. Now your next mistake will be saying ‘but typically there’s only one user’ which is irrelevant because the system runs services as different users for isolation purposes and this vulnerability ignores this isolation.
- cyphar 9y ago> PS: This has been reported to the ethereum foundation but they don’t consider it a valid vulnerability. This is ludicrous. If a torrent client considers this class of bug to be a vulnerability[1], I don't see why folks who are trying to revolutionise money (something that is far more important than a few small RCEs) don't. While it is true you need to run it with the --rpc option, I'm confused why the RPC is unauthenticated by default, and whether there is any front-end that will start up the RPC server in the background (similar to electrum). [1]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-5702 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-5702
- shp0ngle 9y agoBecause it's Ethereum. And Ethereum is actually terrible.
- benchaney 9y agoI very much doubt that torrent client authors consider this to be a vulnerability in their client, but they fixed it anyway because they prefer to work around browsers being weird than to leave all their users vulnerable. I suspect this will eventually be the position of the Ethereum Foundation, but who knows.
- lolikoisuru 9y ago>I very much doubt that torrent client authors consider this to be a vulnerability in their client How could anyone not consider this a vulnerability when it has an actual CVE assigned to it? The discussion in the github issue also shows they took it pretty seriously: https://github.com/transmission/transmission/pull/468 https://github.com/transmission/transmission/pull/468
- benchaney 9y agoIt is certainly a vulnerability. It just isn't a vulnerability in the torrent client, but rather with browsers. Note that this PR is to mitigate the vulnerability, not to fix it.
- TazeTSchnitzel 9y agoThis is why, when I've written an app that runs on localhost, I generate a random token to authenticate access to it, then launch a web browser pointing to the localhost URL with that token. It prevents this type of attack entirely, it's sort of like XSRF prevention.
- hellbanner 9y agoThe Parity cli (Parity is a Proof-of-Authority Ethereum testnet) does exactly this: https://github.com/paritytech/parity https://github.com/paritytech/parity
- joshuakelly 9y agoThis is not quite right - Parity is an EVM implementation, and supports the PoW Foundation chain, amongst other configurations like PoA.
- icebraining 9y agoIt's what git-annex does too. In fact, it does a bit more: rather than launching the browser directly to that URL, it generates an HTML file that then redirects the browser to the URL. That prevents other users in the same system from discovering the token by looking at the process arguments.
- tfha 9y agoIsn't it enough just to have the app require a certain user agent?
- always_good 9y agoThat would still be an authentication token, just placed somewhere else in the request.
- mattigames 9y agoYou could to that in the server level (not the app level); e.g. in the .htaccess file for apache users.
- foepys 9y agoThe proof of concept site is unavailable because its DNS setup is broken. It has no SOA record.
- deleted 9y ago[deleted]
- the8472 9y agoIf you run your own resolver those can be trivially filtered out. For example in unbound there's private-address: <IP address or subnet> Give IPv4 of IPv6 addresses or classless subnets. These are addresses on your private network, and are not allowed to be returned for public internet names. Any occurrence of such addresses are removed from DNS answers. Additionally, the DNSSEC validator may mark the answers bogus. This protects against so-called DNS Rebinding
- xorcist 9y agoFiltering out 127.0.0.1, which is likely what these rebinding attacks utilizes, may cause problems if you run spam filters or ad blockers that use these addresses in their replies. Just something to be aware of, especially of your resolver services other clients than your personal localhost.
- the8472 9y agoAdblockers shouldn't be affected since those usually are operated locally, either as part of the resolver itself or downstream by a user which can always overrule the DNS results. And for dns blacklists you can exempt their domains from these rules.
- benchaney 9y agoCan we all come together and encourage browser developers to fix their shit instead of blaming every service that makes reasonable assumptions about localhost. I do think that Ethereum ought to authenticate it's JSON-RPC service, but not because of DNS rebinding.
- shawnz 9y agoIsn't it a pretty reasonable assumption that code running on your local computer will be able to access local unauthenticated resources?
- benchaney 9y agoIsn't it a reasonable assumption that you won't run untrusted code on your computer without sandboxing it properly?
- shawnz 9y agoSure, but in my experience most people's idea of sandboxing does not include whitelisting access to specific IPs.
- benchaney 9y agoSandboxing means preventing the code from accessing local resources. If that requires whitelisting acces to specific IPs then so be it (although in this case there are other possible solutions).
- mikeash 9y agoAre we not doing multiuser systems anymore?
- benchaney 9y agoSure we are. What does that have to do with DNS rebinding?
- tscs37 9y ago>Since the DNS cache has expired, the browser resolves the DNS again. This time, my server responds with an IP of 127.0.0.1. Sounds like a normal DNS rebind, nothing that is strictly a problem of ethereum. Routers have had the same exact problem for years and it's been partially solved by filtering DNS answers on their side. The easiest solution, of course, would be that browsers consider the origin of any domain pointing to 127.0.0.1 different to localhost itself. Or something in that postcode/general direction.
- STRML 9y agoThis is just one of many vulnerabilities in Geth and other Ethereum clients due to unauthenticated JSON-RPC on localhost. You might recall this even hit Redis years ago. There are many simple solutions (force auth, xsrf token) and it is mind-boggling that these mitigations are not considered standard-issue in the space.
- wickedlogic 9y agoIf you are utilizing json-rpc anywhere in your stack, you should be authenticating every request via your transport(s), or the payload itself with JWT (or the like). To not do this, is to trust the world. This is true over http and browsers, as well as internal servers, sockets, and cross frame communication. There are no such things as trusted internal services, just services that have not yet been breached (looking at you hardware vendors).
- neals 9y agoAnd how would one do this?
- wickedlogic 9y agoSee the details in my comment. The same way you would require authentication and/or signing on any request, on any modern platform. Not doing this is poor form.
- homakov 9y agoI remember checking this issue. Parity has origin whitelisting to prevent exact. No idea why geth is so stupid.
- bhaak 9y agoOn Reddit ret2got quoted the EF on why they don't consider this a geth vulnerability: DNS rebinding to bypass SOP is an old and known issue. There is nothing particular about geth being vulnerable to this. * The RPC api is not the primary protection against theft of ether, users are encouraged to have a long and difficult password, presumably difficult to bruteforce. * Although I cannot find the ticket right now, we're already considering being even more strict on Origin, so that geth would not accept POST-requests from non-whitelisted Origin:s (by default). https://www.reddit.com/r/netsec/comments/7s7cz9/dns_rebinding_of_ethereum_clients/dt2ps6l/ https://www.reddit.com/r/netsec/comments/7s7cz9/dns_rebindin... I'm not sure about the first bullet point. You have to unlock your accounts before calling any balance-changing methods but I don't know if there is a default time after which the accounts get locked again. Even if there is, isn't there a time period while your accounts would be vulnerable? As this seems easily mitigated by a simple security token, I don't see why they shouldn't implement this.
- petee 9y agoSounds more like they are admitting its a vulnerability but downplaying its impact
- silverwind 9y agoDNS rebind attacks can be prevented with dnsmasq. It also has an option for domain-based whitelisting if necessary.
- mangix 9y agoIn OpenWrt, DNS Rebinding is disallowed by default. Not so with many other firmwares.
- r1ch 9y agoI don't understand why DNS rebinding isn't being fixed by browser vendors. If I make an application that listens only on localhost I shouldn't have to take special steps to ensure random 3rd party remote hosts don't have access to it. The browser's DNS client could see if any recently accessed public IP now resolves to a private IP range and force a fresh CORS check.
- manwithaplan 9y agoFrom the previous discussion linked above: https://news.ycombinator.com/item?id=16563135 https://news.ycombinator.com/item?id=16563135 > I regularly encounter users who don’t accept that websites can access services on localhost or their intranet. These users understand that services bound to localhost are only accessible to software running on the local machine, and that their browser is running on the local machine – but somehow believe that accessing a website “transfers” execution somewhere else. It doesn’t work like that, but this is a common source of confusion.
- bluejekyll 9y agoPeople may be interested in a discussion we had about the trust-dns-resolver and some preventative measures in this area: https://github.com/bluejekyll/trust-dns/issues/347 https://github.com/bluejekyll/trust-dns/issues/347 The thing I’m most disappointed with is that because we’ve been so lax about 127.0.0.1 and it’s usage, it’s become a means of different applications to blackhole requests suchas ad-blocking networks. Better than that though, are the applications that are using localhost resolution from public names to communicate with local versions of their applications from the browser. The sad thing, is that because of these we can’t just make a simple resolution policy. The one I would like to be true is that only localhost names can resolve to localhost (this doesn’t require any remote resolution), and that you must whitelist private domains for private address spaces (e.g. 10/8). For localhost it’s a very simple area in resolution code to drop RData with 127.0.0.1, private address spaces would need a little more but still easy to identify when to apply it. For now it seems that we have to rely on applications to do a better job of using things like TLS to validate the endpoints to which they are connecting and verifying that the IP is in the expected scope.
- karalabe 9y agoTL;DR Geth 1.8.0 shipped with [DSN rebind protection](https://github.com/ethereum/go-ethereum/pull/15962 https://github.com/ethereum/go-ethereum/pull/15962), so as far as we know, it's not vulnerable. --- We originally rejected the bounty report because: * We always recommend people communicate with Geth via IPC, not HTTP. The APIs are too powerful for public access: even if noone can steal your Ether, they can exhaust all your local resources via eth_call for example. Our suggestion is to always run a custom proxy that properly rate limits and authenticates outside users vs. running an HTTP server inside Geth. CORS is a protection that always depends on browsers correctly enforcing it, which have been circumvented multiple times, so it's not a good enough security measure. * For a very long time now, we considered unlocking an account a dangerous operation recommended only to power users who can properly protect their setup. Mist and other applications transact via API endpoints that do not unlock accounts, so unless a user explicitly manually unlocks their account, they should be fine. That being said... even though we consider the attack vector fairly convoluted and would require a lot of bad user practices to pull off; we agreed that if we can do anything meaningful to prevent it, then we should most definitely do that. For that reason we introduced the `--rpcvhosts` flag which is similar to CORS, but checks the requests origin via different means, and rejects DNS rebound HTTP actions server side. As for the original report, although we rejected the bounty request initially, we agreed that it should be rewarded with a low-impact value since we did make a software modification based on the report. Unfortunately this bounty decision is waiting for approval since the 5th of February. Not sure why it got stuck in the pipeline, we apologize for the delay.