Wednesday, August 5, 2026
The BLOCKCHAIN Page
No Result
View All Result
  • Home
  • Cryptocurrency
  • Blockchain
  • Bitcoin
  • Market & Analysis
  • Altcoins
  • DeFi
  • Ethereum
  • Dogecoin
  • XRP
  • Regulations
  • NFTs
The BLOCKCHAIN Page
No Result
View All Result
Home Ethereum

Security Alert – Solidity – Variables can be overwritten in storage

by admin
November 30, 2023
in Ethereum
0
Dodging a bullet: Ethereum State Problems
0
SHARES
18
VIEWS
Share on FacebookShare on Twitter


Abstract: In some conditions, variables can overwrite different variables in storage.

Affected Solidity compiler variations: 0.1.6 to 0.4.3 (together with 0.4.4 pre-release variations)

Detailed description:

Storage variables which can be smaller than 256 bits are packed collectively into the identical 256 bit slot if they’ll match. If a worth bigger than what’s allowed by the kind is assigned to the primary variable, that worth will overwrite the second variable.

This implies if an attacker could cause an overflow within the worth of the primary variable, then the second variable might be modified. Creating an overflow within the first variable is feasible utilizing arithmetics or by immediately passing in a worth from the decision information (values in name information are aligned to 32 bytes, and padding is neither verified nor enforced).

Contracts that solely use the categories listed beneath for state variables are not affected. Arrays, mappings and structs (based mostly on these following varieties) are additionally not affected:

  • signed integers, together with sizes smaller than 256 bits
  • bytesNN varieties, together with sizes smaller than 256 bits
  • unsigned integers (uint) of 256 bits

Contracts with varieties smaller than 256 bits which can be by no means subsequent to one another (notice that state variables of base contracts are “pulled in”) are not affected.

The Ethereum multisignature pockets contract is not affected.
Be aware that addresses take up 160 bits, so contracts that solely use addresses and 256-bit varieties are secure. Moreover, addresses and booleans are nearly by no means manipulated by way of arithmetic operations in apply, so contracts utilizing solely addresses, booleans and 256 bit varieties also needs to be secure.

The next contracts could also be affected:
Contracts containing two or extra contiguous state variables the place the sum of their sizes is lower than 256 bits and the primary state variable isn’t a signed integer and never of bytesNN kind.

Sorts smaller than 256 bits embrace:
bool, enums, uint8, …, uint248, int8, …, int248, handle, any contract kind

Advisable motion:

  • Recompile contracts that haven’t but been deployed utilizing no less than Solidity launch 0.4.4 (not the pre-release or nightly model).
  • Deactivate, take away funds from, or improve already deployed contracts.

This vulnerability was discovered by [github.com/catageek](https://github.com/catageek): [https://github.com/ethereum/solidity/issues/1306](https://github.com/ethereum/solidity/points/1306)



Source link

Tags: AlertoverwrittenSecuritySolidityStorageVariables
admin

admin

Recommended

The Battle of the Memecoins: ChatGPT Favours Pomerdoge (POMD) over Solana (SOL) And Dogecoin (DOGE)

The Battle of the Memecoins: ChatGPT Favours Pomerdoge (POMD) over Solana (SOL) And Dogecoin (DOGE)

3 years ago
Bitcoin soars past Ethereum – What now?

Bitcoin soars past Ethereum – What now?

3 years ago

Popular News

  • Protocol-Owned Liquidity: A Sustainable Path for DeFi

    Protocol-Owned Liquidity: A Sustainable Path for DeFi

    0 shares
    Share 0 Tweet 0
  • Cryptocurrency for College: Exploring DeFi Scholarship Models

    0 shares
    Share 0 Tweet 0
  • What are rebase tokens, and how do they work?

    0 shares
    Share 0 Tweet 0
  • What is Velodrome Finance (VELO): why it’s a next-gen AMM

    0 shares
    Share 0 Tweet 0
  • $10 XRP Price Envisioned By Fund Manager As Ripple Mounts Trillion-Dollar Payment Markets ⋆ ZyCrypto

    0 shares
    Share 0 Tweet 0

Latest

You’re charging your phone all wrong: 6 common myths, debunked

You’re charging your phone all wrong: 6 common myths, debunked

August 5, 2026
Marshall Stanmore IV vs. Sonos Era 300: I tested both to find the ultimate home speaker

Marshall Stanmore IV vs. Sonos Era 300: I tested both to find the ultimate home speaker

August 5, 2026

Categories

  • Altcoins
  • Bitcoin
  • Blockchain
  • Cryptocurrency
  • DeFi
  • Dogecoin
  • Ethereum
  • Market & Analysis
  • NFTs & Metaverse
  • Regulations
  • XRP

Follow us

Recommended

  • You’re charging your phone all wrong: 6 common myths, debunked
  • Marshall Stanmore IV vs. Sonos Era 300: I tested both to find the ultimate home speaker
  • This Android launcher made my home screen fun again – and I’m using the free version
  • The Ember Smart Mug 2 will keep your coffee warm for hours – and it’s on sale
  • How to keep your conversations with ChatGPT, Gemini, Copilot or Claude as private as possible
  • About us
  • Privacy Policy
  • Terms & Conditions

© 2023 TheBlockchainPage | All Rights Reserved

No Result
View All Result
  • Home
  • Cryptocurrency
  • Blockchain
  • Bitcoin
  • Market & Analysis
  • Altcoins
  • DeFi
  • Ethereum
  • Dogecoin
  • XRP
  • Regulations
  • NFTs

© 2023 TheBlockchainPage | All Rights Reserved