# Solmate's ERC20 does not check for token contract's existence, which opens up possibility for a honeypot attack

Solmate SafeTransferLib doesn't verify token code exists, so bidding with a not-yet-deployed quote token silently succeeds, letting an attacker later drain a victim's bid.

- Payout: Contest reward
- Severity: medium
- Program: SIZE
- Credited: neko\_nyaa
- Disclosed: 2023-01-09
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2022-11-size-findings/issues/48
- Library page: https://bugbountylibrary.com/r/c4%3A2022-11-size%3AM-02
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** SizeSealed auction contract quoteToken transfer
**Root cause:** SafeTransferLib.safeTransferFrom does not check that the token address has code, so transfers to an empty address succeed silently without crediting the contract.
**Steps:**
1. Alice1 creates auction with baseToken and quoteToken Q (not yet deployed on this chain, expected at a known cross-chain address).
2. Alice2 bids `1000e18` Q; `safeTransferFrom` succeeds silently since Q has no code, contract not credited.
3. Token Q is deployed on local chain at the expected address.
4. Bob bids `1001e18` Q, which actually transfers.
5. Alice2 cancels bid, recovering `1000e18` refund.
6. Alice1 cancels auction, recovering base tokens; contract left with only Bob's `1e18` Q.
**How found:** Code-reading of the bid path noting Solmate's documented lack of code-existence check, combined with the cross-chain deterministic-address deployment pattern (1INCH, GEL) making an empty-but-future token address plausible.
**Exploitation:** Attacker pre-bids with a not-yet-deployed token address, waits for real token deployment, victim bids real tokens, attacker cancels both bid and auction to withdraw base tokens plus victim's quote tokens.
**Insight:** When a protocol accepts arbitrary user-supplied token addresses, an address with no code at bid time can later become a real token via deterministic cross-chain deployment; check `address.code.length` before trusting transfers.
