Skip to content

Reject oversized VK metadata integers#24705

Draft
AztecBot wants to merge 1 commit into
nextfrom
cb/bb-audit-remediation-2516-vk-metadata-integer-bounds
Draft

Reject oversized VK metadata integers#24705
AztecBot wants to merge 1 commit into
nextfrom
cb/bb-audit-remediation-2516-vk-metadata-integer-bounds

Conversation

@AztecBot

Copy link
Copy Markdown
Collaborator

Summary

Verification-key metadata deserialization accepted field and uint256_t words wider than the target integer type, then truncated them through static_cast. This change rejects out-of-range uint32_t and uint64_t encodings in both native VK codec paths before casting, so malformed metadata cannot round-trip as a different value.

Fix

  • Add bounded integer deserialization for uint32_t and uint64_t in FrCodec and U256Codec.
  • Add codec regressions for 2^32 + x and 2^64 + x, plus max-value acceptance checks.
  • Add a VK from_field_elements regression covering oversized metadata across Ultra, Mega, and UltraKeccak flavor parameters.

Testing

  • cmake --build --preset default --target ecc_tests -j$(nproc)
  • ctest --preset default -R 'FieldConversionTest\.(FrCodecRejectsOversizedUint32Metadata|FrCodecRejectsOversizedUint64Metadata|U256CodecRejectsOversizedUint32Metadata|U256CodecRejectsOversizedUint64Metadata|IntegerMetadataMaxValuesAccepted|FieldConversionUint32)$' --output-on-failure
  • cmake --build --preset default --target flavor_tests -j$(nproc)
  • ctest --preset default -R 'FromFieldElementsRejectsOversizedMetadata' --output-on-failure

Issues

  • Closes AztecProtocol/barretenberg-claude#2516 — reject oversized VK metadata integer encodings before truncating casts.
  • Closes AztecProtocol/barretenberg-claude#3348 — apply the same non-canonical integer policy to the companion VK helper surface.

Created by claudebox · group: bb-audit-remediation

@AztecBot AztecBot added ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR. labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant