Thursday, December 4, 2025
SCRYPTO MAGAZINE
No Result
View All Result
  • Home
  • Crypto
  • Bitcoin
  • Blockchain
  • Market
  • Ethereum
  • Altcoins
  • XRP
  • Dogecoin
  • NFTs
  • Regualtions
SCRYPTO MAGAZINE
No Result
View All Result
Home Ethereum

Solidity Optimizer and ABIEncoderV2 Bug

SCRYPTO MAGAZINE by SCRYPTO MAGAZINE
December 4, 2025
in Ethereum
0
The ETH Rangers Program | Ethereum Foundation Blog
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter

Related articles

Ethereum completes Fusaka upgrade with stable network performance

Ethereum completes Fusaka upgrade with stable network performance

December 4, 2025
Bitmine Buys Another 18,345 Ethereum ($54.94M) In Fresh Accumulation Push – Details

Bitmine Buys Another 18,345 Ethereum ($54.94M) In Fresh Accumulation Push – Details

December 4, 2025


Solidity Optimizer and ABIEncoderV2 Bug Announcement

Via the Ethereum bug bounty program, we acquired a report a couple of flaw inside the new experimental ABI encoder (known as ABIEncoderV2). Upon investigation, it was discovered that the part suffers from a number of totally different variations of the identical kind. The primary a part of this announcement explains this bug intimately. The brand new ABI encoder remains to be marked as experimental, however we nonetheless suppose that this deserves a distinguished announcement since it’s already used on mainnet.

Moreover, two low-impact bugs within the optimizer have been recognized over the previous two weeks, one among which was mounted with Solidity v0.5.6. Each had been launched with model 0.5.5. See the second a part of this announcement for particulars.

The 0.5.7 release incorporates the fixes to all bugs defined on this weblog publish.

All of the bugs talked about right here ought to be simply seen in assessments that contact the related code paths, at the very least when run with all combos of zero and nonzero values.

Credit to Melonport crew (Travis Jacobs & Jenna Zenk) and the Melon Council (Nick Munoz-McDonald, Martin Lundfall, Matt di Ferrante & Adam Kolar), who reported this through the Ethereum bug bounty program!

Who ought to be involved

When you have deployed contracts which use the experimental ABI encoder V2, then these is perhaps affected. Because of this solely contracts which use the next directive inside the supply code might be affected:

pragma experimental ABIEncoderV2;

Moreover, there are a selection of necessities for the bug to set off. See technical particulars additional under for extra data.

So far as we are able to inform, there are about 2500 contracts dwell on mainnet that use the experimental ABIEncoderV2. It’s not clear what number of of them comprise the bug.

The way to examine if contract is susceptible

The bug solely manifests itself when all the following situations are met:

  • Storage knowledge involving arrays or structs is distributed on to an exterior operate name, to abi.encode or to occasion knowledge with out prior task to a neighborhood (reminiscence) variable AND
  • there may be an array that incorporates components with measurement lower than 32 bytes or a struct that has components that share a storage slot or members of kind bytesNN shorter than 32 bytes.

Along with that, within the following conditions, your code is NOT affected:

  • if all of your structs or arrays solely use uint256 or int256 varieties
  • for those who solely use integer varieties (which may be shorter) and solely encode at most one array at a time
  • for those who solely return such knowledge and don’t use it in abi.encode, exterior calls or occasion knowledge.

When you have a contract that meets these situations, and wish to confirm whether or not the contract is certainly susceptible, you may attain out to us through security@ethereum.org.

The way to stop some of these flaws sooner or later

With a purpose to be conservative about modifications, the experimental ABI encoder has been obtainable solely when explicitly enabled, to permit individuals to work together with it and check it with out placing an excessive amount of belief in it earlier than it’s thought-about steady.

We do our greatest to make sure prime quality, and have not too long ago began engaged on ‘semantic’ fuzzing of sure elements on OSS-Fuzz (we’ve beforehand crash-fuzzed the compiler, however that didn’t check compiler correctness).

For builders — bugs inside the Solidity compiler are tough to detect with instruments like vulnerability detectors, since instruments which function on supply code or AST-representations don’t detect flaws which can be launched solely into the compiled bytecode.

One of the simplest ways to guard towards some of these flaws is to have a rigorous set of end-to-end assessments in your contracts (verifying all code paths), since bugs in a compiler very possible should not “silent” and as a substitute manifest in invalid knowledge.

Potential penalties

Naturally, any bug can have wildly various penalties relying on this system management circulate, however we anticipate that that is extra more likely to result in malfunction than exploitability.

The bug, when triggered, will below sure circumstances ship corrupt parameters on methodology invocations to different contracts.

Timeline

2019-03-16:

  • Report through bug bounty, about corruption brought about when studying from arrays of booleans straight from storage into ABI encoder.

2019-03-16 to 2019-03-21:

  • Investigation of root trigger, evaluation of affected contracts. An unexpectedly excessive rely of contracts compiled with the experimental encoder had been discovered deployed on mainnet, many with out verified source-code.
  • Investigation of bug discovered extra methods to set off the bug, e.g. utilizing structs. Moreover, an array overflow bug was present in the identical routine.
  • A handful of contracts discovered on Github had been checked, and none had been discovered to be affected.
  • A bugfix to the ABI encoder was made.

2019-03-20:

  • Choice to make data public.
  • Reasoning: It might not be possible to detect all susceptible contracts and attain out to all authors in a well timed method, and it might be good to stop additional proliferation of susceptible contracts on mainnet.

2019-03-26:

  • New compiler launch, model 0.5.7.
  • This publish launched.

Technical particulars

Background

The Contract ABI is a specification how knowledge might be exchanged with contracts from the surface (a Dapp) or when interacting between contracts. It helps a wide range of forms of knowledge, together with easy values like numbers, bytes and strings, in addition to extra advanced knowledge varieties, together with arrays and structs.

When a contract receives enter knowledge, it should decode that (that is carried out by the “ABI decoder”) and previous to returning knowledge or sending knowledge to a different contract, it should encode it (that is carried out by the “ABI encoder”). The Solidity compiler generates these two items of code for every outlined operate in a contract (and likewise for abi.encode and abi.decode). Within the Solidity compiler the subsystem producing the encoder and decoder known as the “ABI encoder”.

In mid-2017 the Solidity crew began to work on a recent implementation named “ABI encoder V2” with the purpose of getting a extra versatile, secure, performant and auditable code generator. This experimental code generator, when explicitly enabled, has been provided to customers because the finish of 2017 with the 0.4.19 launch.

The flaw

The experimental ABI encoder doesn’t deal with non-integer values shorter than 32 bytes correctly. This is applicable to bytesNN varieties, bool, enum and different varieties when they’re a part of an array or a struct and encoded straight from storage. This implies these storage references have for use straight inside abi.encode(…), as arguments in exterior operate calls or in occasion knowledge with out prior task to a neighborhood variable. Utilizing return doesn’t set off the bug. The categories bytesNN and bool will end in corrupted knowledge whereas enum would possibly result in an invalid revert.

Moreover, arrays with components shorter than 32 bytes is probably not dealt with appropriately even when the bottom kind is an integer kind. Encoding such arrays in the best way described above can result in different knowledge within the encoding being overwritten if the variety of components encoded is just not a a number of of the variety of components that match a single slot. If nothing follows the array within the encoding (word that dynamically-sized arrays are at all times encoded after statically-sized arrays with statically-sized content material), or if solely a single array is encoded, no different knowledge is overwritten.

Unrelated to the ABI encoder concern defined above, two bugs have been discovered within the optimiser. Each have been launched with 0.5.5 (launched on fifth of March). They’re unlikely to happen in code generated by the compiler, except inline meeting is used.

These two bugs have been recognized by the latest addition of Solidity to OSS-Fuzz – a safety toolkit for locating discrepancies or points in a wide range of tasks. For Solidity we’ve included a number of totally different fuzzers testing totally different points of the compiler.

  1. The optimizer turns opcode sequences like ((x << a) << b)), the place a and b are compile-time constants, into (x << (a + b)) whereas not dealing with overflow within the addition correctly.
  2. The optimizer incorrectly handles the byte opcode if the fixed 31 is used as second argument. This will occur when performing index entry on bytesNN varieties with a compile-time fixed worth (not index) of 31 or when utilizing the byte opcode in inline meeting.

This publish was collectively composed by @axic, @chriseth, @holiman



Source link

Tags: ABIEncoderV2BugOptimizerSolidity
Share76Tweet47

Related Posts

Ethereum completes Fusaka upgrade with stable network performance

Ethereum completes Fusaka upgrade with stable network performance

by SCRYPTO MAGAZINE
December 4, 2025
0

Ethereum efficiently activated its Fusaka improve on Wednesday, 3 December, introducing a set of execution-layer refinements geared toward enhancing shopper...

Bitmine Buys Another 18,345 Ethereum ($54.94M) In Fresh Accumulation Push – Details

Bitmine Buys Another 18,345 Ethereum ($54.94M) In Fresh Accumulation Push – Details

by SCRYPTO MAGAZINE
December 4, 2025
0

Ethereum has reclaimed the $3,000 stage after a powerful market response to bettering macro circumstances, providing buyers a much-needed shift...

Ethereum Network Fatigue? Monthly On-Chain Transactions Drops As Activity Slows Down

Ethereum Network Fatigue? Monthly On-Chain Transactions Drops As Activity Slows Down

by SCRYPTO MAGAZINE
December 3, 2025
0

Trusted Editorial content material, reviewed by main trade specialists and seasoned editors. Ad Disclosure Over the previous few weeks, the...

Allocation Update – Q3 2024

Allocation Update – Q3 2025

by SCRYPTO MAGAZINE
December 3, 2025
0

Neighborhood & schoolingBluechip25Convention hosted in Vienna, Austria devoted to crypto security, studying and sharing greatest practices, and setting new benchmarks...

All about Ethereum’s Fusaka upgrade – Can it push ETH’s price to $7K?

All about Ethereum’s Fusaka upgrade – Can it push ETH’s price to $7K?

by SCRYPTO MAGAZINE
December 3, 2025
0

The 58% rally in Could was pushed largely by market pleasure over Pectra, however ETH now faces a really completely...

Load More
  • Trending
  • Comments
  • Latest
Bitcoin Price Rally Defies Miner Reserve Drops, Here’s Why

Bitcoin Price Rally Defies Miner Reserve Drops, Here’s Why

January 21, 2025
Analysts’ 2025 Bull Market Predictions

Bitcoin Entering Second ‘Price Discovery Uptrend’, What’s Ahead?

January 21, 2025
Bitcoin Price Recovers Some Losses—Is a Full Rebound in Sight?

Bitcoin Price Recovers Some Losses—Is a Full Rebound in Sight?

March 12, 2025
Bitcoin Spot-Perpetual Price Gap Turns Negative

Bitcoin Spot-Perpetual Price Gap Turns Negative

December 23, 2024
Bitcoin could reach this unbelievable price by 2025, but these factors must align

Bitcoin could reach this unbelievable price by 2025, but these factors must align

0
XRP Consolidation Could End Once It Clears $2.60 – Top Analyst Expects $4 Soon

XRP Consolidation Could End Once It Clears $2.60 – Top Analyst Expects $4 Soon

0

Fed Can’t Hold Bitcoin, No Plans Yet To Change Law, Powell Says

0
Bears Take Full Control of the Market

Bears Take Full Control of the Market

0
The ETH Rangers Program | Ethereum Foundation Blog

Solidity Optimizer and ABIEncoderV2 Bug

December 4, 2025
XRP Price Is Performing As Expected; Analyst Reveals What Comes Next

XRP Price Is Performing As Expected; Analyst Reveals What Comes Next

December 4, 2025
Apple crowned the best apps of 2025 – did your favorite make the list?

Apple crowned the best apps of 2025 – did your favorite make the list?

December 4, 2025
US GENIUS Act Splits Global Stablecoin Liquidity From EU MiCA

US GENIUS Act Splits Global Stablecoin Liquidity From EU MiCA

December 4, 2025

Recent News

The ETH Rangers Program | Ethereum Foundation Blog

Solidity Optimizer and ABIEncoderV2 Bug

December 4, 2025
XRP Price Is Performing As Expected; Analyst Reveals What Comes Next

XRP Price Is Performing As Expected; Analyst Reveals What Comes Next

December 4, 2025

Categories

  • Altcoins
  • Bitcoin
  • Blockchain
  • Cryptocurrency
  • Dogecoin
  • Ethereum
  • Market
  • NFTs
  • Regualtions
  • XRP

Recommended

  • Solidity Optimizer and ABIEncoderV2 Bug
  • XRP Price Is Performing As Expected; Analyst Reveals What Comes Next
  • Apple crowned the best apps of 2025 – did your favorite make the list?
  • US GENIUS Act Splits Global Stablecoin Liquidity From EU MiCA
  • Binance Bitcoin Stockpile Shrinks Amid Market Turmoil

© 2025 SCRYPTO MAGAZINE | All Rights Reserved

No Result
View All Result
  • Home
  • Crypto
  • Bitcoin
  • Blockchain
  • Market
  • Ethereum
  • Altcoins
  • XRP
  • Dogecoin
  • NFTs
  • Regualtions

© 2025 SCRYPTO MAGAZINE | All Rights Reserved