The OWPIdentity smart contract implements an ERC1155 token system with role-based access control. It inherits from OpenZeppelin contracts for enhanced security. While the contract follows many good practices, there are several vulnerabilities and areas for improvement identified during the audit.
Location: burnBatchMultiple function
Description: The function contains a loop calling _burn for each token, which could be vulnerable to reentrancy attacks if not properly protected.
Location: burn and burnBatch functions
Description: The use of uint256 for token amounts could lead to precision loss, potentially allowing users to burn more tokens than intended.
Location: All burning-related functions
Description: No events are emitted when tokens are burned, making it difficult to track off-chain transactions.
Location: supportsInterface function
Description: The function always returns true, which could potentially be exploited if not properly implemented in derived contracts.
Location: burnBatchMultiple function
Description: The function uses a loop without bounds checking, which could cause issues if passed very large arrays.
Location: uri function
Description: The function is public and doesn't check roles, allowing anyone to modify the URI.
These vulnerabilities could potentially lead to:
Unauthorized access to sensitive functions
Unexpected behavior during token burning operations
Difficulty in tracking on-chain transactions
Potential denial of service attacks
Unintended token burning due to precision loss
The impact ranges from minor inconvenience to significant financial losses depending on the specific attack vector and implementation details.
Manual code review
Implement checks-effects-interactions pattern in critical functions like burnBatchMultiple.
Add events for important state changes, particularly for token burning operations.
Implement a maximum balance per user to prevent accidental over-burns.
Restrict access to sensitive functions like setURI and uri to authorized roles only.
Implement proper error handling and revert conditions throughout the contract.
Consider adding a maximum number of tokens that can be burned in a single transaction.
Review and possibly restrict the supportsInterface function to avoid potential exploits.
Implement bounds checking in loops, especially in functions like burnBatchMultiple.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.