Hyperinflation Vulnerability - Reading Assignment

1 ) How was the bug discovered?
The PechShield system noticed an unusual transaction with very large volume

2 ) What is this vulnerability called?
batchOverflow

3 ) Which function is vulnerable?
batchTransfer()

4 ) Why was the vulnerability present in several ERC20 tokens?
because they all used ERC20 standard. Some of them used the same security logic - so also had the bug.

5 ) Why is “code is law” mentality problematic when it comes to fixing bugs?
Because there is no security response mechanism to fix the problem.

6 ) How did exchanges react to this vulnerability?
Some of them suspended withdrawal and trading of vulnerable tokens

1 Like
  1. An automated system to analyze blockchain transfers detected suspicious transactions.
  2. batchOverflow
  3. batchTransfer
  4. Due to code reutilisation.
  5. There are no traditional well known security mechanisms for these vulnerable contracts.
  6. There was a lack of coordination to stop the exchange of the vulnerable tokens
1 Like
  1. The bug was discovered by looking at the SC, only after there was an enormous amount of BEC transferred.
  2. batchOverflow
  3. batchTransfer
  4. Reuse of the ERC-20 standard
  5. Because it restricts from easily correcting the bug in the existing SC
  6. Some stopped the trading of BEC
1 Like
  1. How was the bug discovered?
    A security company raised an alarm of very large token transfers.

  2. What is this vulnerability called?
    batchOverflow

  3. Which function is vulnerable?
    batchTransfer - when passing in two _receivers.

  4. Why was the vulnerability present in several ERC20 tokens?
    ERC-20 token contracts use the same code/functions as one another.

  5. Why is “code is law” mentality problematic when it comes to fixing bugs?
    There is no way to upgrade contracts / fix bugs if there are issues. So errors cannot be fixed.

  6. How did exchanges react to this vulnerability?
    They suspended trading and withdrawal of the tokens.

1 Like
  1. How was the bug discovered?

The system raised an alarm on an unusual BEC token transaction

  1. What is this vulnerability called?

batchOverflow

  1. Which function is vulnerable?

function batchTransfer

  1. Why was the vulnerability present in several ERC20 tokens?

They copied the original ERC20 token called BeautyChain

  1. Why is “code is law” mentality problematic when it comes to fixing bugs?

Humans might make errors in code and the smart contracts need to be updated over time.

  1. How did exchanges react to this vulnerability?

One stopped trading of the token, but not all of them. Especially the decentralized ones with offline trading services might be difficult to stop trading the token.

How was the bug discovered?
A security firm’s scanner monitoring token transfers detected an unusually large transaction of BEC tokens.

What is this vulnerability called?
Overflow

Which function is vulnerable?
One with a calculated variable - batchTransfer in the article.

Why was the vulnerability present in several ERC20 tokens?
The developers of these tokens had not implemented SafeMath at the time, and had likely used the same approach if not even the same code from other published projects.

Why is “code is law” mentality problematic when it comes to fixing bugs?
A “code is law” approach can lead to harm. Just because something is “allowed” in the code (e.g., bug, hack etc.), it shouldn’t absolve responsible parties from taking action to prevent harm.

How did exchanges react to this vulnerability?
One exchange suspended withdrawal and trading of the vulnerable token. Others had not taken action yet, as suggested by the author of the article.

1 Like
  1. system raised an alarm which is related to an unusual BEC token transaction In this particular transaction, someone transferred an extremely large amount of BEC token — 0x8000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000
  2. batchOverflow
  3. batchTransfer
  4. Copy of the contracts
  5. There hard to upgrade contract that’s made a bug fix very hard to fix.
  6. They suspended trading and withdrawal the tokens.
1 Like

1.) How was the bug discovered?
The bug was discovered by setting up an alert through etherscan which alerted PeckShield of an unusually large transfer of coins.

2.) What is this vulnerability called?
Overflow Bug

3.)Which function is vulnerable?
The function BatchTransfer is vulnerable

4.)Why was the vulnerability present in several ERC20 tokens?
Because several ERC20 tokens at the time did not use SafeMath.sol to do their mathematical operations

5.)Why is “code is law” mentality problematic when it comes to fixing bugs?
Once a DApp is on the blockchain there is no way (almost no way) to alter the code or to take it down.

6.) How did exchanges react to this vulnerability?
By halting trading and transfers of the effected tokens.

