LI.FI Protocol Hacked For $600k

Cross-chain swap and DEX aggregator platform LI.FI protocol was hacked yesterday, March 20th, for over 200 Ether. The attacker used a weakness in the protocol’s core offering, the swap function, to launch an attack that stole from a contract which doesn’t hold any funds. How is that even possible?

The answer lies in token approvals. As I discussed in Basic Rug Protection, token approvals are poorly understood and very dangerous if misused. First, let’s understand how a DEX works architecturally.

Users interact with a single router contract which will perform one or more low-level swap calls on the relevant liquidity pools.

DEX aggregators work in a similar fashion. Swap calls are made to the aggregator router, which then calls one or more DEX routers, which call their low-level swaps on the liquidity pools.

Notably, in both patterns, the initial point of entry (router or aggregator) has to be approved to transfer tokens on the user’s behalf! Contrary to popular understanding, once a contract has token approval, it does not need ANY interaction from the user to spend those tokens like they were its own money. It can move them at any time of its choosing until the user revokes approval.

This is the exploit route used by the hacker. The affected router contract did not actually hold any tokens – but it did hold token approvals. Combined with use of a low-level call function in the router that would execute arbitrary, user-provided code, and the exploit was set. The attacker was able to get the swap router to transfer all the tokens it held user approval for to the hacker’s wallet.

The Li.Fi team states that the exploit has been patched by removing the ability to call arbitrary addresses, instead requiring the destination to be one of several approved DEXs. Twenty-five of the affected twenty-nine users have already been compensated by the team, according to their press release in the blog below.

Photo of author

Written By BowTiedPickle

Anonymous cartoon pickle inspired by BowTiedBull. Degen chemical engineer, moonlighting as a Solidity developer.

Disclosure

This article may contain links to third-party websites or other content for information purposes. BowTiedIsland may receive a commission at no cost to you if you purchase a product after clicking one of these links. The Third-Party Sites are not under the control of BowTiedIsland, and BowTiedIsland is not responsible for the content of any Third-Party Site. All information contained herein is the opinion of the writer and does not constitute financial advice. We aim to act as a neutral third party and aid in your research and analysis.


The Jungle


Crypto, Investing, and E-Commerce with BowTied Bull

The future is internet based, therefore we have a triangle based approach with crypto, e-commerce business making and Investing in traditional assets

The Culture War with BowTiedRanger

Whether you’re a political junkie or just interested in current events. 

You’ve come to the right place for analysis of the most relevant current events and political issues.

Fitness With BowTiedOx

BowTiedOx provides you a place to find all of his latest programs and guides.

Weekly newsletters that cover fitness, health, and mindset, all grounded in the fundamentals of physiology.

Media Production with BowTied Turkey and BowTied Tamarin

Video is no longer optional.

Don’t get left behind.

Your brand deserves professional videos to engage your audience.

Art & Graphic Design with BowTied Patriot

BowTied Patriot is a graphic artist who specializes in photography, mixed medium custom artwork, and NFT creation.

Join BowTiedPatriot as he dives into making Art in Web3.0 and The Metaverse.

Cooking with BowTiedOctopod

Learn secrets from a fine dining chef for maximum flavor and time-saving efficiency

Newsletters on Ingredients, Techniques and Flavor hacks that will have you eating better. We will never eat bugs!

Meme Warfare with DgenFren

Increase your online engagement, organically influence narratives, and build your online persona by using marketing that your target audience actually wants: memes.

Learn How to Sell with BowTiedSalesGuy

Sales is one of the most transferrable life skills, yet few know how to actually sell.

Traditional sales tactics don’t cut it in today’s hyper competitive world.

Learn the secrets from a Chad Salesman and change your Life forever.

Ecommerce with BowTiedOpossum

Learn the skills to start and build your first online business.

Want to build a business that travels with you?

Learn from an industry veteran that has worked on and with brands you already know.