การหลอกลวงสัญญานี้ทำงานอย่างไร?

Aug 17 2020

สังเกตเห็นสัญญาที่ไม่ดีนี้มีคนสร้างขึ้นเรื่อย ๆ ดูเหมือนการหลอกลวงบางอย่างมันทำงานอย่างไร?

https://etherscan.io/address/0x4fa738cf30036505d106b22f60e64bf52e64aa77/advanced#code:

/**
 *Submitted for verification at Etherscan.io on 2020-08-16
*/

contract a1_quiz
{
    function Try(string _response) external payable 
    {
        require(msg.sender == tx.origin);

        if(responseHash == keccak256(_response) && msg.value > 1 ether)
        {
            msg.sender.transfer(this.balance);
        }
    }

    string public question;

    bytes32 responseHash;

    mapping (bytes32=>bool) admin;

    function Start(string _question, string _response) public payable isAdmin{
        if(responseHash==0x0){
            responseHash = keccak256(_response);
            question = _question;
        }
    }

    function Stop() public payable isAdmin {
        msg.sender.transfer(this.balance);
    }

    function New(string _question, bytes32 _responseHash) public payable isAdmin {
        question = _question;
        responseHash = _responseHash;
    }

    constructor(bytes32[] admins) public{
        for(uint256 i=0; i< admins.length; i++){
            admin[admins[i]] = true;        
        }       
    }

    modifier isAdmin(){
        require(admin[keccak256(msg.sender)]);
        _;
    }

    function() public payable{}
}

คำตอบ

2 Ismael Aug 18 2020 at 03:42

หากคุณอ่านเฉพาะประวัติการทำธุรกรรมปกติของสัญญาคุณจะถือว่าหลังจากสร้างแล้วได้เริ่มต้นโดยโทรไปStart(string _question, string _response)ที่0xc96ddea6...บล็อกธุรกรรม10668934 ด้วย

  • _question = "ทนายความใส่เสื้อผ้าแบบไหน"
  • _response = "LawsuiT"

แต่ถ้าคุณเห็นธุรกรรมภายในมีการเรียกก่อนหน้านี้function New(string _question, bytes32 _responseHash)ในธุรกรรม0xbed05f75 ...ที่บล็อก 10668933

การโทรหาStartไม่เปลี่ยนแปลงresponseHashตามที่เหยื่อคาดหวังดังนั้นการโทรไปTryจะล้มเหลว

หมายเหตุ: อย่าเล่นกับ "หม้อน้ำผึ้ง" เหล่านี้เสียง่ายมากและไม่น่าจะชนะ