• Loading stock data...
BSC Flash Loan Attack: The Three Copycats - WebTradeTalk Community
Thursday, May 19, 2022
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Login
WebTradeTalk Community
DigitalOcean Referral Badge
  • Home
  • Finance
    Why You (and I) Should Name a ‘Trusted Contact’

    Why You (and I) Should Name a ‘Trusted Contact’

    5 Things to Know About Truist Credit Cards

    5 Things to Know About Truist Credit Cards

    How to Sell Your Car Online

    How to Sell Your Car Online

    How to Book the Star Wars Hotel With Points

    How to Book the Star Wars Hotel With Points

    Lightspeed Restaurant Review 2021: Pricing, Features, Alternatives

    Charles Schwab vs. Robinhood: 2022 Comparison

    Is an Airbnb or a Hotel Right for Your Next Trip?

    Is an Airbnb or a Hotel Right for Your Next Trip?

    How to Insure Your Money When You’re Banking Over $250K

    How to Insure Your Money When You’re Banking Over $250K

    How Does AutoSlash Work? – webtradetalk.com

    How Does AutoSlash Work? – webtradetalk.com

    Smart Money Podcast: COVID Tests, and Reversing a Credit Score Drop

    Smart Money Podcast: The Tax Episode

  • Investing
    Best Stocks Under $5 That Pay Dividends

    Best Stocks Under $5 That Pay Dividends

    10 Best Oil Stocks to Buy Now

    10 Best Oil Stocks to Buy Now

    Best Platforms to Invest in Art

    Best Platforms to Invest in Art

    Hot Cash Stocks for 2022

    Hot Cash Stocks for 2022

    What is the DAX Stock Index?

    What is the DAX Stock Index?

    10 Smart Things To Do With Your Tax Refund

    10 Smart Things To Do With Your Tax Refund

    How to Spot a Crypto Scam (In-Depth Guide)

    How to Spot a Crypto Scam (In-Depth Guide)

    Why You Should Probably Keep Your Distance

    Why You Should Probably Keep Your Distance

    5 Factors To Look For When Investing In An NFT Project

    5 Factors To Look For When Investing In An NFT Project

  • Stock
  • Forex Trading
    Sterling slips in Brexit countdown, Aussie rallies By Reuters

    Forex – Dollar Slides After 4-month High; Aussie Firmer On RBA’s Optimism By Investing.com

    Argentina Peso Tumbles on Bid to Tap $50 Billion IMF Line Faster By Bloomberg

    Argentina Tested as Peso Selloff Prompts Third Abrupt Increase By Bloomberg

    Dollar Drifts Lower as Treasury Yields Retreat By Investing.com

    Dollar Hits Fresh 4-Month High After Mixed Jobs Report By Investing.com

    Dollar Flat After Fed; Aussie Dollar Falls on Weak China PPI Data By Investing.com

    Dollar Eases From 2018 Highs as Wage Growth Woes ‘Puzzle’ Traders By Investing.com

    Virus worries buoy dollar, pound swung by Brexit gyrations By Reuters

    Forex – Weekly Outlook: May 7

    Brexit sterling bets pose no conflict for UK’s Johnson: government By Reuters

    Dollar index at near four-month high after U.S. jobs data By Reuters

    Taiwan probes foreign banks over grain firms’ arbitrage By Reuters

    Forex – Dollar Steady at 4-month High; Aussie Up On Business Confidence By Investing.com

    Dollar Rises as Markets Temper Hopes on Trade, Brexit By Investing.com

    Dollar Holds Near 4-Month High in 4th Week of Gains By Investing.com

    EUR/USD Weakness Limits Dollar’s Retreat From Highs By Investing.com

    EUR/USD Weakness Limits Dollar’s Retreat From Highs By Investing.com

  • Crypto
    Terra (LUNA) Outperforms Popular Cryptos Ether, Dogecoin In The Past 24 Hours

    Terra (LUNA) Outperforms Popular Cryptos Ether, Dogecoin In The Past 24 Hours

    Proof-of-Work Ban Removed From Europe’s Proposed Crypto Regulation – Regulation Bitcoin News

    Proof-of-Work Ban Removed From Europe’s Proposed Crypto Regulation – Regulation Bitcoin News

    GameFi – Play Hard, Earn Hard

    GameFi – Play Hard, Earn Hard

    Square Enix to Bring Dungeon Siege IP to The Sandbox – Metaverse Bitcoin News

    Square Enix to Bring Dungeon Siege IP to The Sandbox – Metaverse Bitcoin News

    Crypto Market Rebounds As Tech firms Boycott Russia

    Crypto Market Rebounds As Tech firms Boycott Russia

    South African Crypto Exchange Valr Raises $50 Million in Series B Funding Round – Exchanges Bitcoin News

    South African Crypto Exchange Valr Raises $50 Million in Series B Funding Round – Exchanges Bitcoin News

    How 4DOT is making DeFi Accessible to Crypto Investors

    How 4DOT is making DeFi Accessible to Crypto Investors

    Technical Analysis:  Fantom Climbs Close to 10% Higher, While THETA Drops on Wednesday – Market Updates Bitcoin News

    Technical Analysis:  Fantom Climbs Close to 10% Higher, While THETA Drops on Wednesday – Market Updates Bitcoin News

    US Senator Urges Regulators to Increase Scrutiny on Crypto as It Risks Undermining Sanctions Against Russia – Bitcoin News

    US Senator Urges Regulators to Increase Scrutiny on Crypto as It Risks Undermining Sanctions Against Russia – Bitcoin News

  • Donate
