0xMiden / 0xMiden/protocol

Smart Contract Diff Audit L-10: Truncated Procedure Roots Can Render Distinct Custom Procedures Identically

Abierto
#3,674 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
132
Forks
167
Merge medio
1 d 23 h
PR fusionados (30 d)
110

Descripción

The [`name`](https://github.com/0xMiden/protocol/blob/8411bf093bde25285708faac152b6d7269009617/crates/miden-standards/src/account/interface/component.rs#L91-L98) accessor renders the `Custom` variant of `AccountComponentInterface` by slicing the hexadecimal form of each procedure MAST root to its first nine characters, which retains the `0x` prefix and seven hex digits out of the sixty-four that a full root produces. The roots collected into that variant come from a set of distinct entries in [`from_procedures`](https://github.com/0xMiden/protocol/blob/8411bf093bde25285708faac152b6d7269009617/crates/miden-standards/src/account/interface/extension.rs#L42-L62), so two entries that render alike always denote genuinely different procedures, and the rendered list carries no index, deduplication, or other disambiguator.

The effect is confined to a human-readable label. Equality, serialization, and every protocol decision operate on the full root, and no caller of `name` exists in the repository, so the string is consumed only by downstream tooling. Because a MAST root is a deterministic hash of compiled code, however, a component author can grind trivial variants until a root matches a chosen 28-bit prefix. An operator who compares custom procedures through a renderer built on this label may therefore accept one procedure as another.

Consider including a collision-resistant identifier in the `Custom` display string, such as the full MAST root hexadecimal form or a substantially longer prefix and suffix pair. If the shortened form is retained, consider documenting that it is not a unique identifier and must not be relied upon to distinguish procedures.

---

_Copied verbatim from finding [L-10](https://audits.openzeppelin.com/miden/miden-01-07-smart-contract-diff-audit-nfts/issues/truncated-procedure-roots-can-render-distinct-custom-procedures-identically-d44ce616) (low severity) of the OpenZeppelin [smart contract diff audit (NFTs)](https://audits.openzeppelin.com/miden/miden-01-07-smart-contract-diff-audit-nfts). The audit was performed against commit `8411bf093bde25285708faac152b6d7269009617`._

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.