Skip to content
Business logic Audit finding Intermediate

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.

WatchPug Follow

Originally disclosed on Code4rena

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

CompoundHandler.sol#L117-L118

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 |

chase-manning (Backd) confirmed


The original report as published on Code4rena, by WatchPug. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by WatchPug

View all

197 more disclosed reports, best first.

More from Backd Tokenomics contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.