No Result
View All Result
  • Home
  • Finance
    Why You (and I) Should Name a ‘Trusted Contact’

    Why You (and I) Should Name a ‘Trusted Contact’

    5 Things to Know About Truist Credit Cards

    5 Things to Know About Truist Credit Cards

    How to Sell Your Car Online

    How to Sell Your Car Online

    How to Book the Star Wars Hotel With Points

    How to Book the Star Wars Hotel With Points

    Lightspeed Restaurant Review 2021: Pricing, Features, Alternatives

    Charles Schwab vs. Robinhood: 2022 Comparison

    Is an Airbnb or a Hotel Right for Your Next Trip?

    Is an Airbnb or a Hotel Right for Your Next Trip?

    How to Insure Your Money When You’re Banking Over $250K

    How to Insure Your Money When You’re Banking Over $250K

    How Does AutoSlash Work? – webtradetalk.com

    How Does AutoSlash Work? – webtradetalk.com

    Smart Money Podcast: COVID Tests, and Reversing a Credit Score Drop

    Smart Money Podcast: The Tax Episode

  • Investing
    Best Stocks Under $5 That Pay Dividends

    Best Stocks Under $5 That Pay Dividends

    10 Best Oil Stocks to Buy Now

    10 Best Oil Stocks to Buy Now

    Best Platforms to Invest in Art

    Best Platforms to Invest in Art

    Hot Cash Stocks for 2022

    Hot Cash Stocks for 2022

    What is the DAX Stock Index?

    What is the DAX Stock Index?

    10 Smart Things To Do With Your Tax Refund

    10 Smart Things To Do With Your Tax Refund

    How to Spot a Crypto Scam (In-Depth Guide)

    How to Spot a Crypto Scam (In-Depth Guide)

    Why You Should Probably Keep Your Distance

    Why You Should Probably Keep Your Distance

    5 Factors To Look For When Investing In An NFT Project

    5 Factors To Look For When Investing In An NFT Project

  • Stock
  • Forex Trading
    Sterling slips in Brexit countdown, Aussie rallies By Reuters

    Forex – Dollar Slides After 4-month High; Aussie Firmer On RBA’s Optimism By Investing.com

    Argentina Peso Tumbles on Bid to Tap $50 Billion IMF Line Faster By Bloomberg

    Argentina Tested as Peso Selloff Prompts Third Abrupt Increase By Bloomberg

    Dollar Drifts Lower as Treasury Yields Retreat By Investing.com

    Dollar Hits Fresh 4-Month High After Mixed Jobs Report By Investing.com

    Dollar Flat After Fed; Aussie Dollar Falls on Weak China PPI Data By Investing.com

    Dollar Eases From 2018 Highs as Wage Growth Woes ‘Puzzle’ Traders By Investing.com

    Virus worries buoy dollar, pound swung by Brexit gyrations By Reuters

    Forex – Weekly Outlook: May 7

    Brexit sterling bets pose no conflict for UK’s Johnson: government By Reuters

    Dollar index at near four-month high after U.S. jobs data By Reuters

    Taiwan probes foreign banks over grain firms’ arbitrage By Reuters

    Forex – Dollar Steady at 4-month High; Aussie Up On Business Confidence By Investing.com

    Dollar Rises as Markets Temper Hopes on Trade, Brexit By Investing.com

    Dollar Holds Near 4-Month High in 4th Week of Gains By Investing.com

    EUR/USD Weakness Limits Dollar’s Retreat From Highs By Investing.com

    EUR/USD Weakness Limits Dollar’s Retreat From Highs By Investing.com

  • Crypto
    Terra (LUNA) Outperforms Popular Cryptos Ether, Dogecoin In The Past 24 Hours

    Terra (LUNA) Outperforms Popular Cryptos Ether, Dogecoin In The Past 24 Hours

    Proof-of-Work Ban Removed From Europe’s Proposed Crypto Regulation – Regulation Bitcoin News

    Proof-of-Work Ban Removed From Europe’s Proposed Crypto Regulation – Regulation Bitcoin News

    GameFi – Play Hard, Earn Hard

    GameFi – Play Hard, Earn Hard

    Square Enix to Bring Dungeon Siege IP to The Sandbox – Metaverse Bitcoin News

    Square Enix to Bring Dungeon Siege IP to The Sandbox – Metaverse Bitcoin News

    Crypto Market Rebounds As Tech firms Boycott Russia

    Crypto Market Rebounds As Tech firms Boycott Russia

    South African Crypto Exchange Valr Raises $50 Million in Series B Funding Round – Exchanges Bitcoin News

    South African Crypto Exchange Valr Raises $50 Million in Series B Funding Round – Exchanges Bitcoin News

    How 4DOT is making DeFi Accessible to Crypto Investors

    How 4DOT is making DeFi Accessible to Crypto Investors

    Technical Analysis:  Fantom Climbs Close to 10% Higher, While THETA Drops on Wednesday – Market Updates Bitcoin News

    Technical Analysis:  Fantom Climbs Close to 10% Higher, While THETA Drops on Wednesday – Market Updates Bitcoin News

    US Senator Urges Regulators to Increase Scrutiny on Crypto as It Risks Undermining Sanctions Against Russia – Bitcoin News

    US Senator Urges Regulators to Increase Scrutiny on Crypto as It Risks Undermining Sanctions Against Russia – Bitcoin News

  • Donate
