Skip to content
Business logic Audit finding Intermediate

The code comparing two big.In pointers for equality, not their numeric values

The node code compared two big integer pointers for equality instead of their numeric values, so the check almost never matched. As a result the node would always try to pack a privileged parameter-setting transaction on startup, needlessly mutating chain parameters and consuming resources.

jesse03 Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

56946 bc insight the code comparing two big in pointers for equality not their numeric values

Submitted on Oct 22nd 2025 at 02:11:03 UTC by @jesse03 for Attackathon | VeChain Hayabusa Upgrade

  • Report ID: #56946
  • Report Type: Blockchain/DLT
  • Report severity: Insight
  • Target: https://github.com/vechain/thor/compare/master...release/hayabusa
  • Impacts:
    • Temporary freezing of network transactions by delaying one block by 500% or more of the average block time of the preceding 24 hours beyond standard difficulty adjustments
    • Causing network processing nodes to process transactions from the mempool beyond set parameters
    • A bug in the respective layer 0/1/2 network code that results in unintended smart contract behavior with no concrete funds at direct risk
    • Increasing network processing node resource consumption by at least 30% without brute force actions, compared to the preceding 24 hours

Description

The code compares two big.Int pointers for equality, not their numeric values:

Go
currentBGP, err := builtin.Params.Native(newState).Get(thor.KeyLegacyTxBaseGasPrice)
if err != nil {
    return errors.WithMessage(err, "failed to get the current base gas price")
}
if currentBGP == baseGasPrice {  // <-- BUG: pointer comparison, almost never true
    return nil
}

In Go, == on *big.Int checks whether the addresses are the same, not whether the integers hold the same value. Since currentBGP and baseGasPrice are different heap objects, this condition will essentially always be false — even when the on‑chain base gas price already equals 1e13.

Impact: the node will always craft and try to pack a privileged Params.set transaction on startup, needlessly mutating (or attempting to mutate) chain parameters and consuming resources. Given this is signed with a dev key and built with an extremely long expiration, it’s a governance‑level logic error.

Proof of Concept

<details> <summary>Test PoC (expand to view)</summary>

{% code title="poc_test.go" %}

Go
func TestInitSolo_PoC_NoTxWhenBasePriceAlreadySet(t *testing.T) {
	solo := newSolo()

	// First init should set base gas price to 1e13 and mine 1 block
	startNum := solo.repo.BestBlockSummary().Header.Number()
	require.NoError(t, solo.init(context.Background()))
	afterFirst := solo.repo.BestBlockSummary().Header.Number()
	require.Equal(t, startNum+1, afterFirst)

	// Verify base gas price is 1e13
	best := solo.repo.BestBlockSummary()
	st := solo.stater.NewState(best.Root())
	v, err := builtin.Params.Native(st).Get(thor.KeyLegacyTxBaseGasPrice)
	require.NoError(t, err)
	require.Equal(t, baseGasPrice, v)

	// Second init SHOULD be a no-op if values are equal (correct behavior)
	require.NoError(t, solo.init(context.Background()))
	afterSecond := solo.repo.BestBlockSummary().Header.Number()

	// Expected: no new block; Actual (bug): afterSecond == afterFirst+1
	require.Equal(t, afterFirst, afterSecond)
}

{% endcode %}

</details>

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the developer used Go's == operator on two *big.Int pointers, which compares addresses rather than the integer values they hold.

Impact

The node could needlessly attempt to mutate chain parameters on every startup and consume extra resources, though the report does not show concrete funds at direct risk.

What the attacker needed

Node startup with the affected code

The fix

The comparison should compare the numeric values of the two big integers rather than their pointers.

How it was found

  1. Initialise the solo node so the base gas price is set to 1e13 and one block is mined.
  2. Read the stored base gas price and confirm it equals the expected value.
  3. Run initialisation a second time and check whether a new block was mined.
  4. Observe that a new block was mined even though the values were equal, showing the comparison failed.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A pointer is a memory address that says where a value lives, not the value itself. The code asked whether two addresses were the same rather than whether the two numbers were equal, so the shortcut that should skip work never triggered and the node kept doing unnecessary work every time it started.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by jesse03

View all

5 more disclosed reports, best first.

More from VeChain Hayabusa Upgrade

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.