A flaw discovered in the Bancor on June 18 would have allowed hackers to easily empty the funds of anyone who had interacted with their smart contracts. The exploit (a piece of software or data that is often used to take advantage of a vulnerability in a system to gain control or access to it) was based on the concept of withdrawal authorization, introduced in the ERC-20 standard. This allows several Ethereum (ETH) DApps to automatically withdraw money from users‘ wallets.
As Oded Leiba, ZenGo’s research engineer, pointed out, the withdrawal function in the Bitcoin System smart contract was wrongly set up so that anyone could use it.
Bancor acted preventively to „remove“ users‘ funds before criminals could intervene.
Added to this was the fact that Bancor contracts required unlimited authorization to withdraw money even in the first interaction with the protocol. Even though users only planned to test the protocol with a limited amount of funds, the system could withdraw the entire balance from that particular account.
The developer who successfully hacked a Bitcoin wallet claims that Bitcoin is still safe
Unlimited approval for unlimited time
As Leiba told Cointelegraph, many well-known decentralized finance applications, or DeFi, request the same authorizations. Among those tested by the ZenGo team, Compound, Uniswap, bZX, Aave, Kyber and dYdX all have either infinite or extremely broad authorizations.
Kain Warwick, founder of Synthetix, told Cointelegraph that these authorizations allow for better use and lower energy consumption, with the disadvantage of greater risk. So far, most DeFi platforms seem to prefer utility. However, after the accident, Bancor decided to modify its contracts to approve only the amount needed with each trade.
Cointelegraph also contacted Aave to learn more about their decision to use unlimited authorizations, but received no response.
Warwick believes that „this is a serious issue as each new contract you give a broad authorisation exposes you to greater risk if the contract is compromised“.
Developer successfully hacks Bitcoin wallet to win contest
Even when the platform is no longer used, the authorizations remain in effect. Leiba noted that more than 160 addresses remain vulnerable to the Bancor’s intelligence contract, presumably without funds. However, if they were to return to activity, hackers could steal the money at any time.
Are standards to blame?
There are fundamental limitations to the ERC-20 token standard that are commonly used today. For one thing, the authorizations cannot have a time limit, which could have helped mitigate some of the long-term effects of infinite authorizations.
Several competent standards, such as ERC-223, tried to mitigate the problem by eliminating the need for authorisations in their entirety. In most existing applications, interactions with an intelligent contract can be signed manually each time without significantly affecting the user experience.
However, smart contracts cannot respond to unilateral transfer calls made by a user. Instead, they must collect the tokens themselves using the „transferFrom“ function, which requires configuration of the concession using the „authorization“ method.
The new decentralized cybersecurity solution allows logins without a password
Warwick explained that the team initially used the more advanced ERC-223 standard. However, problems and errors with contracts that did not support the new standard forced the community to abandon it. However, problems and errors with contracts that did not support the new standard forced the community to abandon it:
„The standards are tough, and when everything is designed for ERC20, moving unilaterally to ERC223 creates a lot of friction.“