1 Like
  1. A system built to check for suspicious transfers, raised an alert while scanning ERC-20 tokens.

  2. batchOverflow

  3. batchTransfer()

  4. A few tokens used a standard ERC-20 token contract to build upon, leaving all those contracts vulnerable.

  5. You have to make sure that you plan for every possible bug of vulnerability, because code committed to the blockchain cannot be changed.

  6. Only one exchange stooped trading BEC token, but others did not really do anything.

1 Like
  1. Their system sent them an alert indicating suspicious transactions were occurring.
  2. batchOverflow
  3. batchTransfer
  4. They used the same base compromised ERC20 code as their infrastructure for token creation.
  5. With corrections needing to be made for discovered bugs goes against the thought of leaving code alone because it operates functionally correct. It becomes problematic when trying to fix these errors because abandoning the faulty contract will always have to occur because the new and improved one will not allow for the same security breaches.
  6. By suspending the withdrawl or trading of those specific corrupted tokens, exchanges have secured themselves from from participating in specific token activities. However, they are not protected from all security threats.
1 Like
  1. How was the bug discovered?
    They found large transaction transfer from the same BeautyChain contract to two different contract on the BEC token.By having two receivers address passed into batchTransfer function, with that extremely large value, Attacker can overflow amount because amount was limit with 256 bit integer.

  2. What is this vulnerability called?
    Batch overflow.

  3. Which function is vulnerable?
    batchTransfer function.

  4. Why was the vulnerability present in several ERC20 tokens?
    The batchTransfer function is not a part of the ERC20 standard and affects only tokens that copied this code into their own smart contracts.
    Most of the coins reuse certified smart contract templates.Some of the ICO companies decide to add ‘batch transfer’ function from the beutychain contract https://etherscan.io/address/0xc5d105e63711398af9bbff092d4b6769c82f793d#code. So, they not risk to have bug for prove new formula.

To prevent these overflow situations from occuring, developers often use the Solidity safeMath library, provided as an open source library by OpenZeppelin. safeMath checks to make sure that the result of any calculation is correct and that no overflow has occurred. It does this by dividing the result of any multiplication by one of the original multipliers, by making sure the result of any addition is larger than the original values, and by checking that no negative numbers can result from a subtraction.
ref: https://blog.wetrust.io/the-batch-overflow-bug-and-why-your-trustcoins-and-wetrust-financial-dapps-are-safe-2e8af266e3fa

  1. Why is “code is law” mentality problematic when it comes to fixing bugs?
    All the smart contract that deploy are immutable.It means once deploy,it can’t modified, either to fix a bugs that becomes apparent, or to refine the functionality and add a new feature. If the developer wants to make any such changes to the smart contract, their only option is to deploy a new version, and then endeavour to transfer token balances or other state from the old to the new. If another bug is discovered, they must repeat the process.
    It will forever be impossible for anyone to change its programming code. With this choice, “the code is law” and that law won’t change.

refer: https://medium.com/hashgraph/code-is-law-but-what-if-the-law-needs-to-change-87846b209e1

  1. How did exchanges react to this vulnerability?
    Exchange ‘OKEx’ made an announcement to suspend the withdrawal and trading of BeautyChain (BEC).
1 Like
  1. PeckShield’s monitoring system raised an alarm
  2. batchOverflow
  3. batchTransfer
  4. Reuse the same code (Ex: @openzeppelin/contracts)
  5. Vulnerabilities will be immutable as well.
  6. OKEx relatively prompt. Others were slow
1 Like

they had a bot that update them about big amount transactions, they found a giga transaction of the token at voilà

BatchOverflow

batchTransfer

Because many projects use the same token contract as standard (copy-paste of the code)

Because one this kind of errors happen is quite impossible change the smart contract, who only made what is written his code, qithout watching if it is the “right thing”

Many block the trades and transactions of that token

1 Like

1 ) How was the bug discovered?
PeckShield, a blockchain security company, became aware of a suspiciously large transaction (and as they discovered, there were two such transactions) in the BeautyChain (BEC) token.

2 ) What is this vulnerability called?
batchOverflow

3 ) Which function is vulnerable?
batchTransfer()

4 ) Why was the vulnerability present in several ERC20 tokens?
Because a number of other ERC20 tokens used the same code.

5 ) Why is “code is law” mentality problematic when it comes to fixing bugs?
Once a smart contract is deployed, it is treated as immutable – bugs and all – hence fixing it requires a new contract to be deployed.

6 ) How did exchanges react to this vulnerability?
The OKEx exchange suspended the withdrawal and trading of the BEC token.

1 Like

It was detected by the security firm’s Automated system scanner that monitors large token transfers in ERC-20.

The vulnerability was called BatchOverflow.

The vulnerable code was located in batchTransfer function.

Re-using (copy-paste) of the same code to create other tokens resulted in the same vulnerability in other ERC20 tokens as well.

“Code is Law” is a technological artifact that embeds the values to the creation. In the case of blockchain, immutability was the value/rule constraint. Since the code could not be changed, it resulted in having a problem fixing the bugs.

OKEx exchange suspended the trading of the token. Whereas, other exchanges were not in coordination.

1 Like
  1. How was the bug discovered?
    When a third party independent security team implemented an automated system to detect suspicious transaction involving excessive amounts of token

  2. What is this vulnerability called?
    BatchOverflow

  3. Which function is vulnerable?
    the batchTransfer function was vulnerable

  4. Why was the vulnerability present in several ERC20 tokens?
    As the developers were using an ERC-20 standard which tend to be aligned in terms of standards with libraries or tokens holding large amount of assets (the amount was higher, the perceive risk of exploits are reduced). Unfortunately, there were bugs that were later exploited which affects all ERC-20 contracts based on the one where the bug was discovered on.

  5. Why is “code is law” mentality problematic when it comes to fixing bugs?
    Because codes that exist in the blockchain are considered immutable, and exploits that happen cannot be prevented as the VM are technically just executing the codes and function as written even if the output or result was not intended to happen

  6. How did exchanges react to this vulnerability?
    CEX such as OKEx are able to suspend trading, whilst exchanges slower to react and mitigate damage risk losing liquidity as the tokens were still exchangeable for other forms of cryptocurrency like stablecoins. DEX’s on the other hand might depend on DAO governance to shut off liquidity pools involving affected tokens but might require more time for votes to pass through

1 Like

1. How was the bug discovered?
When there was a very large amount of tokens in one transfer

2. What is this vulnerability called?
batchOverflow

3. Which function is vulnerable?
batchTransfer()

4. Why was the vulnerability present in several ERC20 tokens?
Because the code was just reused.

5. Why is “code is law” mentality problematic when it comes to fixing bugs?
There is no traditional well-known security response mechanism in place to remedy these vulnerable contracts

6. How did exchanges react to this vulnerability?
OKEx banned trading with BeautyChain

1 Like

Hyperinflation Vulnerability - Reading Assignment

How was the bug discovered?

Via the automated system which scans and analyses ERC-20 token transfers.

What is this vulnerability called?

batchOverflow

Which function is vulnerable?

batchTransfer

Why was the vulnerability present in several ERC20 tokens?

Because they share the same or similar code for their ERC20 tokens

Why is “code is law” mentality problematic when it comes to fixing bugs?

Because once the code is active and deployed onto the blockchain, it is difficult to halt or suspend the trading of these vulnerable tokens in various exchanges

How did exchanges react to this vulnerability?

They made announcements to suspend the withdrawal and trading of affected tokens

1 Like
  1. How was the bug discovered?
    General monitoring via automated scanning of erc-20 smart contract transactions by blockchain security company PeckShield.

  2. What is this vulnerability called?
    batchOverflow

  3. Which function is vulnerable?
    batchTransfer()

  4. Why was the vulnerability present in several ERC20 tokens?
    ERC20 code, just like other program code, is often copied (boilerplate, open source), which means this could be a much more widespread problem than first thought.

  5. Why is “code is law” mentality problematic when it comes to fixing bugs? Because that attitude means once code is deployed, the overarching attitude is that it must be “good” and “secure” code. Testing didn’t find the issue.

  6. How did exchanges react to this vulnerability? Some withdrew trading and withdrawals on the first noted token (BEC) but the article only mentions the complexity of coordinating the safe shut down of all of the tokens across exchanges (CEXs and DEXs).

1 Like
  1. A Security system raised an alarm that there was a suspicious transaction.
  2. batchoverflow.
  3. batchtransfer.
  4. Because the codes are reused without understanding them.
  5. There is no response mechanism in place to remedy vulnerable contracts.
  6. Suspend the withdrawal and trading of the vulnerable tokens.