Anyone Can Arbitrarily Mint Synthetic Assets In VaderPoolV2.mintSynth()
The mintSynth function allows any user to specify a 'to' address and a 'from' address, so an attacker can front-run a victim's approval and mint synthetic assets to themselves using the victim's funds. The attacker monitors approvals to the contract and calls mintSynth with their own address as 'to', causing the victim's deposit to be transferred and the synthetic asset to be sent to the attacker.
Submitted by leastwood
Impact
The mintSynth() function is callable by any user and creates a synthetic asset against foreignAsset if it does not already exist. The protocol expects a user to first approve the contract as a spender before calling mintSynth(). However, any arbitrary user could monitor the blockchain for contract approvals that match VaderPoolV2.sol and effectively frontrun their call to mintSynth() by setting the to argument to their own address. As a result, the nativeDeposit amount is transferred from the victim, and a synthetic asset is minted and finally transferred to the malicious user who is represented by the to address.
Proof of Concept
Tools Used
Manual code review. Discussions with dev.
Recommended Mitigation Steps
Consider removing the from argument in mintSynth() and update the safeTransferFrom() call to instead transfer from msg.sender.
The pool contracts, similarly to Uniswap V2, are never meant to be interacted with directly.
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 mintSynth function takes a 'from' parameter and uses it in safeTransferFrom without verifying that the caller is authorised to spend on behalf of that address, allowing anyone to specify any 'from' address that has approved the contract.
Impact
An attacker could steal a victim's approved deposit and mint synthetic assets to themselves, but the pool contracts are not meant to be interacted with directly, which may limit real-world impact.
What the attacker needed
Victim has approved the contract; attacker can front-run transactions
How it was found
- Victim approves VaderPoolV2 contract to spend their tokens.
- Attacker monitors the blockchain for such approvals.
- Attacker calls mintSynth with 'to' set to their own address and 'from' set to the victim's address.
- The contract transfers the victim's nativeDeposit and mints a synthetic asset to the attacker.
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.
This is a smart contract bug where a function lets anyone choose whose money is used and who receives the new tokens. An attacker watches for someone approving the contract to spend their tokens, then quickly calls the function with their own address as the receiver. The victim's tokens are taken and the attacker gets the newly created 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.