The contract exhibits a vulnerability in the minting functionality, allowing users to mint tokens for any specified address without appropriate restrictions. Additionally, the transfer of shares to the contract itself is intentionally restricted. However, the current design allows a potential bypass of this restriction, rendering it ineffective.
The stETHMock::mint
function permits users to create new tokens for any specified address, with an imposed limit on the minted amount. While the transferShares function is designed to restrict transfers to the contract itself.:
the vulnerability lies in the fact that a bad actor can easily bypass this restriction by directly minting tokens to the contract address using the mint function.
Allowing users to mint tokens for any address defeats the purpose of restricting share transfers to the contract. A bad actor can exploit this vulnerability by bypassing the transfer restriction and minting tokens directly to the contract, potentially leading to unintended consequences or misuse within the contract.
Manual review
To address this vulnerability and ensure the intended restrictions are maintained, it is recommended to modify the mint function. Users should be allowed to mint tokens to their own address using the mint function and then transfer tokens to any desired address using a separate transfer mechanism, such as the transferShares function. This approach aligns with the goal of controlling token destinations while preventing direct transfers to the contract. The modification could be implemented as follows:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.