sherlock-audit / 2023-04-unitasprotocol-judging

4 stars 3 forks source link

stopthecap - The reserve ratio can be pushed even lower than a 100% by front-running "pause" EMC minting #163

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

stopthecap

medium

The reserve ratio can be pushed even lower than a 100% by front-running "pause" EMC minting

Summary

The reserve ratio can be pushed even lower than a 100% by front-running "pause" EMC minting

Vulnerability Detail

When the Reserve ratio is below ≤ 100% the protocol is expected to pause all minting permanently (until the ratio is recovered).

As they have to stop all of the mintings from all the EMCs ( all the coins/stables at a time), you can front-run the pause method from any of these stables and decrease the reserve ratio even more.

https://github.com/sherlock-audit/2023-04-unitasprotocol/blob/main/Unitas-Protocol/src/ERC20Token.sol#L152-L154

Attack:

1 -Reserve ratio reaches 100% 2- Protocol starts pausing the EMCs (stables) 3- Attacker front-runs the pause function from any of those stables and swaps usd1 for any stables 4- Attacker has increased liabilities and decreased more the ratio even if they reached the < 100% ratio beforehand

Impact

The reserve ratio can be pushed even lower than a 100% while pausing all the EMCs, causing more liabilities for the protocol

Code Snippet

https://github.com/sherlock-audit/2023-04-unitasprotocol/blob/main/Unitas-Protocol/src/ERC20Token.sol#L152-L154

Tool used

Manual Review

Recommendation

Add a specific function in the codebase to pause all the EMCs at the same time and use flashbots to trigger it once the reserve ratio threshlod is reached.