Giter Club home page Giter Club logo

Comments (2)

merklejerk avatar merklejerk commented on August 18, 2024

It can be any address with the lowest 8 bits (last byte) equal to 0, such as 0x35C8C87AF6e00FB1BdC075A199f195128f49a700. UnsafeProxy and Impl are defined as two independent (uninherited) contracts so the solidity compiler will assign the state variables declared within them to overlapping storage slots. UnsafeProxy.owner will span byte offset 0-20 of slot 0 and Impl.isInitialized will span byte offset 0-1 of (also) slot 0. Therefore, writing to one state variable will overwrite the contents of the other when in the context of a delegatecall(), as is the norm with proxy pattern contracts. In this test, setting the value of owner to that address will unintentionally reset isInitialized to false because of the 0 byte in offset 0-1 of slot 0.

This is very different from a short address attack, which involves how solidity used to decode function arguments. AFAIK short address attacks haven't really been a thing since solidity 0.5.

from useful-solidity-patterns.

0x0918 avatar 0x0918 commented on August 18, 2024

Thank you very much, the logic is clear now.

from useful-solidity-patterns.

Related Issues (6)

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.