top | item 15349408

XSS Attack Embedded in an ERC20 Token Contract Steals Thousands

84 points| brett | 8 years ago |hackernoon.com

46 comments

order
[+] meowface|8 years ago|reply
>Thus, users of EtherDelta must enter their public wallet address and private key when using the site, meaning their private key could be captured from the browser session by a malicious code injection.

This isn't some sort of fancy cryptocontract based attack. The private key is just stored as a JavaScript object in the session and an attacker found and exploited a reflected XSS vulnerability to send off the key.

Even if you're not sending your private key to the server directly surely some people must have made these users aware of the risks they were taking? Not only XSS risks, but risks of a rogue admin or backend compromise injecting malicious JS.

[+] meowface|8 years ago|reply
(Persistent XSS actually, but exploited similarly to a reflected XSS vulnerability because you have to send a specific link to your victims. It has a much higher exploitation success chance than reflected XSS since pesky browser XSS auditors won't be able to step in.)
[+] AgentME|8 years ago|reply
I'm surprised and disappointed that EtherDelta doesn't use Content-Security-Policy headers. They pretty much solve XSS.

Google has a good introduction to using them here: https://csp.withgoogle.com/

[+] codedokode|8 years ago|reply
You will need to disable inline scripts which is inconvenient. CSP looks more like as hack for broken sites.
[+] jdp23|8 years ago|reply
> I want to make one point clear: I believe that EtherDelta, in concept, is safer and more “trustworthy” than a traditional exchange. Everything about how EtherDelta functions is transparent and verifiable by users.... The attack detailed in this piece could have been identified by anyone before it was exploited, and if there had been a security review protocol in place, it would have been easily prevented.

Even "in concept", releasing fintech software without doing the security basics verges on professional misconduct.

[+] imaginenore|8 years ago|reply
This blows my mind. These programmers can implement quite complex contacts-financial-exchanges on top of a quite complex distributed system, but then fail to sanitize user input in their web interface. It makes no sense.
[+] KGIII|8 years ago|reply
I read the headline and my immediate guess was cryptocurrency. I clicked and, sure enough, there it was.

Maybe it's time to refine some of these ideas? While regular money does get stolen, maybe storing it online isn't the best method? Maybe requiring some human interaction is a good idea?

At this point, I can't really justify investing in any cryptocurrency. I'm absolutely unable to justify investing in any ICO.

If I opened a contract and my PayPal balance disappeared, I'd be pretty angry and might have some recourse. I'd absolutely have some options if it were with my credit/debit card or directly through my bank.

Good luck, folks. I'm still going to maintain the wait-and-see approach.

[+] thephyber|8 years ago|reply
> Maybe requiring some human interaction is a good idea?

What's the fun in that?

Did Samy say "Maybe I should ask the user if they want to friend me"? NO! He said "People want to friend me" and "LOL MYSPACE XSS", then became the most popular person on the network overnight.

After Tom, of course, who cheated.

[+] srcmap|8 years ago|reply
The story is almost like the 2008 time where wall street wiz kids package the mortgages to special mortgages back securities/contacts and resell them over and over again to banks, mutual funds, etc.

Hugh hype was created.

Last time: It was safe because it was back by mortgage.

This time: It is safe because it is back by crypto algorithm.

Last time few smart insiders got billions richer and unload everything before the bubble burst.

And the time ...... (Love to see all imaginable endings to this time's story - good or bad)

[+] davewritescode|8 years ago|reply
The smart contracts in Ethereum sounds awesome in practice and way more useful than Bitcoin mining but it seems like a giant security hole.
[+] baby|8 years ago|reply
There are two problems. First, when writing a contract every line you write might be a potential avenue for an attack. Second, the language (Solidity) and the parsing of the bytecode (EVM) don't help.

If you look at the kind of attacks that happen I feel like two major problems came from the fact that addresses can be real account addresses or contracts (it could have been good to segregate them) and errors/exceptions don't propagate well.

[+] thephyber|8 years ago|reply
Kinda like a knife -- it's a very useful tool if used well and a very painful tool if mishandled.
[+] foota|8 years ago|reply
Don't you also have to trust that the person running EtherDelta hasn't modified what's running on the site...?
[+] AgentME|8 years ago|reply
If you use EtherDelta through MetaMask or Mist, then EtherDelta doesn't have direct access to your private keys, and you're given a prompt outside of EtherDelta's control to confirm any action you take, so you're much less vulnerable to malicious behavior from the EtherDelta admin.
[+] chroem-|8 years ago|reply
>thousands of dollars

The article is out of date. People are saying the amount is now $6 billion.

[+] CryptoPunk|8 years ago|reply
This linked to an 'unlisted' token (a token which doesn't have enough recognition to be 'officially listed' on Etherdelta, and thus doesn't have its own ticker symbol), which the vast majority of token buyers have no interest in, so there's no chance that many people were interested in purchasing it, let alone through Etherdelta (which still has very little volume relative to centralized exchanges).
[+] RcouF1uZ4gsC|8 years ago|reply
Do you have a link to that. Seems like a huge difference if it is thousands of dollars vs billions of dollars?
[+] trophycase|8 years ago|reply
Uh no, there is literally no chance.