Repository navigation
consensus: pin executed OP_VERIF and raw ECDSA hashtypes - #1065
Merged
Merged
Conversation
OP_VERIF and OP_VERNOTIF already fail in an untaken branch. These rows also fail them in the taken branch. DERSIG still accepts hashtype 0x00, 0x80, and 0x85, STRICTENC rejects them, and rewriting the type byte makes the signature miss.
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.
Summary
OP_VERIFandOP_VERNOTIFin the takenIFbranch, in every signature version. The untaken branch was already in the corpus.0x00,0x80, and0x85: DERSIG accepts a signature over that raw byte, STRICTENC rejects it, and rewriting the byte to0x01or0x81rejects.is_valid_signature_encodingstill does not range-check the hashtype byte.is_defined_hashtyperemains the STRICTENC check.Checked against our interpreter and Core v31.1
VerifyScript(script-oracle). No production change: Core already fails unexecutedOP_VERIFbecause0x65/0x66sit insideOP_IF..=OP_ENDIFand hitBAD_OPCODE, andIsValidSignatureEncodingdoes not check the hashtype range.Test plan
cargo test -p rbitcoin-consensus --lib script_corpus_rows_match_our_interpretercargo test -p rbitcoin-consensus --lib bip66_encoding_edge_casescargo test --manifest-path script-oracle/Cargo.tomlcargo test --workspace,ci-os-smoke.sh