2 ms·
This makes sense to me, but where's the actual code that calls into the attacker's contract and lets the attacker call back into splitDAO? And how on Earth is
by amluto 10y ago
This makes sense to me, but where's the actual code that calls into the attacker's contract and lets the attacker call back into splitDAO?
And how on Earth is it a good idea to allow one contract to call another? There are any number of more sensible ways to communicate that don't have this problem: allow contracts to pass messages to other contracts, allow contracts to subscribe to each other's events, etc.
- benmmurphy 10y agowithdrawRewardFor ends up calling ManagedAccount#payOut which does _recipient.call.value(amount): function payOut(address _recipient, uint _amount) returns (bool) { if (msg.sender != owner || msg.value > 0 || (payOwnerOnly && _recipient != owner)) throw; if (_recipient.call.value(_amount)()) { PayOut(_recipient, _amount); return true; } else { return false; } } so the 'vulnerable' code is calling a function in another contract and it is this function that is doing the external callback. this is why security is so hard. everytime you add an external callback you need trace all of your callers to check that they are correctly re-entrant or everytime you use another function you need to trace forward to make sure it doesn't have any external callbacks.