Arithmetic Overflow and Underflow | Hack Solidity (0.6)

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ก.พ. 2025

ความคิดเห็น • 30

  • @smartcontractprogrammer
    @smartcontractprogrammer  4 ปีที่แล้ว +2

    Uint overflow and underflow explanation 0:20
    Code 3:10
    Preventative techniques (using SafeMath) 9:43

  • @Darbyslaton
    @Darbyslaton 3 ปีที่แล้ว +4

    This is fantastic. I was searching for an understanding of overflow and I got so much more. Thanks!

  • @rattle_
    @rattle_ 4 ปีที่แล้ว +2

    This is a great channel. Glad I got to know about this so early!

  • @bautistabaiocchi-lora1339
    @bautistabaiocchi-lora1339 2 ปีที่แล้ว

    Amazing vid! just heads up to those watching rn, arithetic overflow and underflow reverts for solidity v0.8+

  • @androidtechsayed201
    @androidtechsayed201 2 ปีที่แล้ว +1

    Why you are so expert?🥺❤️

  • @pythusiast4701
    @pythusiast4701 2 ปีที่แล้ว +1

    This playlist should be updated for 0.8

  • @salem232
    @salem232 4 ปีที่แล้ว +1

    Very well explained !! 😍 Thank you!! I find this new serie is so valuable so far !! Every smart contract developer should learn this !!
    Question: If these has become known vulnerability in Solidity, is the company working on remedy to enhance protection via new versions ?

    • @smartcontractprogrammer
      @smartcontractprogrammer  4 ปีที่แล้ว +1

      no, not by new versions. Developers go around this problem by using SafeMath

    • @salem232
      @salem232 4 ปีที่แล้ว

      Smart Contract Programmer ah got it! Thanks 🙏

  • @asubijotaka7374
    @asubijotaka7374 4 ปีที่แล้ว

    Awesome, thanks a lot. Nice example

  • @Ts2pc
    @Ts2pc 2 ปีที่แล้ว

    I am confused that Why at05:36 line 37 "constructer( TimeLock _timeLock) in this course, but in the course of "Reentrancy | Hack Solidity (0.6)" 05:30 line35 "constructor (address _etherstoreAddress)"? What is the difference between the two ways?

    • @smartcontractprogrammer
      @smartcontractprogrammer  2 ปีที่แล้ว +1

      syntax
      TimeLock public timeLock;
      constructor(address _timeLock) {
      TimeLock timeLock = TImeLock(_timeLock);
      }

    • @Ts2pc
      @Ts2pc 2 ปีที่แล้ว

      @@smartcontractprogrammer Thanks! I got it !So the "Reentrancy | Hack Solidity (0.6)" 05:30 line36 should be corrected as below:
      EtherStore public etherStore;
      constructor(address _etherStoreaddress) {
      EtherStore etherStore = Etherstore(_etherStoreaddress);
      }
      is that correct?

  • @billsdo4553
    @billsdo4553 2 ปีที่แล้ว

    Great video

  • @kaionwong9115
    @kaionwong9115 ปีที่แล้ว

    essentially, what it means is the malicious contract can modify the lockTime value? Is there a way to "lock" it internally, so it can't be modified at all from external contract?

    • @kaionwong9115
      @kaionwong9115 ปีที่แล้ว

      for example can this be solved by making lockTime internal?

  • @davethemonkey
    @davethemonkey 2 ปีที่แล้ว

    Amazing

  • @RobloxGamer-g9n
    @RobloxGamer-g9n 4 ปีที่แล้ว

    Thanks!

  • @KingOfNeptune_
    @KingOfNeptune_ 3 ปีที่แล้ว

    If I try to do this in a real attack, would I have to deploy the original contract that has the vulnerability AND the contract that "attacks" the vulnerability with my Metamask wallet (injected Web3)
    ?

  • @Ts2pc
    @Ts2pc 2 ปีที่แล้ว

    So based on the answer you teach in the solidity 0.8 course, may I say "Arithmetic Overflow and Underflow " is not an issue any more?

  • @erog2927
    @erog2927 3 ปีที่แล้ว

    I don't think your attack function works correctly because all its doing is depositing Ether on the contract but its not withdrawing it anywhere. Let me know if I am missing something. Love your videos :)

    • @smartcontractprogrammer
      @smartcontractprogrammer  3 ปีที่แล้ว +1

      "timeLock.withdraw()"
      Attack demonstrates how to bypass the time lock by exploiting overflow / underflow
      So code to withdraw ETH back to attacker is omitted. It's not hard to code either.

    • @erog2927
      @erog2927 3 ปีที่แล้ว +1

      @@smartcontractprogrammer yes that's fine but in this case only attacker losses the ether, Alice's ether is still in the contract and she can still withdraw after 1 week, wht's the point of doing overflow or underflow then.

    • @ricardopassos1180
      @ricardopassos1180 2 ปีที่แล้ว

      ​@@erog2927 I agree that the given example is not that critical in real life. but take this function as an example:
      // msg.sender has a balance of 20 ERC20 token
      // and _amount is set to 21
      function transfer(address _to, uint256 _amount) public {
      balances[msg.sender] -= _amount;
      balances[_to] += _amount;
      }
      If you don't use the ^0.8.1 compiler version or don't use a SafeMath like library, the msg.sender balance would be 2^256 - 1 because of an underflow.

  • @RusuEmanuelPaul
    @RusuEmanuelPaul 4 ปีที่แล้ว +7

    Problem solved in 0.8.1