Exploit in Normie Coin caused a rug pull using Flashloan Attack

Photo of author

By aghaasadharoon

Introduction

Normie Coin ($NORMIE) has recently been at the centre of a significant exploit that has rattled its community. The exploit, discovered and detailed by Profound Watcher on Twitter, highlights vulnerabilities in the token’s smart contract. This article delves into the specifics of the exploit, the methods used by the attacker, and the broader implications for $NORMIE and other similar tokens.

Understanding the Exploit

The exploit revolves around using flash loans to manipulate the token pool, ultimately draining its value to zero. Flashloans allow users to borrow large sums of cryptocurrency without collateral, provided the loan is repaid within the same transaction. This capability is often used in arbitrage opportunities but can also be exploited for malicious purposes.

Critical Steps in the Exploit:

  1. Acquisition of Tokens: The attacker bought 5 million $NORMIE tokens, which triggered the permissions needed for the exploit.
  2. Granting Permissions: By purchasing a specific amount of tokens, the attackers granted themselves permissions usually reserved for premarket users.
  3. Flashloan Execution: Using a flashloan, the attacker endlessly filled the contract address (CA) with tokens, draining its liquidity.
  4. Zero Value Pool: This manipulation left the pool at essentially zero value, enabling the attacker to buy up tokens at no cost and sell them as others bought the dip.

Technical Breakdown

The exploit takes advantage of a specific $NORMIE intelligent contract function. Profound Watcher provided a detailed analysis of this function, which checks if a recipient address is already a premarket user. If not, it verifies if the amount being bought matches the amount in the team wallet. If these conditions are met, the recipient is granted premarket user permissions.

Critical Code Snippet:

solidity

_get_premarket_user(address _address, uint256 amount) internal {
premarket_user[_address] = !premarket_user[_address] ? (amount == balanceOf(teamWalletAddress)) : premarket_user[_address];
}

This piece of code inadvertently allowed the attacker to repeatedly grant themselves permissions by matching their purchase amount to the team wallet’s balance, leading to continuous token minting.

Impact on $NORMIE

The immediate impact of this exploit was a catastrophic drop in $NORMIE’s value, as evidenced by the sharp decline in its price chart. The liquidity drain caused panic among investors, many of whom sold their holdings, exacerbating the token’s plummet.

Price Chart Analysis: The chart provided by TradingView shows a dramatic drop, highlighting the moment the exploit was executed and the subsequent panic sell-off. This event underscores the importance of robust intelligent contract security and the potential risks associated with flash loans.

Lessons and Future Precautions

This incident with $NORMIE highlights several critical lessons for the cryptocurrency community:

  1. Smart Contract Audits: Regular and thorough audits by reputable firms can help identify vulnerabilities before they are exploited.
  2. Flashloan Risks: While flashloans offer benefits, they also pose significant risks. Developers need to consider these risks and implement safeguards.
  3. Community Vigilance: Active monitoring and quick response from the community and developers can mitigate damage during an exploit.

Conclusion

The recent exploit of Normie Coin serves as a stark reminder of the vulnerabilities in decentralized finance (DeFi). As the space evolves, developers and investors must remain vigilant, ensuring robust security measures are in place. This incident, while detrimental, provides valuable lessons for the future, emphasizing the need for continuous improvement in smart contract security.

For further updates and detailed analysis, follow Profound Watcher on Twitter.


Notice: file_put_contents(): Write of 376 bytes failed with errno=28 No space left on device in /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-content/plugins/litespeed-cache/src/file.cls.php on line 172

Fatal error: Uncaught ErrorException: md5_file(/var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-content/litespeed/css/a89884a0cddb1b223544e917d06edb20.css.tmp): Failed to open stream: No such file or directory in /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-content/plugins/litespeed-cache/src/optimizer.cls.php:130 Stack trace: #0 [internal function]: litespeed_exception_handler(2, 'md5_file(/var/w...', '/var/www/30998d...', 130) #1 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-content/plugins/litespeed-cache/src/optimizer.cls.php(130): md5_file('/var/www/30998d...') #2 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-content/plugins/litespeed-cache/src/optimize.cls.php(837): LiteSpeed\Optimizer->serve('https://cryptov...', 'css', true, Array) #3 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-content/plugins/litespeed-cache/src/optimize.cls.php(330): LiteSpeed\Optimize->_build_hash_url(Array) #4 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-content/plugins/litespeed-cache/src/optimize.cls.php(264): LiteSpeed\Optimize->_optimize() #5 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-includes/class-wp-hook.php(324): LiteSpeed\Optimize->finalize('<!DOCTYPE html>...') #6 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters('<!DOCTYPE html>...', Array) #7 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-content/plugins/litespeed-cache/src/core.cls.php(477): apply_filters('litespeed_buffe...', '<!DOCTYPE html>...') #8 [internal function]: LiteSpeed\Core->send_headers_force('<!DOCTYPE html>...', 9) #9 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-includes/functions.php(5427): ob_end_flush() #10 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-includes/class-wp-hook.php(324): wp_ob_end_flush_all('') #11 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #12 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #13 /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-includes/load.php(1280): do_action('shutdown') #14 [internal function]: shutdown_action_hook() #15 {main} thrown in /var/www/30998d21-5932-4e8b-985b-f8ab40b8404c/public_html/wp-content/plugins/litespeed-cache/src/optimizer.cls.php on line 130