Skip to content

Custom ERC20 implementation exposes _transfer() as public

Description

The _transfer() function in a custom ERC20 implementation is exposed as public, allowing unauthorized access and potentially leading to security vulnerabilities.

Examples

Insecure Code

solidity
function _transfer(address recipient, uint256 amount) public {... }

Secure Code

solidity
function _transfer(address recipient, uint256 amount) internal {... }

Remediation

Change the visibility of the _transfer() function to internal or private to restrict access.

Rule Details

FieldValue
IDCODE-0206
CategoryAccessControl
SeverityHIGH
CWECWE-284
ConfidenceLOW
ImpactHIGH
LikelihoodHIGH
ExploitabilityEASY
Tagserc20, smart contract
OWASPN/A

References