Skip to content

Instantly share code, notes, and snippets.

View DAVEALLCAPS's full-sized avatar

CAPS LOCK DAVE DAVEALLCAPS

View GitHub Profile
############
# Puzzle 5 #
############
00 34 CALLVALUE
01 80 DUP1
02 02 MUL
03 610100 PUSH2 0100
06 14 EQ
07 600C PUSH1 0C
➜ 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:
// 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 {
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import {Address} from "openzeppelin-contracts/utils/Address.sol";
interface IFlashLoanEtherReceiver {
function execute() external payable;
}
/**
➜ evm-puzzles git:(master) ✗ npx hardhat play
############
# Puzzle 4 #
############
00 34 CALLVALUE
01 38 CODESIZE
02 18 XOR
03 56 JUMP
04 FD REVERT
➜ evm-puzzles git:(master) ✗ npx hardhat play
############
# Puzzle 3 #
############
00 36 CALLDATASIZE
01 56 JUMP
02 FD REVERT
03 FD REVERT
04 5B JUMPDEST
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Vault {
bool public locked;
bytes32 private password;
constructor(bytes32 _password) {
locked = true;
password = _password;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Destruct {
constructor() payable {
}
function destroy(address apocalypse) public {
selfdestruct(payable(apocalypse));
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Force {/*
MEOW ?
/\_/\ /
____/ o o \
/~____ =ø= /
(______)__m_m)
@DAVEALLCAPS
DAVEALLCAPS / truster.challenge.js
Created February 2, 2023 01:39
Deploy our contract with the pool address and the token address, then call the function.
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()
});