-
Notifications
You must be signed in to change notification settings - Fork 3
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
Missing Deadline in UniStaker.sol
Stake Delegation Leads to Potential Misuse
#301
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-205
🤖_116_group
AI based duplicate group recommendation
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Comments
c4-bot-5
added
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
labels
Mar 4, 2024
MarioPoneder marked the issue as duplicate of #69 |
MarioPoneder marked the issue as not a duplicate |
MarioPoneder marked the issue as duplicate of #205 |
MarioPoneder changed the severity to QA (Quality Assurance) |
c4-judge
added
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
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
labels
Mar 14, 2024
MarioPoneder marked the issue as grade-c |
c4-judge
added
grade-c
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
labels
Mar 14, 2024
This previously downgraded issue has been upgraded by MarioPoneder |
c4-judge
added
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
and removed
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
labels
Mar 17, 2024
MarioPoneder marked the issue as satisfactory |
c4-judge
added
satisfactory
satisfies C4 submission criteria; eligible for awards
and removed
grade-c
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
labels
Mar 17, 2024
CloudEllie
added
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
and removed
satisfactory
satisfies C4 submission criteria; eligible for awards
labels
Mar 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-205
🤖_116_group
AI based duplicate group recommendation
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/src/UniStaker.sol#L315
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/src/UniStaker.sol#L382
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/src/UniStaker.sol#L512
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/src/UniStaker.sol#L544
Vulnerability details
Impact
The absence of a
deadline
check in thestakeMoreOnBehalf
,stakeOnBehalf
,withdrawOnBehalf
,claimRewardOnBehalf
functions could lead to unauthorized staking actions if signatures are reused or intentions change over time, potentially compromising the integrity of the staking process and user funds.Proof of Concept
let's take a example of
stakeMoreOnBehalf
.Generate a signature for
stakeMoreOnBehalf
without a deadline.Simulate a delay before using the signature to stake more on behalf of the user.
Observe that the signature remains valid indefinitely, allowing for potential misuse.
For Example:
Alice initially decides to increase her stake and provides Bob with a signature to do so.
Over the next 30 days, the market conditions change, and Alice decides not to add more to her stake.
Alice assumes the signature she gave Bob is no longer valid because too much time has passed.
However, Bob or a malicious actor who obtained the signature proceeds to call
stakeMoreOnBehalf
after the 30 days.The UniStaker contract accepts the signature since there's no deadline mechanism in place.
The additional tokens are staked under Alice's deposit ID, contrary to her current investment strategy.
The lack of a deadline allows for the execution of an action that no longer aligns with the user's intent, demonstrating the vulnerability.
Tools Used
Manual Review
Recommended Mitigation Steps
Add expiration param to the following functions:
stakeMoreOnBehalf
,stakeOnBehalf
,withdrawOnBehalf
,claimRewardOnBehalf
.Assessed type
Error
The text was updated successfully, but these errors were encountered: