Giter Club home page Giter Club logo

timedelayedvault's Introduction

TimeDelayedVault

合约地址

0x997f5d2A4865D48873E4D4130A791C801D209E12

关于重生

有一个12小时的限制。 刚刚智才同学已经更新过了,下次更新,需要发生在2018/7/14 15:55之前

攻击方案

re-entry

function withdrawFund() onlyAuthorized external returns (bool) {
    require(now > nextWithdrawTime);
    assert(withdrawObserver.call(bytes4(sha3("observe()"))));
    walletLibrary.delegatecall(bytes4(sha3("basicWithdraw()")));
    nextWithdrawTime = nextWithdrawTime + withdrawCoolDownTime;
    return true;
}

因为这里的金额转账发生在时间修改之前。 根据第七课特别提到的re-entry攻击。通过智能合约去调用该方法,然后获得所有权之后,重复调用。在block gas limit限制下,尽量多的获取ETH。

先自行在测试网络上部署,在自己的测试网络上尝试

  1. 先建立投票选出取钱的地址,每个小组成员都调用该函数 addAuthorizedAccount 投票选择取钱的目标是攻击合约的地址
  2. 调用setObserver函数,随便一个地址
  3. re-entry攻击

尚未成功。

攻击流程

  1. 需要确定每个人的地址在authorizedUsers[index]中的index
  2. 每个人调用function addAuthorizedAccount(uint votePosition, address proposal),投票出攻击发动者
    • votePosition表示步骤1中的index
    • proposal表示推举出的攻击发动者地址
    • 此过程一旦有人输入错误的proposal地址,则需要全部重来
  3. 攻击发动者调用function setObserver(address ob),以避免assert(withdrawObserver.call(bytes4(sha3("observe()"))))验证失败
    • ob可为任意地址
  4. 发动攻击

下一个方案

timedelayedvault's People

Contributors

zhouzidan avatar mitdarkmomo avatar

Watchers

zhicai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.