# Transferring any amount of the underlying token to the CNote contract will make the contract functions unusable

CNote required underlying token balance to equal zero; anyone could send 1 wei of Note directly to the contract, making all functions revert.

- Payout: Audit contest
- Severity: high
- Program: Canto
- Found by: Tutturu
- Disclosed: 2022-10-18
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2022-06-newblockchain-findings/issues/227
- Library page: https://bugbountylibrary.com/r/c4%3A2022-06-canto%3AH-08
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:business-logic vuln:dos

**Target:** CNote lending market contract (Solidity)
**Root cause:** Functions require getCashPrior() == 0, which reads token.balanceOf(address(this)); any direct ERC20 transfer to the contract breaks this invariant and causes reverts.
**Steps:**
1. Obtain 1 wei of the underlying Note token
2. Call `note.transfer(CNoteAddress, 1)` directly to the CNote contract
3. All CNote functions gated on `getCashPrior() == 0` now revert, bricking the contract
**How found:** Code reading of CNote.sol identified the `getCashPrior() == 0` invariant checks at multiple lines and recognized that ERC20 balanceOf can be inflated by any external transfer.
**Exploitation:** Attacker sends a minimal amount (1 wei) of the underlying ERC20 directly to the CNote contract address, permanently breaking the zero-balance invariant and disabling all dependent functions.
**Insight:** When a contract asserts an exact token balance (e.g. == 0) via balanceOf, remember anyone can push tokens in; look for such invariants as griefing/DoS vectors.

