Withheld ETH shoud not be sent back to the frxETHMinter contract itself
The frxETHMinter contract's moveWithheldETH and recoverEther functions allow the owner to send withheld ETH back to the contract itself, which triggers the receive function and mints new frxETH, duplicating the accounting of ETH already converted. This breaks the 1:1 ETH:frxETH peg.
Originally disclosed on Code4rena
Submitted by ronnyx2017, also found by ayeslick and rvierdiiev
https://github.com/code-423n4/2022-09-frax/blob/main/src/frxETHMinter.sol#L166-L174
https://github.com/code-423n4/2022-09-frax/blob/main/src/frxETHMinter.sol#L191-L196
https://github.com/code-423n4/2022-09-frax/blob/main/src/frxETHMinter.sol#L114-L116
Impact
It will lead to duplicating accounting for the Eths which have been already converted to the frxETH tokens. It means Eth:frxEth will not be 1:1, and eventually leads to decoupling.
Proof of Concept
The function moveWithheldETH will send the amount of the Withheld ETH in the contract to the address to. It doesnt check if the to address is the frxETHMinter contract itself.
And the frxETHMinter has the receive function which will submit any eth received to the frxETH.
/// @notice Fallback to minting frxETH to the sender
receive() external payable {
_submit(msg.sender);
}
But these parts of Eths (WithheldETH) also have been converted to the frxETH normally when they were sent to the contract at the first time.
function _submit(address recipient) internal nonReentrant {
// Initial pause and value checks
...
// Give the sender frxETH
frxETHToken.minter_mint(recipient, msg.value);
So these Eths will be accounted, Twice, even more. It means Eth:frxEth will not be 1:1 anymore.
The function recoverEther has the same problem. Although these two functions can only be called by owner or DAO gov. It seriously affects financial stability.
Recommended Mitigation Steps
Furthermore, due to the logic receive() -> submit(), any kind of transaction that withdraws ETH from the contract and then sends it back will cause the same problem.
A non-feedback paybale empty function that does not use _submit() should be added to receive special ETH without increasing the frxeth supply.
FortisFortuna (Frax) commented:
We are well aware of the permission structure. The owner will most likely be a large multisig. We mentioned the Frax Multisig in the scope too. If moving funds, it is assumed someone in the multisig would catch an invalid or malicious address.
Wardens have demonstrated a mechanism which breaks core assumptions of the contract’s accounting. While I am usually very apprehensive to call input sanitization a M issue, a simple require statement here mitigates a risk of accidentally breaking a core tenet of the asset backed token.
Going to award this as Medium for now, may come back to it to revise later.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the moveWithheldETH and recoverEther functions do not check that the recipient is not the contract itself, and the receive function automatically mints frxETH for any ETH received.
Impact
The ETH:frxETH ratio could become unbalanced, potentially decoupling the two assets, but only the owner or DAO governance can trigger this.
What the attacker needed
Owner or DAO governance privileges
The fix
A check should be added to prevent sending withheld ETH to the contract itself, and a separate payable function that does not mint frxETH should be used for receiving special ETH.
How it was found
- The owner calls moveWithheldETH with the contract's own address as the recipient.
- The contract sends the withheld ETH to itself, triggering the receive function.
- The receive function calls _submit, which mints new frxETH to the contract.
- The total frxETH supply increases without new ETH backing, breaking the 1:1 ratio.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The contract holds ETH and gives out frxETH tokens in return. If the owner accidentally sends some of that ETH back into the contract, the contract thinks it is a new deposit and creates extra frxETH tokens, so there are now more frxETH tokens than ETH backing them.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.