No Result
View All Result
WebTradeTalk Community
No Result
View All Result
Home Crypto

BSC Flash Loan Attack: The Three Copycats

Newsroom by Newsroom
July 25, 2021
in Crypto
0
BSC Flash Loan Attack: The Three Copycats
0
SHARES
82
VIEWS
Share on FacebookShare on Twitter

A series of attacks compromised several Binance Smart Chain (BSC) projects in May. Following PancakeBunny, its three forks projects — AutoShark, Merlin Labs, and PancakeHunny — were also attacked using similar techniques. PancakeBunny suffered the most costly attack of the four, which saw nearly $45M in total damages. In this article, Dr. Chiachih Wu, Head of the Amber Group Blockchain Security Team, elaborates on the details behind the attacks on the three copycats.

Copycats

AutoShark was attacked five days after PancakeBunny, followed by Merlin Labs and PancakeHunny, respectively. The following is an analysis of the problems and possible attack techniques for these three forked projects.

In the SharkMinter.mintFor() function, the amount of rewarding SHARK tokens to be minted (i.e., mintShark) is derived from sharkBNBAmount computed by tokenToSharkBNB() in line 1494. However, tokenToSharkBNB() references the current balance of flip, which makes it a vulnerable point. One could assume that the amount of tokens received in line 1492 is equal to the amount of the flip balance. Still, a bad actor could manipulate the flip balance simply by sending in some flip tokens right before the getReward() call and indirectly breaking the logic of tokenToSharkBNB().

