Skip to main content

A Bug Making Ethereum Transactions on Exchanges Vulnerable Has Been Fixed

A bug centering around a new Ethereum token, GasToken, which was enabling abuse on cryptocurrency exchanges, appears to have been resolved.
Privacy & security - A Bug Making Ethereum Transactions on Exchanges Vulnerable Has Been Fixed

A bug centering around a new Ethereum token, GasToken, which was enabling abuse on cryptocurrency exchanges, appears to have been resolved. The details are provided in a report originally published on November 13, 2018, that discussed how the bug was exploited by attackers, and what digital platforms could do if they wished to protect their hot wallet funds.

It was unclear which exchanges could or could not be affected by the bug. Thus, private disclosures were issued to “as many exchanges as possible” according to a Medium post. While it was determined that most of these exchanges were not in any danger, all vulnerable exchanges have since instilled the proper protections. At press time, the bug is no longer considered a threat.

According to its website, GasToken is an Ethereum-based contract that allows individuals to tokenize the Ethereum network through a special refund mechanism. Users can store gas when the price is low and garner refunds when it’s high.

The website reads, “Every transaction on the network must include some gas, and the fee paid to miners for each transaction is directly proportional to the gas consumed by a transaction. GasToken allows a transaction to do the same amount of work and pay for less gas, saving on miner fees and costs and allowing users to bid higher gas prices without paying correspondingly higher fees.”

The document alleges that many exchanges either enforced no gas usage limits or allowed for the withdrawal of ether to arbitrary addresses. Combined with GasToken’s refund structure, an open doorway was subsequently provided to attackers, who could then mint gas whenever they received ether and make exchanges pay for arbitrary computation.

Attackers could exploit the bug in one of two ways. The first was by performing computations through Ethereum’s fallback function when a contract received Ethereum-based tokens from an exchange. If a malicious actor wanted to attack an exchange, the attacker could do so by initiating withdrawals to a contract address they controlled.

Granted the person operating the exchange had failed to enforce gas limits or know-your-customer (KYC) protocols, the exchange would pay the transaction fees out of their own hot wallet. The attacker could then create several accounts to bypass any single account withdrawal limits. They could also mint GasTokens, thereby causing the exchange owner’s wallet to drain even further.

The second attack vector could be exploited through a token’s transfer function. The attacker could force an exchange to pay for large amounts of computation and even cause it to burn its own ether supply.

From there, the attacker could drain the exchange’s hot wallet or mint the GasTokens for a profit if they controlled the token’s code on an exchange if the token featured an upgradeable contract or if the exchange automatically lists tokens. Whenever a token transfer occurred, the attacker could work to update the function, which would perform the same computation described in the first method, and the exchange would then pay the costs of every future transfer of that token.

The good news was that the bug could only affect exchanges that initiatedEthereum transactions not those that processed them. Thus, decentralized exchanges or those based on similar smart contract technology that processed transactions initiated by users were likely to remain unaffected.

The report listed several options to ensure the problem didn’t persist. For example, the authors suggested implementing reasonable gas limits on all transactions. That way, if any particularly expensive transactions occurred, the users would bear all the costs, ensuring exchanges remained free and clear of any charges.

In addition, exchange operators were advised to enforce both gas monitoring and rate limiting on all withdrawals. Most exchanges usually incorporate either one or the other, and neither tactic can do much on its own. Lastly, Ethereum-based contracts were told to implement gas usage restrictions when making calls to unknown addresses.

To view the full report, click here.