Finance

Ethereum’s ERC-20 design flaws are a crypto scammer’s best friend

ERC-20 tokens are among the most frequently stolen assets in the crypto industry, and even some of the updates intended to fix the issues are inadvertently facilitating theft.

The Ethereum network’s near-ubiquitous token standard accounted for 89.5% of the $71.5 million worth of crypto lost to phishing scams in March, according to Scam Sniffer.

These tokens were stolen as a result of victims unwittingly being phished and approving functions like “permit” and “increaseAllowance.” Functions intended to enhance the token standard’s efficiency have introduced new vulnerabilities.

First introduced back in 2015, ERC-20 tokens are full of gaping security holes, with little chance of a fix any time soon.

“The problem is because of historically bad decisions in ERC-20 and Ethereum designs,” Mikko Ohtamaa, co-founder of algorithmic investment protocol Trading Strategy, tells Magazine.

He says issues related to token design are mainly a problem specific to Ethereum and (to a lesser extent) Solana.

“The issue has been fixed on other chains like MultiversX, Radix, Cosmos-based ones, and so on,” Ohtamaa says. 

But the immutable nature of smart contracts complicates efforts to rectify ERC-20’s flaws.

Ethereum is the leading network for phishing scams. (Scam Sniffer)

Phishing attacks: Uniswap’s Permit2

Uniswap’s “Permit2” — a smart contract launched in 2022 — aims to improve transactions by allowing users to grant batch token approvals to DApps. This eliminates the need for separate approvals for each transaction, saving gas fees in the process. 

Permit2 is similar to its predecessor, “permit” from Ethereum Improvement Proposal-2612, which introduced off-chain token approvals. As these are not on-chain, signing these messages doesn’t incur gas fees.

EIP-2612 is an ERC-20 extension, meaning that it’s an optional feature. But most ERC-20 tokens circulating in the market don’t have this add-on, meaning users can’t always reap the benefits when interacting with DApps.



And that’s where Uniswap’s Permit2 comes in. This intermediary contract extends EIP-2612 to the entire spectrum of ERC-20 tokens on its platform.

But what seemed to be a valuable update for DeFi participants in one of the world’s largest decentralized exchanges prompted one researcher to sound the alarm bells.

About a week after Uniswap’s new contract release in November 2022, security researcher Roman Rakhlin published a Medium article to demonstrate how illicit actors can obtain permit signatures via phishing schemes, ultimately stealing tokens from unsuspecting victims.

Rakhlin demonstrates how a Permit2 scam works. (Roman Rakhlin)

“Like a month after I published my article, I saw some drainers that actually started to use permit signatures like I demonstrated,” Rakhlin says.

Uniswap did not respond to Magazine’s comment request.

ERC-20 and cryptocurrency scams

None of which is to say that ERC-20 tokens weren’t a major leap forward when introduced over eight years ago. They provided a generic framework that allowed new fungible tokens to be created on Ethereum and operate smoothly within predefined rules.

The standard’s core functionalities, like the “approve” mechanism, enable tokenholders to manage their assets in decentralized ecosystems and to grant permissions for assets to be moved on their behalf, thereby catalyzing the rise of DeFi.

There is a discrepancy between Ethereum’s native currency, Ether, and ERC-20 tokens, particularly in how they interact with smart contracts. 

For one, sending Ether to a smart contract is straightforward. A user simply sends Ether much like they would when sending it to another person’s wallet. 

But ERC-20 tokens require approvals when interacting with other smart contracts. Malicious actors can target this confirmation procedure to deceive users into signing fake messages.

“The standard itself is flawed,” Mikhail Vladimirov, an Ethereum developer and smart contract auditor, tells Magazine. 

Headshot of Mikhail Vladimirov.
Ethereum developer and auditor Mikhail Vladimirov.

In 2016, Vladimirov authored a paper describing a theoretical “approve” attack vector where changes in approved token amounts could be exploited by malicious entities to move a larger amount of funds than initially permitted by the token owner. 

For example, let’s say Alice owns 1,000 tokens and wants to trade them on a DEX. Alice uses the “approve” function to allow the DEX to spend 500 tokens on her behalf. But Alice changes her mind and wants to trade more. 

Alice can raise the amount of approved tokens by first setting the allowance to zero and then approving 800 tokens. In this hypothetical scenario, a malicious actor can initiate a transaction in the brief period before the reset to zero and before the new allowance, spending more tokens than Alice intends.

This particular theoretical attack could be quite tricky to pull off as it relies on targeting the short window when Alice amends her approval.

The paper proposed a solution to this hypothetical attack that lets users change the allowance instead of setting a new one. 

The adoption of “increaseAllowance” and “decreaseAllowance” functions in 2017 began to address the risk of “approve” attacks by enabling tokenholders to adjust approved token amounts without resetting them entirely.

