Skip to content
Audit finding Intermediate

Redundant sload for global endorsement parameter

The native_isEndorsed function reads the global ProposerEndorsement parameter from storage on every call, causing a redundant cold SLOAD when invoked multiple times in one transaction. An attacker could not exploit this; it is a gas inefficiency that wastes about 2100 gas per additional call.

VeChain Hayabusa Upgrade

Originally disclosed on Immunefi

Informational View original

56256 bc insight redundant sload for global endorsement parameter

Submitted on: Oct 13th 2025 at 16:07:30 UTC by @rionnaldi
Competition: Attackathon | VeChain Hayabusa Upgrade
Report ID: #56256
Report Type: Blockchain/DLT
Severity: Insight
Target: https://github.com/vechain/thor/compare/master...release/hayabusa


Description

Brief / Intro

The native_isEndorsed function is called to verify if a validator meets the endorsement requirements. Every time it is called, it reads the global ProposerEndorsement value from the Params contract storage.

Vulnerability Details

  • ProposerEndorsement is a global parameter shared by all validators and does not change within a single transaction.
  • Reading this value uses an SLOAD operation; a cold SLOAD costs ~2100 gas.
  • If isEndorsed is invoked multiple times within the same transaction (for example, by a contract iterating through validators), the SLOAD is repeated. Subsequent reads are warm and cost ~100 gas each, but the initial cold read cost (~2100 gas) can still be significant if repeated across calls.

Impact

  • Gas savings of ~2100 gas per call to isEndorsed (for each avoided cold SLOAD).

Recommendation

{% hint style="info" %} Read the global ProposerEndorsement parameter once per block/transaction at a higher layer and pass it into isEndorsed to avoid repeated SLOADs. For system-level processes that check endorsements for multiple validators (e.g., consensus engine), prefer reading the parameter once and reusing it. {% endhint %}

  • If multiple on-chain calls are expected in a single transaction, consider adding a batch API such as areEndorsed(address[] calldata nodeMasters) which reads the parameter once and checks a batch of validators in a loop.

Benefit

  • Gas savings: avoids at least one SLOAD (~2100 gas) for every additional call to isEndorsed within the same transaction.
  • Efficiency: reduces redundant storage reads and makes on-chain validation checks more efficient.

Measurable Impact

Caching the global parameter or batching endorsement checks will reduce gas consumption and lower blockchain bloat when multiple endorsement checks are performed in a single transaction.


References


Proof of Concept

<details> <summary>Relevant code snippet (builtin/authority_native.go)</summary>

{% code title="builtin/authority_native.go" %}

Go
{"native_isEndorsed", func(env *xenv.Environment) []any {
// ...
    env.UseGas(thor.SloadGas) // SLOAD for endorsement param
    endorsement, err := Params.Native(env.State()).Get(thor.KeyProposerEndorsement)
    }
}
// ...

{% endcode %}

</details>

The original report as published on Immunefi. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Redundant SLOAD for a Global Endorsement Parameter in VeChain Thor

Context

