The current Steak Points schema has multiple vulnerabilities that could lead to data inconsistencies, inaccurate point calculations, and performance issues. These include the possibility of duplicate entries, inadequate data types for large numbers, lack of proper indexing and validation, and limited functionality for point management.
Relevant code - 2024-08-steaking/steaking-server/src/models/steakPoints.js at main · Cyfrin/2024-08-steaking (github.com)
The schema allows duplicate walletAddress
entries, potentially leading to data conflicts.
The use of Number
type for points is insufficient for handling uint256 values from smart contracts.
Lack of indexing on the walletAddress
field may result in poor query performance.
The schema lacks timestamp fields for auditing purposes.
Limited data model restricts the ability to track comprehensive staking information.
Data Integrity: Duplicate entries and invalid data can lead to incorrect point totals and unfair distribution of rewards or voting power.
Calculation Errors: Inadequate number handling can result in inaccurate point calculations, especially for large stake amounts.
Performance: Lack of indexing can cause slow queries as the dataset grows, impacting system responsiveness.
Manual Review
Implement unique constraint on walletAddress
:
Use String
type for points with BigInt validation:
}
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.