With these functions, Alice no longer has to reset to zero but can directly change her allowance to 800 tokens.

Read also

Features

Wild, Wild East: Why the ICO Boom in China Refuses to Die

Features

How to prepare for the end of the bull run, Part 1: Timing

“The increasedAllowance function is meant to solve this problem, but in the end, it more often creates additional ones for the end-user,” Lev Menshikov, a security researcher at auditing firm Oxorio, tells Magazine. 

In a scam, illicit actors may send phishing messages asking users to increase their token allowance for seemingly valid reasons — like a phony update that requires higher allowances for users to continue enjoying services without disruptions or a fake security measure that requires users to increase approved tokens. 

This allows the hackers to move the approved tokens from the user’s wallet to theirs, draining the entire amount in some instances.

ERC-20 tokens: The immutable curse

IncreaseAllowance was removed from the ERC-20 contract last year and moved to an extension after independent security researcher pcaversaccio raised concerns about scamming possibilities enabled by the function.

“Since contracts are immutable, you can’t change them,” pcaversaccio tells Magazine. 

For existing tokens already in circulation — and there are untold numbers of them — modifications are not feasible due to blockchain’s immutable nature. 

However, by utilizing upgradable proxies or intermediary contracts, projects have the capability to augment or diminish functionalities, such as eliminating non-core functionalities like “increaseAllowance” and “permit,” akin to how Uniswap’s Permit2 brought the “permit” function to ERC-20 tokens lacking this capability on its own.

Screenshot of Pcaversaccio's proposal on OpenZeppelin to remove increaseAllowance and decreaseAllowance from ERC-20 standard.
Researcher pcaversaccio proposes the removal of functions that enable phishing schemes. (OpenZeppelin)

But pcaversaccio adds that the “approve” function must be kept since it belongs to the original ERC-20 specification. 

That means the attack vector will remain pretty much forever.

“Immutability is a feature, not a bug on the execution layer.” 

The issue is on the application layer, he says — like DApps and wallets.

Vladimirov concedes there are flaws in the ERC-20 design but attributes the rise in scams primarily to social engineering — manipulation tactics that trick the humans who interact with security systems rather than the technology itself.

He argues that wallets should provide simpler or human-readable formats rather than technical jargon or codes that often confuse users and make them more susceptible to scams.

Eth Hub's Eric Connor lays down the priorities of Ethereum community members in a tweet. Token approval issues on the list.
Token approval issues appear to be a priority for Ethereum. (Eric Connor)

“Unfortunately, we can’t require all of the [wallets] to do things in the right way, especially if the community can’t agree on what is the right way,” Vladimirov says.

Ohtamaa suggests the security community does not consider scams a high-priority issue as they mainly affect lower knowledge users or are caused by faulty front ends.

“Some security researchers are even more arrogant to say it’s ‘a stupid user issue’ or something ‘wallet and front-end developers should fix’ pushing the problem they caused to someone else,” Ohtamaa says.

Phishing attacks catch out crypto OGs

Increasingly though, anyone and everyone transacting regularly in the Ethereum ecosystem is starting to fall victim to the ubiquitous scams.

Even crypto natives, such as Necksus, a crypto miner and collaborator with the forensics platform Intelligence On Chain, have fallen victim to sophisticated social engineering tactics.

Pickle Finance's Beary the Cucumber tweets he fell victim to a phishing attack.
Beary the Cucumber becomes a permit function victim. (Beary the Cucumber)

“The losses were severe, but I am slowly working to have them recovered,” says Necksus, who claims to have lost approximately $20,000 to a phishing scam. 

Necksus says he was tricked by a compromised account of an NFT artist and visited the website of a fake Web3 social media project. 

“I did not know it until it was too late,” he adds. 

The co-founder of the DeFi platform Pickle Finance, who operates under the pseudonyms “Larry the Cucumber” and “Beary the Cucumber,” also fell victim to a recent phishing scam that involved the “permit” function.

Unlike most victims, Larry the Cucumber used additional precautionary measures, such as using a transaction simulator that allows users to review the scenario before finalizing the transaction.

Menshikov of Oxorio warns investors that inventive new phishing trends continue to appear.

“A really important trend that I could highlight in the field of phishing is the noticeable popularization of attacks on ENS Domain owners,” Meshikov says.

In this phishing scheme, attackers send fake email alerts to ENS domain owners to lure them to a fake renewal site where their funds can be extorted. 

Read also

Features

Game theory meets DeFi: Bouncing ideas around tokenomic design

Features

Powers On… Why aren’t more law schools teaching blockchain, DeFi and NFTs?

