The potential vulnerability in the _refundGas function arises from its method of calculating the gas costs for refunding the administrators of the contract. This calculation uses the formula gasUsed * tx.gasprice, where gasUsed is the difference between the gas available at the start of the transaction (initialGas) and the gas left at the point of calculation (gasleft()), and tx.gasprice is the gas price set by the user who initiated the transaction.
Imagine an administrator or a malicious user initiates a transaction interacting with the contract, and deliberately sets a very high tx.gasprice, much higher than the average network gas price.
Calculation:
Suppose the transaction uses 100,000 gas (gasUsed).
The user sets tx.gasprice to 1,000 gwei, significantly above normal rates.
The refund amount would be 100,000 * 1,000 gwei = 100,000,000 gwei, or 0.1 ether.
If the _refundGas function does not cap the refund amount or if the transactions gas price is exceptionally high, theres a risk that a large portion of the contracts ETH balance could be used to cover these gas costs. This is particularly concerning if the function is called with high frequency or during periods of high gas prices.
https://github.com/code-423n4/2024-04-renzo/blob/519e518f2d8dec9acf6482b84a181e403070d22d/contracts/Deposits/DepositQueue.sol#L279-L289
