News for hackers. Stuff that matters.
Re:Ethereum is Doomed by DennisP on Monday June 20, 2016 @08:04PM (#11942601)
I have actually tested this attack technique (using my own contracts on a local test chain), and I've been in discussions with some Solidity developers and the guy who first published the attack. The situation is not as bad as this article claims.

For starters, you can use address.send(x) instead of address.call.value(x)(). All computations on Ethereum have to be funded with "gas" (transaction fees), and send() only forwards a small amount of gas. The recipient can write to the log but that's about it. TheDAO used .value() which forwards all the available gas.

If you do use .value(), then you can do it safely by doing it only once per method, as the very last step, and only using it in top-level methods. Then any sort of reentrant callback will find any required state changes already done. E.g. subtract from the user's balance, send the funds, and if the send fails then throw. The recipient can call back but the balance is already decremented. Using a mutex is another option. I've tested all this and it works.

There are a lot of reasons Ethereum is designed this way. The most common reason for a contract to run code when receiving funds is to prevent users from accidentally losing their money. E.g. in any contract that holds ether and maintains a ledger with balances for multiple users, if anyone sends ether to the contract address, they'll lose it, unless the contract either throws an exception or automatically adds to the user's balance on its ledger.

User addresses and contract addresses are interchangeable, because it lets you do things like use a multisig timelocked vault to receive funds and anything can send to it just as if it were a regular user account.

All that said, the devs are working on improvements too.

Re:Ethereum is Doomed by ianpurton on Tuesday June 21, 2016 @04:53AM (#11944433)
The situation is not as bad as this article claims.

Well it kind of is actually. The people that wrote the DAO script had the script checked by lots of Ethereum experts and the bug slipped through.

So if the Ethereum experts can't stop things like this happening then what chance do individual developers have. Basically creating a turing complete scripting language on the blockchain is not secure.

No financial institution will risk creating smart contracts on this platform.

Re:Ethereum is Doomed by wickedlogic on Tuesday June 21, 2016 @07:34AM (#11944951)
Not a knock on your post, but "checked by experts" is like saying "QA looked at it". If the tools aren't in place to warn/prevent, re:"stop things like this", unintended executions are only going to continue. It is the brave new old world.
Re:Ethereum is Doomed by ianpurton on Tuesday June 21, 2016 @07:55AM (#11945020)
That's exactly it. The current op codes allow for this kind of mistake. So mistakes like this will happen.
Re:Ethereum is Doomed by kordless on Wednesday June 22, 2016 @11:03PM (#11958600)
Until they don't with better DAOs.
Re:Ethereum is Doomed by tomw1808 on Tuesday June 21, 2016 @06:22AM (#11944724)
Whenever I hear "expert" I think of https://www.youtube.com/watch?v=BKorP55Aqvg
Re:Ethereum is Doomed by curiousgal on Tuesday June 21, 2016 @07:03AM (#11944850)
Re:Ethereum is Doomed by Cyph0n on Tuesday June 21, 2016 @06:29AM (#11944737)
This is the video I was expecting.
Re:Ethereum is Doomed by curiousgal on Tuesday June 21, 2016 @04:44AM (#11944394)
Well Well Well, what do you know, someone who has actually looked into things and not just basing their statements on their anti-crypto beliefs.
Re:Ethereum is Doomed by yarrel on Tuesday June 21, 2016 @12:55AM (#11943593)
Send at the end is like return-once or tail recursion.

Does -

http://www.joeykrug.com/home/a-serpent-send-exploit

change things at all?

Re:Ethereum is Doomed by DennisP on Tuesday June 21, 2016 @06:59AM (#11944840)
Nope, Serpent is a different language that compiles to the EVM, and Krug just noticed that by default, a send in Serpent includes more gas than Solidity does, opening a door to unexpected attacks.

Solidity is the official supported language, Serpent is an earlier and slightly lower-level language that some people still use. I expect they'll fix the gas default.

Re:Ethereum is Doomed by amaks on Monday June 20, 2016 @08:09PM (#11942621)
> All computations on Ethereum have to be funded with "gas" (transaction fees)

But that's what was wrong with the exploited DAO code - it didn't use gas. The point of the article is that it's very hard or impossible to verify the correctness of the smart contracts.

Re:Ethereum is Doomed by aakilfernandes on Monday June 20, 2016 @08:12PM (#11942630)
> it didn't use gas

this is incorrect

Re:Ethereum is Doomed by amaks on Monday June 20, 2016 @08:18PM (#11942657)
Well perhaps but I read this article (http://vessenes.com/deconstructing-thedao-attack-a-brief-cod...) and it says:

"OK, here we go. _recipient.call.value()() is called without a gas amount. That is easily attackable with an attacking wallet."

Re:Ethereum is Doomed by aakilfernandes on Monday June 20, 2016 @08:27PM (#11942693)
Ah, that means the exact opposite ie "use as much gas as needed".

This is different from the default _recipient.send() which would be limited to 2300 gas

Re:Ethereum is Doomed by goldenkey on Tuesday June 21, 2016 @12:38AM (#11943531)
It doesn't matter if it uses gas when you are getting free eth...