All user assets which are approved to VaderPoolV2 may be stolen
The mintFungible function in VaderPoolV2 allows an attacker to specify any address as the source of tokens, so if that address has approved the pool to spend its tokens, the attacker can mint LP tokens for themselves and steal the underlying assets.
Originally disclosed on Code4rena
Submitted by TomFrenchBlockchain, also found by cmichel
Impact
Total loss of funds which have been approved on VaderPoolV2
Proof of Concept
VaderPoolV2 allows minting of fungible LP tokens with the mintFungible function
Crucially this function allows a user supplied value for from which specifies where the nativeAsset and foreignAsset should be pulled from. An attacker can then provide any address which has a token approval onto VaderPoolV2 and mint themselves LP tokens - stealing the underlying tokens.
Recommended Mitigation Steps
Remove from argument and use msg.sender instead.
pool is not meant to be interacted with
And how are you going to ensure that the pool is not interacted with, @SamSteinGG?
@alcueca Upon second consideration, the functions relating to the minting of synths and wrapped tokens should have had the onlyRouter modifier and thus are indeed vulnerable. Issue accepted.
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
The mintFungible function accepts a user-supplied 'from' address instead of using msg.sender, allowing anyone to pull tokens from any address that has approved the pool.
Impact
Any user who has approved tokens to VaderPoolV2 could have their entire approved balance stolen.
What the attacker needed
Victim has approved tokens to VaderPoolV2
The fix
The function should be changed to remove the 'from' argument and use msg.sender instead, and the project confirmed the issue was accepted.
How it was found
- Find an address that has approved VaderPoolV2 to spend its tokens.
- Call mintFungible with that address as the 'from' parameter.
- Receive LP tokens and steal the underlying tokens.
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.
When you approve a contract to spend your tokens, you trust it to only take them when you ask. Here, the contract let anyone say 'take tokens from this other person's account' and gave the attacker the pool tokens in return. So anyone who had approved the pool could lose their tokens.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.