In the underlying implementation of tokenToSharkBNB() , there’s another attack surface. As shown in the above code snippet, _flipToSharkBNBFlip() removes liquidity from ApeSwap (line 1243) or PantherSwap (line 1262) and converts the LP tokens into SHARK+WBNB. Later on, the generateFlipToken() is invoked to convert SHARK+WBNB into SHARK-BNB LP tokens.

Inside generateFlipToken() , the current SHARK and WBNB balances of SharkMinter (amountADesired, amountBDesired) are used to generated LP tokens and the amount of LP tokens are returned to mintFor() as sharkBNBAmount. Based on that, the bad actor could transfer SHARK+WBNB into SharkMinter to manipulate the amount of SHARK tokens to be minted as well.

The loophole in PancakeHunny is identical to that found in AutoShark, in that the bad actor can manipulate HUNNY reward minting with HUNNY and WBNB tokens.

Compared to AutoShark and PancakeHunny, Merlin Labs’ _getReward() has a more obvious vulnerability.

The code snippet above shows that the performanceFee could be manipulated by the balance of CAKE, which indirectly affects the MERL rewards minting. However, the nonContract modifier gets rid of flash loans.

Even without an exploit contract, the bad actor could still profit through multiple calls.

Reproducing AutoShark Attack

To reproduce the AutoShark hack, we need to first get some SHARK-BNB-LP tokens from PantherSwap. Specifically, we swap 0.5 WBNB into SHARK (line 58) and transfer the rest WBNB with those SHARK tokens into PantherSwap for minting SHARK-BNB-LP tokens (line 64). Later on, we deposit those LP tokens into AutoShark’s StrategyCompoundFLIP contract (line 69) to qualify for rewards. Note that we purposely only deposit half of the LP tokens in line 69.

The second step is to make getReward() go into the SharkMinter contract. In the above code snippet, we know that the reward can be retrieved by the earned() function (line 1658). Besides, 30% of the reward (i.e., performanceFee) should be greater than 1,000 (i.e., DUST) to trigger the SharkMinter.mintFor() in line 1668.

Therefore, in our exploit code, we transfer some LP tokens to the StrategyCompoundFLIP contract in line 76 to bypass the performanceFee > DUST check and trigger the mintFor() call. Since we need a lot of WBNB+SHARK to manipulate SharkMinter, we leverage PantherSwap’s 100k WBNB via a flash-swap call in line 81.

In the flash-swap callback, pancakeCall(), we exchange half of the WBNB into SHARK and send the SHARK with the remaining 50,000 WBNB to the SharkMinter contract to manipulate the reward minting.

The next step is to trigger getReward() when the SharkMinter receives the WBNB+SHARK tokens to mint a large amount of SHARK to the caller.

The last step is to convert SHARK to WBNB, pay the flash loan, and walk away with the remaining WBNB tokens.

In our experiment, the bad actor starts with 1 WBNB. With the help of flash loans, he profits from more than 1,000 WBNB being returned in one transaction.

Reproducing PancakeHunny Attack

The theory behind the PancakeHunny attack is similar to the AutoShark attack. In brief, we need to send a lot of HUNNY+WBNB to HunnyMinter before triggering getReward(). However, the HUNNY token contract has a protection mechanism called antiWhale to prevent large amount transfers. Therefore, flash loans do not work here.

To bypass antiWhale, we create multiple child contracts and initiate multiple CakeFlipVault.deposit() calls via said contracts.

In the above exploit code snippet, the LP tokens gathered in line 116 are divided into 10 parts and transferred to 10 Lib contracts in line 122 followed by Lib.prepare() calls for each of them.

Inside Lib.prepare(), we approve() the CakeFlipVault to spend the LP tokens and invoke CakeFlipVault.deposit() to enable the later getReward() calls for minting rewarding HUNNY tokens.

After preparing 10 Lib contracts, the main contract iterates each of them to: 1) swap WBNB to the maximum allowable amount of HUNNY; 2) transfer WBNB+HUNNY to HunnyMinter; 3) trigger getReward() via lib.trigger(); and 4) swap HUNNY back to WBNB.

