Report2023-02-05
5 Minutes Read
BradMoon
Security Operation / Audit
On February 10, 2023, some reflection mechanism tokens on BNB Chain were attacked and spread to multiple tokens. MetaTrust conducted a thorough analysis and found several dozens of tokens that were not yet attacked through its exclusive IP Analyzer engine.
On February 10, 2023, some reflection mechanism tokens on BNB Chain were attacked and spread to multiple tokens. MetaTrust conducted a thorough analysis and found several dozens of tokens that were not yet attacked through its exclusive IP Analyzer engine.
In Yield farming, liquidity mining, and staking projects in DeFi, users can lock up some assets to earn interest on their held cryptocurrency over a specific period. However, when the value of the collateral assets decreases, users also bear the losses from the asset’s decline. This drawback led to the creation of reflection tokens. Simply put, reflection tokens come with a similar staking mechanism, in theory, eliminating the need to lock tokens and providing similar staking benefits.
Specifically, reflection tokens reduce the circulating supply of tokens in the market by taxing each sale of tokens, maintaining a high coin price, avoiding a direct drop in token prices due to token sales, and distributing the revenue to all users. However, some tokens in order to reduce the circulating supply of tokens as quickly as possible, opened up the token destruction mechanism to all holders, allowing each user to destroy tokens after holding them to maintain the circulating supply of tokens in the market. As a result, every time a user destroys tokens, the total supply of tokens decreases, leading to an increase in token prices in decentralized exchanges.
In this attack, the general steps of the user’s attack process are as follows:
The key step is step 4. The core code is as follows:
In balanceOf
, unlike the traditional erc20 token, the balance acquisition of an account may be recalculated in real time through the current totalsupply
, rather than relying on the actual holdings of users, which means that balanceOf (account)
depends on the value of tokenFromReflection (_rOwned [account])
. Continue to analyze, and we find the order of data dependence. Here we use a mathematical formula to express:
https://miro.medium.com/v2/resize:fit:1400/0*RQxotZdhnm3FaVhP
According to this formula, we can find that if the tTotal
is smaller, the calculated balanceOf (account)
is smaller, and users can destroy their own tokens through the call of the burn
function to make the tTotal
smaller. The final result is that when calculating the amount of tokens held in the liquidity pool balanceOf (liquidityPool)
, the result will be smaller than expected, which will cause the price of tokens in the liquidity pool to rise, Users can hold some tokens in advance and make profits after the token price in the liquidity pool rises
We found that many tokens follow this design pattern, and their characteristics are very distinct: that is, it contains the above functions simultaneously. Based on this feature, combined with MetaTrust’s unique IP Analyzer engine, we found that tokens in multiple chains have such vulnerabilities. As of noon on February 12, 2023, there are still some tokens that can be attacked. Take Ethereum as an example, the potential loss is about $11000:
https://miro.medium.com/v2/resize:fit:1400/0*mL6XrrDy4H2o00Ih
Take the token 0xe8847d2fa66d0d1f4a77221cae1e47d8d59cf7d7 as an example. Its code also contains these key functions
Its corresponding liquidity pool is:0xd3a3b04e222229ec1dd1215363b7ac5e0102eb8e
In addition, our data set also contains the potential vulnerability tokens of BNB Polygon and the other 9 EVM chains
IP Analyzer ****is a code clone detection engine that uses machine learning models to detect similarities in contracts from the chain, open source library and project sources. This engine also builds a code usage dependency graph among all available smart contracts on the chains using function-level clone detection. Using the graph, we can find all dependent sub-contracts or similar contracts for the given contract, which can discover vulnerabilities introduced by the code clone and code reuse.
Security Analyzer: Security Analyzer performs static analysis to detect vulnerabilities on the source code level using a set of comprehensive vulnerability patterns. This engine leverages data flow, control flow and money flow to perform precise security analysis. Furthermore, we have defined MetaTrust security rule standards, which contain about 150 rules to cover a wide range of smart contract vulnerabilities including logical and economical bugs.
Security Prover: Prover is a smart contract vulnerability detection tool based on source code-level symbolic execution technology. Simulating the program running process and predicting its behavior, Prover can predict the operation of smart contracts and identify possible vulnerabilities, including capital loss, privacy disclosure, etc. It helps developers identify contract boundaries and control structures, and provides comprehensive vulnerability PoC.
Open Source Analyzer: this Analyzer focuses on open-source security. It detects the relationship between the project and third-party open-source libraries, such as Openzeppelin and Pancakeswap. By monitoring vulnerabilities of open source libraries, security issues of projects can be alerted.
The deflation token attack on the BNB chain, Metatrust found dozens of tokens on the EVM chain that were not attacked.
On February 10, 2023, some reflection mechanism tokens on BNB Chain were attacked and spread to multiple tokens. Metatrust conducted a thorough analysis and found several dozens of tokens that were not yet attacked through its exclusive IP Analyzer engine.
https://miro.medium.com/v2/resize:fit:1400/0*B_7P_FY6Ywxn0ZFV
If any EVM chain organization needs information about these tokens, please contact us (Ty@metatrust.io).
BradMoon
Security Operation / Audit
On February 10, 2023, some reflection mechanism tokens on BNB Chain were attacked and spread to multiple tokens. MetaTrust conducted a thorough analysis and found several dozens of tokens that were not yet attacked through its exclusive IP Analyzer engine.