-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: rename token security benchmark to token risk classification (#4)
- Loading branch information
1 parent
7a442bc
commit e979de2
Showing
127 changed files
with
253 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
# TRC-001 Honeypot | ||
## Description | ||
|
||
This is a honeypot smart contract sample demonstrating unpredictable behavior when storing a value that exceeds integer limitations. | ||
|
||
## Risk Samples | ||
|
||
- [01.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-001/samples/01.sol) | ||
- [02.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-001/samples/02.sol) | ||
- [03.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-001/samples/03.sol) | ||
- [04.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-001/samples/04.sol) | ||
- [05.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-001/samples/05.sol) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
# TRC-002 Mintable | ||
## Description | ||
|
||
Changing the percentage of a position by increasing the balance at a specific address. | ||
|
||
## Risk Pattern | ||
|
||
```solidity | ||
function mint(unit256 amount) external onlyowner { | ||
_balances[_msgSender()] += amount; | ||
} | ||
``` | ||
|
||
## Risk Samples | ||
|
||
- [01.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-002/samples/01.sol) | ||
- [02.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-002/samples/02.sol) | ||
- [03.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-002/samples/03.sol) | ||
- [04.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-002/samples/04.sol) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
# TRC-003 OwnershipRetrieval | ||
## Description | ||
|
||
When Owner permissions are set to a black hole address, it is still possible to fetch owner permissions back to an actionable address. | ||
|
||
## Risk Pattern | ||
|
||
```solidity | ||
function lock(uint256 time) public virtual onlyOwner { | ||
_previousOwner = _owner; | ||
_owner = address(0); | ||
} | ||
function unlock() public virtual { | ||
require(_previousOwner == msg.sender, ); | ||
_owner = _previousOwner; | ||
} | ||
``` | ||
|
||
## Risk Samples | ||
|
||
- [01.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-003/samples/01.sol) | ||
- [02.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-003/samples/02.sol) | ||
- [03.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-003/samples/03.sol) | ||
- [04.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-003/samples/04.sol) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
# TRC-004 BalanceManipulation | ||
## Description | ||
|
||
Changes can be made to the user's balance without the user's allowance to achieve a reduction in the percentage of the user's position. | ||
|
||
## Risk Pattern | ||
|
||
```solidity | ||
function setBalance(address user, uint256 value) public onlyOwner returns (bool) { | ||
_balances[user] = value | ||
return true; | ||
} | ||
``` | ||
|
||
## Risk Samples | ||
|
||
- [01.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-004/samples/01.sol) | ||
- [02.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-004/samples/02.sol) | ||
- [03.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-004/samples/03.sol) | ||
- [04.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-004/samples/04.sol) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
# TRC-005 HiddenOwnership | ||
## Description | ||
|
||
To hide the status of a privileged address, set it to an unreadable address, or to name it using a non-standard method. | ||
|
||
## Risk Pattern | ||
|
||
```solidity | ||
modifier superman() { | ||
require(superman == _msgSender(), ); | ||
} | ||
``` | ||
|
||
## Risk Samples | ||
|
||
- [01.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-005/samples/01.sol) | ||
- [02.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-005/samples/02.sol) | ||
- [03.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-005/samples/03.sol) | ||
- [04.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-005/samples/04.sol) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
# TRC-006 SelfDestruction | ||
## Description | ||
|
||
The contract can be destroyed, resulting in the loss of all functionality and zeroing of assets. | ||
|
||
## Risk Pattern | ||
|
||
```solidity | ||
function close(address payable to) external onlyOwner { | ||
selfdestruct(to); | ||
} | ||
``` | ||
|
||
## Risk Samples | ||
|
||
- [01.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-006/samples/01.sol) | ||
- [02.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-006/samples/02.sol) | ||
- [03.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-006/samples/03.sol) | ||
- [04.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-006/samples/04.sol) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
# TRC-007 ExternalInvocation | ||
## Description | ||
|
||
Certain functions or logic judgments within the contract rely on external contracts. | ||
|
||
## Risk Pattern | ||
|
||
```solidity | ||
function _transfer(address from, address recipient, uint256 amount) internal virtual override returns (bool) { | ||
require(_balances[_msgSender()] >= amount, ); | ||
_balances[_msgSender()] -= amount; | ||
_balances[recipient] += amount; | ||
address1.transfer(amount); | ||
emit Transfer(_msgSender(), recipient, amount); | ||
return true; | ||
} | ||
``` | ||
|
||
## Risk Samples | ||
|
||
- [01.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-007/samples/01.sol) | ||
- [02.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-007/samples/02.sol) | ||
- [03.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-007/samples/03.sol) | ||
- [04.sol](https://github.com/cryptousersecurity/token-risk-classification/blob/main/src/TRC-007/samples/04.sol) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.