In the end, the bad actor with 10 WBNB earns around 200 WBNB from 10 runs of 10 Lib contracts operations.

Reproducing Merlin Labs Attack

As mentioned earlier, Merlin Labs has the noContract modifier to get rid of flash loan attacks. However, we could use a script to trigger the attack with multiple transactions initiated from an EOA (Externally Owned Account) address. The only difference is that someone may front-run the bad actor’s transaction to steal the profits.

Similar to the AutoShark attack, we need to prepare enough LINK and WBNB (line 23), use them to mint WBNB-LINK-LP tokens (line 34), and deposit LP tokens into VaultFlipCake contract (line 38).

The remaining actions are:

  1. Swapping WBNB to CAKE (line 42).
  2. Manipulating MERL minting by sending CAKE to VaultFlipToCake contract (line 50).
  3. Triggering getReward() in line 55 (a large amount of MERL tokens are minted).
  4. Swapping MERL back to WBNB and repeating the above steps multiple times.

As mentioned earlier, if someone front runs step 3 right after step 2, that person could remove a large amount of MERL.

In our experiment, the bad actor starts with 10 WBNB and walks away with around 165 WBNB by repeating the four steps 10 times.

About Amber Group

Amber Group is a leading global crypto finance service provider operating around the world and around the clock with a presence in Hong Kong, Taipei, Seoul, and Vancouver. Founded in 2017, Amber Group services over 500 institutional clients and has cumulatively traded over $500 billion across 100+ electronic exchanges, with over $1.5 billion in assets under management. In 2021, Amber Group raised $100 million in Series B funding and became the latest FinTech unicorn valued at over $1 billion. For more information, please visit www.ambergroup.io.

Source link

Tags: attackBSCCopycatsFlashLoan
Previous Post

U.S. judge rules Lithium Americas may excavate Nevada mine site

Next Post

3 Dividend Stocks to Buy and Never, Ever Sell

Newsroom

Newsroom

Related Posts

Terra (LUNA) Outperforms Popular Cryptos Ether, Dogecoin In The Past 24 Hours
Crypto

Terra (LUNA) Outperforms Popular Cryptos Ether, Dogecoin In The Past 24 Hours

by Newsroom
March 3, 2022
Proof-of-Work Ban Removed From Europe’s Proposed Crypto Regulation – Regulation Bitcoin News
Crypto

Proof-of-Work Ban Removed From Europe’s Proposed Crypto Regulation – Regulation Bitcoin News

by Newsroom
March 3, 2022
GameFi – Play Hard, Earn Hard
Crypto

GameFi – Play Hard, Earn Hard

by Newsroom
March 3, 2022
Square Enix to Bring Dungeon Siege IP to The Sandbox – Metaverse Bitcoin News
Crypto

Square Enix to Bring Dungeon Siege IP to The Sandbox – Metaverse Bitcoin News

by Newsroom
March 3, 2022
Crypto Market Rebounds As Tech firms Boycott Russia
Crypto

Crypto Market Rebounds As Tech firms Boycott Russia

by Newsroom
March 3, 2022
Next Post
3 Safe Dividend-Paying Canadian Stocks to Buy Amid Volatility

3 Dividend Stocks to Buy and Never, Ever Sell

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Articles

Sterling slips in Brexit countdown, Aussie rallies By Reuters

Forex – Dollar Slides After 4-month High; Aussie Firmer On RBA’s Optimism By Investing.com

March 3, 2022
Why You (and I) Should Name a ‘Trusted Contact’

Why You (and I) Should Name a ‘Trusted Contact’

March 3, 2022
Terra (LUNA) Outperforms Popular Cryptos Ether, Dogecoin In The Past 24 Hours

Terra (LUNA) Outperforms Popular Cryptos Ether, Dogecoin In The Past 24 Hours

March 3, 2022

Browse by Category

  • Crypto
  • Finance
  • Forex Trading
  • Investing
  • Stock

About us

Our mission is to develop a community of people who try to make financially sound decisions. The website strives to educate individuals in making wise choices about Personal Finance, Stock, Investing, Crypto, and more.

