Open hats-bug-reporter[bot] opened 2 months ago
stZETAMinter.sol and stZETAMinterERC20.sol
are OOS.
Hey @0xRizwan, thanks for the quick reply.
The problem above is in NativeMinter
and ERC20Minter
and that they cannot be used simultaneously, Zeta minters are just an example of a token, it doesn't matter which token. Also as you can see NativeMinter
and ERC20Minter
are the base ones and then every token implementation has 2 minters deriving from these contracts but they only change if the baseToken
has something specific like in the ROSE case, all others are 1:1 with NativeMinter
and ERC20Minter
.
The vulnerable line is from NativeMinter
and ERC20Minter
, so that's why this issue is in scope and valid High.
@Slavchew Answered here – minters are not used simultaneously by design: https://github.com/hats-finance/OLD-Accumulated-finance-0x75278bcc0fa7c9e3af98654bce195eaf3bb6a784/issues/25#issuecomment-2325890860
Github username: -- Twitter username: -- Submission hash (on-chain): 0x21489a057fa0506a3a1faab5d479a4beea55f5f7f2a1c0f89530484024be14b5 Severity: high
Description: Description\
Minter.sol
implements the logic for a MinterContract, which acts as an middleMan to mint staked tokens of a specific asset.There is 1 base implementation and 2 implementations that can be used for all
stX
tokens that Accumulated Finance wants to support.BaseMinter
the abstract contract and:NativeMinter
allowing depositing theNATIVE
token of the chain and receivingstX
(staked representation of theNATIVE
token)ERC20Minter
allowing to depositbaseToken
and get back the staked version of the chain'sNATIVE
tokenBoth Minters will be different deployed contracts (eg - for
ZETA
NATIVE
token -stZETAMinter.sol
andstZETAMinterERC20.sol
), both have adeposit()
that will mint to the userstX
(stZETA
in this example), but sincemint()
insidestX
tokens isonlyOwner
, Minter must be the owner of the token. But a token can only have one owner at a time and therefore both ways of gettingstX
tokens are not possible, only one will work as the other Minter contract will not be the owner andstX.mint()
will fail.Attack Scenario\ Describe how the vulnerability can be exploited.
Recommended Mitigation
This can be fixed by changing the
withdraw()
implementation of both minters to not be 1:1 as a signature and then have a contract that will inherit both minters and users can deposit there eitherbase
orNATIVE
tokens, this way only this contract you need to be the owner of thestX
token and you will mine it.Another approach which is easier is to make
mint()
insidestX
notonlyOwner
but with a role check (MINTER_ROLE
) and grant that role to both Minters.