Skip to content

Commit cbd0ddc

Browse files
authored
Merge pull request #269 from crytic/non-standard-erc20-list
Include list of non-standard ERC20 tokens
2 parents 5a8ddd6 + 4ee19a7 commit cbd0ddc

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [Code Maturity](./development-guidelines/code_maturity.md)
77
- [High-Level Best Practices](./development-guidelines/guidelines.md)
88
- [Token Integration Checklist](./development-guidelines/token_integration.md)
9+
- [Known non-standard ERC20 tokens](./development-guidelines/non-standard-tokens.md)
910
- [Incident Response Recommendations](./development-guidelines/incident_response.md)
1011
- [Secure Development Workflow](./development-guidelines/workflow.md)
1112
- [Preparing for a Security Review](./development-guidelines/review_checklist.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Known non-standard ERC20 tokens
2+
3+
The following tokens are known to be non-standard ERC20 tokens. They may have additional risks that must be covered.
4+
5+
## Missing Revert
6+
7+
These tokens do not revert when a transfer fails, e.g. due to missing funds. Protocols that integrate these tokens must include a check for the transfer function's returned boolean success status and handle the failure case appropriately.
8+
9+
| Token | Notes |
10+
| :--------------------------------------------------------------------------------------------------- | :---- |
11+
| [Basic Attention Token (BAT)](https://etherscan.io/token/0x0d8775f648430679a709e98d2b0cb6250d2887ef) | |
12+
| [Huobi Token (HT)](https://etherscan.io/token/0x6f259637dcd74c767781e37bc6133cd6a68aa161) | |
13+
| [Compound USD Coin (cUSDC)](https://etherscan.io/token/0x39aa39c021dfbae8fac545936693ac917d5e7563) | |
14+
| [0x Protocol Token (ZRX)](https://etherscan.io/token/0xe41d2489571d322189246dafa5ebde1f4699f498) | |
15+
16+
## Transfer Hooks
17+
18+
These tokens include [ERC777](https://eips.ethereum.org/EIPS/eip-777)-like transfer hooks. Protocols that interact with tokens that include transfer hooks must be extra careful to protect against reentrant calls when dealing with these tokens, because control is handed back to the caller upon transfer. This can also affect cross-protocol reentrant calls to `view` functions.
19+
20+
| Token | Notes |
21+
| :----------------------------------------------------------------------------------------------------- | :---- |
22+
| [Amp (AMP)](https://etherscan.io/token/0xff20817765cb7f73d4bde2e66e067e58d11095c2) | |
23+
| [The Tokenized Bitcoin (imBTC)](https://etherscan.io/token/0x3212b29E33587A00FB1C83346f5dBFA69A458923) | |
24+
25+
## Missing Return Data / Transfer Success Status
26+
27+
These tokens do not return any data from the external call when transferring tokens. Protocols using an interface that specifies a return value when transferring tokens will revert. Solidity includes automatic checks on the return data size when decoding return values of an expected size.
28+
29+
| Token | Notes |
30+
| :------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------- |
31+
| [Binance Coin (BNB)](https://etherscan.io/token/0xB8c77482e45F1F44dE1745F52C74426C631bDD52) | Only missing return data on `transfer`. `transferFrom` returns `true`. |
32+
| [OMGToken (OMG)](https://etherscan.io/token/0xd26114cd6ee289accf82350c8d8487fedb8a0c07) | |
33+
| [Tether USD (USDT)](https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7) | |
34+
35+
## Permit No-op
36+
37+
Does not revert when calling `permit`. Protocols that use [EIP-2612 permits](https://eips.ethereum.org/EIPS/eip-2612) should check that the token allowance has increased or is sufficient. See [Multichain's incident](https://media.dedaub.com/phantom-functions-and-the-billion-dollar-no-op-c56f062ae49f).
38+
39+
| Token | Notes |
40+
| :-------------------------------------------------------------------------------------------- | :-------------------------------------------- |
41+
| [Wrapped Ether (WETH)](https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) | Includes a non-reverting `fallback` function. |
42+
43+
## Additional Non-standard Behavior
44+
45+
Additional non-standard token behavior that could be problematic includes:
46+
47+
- fee on transfers
48+
- upgradeable contracts ([USDC](https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48))
49+
- tokens with multiple address entry-points to the same accounting state
50+
- non-standard decimals ([USDC](https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48): 6)
51+
- non-standard permits ([DAI](https://etherscan.io/token/0x6b175474e89094c44da98b954eedeac495271d0f))
52+
- do not reduce allowance when it is the maximum value
53+
- do not require allowance for transfers from self
54+
- revert for approval of large amounts `>= 2^96 < 2^256 - 1` ([UNI](https://etherscan.io/token/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984), [COMP](https://etherscan.io/token/0xc00e94cb662c3520282e6f5717214004a7f26888))
55+
56+
Refer to [d-xco/weird-erc20](https://github.com/d-xo/weird-erc20) for additional non-standard ERC20 tokens.

development-guidelines/token_integration.md

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ Token scarcity issues must be reviewed manually. Check for the following conditi
7272
- [ ] **Users understand the risks associated with large funds or flash loans.** Contracts relying on the token balance must account for attackers with large funds or attacks executed through flash loans.
7373
- [ ] **The token does not allow flash minting.** Flash minting can lead to drastic changes in balance and total supply, requiring strict and comprehensive overflow checks in the token operation.
7474

75+
### Known non-standard ERC20 tokens
76+
77+
Protocols that allow integration with arbitrary tokens must take care to properly handle certain well-known non-standard ERC20 tokens. Refer to the [non-standard-tokens list](./non-standard-tokens.md) for a list of well-known tokens that contain additional risks.
78+
7579
## ERC721 Tokens
7680

7781
### ERC721 Conformity Checks

0 commit comments

Comments
 (0)