0xMiden / 0xMiden/protocol

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

Đang mở
#3,674 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
132
Fork
167
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
110

Mô tả

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`._

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.