Submitted by Tutturu, also found by 0x52, hyh, p4st13r4, and WatchPug
The contract expects the balance of the underlying token to == 0 at all points when calling the contract functions by requiring getCashPrior() == 0, which checks token.balanceOf(address(this)) where token is the underlying asset.
An attacker can transfer any amount of the underlying asset directly to the contract and make all of the functions requiring getCashPrior() == 0 to revert.
CNote.sol#L43
CNote.sol#L114
CNote.sol#198
CNote.sol#310
Instead of checking the underlying token balance via balanceOf(address(this)) the contract could hold an internal balance of the token, mitigating the impact of tokens being forcefully transferred to the contract.
tkkwon1998 (Canto) confirmed
Alex the Entreprenerd (judge) commented:
