Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_createLock implementation is wrong. #69

Closed
c4-bot-5 opened this issue Mar 11, 2024 · 5 comments
Closed

_createLock implementation is wrong. #69

c4-bot-5 opened this issue Mar 11, 2024 · 5 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@c4-bot-5
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2024-03-abracadabra-money/blob/main/src/staking/LockingMultiRewards.sol#L490

Vulnerability details

Impact

_createLock implementation is wrong.

Proof of Concept

  1. Let assume, lockduration = 7 days, reward duration = 1 days, alice locks 100 amount on january 1, so alice’s lastlockindex unlocktime is set to january 8.

  2. In january 2,alice again locks 100 amount , so this 100 amount should be locked in the lastlockindex as per code comment but this 100 amount is locked in a different lock index.

  3. Let’s see how? On January 2 , when alice locks 100 amounts, function _createLock is called.

  4. See function _createLock, here userLocks[user][_lastLockIndex].unlockTime = january 8 and _nextUnlockTime = january 9. As _userLocks[user][_lastLockIndex].unlockTime < _nextUnlockTime, so this will create new lock index for the user but as per code comment Add to current lock if it's the same unlock time.here _nextUnlockTime will be always greater than last index unlockTime.

Tools Used

manual review

Recommended Mitigation Steps

implement properly _createLock

Assessed type

Error

@c4-bot-5 c4-bot-5 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Mar 11, 2024
c4-bot-10 added a commit that referenced this issue Mar 11, 2024
@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #225

@c4-judge
Copy link
Contributor

thereksfour marked the issue as not a duplicate

@c4-judge
Copy link
Contributor

thereksfour marked the issue as unsatisfactory:
Insufficient proof

@c4-judge c4-judge added unsatisfactory does not satisfy C4 submission criteria; not eligible for awards downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Mar 29, 2024
@c4-judge
Copy link
Contributor

thereksfour changed the severity to QA (Quality Assurance)

@c4-judge
Copy link
Contributor

thereksfour marked the issue as grade-c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants