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

Sum of total staked ETH on SafEth is not always equal to msg.value, which will lead to stuck ether on vault #252

Closed
code423n4 opened this issue Mar 27, 2023 · 4 comments
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 downgraded by judge Judge downgraded the risk level of this issue duplicate-152 low quality report This report is of especially low quality satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/SafEth.sol#L88
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/SafEth.sol#L95

Vulnerability details

Impact

Because of rounding errors on SafEth.stake, the total ether amount passed to derivative contracts will not always be equal to msg.value. As a result, some ether will be stuck on the SafEth contract.

Proof of Concept

  1. User deposits 1 ether
  2. There are three derivatives, each one with equal weight
  3. Each derivative contract will receive msg.value/3 ether
  4. The SafEth ether will be stuck with 1 wei

Tools Used

Manual review

Recommended Mitigation Steps

Refund the user back with the amount of ether that was not used to fund the derivative contracts.

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Mar 27, 2023
code423n4 added a commit that referenced this issue Mar 27, 2023
@c4-pre-sort c4-pre-sort added the low quality report This report is of especially low quality label Apr 1, 2023
@c4-pre-sort
Copy link

0xSorryNotSorry marked the issue as low quality report

@c4-pre-sort
Copy link

0xSorryNotSorry marked the issue as duplicate of #455

@c4-judge c4-judge added duplicate-152 satisfactory satisfies C4 submission criteria; eligible for awards and removed duplicate-455 labels Apr 24, 2023
@c4-judge
Copy link
Contributor

Picodes marked the issue as satisfactory

@c4-judge c4-judge added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Apr 24, 2023
@c4-judge
Copy link
Contributor

Picodes changed the severity to 2 (Med Risk)

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 downgraded by judge Judge downgraded the risk level of this issue duplicate-152 low quality report This report is of especially low quality satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants