Cointime

Download App
iOS & Android

SharkTeam: Analysis of the HashFlow Attack Incident

On June 14, 2023, Beijing time, HashFlow fell victim to a hacker attack, resulting in an estimated profit of around $600,000 for the attackers.

SharkTeam conducted a prompt technical analysis of the incident and has summarized security measures to be taken as a precautionary approach. It is our hope that this incident serves as a lesson for future projects, contributing to the strengthening of security defenses within the blockchain industry.

1. Incident analysis

Attacker address: 0xBDf38B7475Ff810325AA39e988fb80E0aA007E84

Attack contract: 0xDDb19a1Bd22C53dac894EE4E2FBfdB0A06769216

Attacked contract: 0x79cdFd7Bc46D577b95ed92bcdc8abAba1844Af0c

Attack transactions:

0xdedda493272b6b35660b9cc9070d2ea32ee61279b821184ff837e0a5752f4042

0xb08f6d3fc70b95223cfffc2c905d9c0467a589e5f652cd193e5c00b4ad329b99

0x08b5f35076beb363a7206b8f9b4a6460f42aa9f998b561582fb4e4cdd6f05dce

1. After deploying the attack contract (0xDDb19a1B), the attacker (0xBDf38B74) proceeded to call the Wooooo function within the attack contract (0xDDb19a1B).

2. The attack contract (0xDDb19a1B) called the function 0x0031b016 of the target contract (0x79cdFd7B) during the attack.

3. The function directly transferred the user's USDT tokens to the attack contract.

2. Vulnerability Analysis

The target contract (0x79cdFd7B) that was attacked is a deprecated HashFlow contract, which was abandoned in May of the previous year and was not open-source. Through reverse engineering, it can be observed that the contract transfers tokens from the "from" address to the "to" address. Based on analysis, it is highly likely that users had granted significant authorization to this contract before May of the previous year. However, after the contract was deprecated, these authorizations were not revoked, and due to potential issues with the restriction logic after deprecation, attackers were able to call functions in the deprecated contract to transfer user assets.

3. Subsequent Developments

After carrying out the attack, the attacker (0xBDf38B74) open-sourced the attack contract and left a message stating, "Before use recover, please revoke first. Your funds are not safe." This message serves as a reminder to users to revoke their authorizations to the targeted contract (0x79cdFd7B) before transferring their funds elsewhere.

The hacker left behind two functions. One function allows users to withdraw all their funds, while the other function leaves 10% of the assets as a reward for the attacker. Currently, users have started withdrawing their funds one by one.

4. Security Recommendations

The occurrence of this incident was due to the fact that the targeted contract (0x79cdFd7B) had received significant user authorizations in the past, and these authorizations were not revoked after its deprecation, resulting in user asset losses. To prevent similar attacks in the future, it is important to follow these precautions during the development process:

(1) Project developers should thoroughly validate and address any potential logic issues that may arise after deprecating a contract.

(2) Users should regularly review their account authorizations for different protocol contracts and promptly revoke authorizations for contracts they no longer interact with or have been upgraded.

(3) Before deploying contract upgrades, it is crucial to collaborate with professional third-party auditing teams to ensure security.

About us

SharkTeam’s vision is to comprehensively protect the security of the Web3 world. The team is composed of experienced security professionals and senior researchers from all over the world. They are proficient in the underlying theory of blockchain and smart contracts, and provide services including smart contract auditing, on-chain analysis, and emergency response. It has established long-term cooperative relationships with key players in various fields of the blockchain ecosystem, such as Polkadot, Moonbeam, polygon, OKC, Huobi Global, imToken, ChainIDE, etc.
Official website: https://www.sharkteam.org/
Twitter: https://twitter.com/sharkteamorg
Discord: https://discord.gg/jGH9xXCjDZ
Telegram: https://t.me/sharkteamorg

Comments

All Comments

Recommended for you

  • Circle minted 500 million USDC on the Solana network.

    according to Onchain Lens monitoring, Circle has minted 500 million USDC on the Solana network. Since October 11, Circle has issued a total of 18 billion USDC on the Solana network.

  • Sources familiar with the matter: JPMorgan Chase is considering offering cryptocurrency trading services to institutional clients.

    according to Bloomberg, as major global banks deepen their involvement in the cryptocurrency asset class, JPMorgan Chase is considering offering cryptocurrency trading services to its institutional clients. A knowledgeable source revealed that JPMorgan is evaluating what products and services its market division can offer to expand its business in the cryptocurrency field. The source stated that these products and services may include spot and derivatives trading.

  • Federal Reserve Governor Milan: We believe that the policy rate will eventually be lowered.

    Federal Reserve Board member Mylan stated that due to the US government shutdown, there were some anomalies in last week's inflation data; he believes that the US will not experience an economic recession in the near term, but if policies are not adjusted, the US will face an increasing risk of economic recession. We believe that policy interest rates will eventually be lowered.

  • BlackRock deposited 819.39 BTC, worth approximately $73.72 million, into Coinbase.

     according to Onchain Lens monitoring, BlackRock deposited 819.39 BTC into Coinbase, worth approximately 73.72 million USD.

  • Ghana passes law legalizing the use of cryptocurrency

    according to Bloomberg, the Ghanaian Parliament has approved a cryptocurrency legalization bill aimed at addressing the expanding use of cryptocurrencies in the country but the lack of regulation. According to Johnson Asiamah, Governor of the Bank of Ghana, the newly passed Virtual Asset Service Providers Act will facilitate the licensing of crypto platforms and the regulation of related activities.

  • CryptoQuant: Bitcoin network activity cools, market shows clear bearish signs.

    CryptoQuant published an analysis stating that the Bitcoin market continues to be in a bear market state, with multiple network indicators showing a significant cooling of activity. Data shows that the 30-day moving average of Bitcoin is below the 365-day moving average (-0.52%), and the bull-bear cycle indicator confirms the current bear market pattern. The number of network transactions has dropped from about 460,000 to about 438,000, fees have decreased from $233,000 to $230,000, and highly active addresses have reduced from 43.3K to 41.5K, all indicating reduced speculative activity and that the market is in a defensive phase.

  • ETH falls below $3,000

    the market shows that ETH has fallen below $3000, currently at $2999.5, with a 24-hour increase of 0.86%. The market is highly volatile, please manage your risks accordingly.

  • BTC breaks through $89,000

    market shows BTC breaking through $89,000, currently at $89,014.5, with a 24-hour increase of 0.85%. The market is highly volatile, please manage your risk accordingly.

  • Web3 data and AI company Validation Cloud completes $10 million in new round of financing

     Web3 data and AI company Validation Cloud announced a $10 million financing round from True Global Ventures. The company plans to use the funds to expand its AI products and achieve seamless access to Web3 data.