This finding was submitted to the Attackathon | VeChain Hayabusa Upgrade competition on Immunefi (report ID #56256, submitted 13 October 2025) and is classified as an Insight rather than a vulnerability. The target is the comparison between master and the release/hayabusa branch of the VeChain thor repository:

Text
https://github.com/vechain/thor/compare/master...release/hayabusa

The code under discussion lives in builtin/authority_native.go. The native_isEndorsed function is called to verify whether a validator meets the endorsement requirements. Each time it is called, it reads the global ProposerEndorsement value from the Params contract storage. That parameter is shared by all validators and is the same for every endorsement check in a transaction, which is the starting point for the observation.

Setup

No accounts, roles, tooling versions or deployment preconditions are described in the report. The analysis is a source-level review of the referenced file on the release/hayabusa branch.

Finding it

The researcher noticed that native_isEndorsed performs a storage read of ProposerEndorsement on every invocation, even though the value is a global parameter that does not change within a single transaction. The relevant code is quoted in the report as follows:

Go
{"native_isEndorsed", func(env *xenv.Environment) []any {
// ...
    env.UseGas(thor.SloadGas) // SLOAD for endorsement param
    endorsement, err := Params.Native(env.State()).Get(thor.KeyProposerEndorsement)
    }
}
// ...

The env.UseGas(thor.SloadGas) call charges for the storage read, and the Params.Native(env.State()).Get(thor.KeyProposerEndorsement) call fetches the parameter. Because the parameter is global, the same value is fetched again on every call within the same transaction.

The gas reasoning in the report is as follows:

  • Reading the value uses an SLOAD operation; a cold SLOAD costs around 2100 gas.
  • If isEndorsed is invoked multiple times within the same transaction, for example by a contract iterating through validators, the SLOAD is repeated.
  • Subsequent reads are warm and cost around 100 gas each, but the initial cold read cost (around 2100 gas) can still be significant if repeated across calls.

Exploitation

There is no exploitation step in this report. It is an efficiency observation, not an attack: no request, payload, command or transaction is shown, and no state is manipulated. The only artefact is the code snippet above, which demonstrates where the repeated read happens. The report's own framing is a gas-saving opportunity, and the impact section states it as gas savings of around 2100 gas per call to isEndorsed for each avoided cold SLOAD.

Root cause

The endorsement parameter is read at the point of each individual check rather than once at a higher layer and passed down. Since ProposerEndorsement is global and constant within a transaction, every additional call to isEndorsed in the same transaction repeats work that has already been done. The report does not describe any caching layer or batching path that would already avoid this.

Impact

The report frames the impact strictly in terms of cost:

  • Gas savings of around 2100 gas per call to isEndorsed, for each avoided cold SLOAD.
  • Fewer redundant storage reads, making on-chain validation checks more efficient.
  • Lower gas consumption and reduced blockchain bloat when multiple endorsement checks are performed in a single transaction.

There is no security consequence described: no party gains an advantage, no check is bypassed, and no funds or permissions are at stake. The report is filed as an Insight.

Fix

The recommendation is to read the global ProposerEndorsement parameter once per block or transaction at a higher layer and pass it into isEndorsed, avoiding repeated SLOADs. For system-level processes that check endorsements for multiple validators, such as the consensus engine, the report suggests preferring to read the parameter once and reuse it.

Additionally, if multiple on-chain calls are expected in a single transaction, the report suggests considering a batch API such as:

Go
areEndorsed(address[] calldata nodeMasters)

which reads the parameter once and checks a batch of validators in a loop. The report does not state that any change was made.

Variants to test

  • Look for other native or precompile functions that read global parameters from Params storage on every call. A positive result is a function whose body fetches a key that is constant for the whole transaction and charges SloadGas for it each time.
  • Look for loops over validators, nodes or other collections where each iteration calls a function that performs its own storage read of a shared value. A positive result is a per-iteration SLOAD of a value that could be hoisted out of the loop.
  • Look for public entry points that a contract could call repeatedly in one transaction, where each call re-reads configuration. A positive result is a measurable gas delta between N calls and one batched call.
  • Check whether a batch variant of a per-item check already exists elsewhere in the codebase. A positive result is an inconsistency where one path batches and another does not.

Hunting notes

This kind of finding hides in native/extension code that wraps contract storage access, especially where a helper is designed to be called per item and internally fetches configuration. During review, the signals are a UseGas call for a storage read sitting directly next to a Get of a well-known global key, and call sites that invoke the helper inside loops or from contracts that iterate. The report shows impact by quantifying the per-call gas cost and describing the repeated-call scenario, which is what makes it actionable as an Insight even without a security consequence.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

A security researcher looked at a piece of code in VeChain's blockchain software and noticed a small inefficiency. Nothing was broken, nobody could steal anything, and no rule could be bypassed. The code simply does the same small piece of work over and over when it could do it once and remember the answer.

To understand the finding you need three ideas. First, a blockchain is a shared ledger that many computers keep copies of, and every change to it costs a fee called gas. Second, storage on a blockchain is like a very expensive filing cabinet: every time a program opens a drawer to read a note, it pays a fee, and opening a drawer that has not been touched recently (a cold read) costs much more than reopening one that was just used (a warm read). Third, a validator is a computer that helps confirm transactions, and in this system a validator must be endorsed, meaning it must meet a requirement before it is allowed to take part.

The researcher found that the function which checks whether a validator is endorsed reads one shared setting from storage every single time it runs, even though that setting is the same for everyone and cannot change in the middle of a transaction. If the check runs several times in one transaction, the same expensive read happens again and again. The report suggests reading the value once and passing it down, or adding a version of the check that handles many validators in one go.

This was filed as an Insight, which on bug bounty platforms means a useful observation or improvement rather than a security vulnerability. The competition was the Attackathon | VeChain Hayabusa Upgrade on Immunefi, report ID #56256, submitted on 13 October 2025.

The target

The report points at a comparison between two versions of VeChain's thor software, the master branch and the release/hayabusa branch:

Text
https://github.com/vechain/thor/compare/master...release/hayabusa

A repository is a folder of source code kept online, and a branch is a parallel copy of that code where a particular line of work happens. master is the main line; release/hayabusa is the branch preparing the upgrade called Hayabusa. The comparison page shows what the upgrade branch changes relative to the main line, which is where the researcher was reading.

The specific file is builtin/authority_native.go. The word native here signals code that is built directly into the blockchain node rather than written as a separate smart contract, and authority relates to who is allowed to produce blocks. The function in question, native_isEndorsed, answers one question: does this validator meet the endorsement requirements? Each time it is asked, it fetches the global ProposerEndorsement value from the storage of a contract called Params. That value is shared by all validators and is identical for every check within a transaction, which is the seed of the observation.

Setup

The report describes no accounts, roles, tool versions or deployment steps. The work is a source-level review: reading the code as text and reasoning about it, rather than running it and measuring.

Finding it

The researcher noticed that native_isEndorsed performs a storage read of ProposerEndorsement on every invocation, even though the value is global and does not change within a single transaction. The relevant code is quoted in the report as follows:

Go
{"native_isEndorsed", func(env *xenv.Environment) []any {
// ...
    env.UseGas(thor.SloadGas) // SLOAD for endorsement param
    endorsement, err := Params.Native(env.State()).Get(thor.KeyProposerEndorsement)
    }
}
// ...

Line by line, in plain words:

  • {"native_isEndorsed", func(env *xenv.Environment) []any { registers a function under the name native_isEndorsed. The env argument is the function's environment, the bundle of context it is given, including access to the current state and to gas accounting. The []any at the end says the function returns a list of values of any type.
  • // ... marks code that has been left out of the snippet for brevity.
  • env.UseGas(thor.SloadGas) charges gas for a storage read before doing it. SloadGas is the named cost constant for an SLOAD, the EVM instruction that loads a value from storage. Charging first is how the system makes sure the caller can pay.
  • endorsement, err := Params.Native(env.State()).Get(thor.KeyProposerEndorsement) actually fetches the setting. Params.Native(env.State()) builds an interface to the Params contract using the current state, .Get(...) reads a value, and thor.KeyProposerEndorsement is the key naming which value to read. The result goes into endorsement, and any error into err.
  • } and } close the function and the registration.
  • // ... again marks omitted code.

Because the parameter is global, the same value is fetched again on every call within the same transaction. The report's gas reasoning is:

  • Reading the value uses an SLOAD operation; a cold SLOAD costs around 2100 gas.
  • If isEndorsed is invoked multiple times within the same transaction, for example by a contract iterating through validators, the SLOAD is repeated.
  • Subsequent reads are warm and cost around 100 gas each, but the initial cold read cost (around 2100 gas) can still be significant if repeated across calls.

A useful comparison: imagine a librarian who, every time a visitor asks whether a book is available, walks to the back room to check the opening-hours sign on the wall. The sign never changes during the day. The first walk is long because the room is dark and cold; later walks are quicker because the lights are already on. Still, walking there for every visitor is wasted effort when the librarian could read the sign once in the morning and remember it.

Exploitation

There is no exploitation step in this report. It is an efficiency observation, not an attack: no request, payload, command or transaction is shown, and no state is manipulated. The only artefact is the code snippet above, which shows where the repeated read happens. The report frames the whole thing as a gas-saving opportunity, and its impact section states it as gas savings of around 2100 gas per call to isEndorsed for each avoided cold SLOAD.

Root cause

The endorsement parameter is read at the point of each individual check rather than once at a higher layer and passed down. Since ProposerEndorsement is global and constant within a transaction, every additional call to isEndorsed in the same transaction repeats work that has already been done. The report does not describe any caching layer or batching path that would already avoid this.

Impact

The report frames the impact strictly in terms of cost:

  • Gas savings of around 2100 gas per call to isEndorsed, for each avoided cold SLOAD.
  • Fewer redundant storage reads, making on-chain validation checks more efficient.
  • Lower gas consumption and reduced blockchain bloat when multiple endorsement checks are performed in a single transaction.

There is no security consequence described: no party gains an advantage, no check is bypassed, and no funds or permissions are at stake. The report is filed as an Insight.

Fix

The recommendation is to read the global ProposerEndorsement parameter once per block or transaction at a higher layer and pass it into isEndorsed, avoiding repeated SLOADs. For system-level processes that check endorsements for multiple validators, such as the consensus engine (the part of the node that agrees with other nodes on which blocks are valid), the report suggests preferring to read the parameter once and reuse it.

Additionally, if multiple on-chain calls are expected in a single transaction, the report suggests considering a batch API such as:

Go
areEndorsed(address[] calldata nodeMasters)

An API is simply a defined way for one piece of software to ask another to do something. Here the proposed function would take a list of addresses (the address[] part), read the parameter once, and check each validator in a loop. calldata marks the input data passed to the function in EVM terms. The report does not state that any change was made.

Variants to test

These are the follow-up checks the technical write-up lists, explained for a newcomer:

  • Look for other native or precompile functions that read global parameters from Params storage on every call. A precompile is a built-in operation the blockchain offers natively. A positive result is a function whose body fetches a key that is constant for the whole transaction and charges SloadGas for it each time.
  • Look for loops over validators, nodes or other collections where each iteration calls a function that performs its own storage read of a shared value. A positive result is a per-iteration SLOAD of a value that could be hoisted out of the loop, meaning read once before the loop starts.
  • Look for public entry points that a contract could call repeatedly in one transaction, where each call re-reads configuration. A positive result is a measurable gas difference between N separate calls and one batched call.
  • Check whether a batch variant of a per-item check already exists elsewhere in the codebase. A positive result is an inconsistency where one path batches and another does not.

Hunting notes

This kind of finding hides in native or extension code that wraps contract storage access, especially where a helper is designed to be called per item and internally fetches configuration. During review, the signals are a UseGas call for a storage read sitting directly next to a Get of a well-known global key, and call sites that invoke the helper inside loops or from contracts that iterate. The report shows impact by quantifying the per-call gas cost and describing the repeated-call scenario, which is what makes it actionable as an Insight even without a security consequence.

Glossary

  • Blockchain: a shared ledger of records kept in sync by many computers, where changes cost a fee.
  • Gas: the unit that measures computational work on a blockchain and that users pay for.
  • Storage: the persistent memory a blockchain program can read and write, where each access has a cost.
  • SLOAD: the EVM instruction that loads a value from storage.
  • Cold read: the first access to a storage slot in a transaction, which costs more (around 2100 gas here).
  • Warm read: a repeat access to a storage slot already touched in the same transaction, which costs less (around 100 gas here).
  • Validator: a computer that helps confirm transactions and produce blocks.
  • Endorsement: a requirement a validator must meet before it is allowed to take part.
  • Transaction: a single unit of work submitted to the blockchain, within which state changes and costs are accounted.
  • Insight: a bug bounty classification for a useful observation or improvement rather than a security vulnerability.
  • Bug bounty platform: a website where researchers report issues to software owners, here Immunefi.
  • Repository: an online folder of source code, often with history.
  • Branch: a parallel copy of a repository's code used for a particular line of work.
  • Source-level review: examining code as text and reasoning about it, without running it.
  • EVM: the Ethereum Virtual Machine, the shared rules that define how blockchain programs run and what each operation costs.
  • Function: a named block of code that performs a task and can be called.
  • Parameter: a value passed into a function, or in this report a stored setting the code reads.
  • Global parameter: a setting shared by everyone, identical for all users and checks.
  • API: a defined way for one piece of software to ask another to do something.
  • Precompile: a built-in operation offered natively by the blockchain rather than written as a separate contract.
  • Consensus engine: the part of a node that agrees with other nodes on which blocks are valid.
  • Batch: handling many items in one operation instead of one at a time.
  • Hoisting: moving a repeated read out of a loop so it happens once.
  • Blockchain bloat: the growth in stored data and work that the network must carry.

More from VeChain Hayabusa Upgrade

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.