-
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
Signatures can be held indefinitely, as they cannot expire #205
Comments
MarioPoneder marked the issue as primary issue |
apbendi (sponsor) confirmed |
apbendi marked the issue as disagree with severity |
Adding a deadline is a good idea, and we will likely implement it. That said, the degree to which this could be actively used in an attack is limited, it can't allow the holder of the signature to steal funds or take any action the user didn't express consent for, but only submit it at "an inopportune time". Additionally, the user would always be able to mitigate even that risk by simply moving assets out of the wallet in question, or taking another action via signature which would consume the nonce. There is no opportunity for griefing, as the nonce would be consumed and the holder of the signed message couldn't replay it, but only execute it once. |
Deadline checks as well as slippage checks can be considered state-of-the art and a protocol bears a responsibility to introduce such measures in order to protect its users. Nevertheless, this is a valid & valuable QA suggestion. |
MarioPoneder changed the severity to QA (Quality Assurance) |
This previously downgraded issue has been upgraded by MarioPoneder |
MarioPoneder marked the issue as satisfactory |
MarioPoneder marked the issue as selected for report |
We'd like to reiterate that, while we find this report helpful, we don't believe it rises to the level of Medium severity, as explained above. We'd also like to expand on the mitigation avenue available in the contracts as written: Several the of the |
here are a few contests where the "missing deadline checks" were reported as medium severity:
these are cases where the contract seems to forward a swap to some uni pool. i think our case is much different though. in our case, the time sensitivity is not nearly as material. like, is the worst case here that you changed your mind about staking X amount of UNI but then an operator went ahead and did it for you a day later anyway? ok, where's the leaked value? are assets at risk? i think the answer is no and no, distinguishing this case from the others. |
Hello, and thank you for your comments! Given your questions, even if the contest has ended, I think I can provide some additional info to further validate the severity of this issue. Consider the following cases as a leak of value:
|
hi @DadeKuma
The signature will be invalidated when the nonce is used. This comment assumes a malicious relayer will grief you by withholding your
i don't think this is relevant to the issue at hand; including a deadline in an
Again, in the case where a malicious relayer withholds your withdrawal tx, the user gets no protection from an enforced deadline in the payload. The user should protect herself here by calling |
Summary of the issue Functions that use signatures to act on behalf of the owner could be used against the owner's will, as signatures do not have any deadline. Picodes view The current main argument for Medium severity is: Deadline checks (similar to slippage checks) are state-of-the-art and the protocol bears a responsibility to provide such protection measures for users. I am not convinced by this argument. To me, it's true only when the signature is used to swap on a pool or to do an inherently time-sensitive action. Otherwise, it's a valid design to view signatures as transactions and to expect users to have an understanding of how nonces work if they want to invalidate them. Or if we push the reasoning, we could argue that the fact that transactions have no deadline is a Medium severity issue at the chain level? So to me, this should be QA or even Invalid. gzeon’s view Agree with Picodes here, deadline only protect against pending tx where the outcome of the transaction would vary by time (e.g. price movement). All the listed functions there have deterministic outcomes and should not require a deadline. If a signature needs to be revoked, the user can burn a nonce then invalidate it. QA / Invalid (feature request) imo LSDan’s view I view this as outright invalid. The core premise that the signature doesn't expire is misleading and bordering on outright false. The nonce causes signatures to expire, making a longstanding signature the result of a careless user no longer wanting something they allowed for to happen but taking no action to prevent it. Result Issue #205 will be invalidated. |
Agree. See also: #417 (comment) |
Lines of code
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/main/src/UniStaker.sol#L512-L532
Vulnerability details
Impact
Any function that uses a signature to act on behalf of the owner can be postponed indefinitely, as signatures do not have any deadline.
This can lead to issues, as the action can be executed at any time in the future (possibly at an unfavorable moment for the signer), and the signer has no means to invalidate a signature.
Proof of Concept
This issue applies to any function that uses
_revertIfSignatureIsNotValidNow
. This includes:stakeOnBehalf
stakeMoreOnBehalf
alterDelegateeOnBehalf
alterBeneficiaryOnBehalf
withdrawOnBehalf
claimRewardOnBehalf
Let's take for example
withdrawOnBehalf
:There are no checks in place to ensure that a withdrawal will be executed within a reasonable timeframe. Someone having this signature can essentially wait indefinitely, and proceed with the withdrawal at an unfavorable moment without any means for the owner to revoke or invalidate the signature.
Tools Used
Manual review
Recommended Mitigation Steps
Consider adding a
deadline
parameter inside the hash. This is an example for withdrawals, but it should be applied to any function that uses_revertIfSignatureIsNotValidNow
:Assessed type
Timing
The text was updated successfully, but these errors were encountered: