Mergen Demo Crypto 7/60
Skip to content
Your daily crypto market briefing lands in the newsletter every morning at 8:00 a.m. — Subscribe
DeFiSecurity

Smart contract vulnerabilities: How do DeFi protocols stay secure?

Most attacks on decentralized finance protocols stem from smart contract vulnerabilities. In this video, security auditors explain how to reduce the risks and share key tips for investors.

SLSophie LaurentArts & Entertainment Editor
5 min6.5B0
YouTubeYouTube content loads when you press play
Table of contents
  1. The most common attack types
  2. Reading audit reports
  3. Steps users can take
  4. Key takeaways

Decentralized finance protocols have built an ecosystem worth billions of dollars on the back of innovative services. But that growth has also whetted the appetite of bad actors. According to reports from security firms, a significant share of last year's attacks stemmed from coding errors in smart contracts. In our video report, we spoke with a smart contract auditor about the most common types of vulnerabilities and how users can protect themselves.

The most common attack types

The security expert in our video interview grouped attacks into three main categories: logic errors, reentrancy attacks and access control flaws. In a reentrancy attack, a malicious contract calls the same function again before the balance is updated, allowing it to withdraw from the pool over and over. The expert is not surprised that this classic vulnerability still turns up today. The video shows on screen, step by step, how it works using a simple code example.

Another common method is manipulating the systems that supply price data. The attacker temporarily distorts the price in a small pool to mislead the protocol and borrow on favorable terms. Access control flaws arise when admin keys are poorly protected or misconfigured; a single compromised key can put the entire protocol at risk.

The most common attack types — Smart contract vulnerabilities: How do DeFi protocols stay secure?

Code is law; but buggy code leaves the door wide open.

Sophie Laurent

Reading audit reports

An audit report is a document prepared by an independent security firm after reviewing a contract's code. The expert said that when reading a report, you should first check which contracts are in scope, when the audit was carried out and how severe the findings are. If the code has changed since the audit, the report is considered outdated. A report opens with a scope section showing how much of the code was reviewed and briefly describes its methodology, which makes it the easiest part to read.

Whether critical and high-severity findings have been resolved is usually stated at the end of the report. Findings that are unresolved or marked as “acknowledged risk” deserve particular attention. According to the expert, a single audit is no guarantee; multiple independent audits, bug bounty programs and a long track record of the code running without problems should all be weighed together.

Steps users can take

The first precaution users can take is to start with amounts they can afford to lose. Running a small test on every new protocol instead of risking all your assets limits the damage if a vulnerability is exploited. The expert also recommends checking how long the protocol has been running and how much value it holds. A small test is also a good opportunity to get to know the protocol's interface and transaction flow.

Topic DeFi
Highlights smart contract, wallet security, scams
Reading time 5 minutes
Written by Sophie Laurent

Key takeaways

  • The most common flaws are logic errors, reentrancy and access control weaknesses.
  • Check an audit report's scope, date and unresolved findings.
  • Starting small and reviewing spending approvals reduces risk.

Another precaution is to regularly review the spending approvals granted to contracts and revoke those you no longer need. Using a separate wallet, reading what a transaction does before signing it and following official announcements only through verified channels also reduce risk. No precaution guarantees zero risk; this information is not investment advice.

What do you think about this post?

SL
Arts & Entertainment Editor

Sophie Laurent

A former film, music and performing arts reporter, Sophie Laurent covers festivals and exhibitions alongside the colorful world of entertainment news. In her interviews, she likes to put the story the artist is telling front and center, rather than the artist.

Leave a comment

Share your thoughts

Your email address will not be published. Respectful, on-topic comments are approved.

Block News

Welcome back

Log in to your account; your saved posts and comments are waiting for you.