Accessing Private Data | Hack Solidity (0.6)

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

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

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

    Vulnerability 0:40
    Storage layout 1:41
    Code 4:57
    Setup 10:09
    Demo 10:38
    Preventative technique 16:54

  • @yellemonster
    @yellemonster 4 ปีที่แล้ว +74

    Everyone else is doing "beginner" tutorials. You're the only person I've found who does legit, intermediate-advanced tutorials. Your channel is an excellent resource. Thank you for the work you've done!

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

      That is exactly why I created this channel!

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

      @@smartcontractprogrammer , thanks for a great tutorial. I'm tryna access the values of mapping(address => unit) via ethers.js, but nothing doesn't work. I managed to get values for all privimitive types, but stuck at calculating the hash for getStorageAt(). Could you please help me out?

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

      @@smartcontractprogrammer you should be paid for just been alive.

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

      Fixed it

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

      @@viktorlavrenenko1713 You dont have to use soliditySha3 to hash an address as the address is already an hash itself. You have to pad the address to 32bytes (64 chars) and the same must be done with slot (in hex format). Then keccack256 the concatenation of the padded address and padded slot.
      hash = Utils.leftPad(Utils.stripHexPrefix(key), 64);
      hash += Utils.padLeft(Utils.stripHexPrefix(Utils.toHex(slot)), 64);
      hash = Utils.keccak256("0x" + hash);

  • @karthiksai9162
    @karthiksai9162 3 ปีที่แล้ว +7

    the most simplest explanation of one of the advanced concepts. Awesome.

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

    wow! this video was more informative than other 52 channels I watched and spent 40 hours

  • @福瑞黃
    @福瑞黃 2 ปีที่แล้ว +3

    Thanks so much! You show me the new world with such an excellent course!

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

    Bro, you are just awesome, no words. Great content 👌

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

    I want to thank you for your work sir, knowledge is a treasure to share. Again thank you

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

    From South Africa❤, I love your videos you explain concept very easily big ups

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

    You are a gem. excellent explanation. Love you brother.

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

    Wow, awesome video! Very insightful and well explained

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

    Brilliantly clear demonstration !!!

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

    This is great info . Thank you for the advanced solidity content.

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

    BEST CHANNEL ON TH-cam U NEED A MILLION VIEWZZ

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

    i love the level of this content, thank you!

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

    Amazing, Amazing, Amazing!

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

    By the way congrats bro, we got 500 subscribers 😎😎 it's just starting only.

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

    Great video, congrats

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

    That's pretty crazy that password could be hacked on blockchain !!! 😮 thanks so much for the video !! 😍

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

      Yeah, don't store passwords on the blockchain

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

      @@smartcontractprogrammer Yes sir !!

  • @0x_minato4thh
    @0x_minato4thh 2 ปีที่แล้ว

    any advanced solidity i search ur channel pops up 😂😂

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

    Great video, I appreciate your work!

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

    amazing!

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

    content 💥.

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

    you're brilliant! what a great channel

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

    I can feel my brain growing

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

    Thanks a lot for your videos. Your explanations are incredible good! ¡Muchas gracias!

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

    Great videos keep making them!

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

    Nice VID! How would u decode the address ?

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

    Wow, great video,
    I got some eth stuck in the contract I deployed without a transfer function in it, how to destroy that contract and send the eth to another address?

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

    what a great channel

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

    Really informative sir

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

    great work!

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

    Thanks!!! Great tutorial!

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

    is this working on 0.8 or further versions??

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

    I have no words for the author and many thanks for his efforts,
    I would like to ask a question here .. you had said that data of dynamic array element data will be stored at keccak256() , that mean keccak256(6) ll always be same, So what happens if two contract which had dynamic array at slot number 6 ..
    Contract 1 - Dynamic array at Slot 6 will also point at the same place where
    Contract 2 - Dynamic array at Slot 6 will point
    Does that mean the values ll be overwritten ,, Offcoure that should not be possible .. So can anyone help me understand that what I am missing here?

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

    So we can store sensitive information by storing their hash in the blockchain right?

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

      Yes! But keep in mind that data stored on the blockchain is permanent. So if the hash function becomes decipherable in the future, then the password can be recovered from the password hash stored on the blockchain.

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

      OK, never keep sensitive info in blockchain, got it👍

    • @AnuragVishwa
      @AnuragVishwa 3 ปีที่แล้ว +2

      You can use Filecoin/IPFS to store data outside of blockchain.

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

    Haha this preventive technique. Thx for this vdo

  • @arifulislam-xj9if
    @arifulislam-xj9if 10 หลายเดือนก่อน

    can we get read contract storage that deployed on testnets ? ( like on remix ) or browser console ?

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

    Hi. I don't know if you can see my comment now after all it was one year old tutorial. First, I 'd like to say thank you, I learned a lot from you. I'd like to confirm a point that you say the size of EVM storage is 2**256 slots times 32 bytes. I doubt the number. You know the 2**256 * 32 bytes is a very big number. 1TB disk can only store 2**40 Byte. Can you double check this or if what I understood is not correct, please let me know. Thanks

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

      2**256 possible slots
      not all slots are used

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

      @@smartcontractprogrammer thank you!

  • @erick-llerenas
    @erick-llerenas 2 ปีที่แล้ว +1

    So there is no way to create passwords on solidity, that sucks

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

    does this apply to incrementing variables as well?

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

      accessing private state variables that are used to increment stuff?

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

      @@smartcontractprogrammer yes with public function and modifier that only allowes certain contracts address. How secured is this approach?

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

      all data including private can be read
      some data can be written, depends on what your smart contract allows
      private data can be written only if you have a function that allow other accounts / contracts to call

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

    It looks like a mistake in video, in code comments you put "(2 ** 8) * 32" for uint slot. But uint uses only 256 bit and not 256 * 32?