Categories

  • Crypto
  • Finance
  • Forex Trading
  • Investing
  • Stock

Recent Posts

  • Forex – Dollar Slides After 4-month High; Aussie Firmer On RBA’s Optimism By Investing.com
  • Why You (and I) Should Name a ‘Trusted Contact’
  • Terra (LUNA) Outperforms Popular Cryptos Ether, Dogecoin In The Past 24 Hours
  • Contact
  • Privacy Policy
  • Terms & Conditions

© 2021 webtradetalk.com - All rights reserved

No Result
View All Result
  • Home
  • Finance
  • Investing
  • Stock
  • Forex Trading
  • Crypto
  • Donate

© 2021 webtradetalk.com - All rights reserved

Welcome Back!

Login to your account below

Forgotten Password?

Create New Account!

Fill the forms below to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
  • bitcoinBitcoin(BTC)$60,736.00-1.05%
  • MMS Cash TokenMMS Cash Token(MCASH)$1.000.00%
  • ethereumEthereum(ETH)$4,240.29-1.27%
  • binancecoinBinance Coin(BNB)$516.85-0.75%
  • tetherTether(USDT)$1.00-0.09%
  • cardanoCardano(ADA)$1.96-0.75%
  • SolanaSolana(SOL)$196.662.08%
  • rippleXRP(XRP)$1.091.42%
  • polkadotPolkadot(DOT)$42.28-1.30%
  • Shiba InuShiba Inu(SHIB)$0.000067-5.05%
  • dogecoinDogecoin(DOGE)$0.261766-4.15%
  • usd-coinUSD Coin(USDC)$1.00-0.08%
  • TerraTerra(LUNA)$42.35-2.09%
  • AvalancheAvalanche(AVAX)$63.120.93%
  • wrapped-bitcoinWrapped Bitcoin(WBTC)$60,784.00-0.96%
  • chainlinkChainlink(LINK)$29.46-1.35%
  • Binance USDBinance USD(BUSD)$1.00-0.14%
  • litecoinLitecoin(LTC)$190.63-0.15%
  • UniswapUniswap(UNI)$24.680.07%
  • matic-networkPolygon(MATIC)$1.85-1.97%
  • algorandAlgorand(ALGO)$1.820.55%
  • bitcoin-cashBitcoin Cash(BCH)$593.931.51%
  • cosmosCosmos(ATOM)$36.33-3.38%
  • stellarStellar(XLM)$0.3666102.15%
  • vechainVeChain(VET)$0.130379-1.17%
  • Axie InfinityAxie Infinity(AXS)$137.08-5.29%
  • Internet ComputerInternet Computer(ICP)$45.074.39%
  • daiDai(DAI)$1.00-0.06%
  • filecoinFilecoin(FIL)$63.938.88%
  • tronTRON(TRX)$0.099972-0.89%
  • theta-tokenTheta Network(THETA)$7.12-7.47%
  • ethereum-classicEthereum Classic(ETC)$53.802.21%
  • FTX TokenFTX Token(FTT)$58.46-1.92%
  • FantomFantom(FTM)$2.68-1.66%
  • cETHcETH(CETH)$85.17-1.02%
  • VectoriumVectorium(VECT)$425.81-3.49%
  • HederaHedera(HBAR)$0.401606-3.25%
  • Lido Staked EtherLido Staked Ether(STETH)$4,218.57-0.97%
  • OKBOKB(OKB)$20.58-2.77%
  • tezosTezos(XTZ)$6.26-1.07%
  • ElrondElrond(EGLD)$264.881.10%
  • Crypto.com CoinCrypto.com Coin(CRO)$0.208427-3.29%
  • NearNear(NEAR)$9.86-6.89%
  • The GraphThe Graph(GRT)$0.995.37%
  • moneroMonero(XMR)$268.562.08%
  • eosEOS(EOS)$4.562.83%
  • FlowFlow(FLOW)$13.88-4.08%
  • PancakeSwapPancakeSwap(CAKE)$17.40-3.20%
  • AaveAave(AAVE)$310.80-2.66%
  • KlaytnKlaytn(KLAY)$1.58-1.86%