#37359 [BC-Insight] Failure to Generate ABI Binding in Golang

Submitted on Dec 2nd 2024 at 20:36:56 UTC by @CertiK for Attackathon | Ethereum Protocol

  • Report ID: #37359

  • Report Type: Blockchain/DLT

  • Report severity: Insight

  • Target: https://github.com/ledgerwatch/erigon

  • Impacts:

    • (Specifications) A bug in specifications with no direct impact on client implementations

Description

Brief/Intro

Abigen fails to generate ABI binding of Solidity code in the accounts/abi package when the keyword of Golang is passed as the inputs of the binding.

Vulnerability Details

Affected Codebase: https://github.com/erigontech/erigon/tree/v2.61.0-beta1

The Ethereum client Erigon (https://github.com/erigontech/erigon) provides the Abigen tool to generate the Golang wrapper around a Solidity contract ABI:

https://github.com/erigontech/erigon/blob/v2.61.0-beta1/accounts/abi/bind/bind.go#L60

However, in case that the Golang keyword is passed in as the function parameter names, the ABI wrapper generation fails.

This issue of Abigen has been reported in the Go-ethereum: https://github.com/ethereum/go-ethereum/issues/25252

And it has been patched in the PR: https://github.com/ethereum/go-ethereum/pull/25307

Impact Details

The tool Abigen fails in case that the Golang keywords are passed as the function parameter names.

References

  • https://github.com/erigontech/erigon/tree/v2.61.0-beta1

  • https://github.com/ethereum/go-ethereum/issues/25252

  • https://github.com/ethereum/go-ethereum/pull/25307

Proof of Concept

Proof of Concept

For simplicity, we can reuse and modify the test case from go-ethereum (https://github.com/ethereum/go-ethereum/pull/25307 ) to verify the issue:

Run the following unit test:

The test result shows the Abigen fails due to the range keyword conflict:

Was this helpful?