Vladimirov claims that the immutability of smart contracts and the constantly growing amount of tokens makes it difficult for any on-chain solutions to prevent attacks and notes social engineering tactics (AKA conmen and tricksters) existed long before crypto.

Instead, he says that the real solutions will come from the evolution of security tools that can warn users of known attack vectors.

Larry the Cucumber tells Magazine that crypto users can protect themselves from many attacks by using security tools like WalletGuard and Pocket Universe, where users can scan URLs to detect risks such as wallet drainers.

Pcaversaccio’s general rule to avoid phishing scams is to be suspicious of everyone and everything: “Be paranoid about everything you sign.”

But Ohtamaa takes the somewhat cynical view that there is more money to be made by “not fixing the issue.”

“It is always more profitable to sell aspirin than to cure the patient,” Ohtamaa says. 

Yohan Yun

Yohan Yun

Yohan Yun is a multimedia journalist covering blockchain since 2017. He has contributed to crypto media outlet Forkast as an editor and has covered Asian tech stories as an assistant reporter for Bloomberg BNA and Forbes. He spends his free time cooking, and experimenting with new recipes.

Source link

Related Articles

Back to top button
  • bitcoinBitcoin (BTC) $ 66,877.00 4.9%
  • ethereumEthereum (ETH) $ 3,229.66 8.04%
  • tetherTether (USDT) $ 0.999378 0.11%
  • bnbBNB (BNB) $ 590.88 2.41%
  • solanaSolana (SOL) $ 152.89 12.89%
  • usd-coinUSDC (USDC) $ 1.00 0.17%
  • staked-etherLido Staked Ether (STETH) $ 3,220.57 8.16%
  • xrpXRP (XRP) $ 0.530390 13.19%
  • dogecoinDogecoin (DOGE) $ 0.171425 11.19%
  • the-open-networkToncoin (TON) $ 6.44 10.23%
  • cardanoCardano (ADA) $ 0.483390 16.95%
  • avalanche-2Avalanche (AVAX) $ 38.68 16.32%
  • shiba-inuShiba Inu (SHIB) $ 0.000024 13.12%
  • wrapped-bitcoinWrapped Bitcoin (WBTC) $ 66,775.00 4.88%
  • bitcoin-cashBitcoin Cash (BCH) $ 519.54 15.11%
  • tronTRON (TRX) $ 0.114398 4.46%
  • polkadotPolkadot (DOT) $ 6.99 15.73%
  • chainlinkChainlink (LINK) $ 14.27 17.77%
  • matic-networkPolygon (MATIC) $ 0.748072 14.61%
  • litecoinLitecoin (LTC) $ 84.51 14.19%
  • internet-computerInternet Computer (ICP) $ 13.33 14.23%
  • nearNEAR Protocol (NEAR) $ 5.73 15.99%
  • uniswapUniswap (UNI) $ 7.79 13.45%
  • leo-tokenLEO Token (LEO) $ 5.75 1.32%
  • daiDai (DAI) $ 1.00 0.08%
  • ethereum-classicEthereum Classic (ETC) $ 28.73 15.17%
  • first-digital-usdFirst Digital USD (FDUSD) $ 1.00 0.1%
  • aptosAptos (APT) $ 9.82 17.33%
  • blockstackStacks (STX) $ 2.60 12.61%
  • mantleMantle (MNT) $ 1.14 10.65%
  • crypto-com-chainCronos (CRO) $ 0.134849 8.26%
  • bittensorBittensor (TAO) $ 537.85 14.68%
  • cosmosCosmos Hub (ATOM) $ 9.13 15.01%
  • filecoinFilecoin (FIL) $ 6.43 19.84%
  • stellarStellar (XLM) $ 0.111990 13.64%
  • okbOKB (OKB) $ 53.72 5.43%
  • vechainVeChain (VET) $ 0.042492 10.75%
  • hedera-hashgraphHedera (HBAR) $ 0.084992 14.38%
  • immutable-xImmutable (IMX) $ 2.13 16.59%
  • arbitrumArbitrum (ARB) $ 1.14 20.3%
  • render-tokenRender (RNDR) $ 7.79 13.57%
  • kaspaKaspa (KAS) $ 0.125056 11.88%
  • dogwifcoindogwifhat (WIF) $ 2.79 21.05%
  • makerMaker (MKR) $ 2,901.23 13.98%
  • pepePepe (PEPE) $ 0.000006 20.52%
  • theta-tokenTheta Network (THETA) $ 2.42 16.28%
  • the-graphThe Graph (GRT) $ 0.256915 16.42%
  • optimismOptimism (OP) $ 2.40 18.43%
  • ethena-usdeEthena USDe (USDE) $ 1.00 0.19%
  • injective-protocolInjective (INJ) $ 25.69 20.12%