<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/solving-damn-vulnerable-defi-v4-level-4--side-entrance-klhs1n1t1" -->

---
title: Solving Damn Vulnerable DeFi V4: Level 4- Side Entrance
description: A walkthrough of the Side Entrance challenge from Damn Vulnerable DeFi V4, where the goal is to drain a lending pool. The vulnerability is a business logic...
canonical: https://daily.dev/posts/solving-damn-vulnerable-defi-v4-level-4--side-entrance-klhs1n1t1
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Solving Damn Vulnerable DeFi V4: Level 4- Side Entrance | daily.dev
og:description: A walkthrough of the Side Entrance challenge from Damn Vulnerable DeFi V4, where the goal is to drain a lending pool. The vulnerability is a business logic...
og:url: https://daily.dev/posts/solving-damn-vulnerable-defi-v4-level-4--side-entrance-klhs1n1t1
og:image: https://api.daily.dev/og/posts/klHs1n1T1.png
og:image:alt: Solving Damn Vulnerable DeFi V4: Level 4- Side Entrance
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Solving Damn Vulnerable DeFi V4: Level 4- Side Entrance

**[Coins Bench](https://daily.dev/sources/coinsbench)** · 3 min read · 0 upvotes · 0 comments

## Summary

A walkthrough of the Side Entrance challenge from Damn Vulnerable DeFi V4, where the goal is to drain a lending pool. The vulnerability is a business logic flaw: the flash loan contract only checks that the pool balance is restored after the loan, but doesn't verify whether funds were returned via deposit (which credits the attacker's balance) rather than a direct transfer. The exploit takes a flash loan, repays it via the deposit function to gain an internal balance, then withdraws and sends funds to a recovery address. A working Solidity proof-of-concept contract and test function are provided.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://coinsbench.com/solving-damn-vulnerable-defi-v4-level-4-side-entrance-21fa02a276ce>

## Similar posts on daily.dev

- [Solving Damn Vulnerable DeFi V4: Level 6- Selfie](https://daily.dev/posts/solving-damn-vulnerable-defi-v4-level-6--selfie-c7zglbptb) · Coins Bench · 0 upvotes · 0 comments
- [Solving Damn Vulnerable DeFi V4: Level 3- Truster](https://daily.dev/posts/solving-damn-vulnerable-defi-v4-level-3--truster-txk8enrbt) · Coins Bench · 0 upvotes · 0 comments
- [Solving Damn Vulnerable DeFi V4: Level 2- Naive Receiver](https://daily.dev/posts/solving-damn-vulnerable-defi-v4-level-2--naive-receiver-sgr6y88vg) · Coins Bench · 0 upvotes · 0 comments

---

Tags: [#smart-contracts](https://daily.dev/tags/smart-contracts), [#solidity](https://daily.dev/tags/solidity), [#defi](https://daily.dev/tags/defi)

[View this post on daily.dev](https://daily.dev/posts/solving-damn-vulnerable-defi-v4-level-4--side-entrance-klhs1n1t1)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Solving Damn Vulnerable DeFi V4: Level 4- Side Entrance","url":"https://daily.dev/posts/solving-damn-vulnerable-defi-v4-level-4--side-entrance-klhs1n1t1","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/solving-damn-vulnerable-defi-v4-level-4--side-entrance-klhs1n1t1"},"datePublished":"2026-07-11T00:22:33.969Z","dateModified":"2026-07-11T00:22:54.932Z","description":"A walkthrough of the Side Entrance challenge from Damn Vulnerable DeFi V4, where the goal is to drain a lending pool. The vulnerability is a business logic...","image":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","thumbnailUrl":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","isAccessibleForFree":true,"articleSection":"Coins Bench","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Coins Bench","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/ba340d3c8caa4c2586911332928e24d9","url":"https://daily.dev/sources/coinsbench"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/solving-damn-vulnerable-defi-v4-level-4--side-entrance-klhs1n1t1","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"smart-contracts,solidity,defi","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Coins Bench","item":"https://daily.dev/sources/coinsbench"},{"@type":"ListItem","position":3,"name":"Solving Damn Vulnerable DeFi V4: Level 4- Side Entrance"}]}
```

