fix(assembly): validate procedure roots during library deserialization#2933
Open
giwaov wants to merge 1 commit into0xMiden:nextfrom
Open
fix(assembly): validate procedure roots during library deserialization#2933giwaov wants to merge 1 commit into0xMiden:nextfrom
giwaov wants to merge 1 commit into0xMiden:nextfrom
Conversation
249710f to
9ff84ee
Compare
Contributor
|
@amathxbt Please cease spam comments. |
|
This PR contains unsigned commits. All commits must be cryptographically signed (GPG or SSH). Unsigned commits:
For instructions on setting up commit signing and re-signing existing commits, see: |
8754a14 to
619f63f
Compare
Library::read_from accepts procedure exports whose MastNodeId is not a procedure root in the underlying MAST forest. This means a malicious library can export uncallable procedures, violating the invariant enforced by Library::new(). Add a validation loop to the Deserializable implementation for Library that checks each procedure export has a corresponding procedure root in the MastForest, matching the existing check in Library::new(). Add a regression test that constructs a tampered library with an export pointing to a non-root node and verifies deserialization rejects it. Closes 0xMiden#2831
619f63f to
8d82445
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes an issue where \Library::read_from\ accepts procedure exports whose \MastNodeId\ is not a procedure root in the underlying MAST forest. This allows crafting a library with uncallable procedure exports, violating the invariant enforced by \Library::new().
This was identified as finding 19 in the audit report.
Changes
Fix
Test
Testing
Closes #2831