Open c4-submissions opened 1 year ago
0xA5DF marked the issue as duplicate of #842
0xA5DF marked the issue as sufficient quality report
alcueca marked the issue as unsatisfactory: Invalid
Hi @alcueca,
It is not a duplicate of #842 since that issue only state that there is no modifier and it is different to the Natspec.
Sponsor states that "There is no issue here. It is intended that the strategy can repay its own debt. We check such debt exists here:"
It is correct that strategy cannot over repay its own debt and it is not an issue, the problem here lies in which strategy the fund is withdrawn from. By allowing anyone to choose the strategy, the strategy can be withdrawn in an order that harmful to the protocol. The protocol can try to withdraw from protocol B but be front-run executed and end up withdrawing from protocol A.
alcueca marked the issue as not a duplicate
The harm scenario is very hypothetical, but upgrading to QA grade-a so that the sponsor takes it into consideration.
alcueca changed the severity to QA (Quality Assurance)
alcueca marked the issue as grade-a
Lines of code
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/BranchPort.sol#L188-L219
Vulnerability details
Impact
The protocol is at risk of losing funds and yield due to the potential for front-running attacks that exploit the race condition. Malicious actors can choose to withdraw from strategies with higher fees or slippage, thereby increasing costs for the protocol.
Proof of Concept
The
BranchPort.replenishReserves
function allows anyone to withdraw tokens from a strategy to refill the reserve when it falls below the minimum.https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/BranchPort.sol#L188-L219
A port can have multiple strategies for a single token. Because anyone can call this function, it creates a race condition among these strategies. A malicious user can front-run the transaction and choose to withdraw from a strategy that has high withdrawal fees or slippage, thereby causing financial loss to the protocol.
Example Scenario
Tools Used
Manual
Recommended Mitigation Steps
Restrict the ability to call the
replenishReserves
function to a strategy manager role within the protocol.Assessed type
Access Control