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

The owner of deposit in the BranchBridgeAgent.sol can be different than the value of _refundee address #364

Open
c4-submissions opened this issue Oct 3, 2023 · 5 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-858 edited-by-warden grade-a Q-74 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sufficient quality report This report is of sufficient quality

Comments

@c4-submissions
Copy link
Contributor

c4-submissions commented Oct 3, 2023

Lines of code

https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BranchBridgeAgent.sol#L832
https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BranchBridgeAgent.sol#L354

Vulnerability details

Impact

The transaction to the retryDeposit function can get reverted.

Proof of Concept

When the user call callOutAndBridge function, user can choose value of _refundee as the address to return excess gas deposited in msg.value to.
https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BranchBridgeAgent.sol#L210

The callOutAndBridge will call _createDeposit to move assets from branch chain to root and create deposit data for user. in the deposit data, contract is using _refundee value as owner of deposit transaction / data.
https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BranchBridgeAgent.sol#L832

Now if the user needs to retry the deposit transaction The deposit that is already created, the user should call retryDeposit function. in this function, first, contract check if deposit belongs to message sender. if MSG.SENDER is the owner of the deposit, it's ok, else the transaction will get reverted.
https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BranchBridgeAgent.sol#L354

Now in the callOutAndBridge, if the user uses another address as _refundee value, the owner of the deposit transaction will be another address, and the user is not able to use retryDeposit function for the deposit transaction in future.

Tools Used

Manually

Recommended Mitigation Steps

I think best option is to use msg.sender as the owner of deposit.
https://github.com/code-423n4/2023-05-maia/blob/1a95ffeaa057f14e6f317f7c3af84def2db16309/src/ulysses-omnichain/BranchBridgeAgent.sol#L264

Assessed type

Other

@c4-submissions c4-submissions added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Oct 3, 2023
c4-submissions added a commit that referenced this issue Oct 3, 2023
@c4-bot-7 c4-bot-7 removed the 3 (High Risk) Assets can be stolen/lost/compromised directly label Oct 6, 2023
@code4rena-admin code4rena-admin added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value edited-by-warden labels Oct 6, 2023
@c4-pre-sort
Copy link

0xA5DF marked the issue as duplicate of #858

@c4-pre-sort
Copy link

0xA5DF marked the issue as sufficient quality report

@c4-pre-sort c4-pre-sort added the sufficient quality report This report is of sufficient quality label Oct 11, 2023
@c4-judge 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 Oct 26, 2023
@c4-judge
Copy link
Contributor

alcueca changed the severity to QA (Quality Assurance)

@c4-judge
Copy link
Contributor

alcueca marked the issue as grade-a

@alcueca
Copy link

alcueca commented Oct 26, 2023

Documentation issue, the _refundee is actually the deposit owner if the caller decides that it should be anyone else.

@C4-Staff C4-Staff reopened this Nov 8, 2023
@C4-Staff C4-Staff added the Q-74 label Nov 8, 2023
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 duplicate-858 edited-by-warden grade-a Q-74 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sufficient quality report This report is of sufficient quality
Projects
None yet
Development

No branches or pull requests

7 participants