CEthInterface#repayBorrowBehalf() reading non-existing returns makes _repayAnyDebt() with CEther always revert
The CEthInterface declares that repayBorrowBehalf returns a uint256, but the actual CEther contract returns nothing. As a result, any call to ether.repayBorrowBehalf() always reverts, breaking the _repayAnyDebt() function for CEther.
Submitted by WatchPug
CTokenInterfaces.sol#L355-L358
function repayBorrowBehalf(address borrower, uint256 repayAmount)
external
payable
returns (uint256);
repayBorrowBehalf() for native cToken (CEther) will return nothing, while the current CEthInterface interface defines the returns as (uint256).
As a result, ether.repayBorrowBehalf() will always revert
CEther cether = CEther(address(ctoken));
err = cether.repayBorrowBehalf{value: debt}(account);
Ref:
method | CEther | CErc20 |
mint() | revert | error code |
redeem() | error code | error code |
repayBorrow() | revert | error code |
repayBorrowBehalf() | revert | error code |
- Compound cToken Repay Borrow Behalf doc
- Compound CEther.repayBorrowBehalf()
- Compound CErc20.repayBorrowBehalf()
chase-manning (Backd) confirmed
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
Impact
Any attempt to repay a debt using CEther through _repayAnyDebt() will always revert, so the function cannot be used for native cToken repayments.
What the attacker needed
Use of CEther in _repayAnyDebt()
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.
A smart contract interface is like a promise about what functions look like. Here the promise said the function would give back a number, but the real function gives back nothing. When the code tries to read that missing number, the whole transaction fails.
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.