arbitrary synth mint/burn from pool
The Pool contract allowed minting any valid Synth regardless of which underlying token the pool held, so an attacker could mint an expensive synth from a cheaper pool. The attacker could then burn the minted synth at the expensive pool for profit, amplified with flash loans.
Submitted by jonah1005
Pool can mint arbitrary Synth provided as long as it’s a valid synth. When there are multiple curated pools and synth (which the protocol is designed for), hackers can mint expensive synthetics from a cheaper AMM pool. The hacker can burn the minted synth at the expensive pool and get profit. The arbitrage profit can be amplified with flash loan services and break all the pegs.
Pool’s mintSynth logic, Synth’s mintSynth logic, and Synth’s authorization logic.
The price of the synthetics to be mint is calculated in Pool based on the AMM price of the current Pool
Here’s a web3.py script of minting arbitrary Synth in a pool. For simplicity, two pools are set with the assumption that link is 10x expensive than dai.
sparta_amount = 100 * 10**18
initail_link_synth = link_synth.functions.balanceOf(user).call()
base.functions.transfer(link_pool.address, sparta_amount).transact({'from': user})
link_pool.functions.mintSynth(link_synth.address, user).transact({'from': user})
after_link_synth = link_synth.functions.balanceOf(user).call()
print('get link synth amount from link pool:', after_link_synth - initail_link_synth)
sparta_amount = 100 * 10**18
initail_link_synth = link_synth.functions.balanceOf(user).call()
base.functions.transfer(dai_pool.address, sparta_amount).transact({'from': user})
dai_pool.functions.mintSynth(link_synth.address, user).transact({'from': user})
after_link_synth = link_synth.functions.balanceOf(user).call()
print('get link synth amount from dai pool:', after_link_synth - initail_link_synth)
The log of the above script
get link synth amount from link pool: 97078046905036524413
get link synth amount from dai pool: 970780469050365244136
Recommend Checking the provided synth’s underlying token in mintSynth
require(iSYNTH(synthOut).LayerONE() == TOKEN, "invalid synth");
verifyfirst (Spartan) confirmed:
We agree and appreciate this finding being valid high risk issue.
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 mintSynth function did not verify that the requested synth's underlying token matched the pool's own token.
Impact
An attacker could mint expensive synths from a cheaper pool and burn them at the expensive pool for profit, with flash loans amplifying the arbitrage and potentially breaking all the pegs.
What the attacker needed
Multiple curated pools with different synth prices; attacker holds the cheaper pool's base token; flash loan access to amplify profit
The fix
The mintSynth function should check that the provided synth's underlying token matches the pool's token.
How it was found
- Transfer the pool's base token to the cheaper pool.
- Call mintSynth on the cheaper pool, requesting the expensive synth.
- Receive the expensive synth from the cheaper pool.
- Burn the expensive synth at the expensive pool to realise a profit.
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.
A pool is a smart contract that lets people swap tokens. A synth is a token that represents another asset. The pool did not check that the synth you asked for matched the token the pool actually held, so you could use a cheap pool to create an expensive synth and sell it elsewhere for more than you paid.
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.