Damn Vulnerable DeFi V3 Challenge 7 Solution - Compromised Walkthrough
Johnny Time
Hey everyone, it's JohnnyTime, your go-to source for all things blockchain security and smart contract hacking. In today's video, we're diving deep into the 7th challenge of Damn Vulnerable DeFi V3, known as the "Compromised".
This is the most up-to-date solution you'll find online for this challenge, so get ready for an exciting walkthrough.
Learn Smart Contract Hacking Fundamentals and Become a Certified Smart Contract Hacker: https://johnnytime.xyz/smart-contract-hacker
Damn Vulnerable DeFi V3: https://www.damnvulnerabledefi.xyz/
Damn Vulnerable DeFi V3 Videos and Solutions: https://www.youtube.com/playlist?list=PLKXasCp8iWpiKdsSR18XdAyDeYlYzMG00
Damn Vulnerable DeFi Repository with Solutions on Github (Leave a star š): https://github.com/RealJohnnyTime/damn-vulnerable-defi-v3-solutions-johnnytime
š Challenge Overview š Damn Vulnerable DeFi V3 Challenge 7, "Compromised," is about an NFT exchange which sells NFTS in crazy high prices. The prices are being taken from some kind of external Oracle Service. Our mission is to understand how this exchange operates and, more importantly, how we can manipulate it to our advantage. To succeed, we'll need to think like hackers and identify vulnerabilities in the system to steal all the ETH from the NFT Exchange!
š¤ Meet the Smart Contracts š¤ Exchange.sol: The Exchange contract represents an on-chain exchange where collectibles called DVNF are bought and sold. The contract interacts with two main components: the DamnValuableNFT contract, which handles the creation and management of NFTs, and the TrustfulOracle contract, which provides price data from trusted sources. Users can buy and sell these NFTs, ensuring that the prices align with the Oracle's data.
TrustfulOracle.sol: The TrustfulOracle contract is a price oracle with multiple trusted sources. It ensures the accuracy of the reported prices for various symbols by calculating the median of the prices from these sources. Sources with the TRUSTED_SOURCE_ROLE can post prices for specific symbols, while the oracle contract keeps track of the prices reported by each source. It also includes an INITIALIZER_ROLE for setting up initial prices during deployment. This contract helps maintain accurate and reliable price data for the Exchange contract.
TrustfulOracleInitializer.sol: The TrustfulOracleInitializer contract serves as a utility for deploying and initializing a new instance of the TrustfulOracle contract. It accepts arrays of sources, symbols, and initial prices, creates a new TrustfulOracle contract, and sets up the initial prices using the provided data. This initializer simplifies the deployment process for a new Oracle contract and ensures that it starts with trustworthy price data.
These contracts work together to create a secure and functioning decentralized exchange with reliable price information, making it possible for users to buy and sell collectibles on-chain.
SelfiePool.sol: The flash loan provider with a safety net - governance can drain funds in emergencies. Only the governance contract can trigger this emergency exit feature.
š Level Up Your Skills š Feeling overwhelmed by smart contract hacking challenges? Consider enrolling in our comprehensive Smart Contract Hacking Course. With 30+ videos, 40+ exercises, and a supportive community, you'll master the art of smart contract security.
š Certification Awaits š Complete the course and ace the final test to earn your official Smart Contract Hacker Certificate. This credential can open doors to exciting career opportunities in the Web3 security space.
š„ Ready to Dive In? š„ Get started today with a limited-time discount: https://johnnytime.xyz/smart-contract-hacker
Timestamps 00:00 Intro 00:40 Compromised Challenge Overview 01: 00 Smart Contract Overview 14:20 Test File Overview 15:20 Planning Our Solution 19:40 Implementing Our Exploit 30:00 Testing Our Exploit
If you're ready for some hands-on learning and a deep dive into smart contract vulnerabilities, hit that play button and let's hack our way through Damn Vulnerable DeFi V3 Challenge 7!
Don't forget to subscribe for more content like this, and if you have questions or comments, feel free to drop them below. Let's get started! šš #SmartContractHacking #BlockchainSecurity #DamnVulnerableDefi #V3 #Compromised ... https://www.youtube.com/watch?v=ecYTmC6tUXI
261998669 Bytes