PantherSwap Lottery Bug Fixed

From Quadriga Initiative Cryptocurrency Hacks, Scams, and Frauds Repository
Jump to navigation Jump to search

Notice: This page is a freshly imported case study from the original repository. The original content was in a different format, and may not have relevant information for all sections. Please help restructure the content by moving information from the 'About' and 'General Prevention' sections to other sections, and add any missing information or sources you can find. If you are new here, please read General Tutorial on Wikis or Anatomy of a Case Study for help getting started.

Notice: This page contains sources which are not attributed to any text. The unattributed sources follow the initial description. Please assist by visiting each source, reviewing the content, and placing that reference next to any text it can be used to support. Feel free to add any information that you come across which isn't present already. Sources which don't contain any relevant information can be removed. Broken links can be replaced with versions from the Internet Archive. See General Tutorial on Wikis, Anatomy of a Case Study, and/or Citing Your Sources Guide for additional information. Thanks for your help!

PantherSwap

The PancakeSwap smart contract included a lottery. While the lottery was not actively running, the smart contract was still live and there may have been funds in the smart contract hot wallet.

Due to having a bug bounty program, a white hat hacker uncovered the issue and claimed the reward. The PantherSwap smart contract was upgraded before an exploit could occur.

This is a global/international case not involving a specific country.[1][2][3][4][5][6][7][8][9][10][11][12]

About PantherSwap

"The First Automatic Liquidity Acquisition Yield Farm & AMM on Binance Smart Chain." "PantherSwap is the first automatic liquidity acquisition yield farm and AMM decentralized exchange running on Binance Smart Chain with lots of unique and creative features that let you earn and win."

"Each transfer of PANTHER must pay a 2% transfer tax." "The 1% transfer tax will be allocated to automatic liquidity acquisition. And the rest 1% transfer tax will be burned immediately. The whole process is automatic."

PantherSwap depended on the same lottery contract code as PancakeSwap. "Whitehat Juno submitted a critical vulnerability in PancakeSwap’s lottery contract on April 27." (Status of contract in Knights Defi.)

"Due to insufficient validation, a malicious user could have claimed the same winning ticket at least 255 times in a single transaction, meaning the reward size was 255 times too great. A total of $700,000 in funds could have been lost, had the vulnerability been exploited."

"An analysis of this code block reveals that if a ticket is submitted to multiClaim multiple times (that is, the _tickets[] aren’t all unique), the duplicate ticket will be able to be redeemed multiple times. This happens because Lottery.sol checks that the ticket hasn’t been claimed, and it checks all the tickets before marking any of them as claimed. Additionally, LotteryNFT.sol multiClaimReward doesn’t require that the ticket being claimed hasn’t already been marked as claimed."

"None of the checks account for the possibility that a malicious user would pass the same ticket multiple times. The result is that the total reward is a function of the reward itself multiplied by the number of times the ticket is claimed."

"Step 1: Buy a lottery ticket. Step 2: Win the lottery. The lottery works by allowing you to pick a number between 1 and 14, and you pick four numbers. There are prizes available for matching at least two of the numbers together. If you match four numbers together, you win the grand prize. However, the exploit does not depend on winning the grand prize. The exploit depends on winning at least some amount of money, which is not difficult. Step 3: Submit the malicious transaction, which calls multiClaim(), and pass the winning ticket 255 times, where each ticket is the ID of the NFT lottery ticket. There’s no validation that a user is claiming the same ticket, so that user can effectively claim the same ticket an unlimited number of tickets — with the only limit being the blocksize of the transaction."

"PancakeSwap fixed [the] logic bug after it was responsibly disclosed by Juno." "Immunefi began the process of disclosure assistance, contacting every project on Binance Smart Chain that had forked PancakeSwap’s lottery contract to inform them of the vulnerability as well. ApeSwap, PantherSwap, and Knights DeFi were vulnerable. All three decided to pay a bounty to the whitehat as well."

"PancakeSwap paid $70,000 in CAKE tokens. ApeSwap paid $2,700. PantherSwap paid 10,290 PANTHER tokens. Knights DeFi paid 7,000 KNIGHT tokens. All affected projects have fixed the vulnerability."

"After Juno reported the vulnerability through Immunefi, PancakeSwap withdrew all funds out of the contract." "PantherSwap, however, kept the lottery contract active and applied a fix as suggested by Immunefi’s CTO Duncan Townsend. The fix was to rewrite the multiClaim() function." "ApeSwap shut down its lottery contract. Knights DeFi took down the contract and migrated to a new one."

This is a global/international case not involving a specific country.

The background of the exchange platform, service, or individuals involved, as it would have been seen or understood at the time of the events.

Include:

  • Known history of when and how the service was started.
  • What problems does the company or service claim to solve?
  • What marketing materials were used by the firm or business?
  • Audits performed, and excerpts that may have been included.
  • Business registration documents shown (fake or legitimate).
  • How were people recruited to participate?
  • Public warnings and announcements prior to the event.

Don't Include:

  • Any wording which directly states or implies that the business is/was illegitimate, or that a vulnerability existed.
  • Anything that wasn't reasonably knowable at the time of the event.

There could be more than one section here. If the same platform is involved with multiple incidents, then it can be linked to a main article page.

The Reality

This sections is included if a case involved deception or information that was unknown at the time. Examples include:

  • When the service was actually started (if different than the "official story").
  • Who actually ran a service and their own personal history.
  • How the service was structured behind the scenes. (For example, there was no "trading bot".)
  • Details of what audits reported and how vulnerabilities were missed during auditing.

What Happened

The specific events of the loss and how it came about. What actually happened to cause the loss and some of the events leading up to it.

Key Event Timeline - PantherSwap Lottery Bug Fixed
Date Event Description
April 27th, 2021 Main Event Expand this into a brief description of what happened and the impact. If multiple lines are necessary, add them here.

Technical Details

This section includes specific detailed technical analysis of any security breaches which happened. What specific software vulnerabilities contributed to the problem and how were they exploited?

Total Amount Lost

The total amount lost is unknown.

How much was lost and how was it calculated? If there are conflicting reports, which are accurate and where does the discrepancy lie?

Immediate Reactions

How did the various parties involved (firm, platform, management, and/or affected individual(s)) deal with the events? Were services shut down? Were announcements made? Were groups formed?

Ultimate Outcome

What was the end result? Was any investigation done? Were any individuals prosecuted? Was there a lawsuit? Was any tracing done?

Total Amount Recovered

There do not appear to have been any funds recovered in this case.

What funds were recovered? What funds were reimbursed for those affected users?

Ongoing Developments

What parts of this case are still remaining to be concluded?

General Prevention Policies

There were no losses in this case, due to the bug bounty program.

The lottery would have been more secure if the funds were in an offline multi-signature wallet. The drawing could still be run through the blockchain for process transparency.

Lotteries may also be possible with smart contract insurance.

Individual Prevention Policies

No specific policies for individual prevention have yet been identified in this case.

For the full list of how to protect your funds as an individual, check our Prevention Policies for Individuals guide.

Platform Prevention Policies

Policies for platforms to take to prevent this situation have not yet been selected in this case.

For the full list of how to protect your funds as a financial service, check our Prevention Policies for Platforms guide.

Regulatory Prevention Policies

No specific regulatory policies have yet been identified in this case.

For the full list of regulatory policies that can prevent loss, check our Prevention Policies for Regulators guide.

References