manager: return an error for truncated adaptor signature lists - #194
Merged
Merged
Conversation
Enum, numeric trie, and settlement paths indexed the wire-supplied adaptor signature vector without a length check, so an AcceptDlc or SignDlc with a short list panicked inside the message handler. Both transports awaited the handler inline, and nothing restarted the listener, so one malformed accept from any peer silenced DLC message processing until the process restarted. Every indexed access is now bounds checked and returns an invalid argument error, and the stateless suite covers an empty accept list. The nostr and lightning transports run each inbound message in its own task and log a panic instead of dying with it, and the nostr reply path logs send failures instead of unwrapping them.
bennyhodl
force-pushed
the
fix/adaptor-signature-bounds
branch
from
September 14, 2026 20:41
a37d45a to
236c9c7
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.
Summary
Fixes the Bitcoin Red Team finding FND-006, "Truncated adaptor-signature lists in counterparty messages panic the DLC message-handler task". The enum descriptor, the numeric trie (serial and parallel), and the CET settlement paths indexed the wire-supplied adaptor signature vector without a length check. An
AcceptDlcorSignDlcwith a short list panicked insideon_dlc_message; both transports awaited the handler inline and nothing restarted the listener, so one malformed accept from any peer silenced DLC message processing until the process restarted. The auditor's re-run reproduced the panic atenum_descriptor.rs:129on current master.Changes
EnumDescriptor::verify_adaptor_info, bothverify_helpervariants inddk-trie,get_signed_cetincontract_updater, and the settled channel close inchannel_updateruse bounds-checked access and return an invalid argument or invalid state error naming the missing index and the received count.too_many_argumentsallowance as the serial one soclippy --all-featurespasses for the crate.tokio::spawntask and await the join handle. A handler panic is logged with the counterparty and the loop continues, so a parser bug can no longer take the listener down. The nostr reply path logs event build and send failures instead of unwrapping them.Testing
truncated_counterparty_adaptor_signatures_are_rejectedin the stateless suite: an accept with an empty adaptor signature list now yieldsInvalidAcceptmentioning the missing signature, where it panicked before.ddk-triewith and withoutparallel(42), and the regtestenum_single_oracle_testandsingle_oracle_numerical_testpass.cargo check --all-features --testsandcargo +1.89.0 clippy -- -D warnings(the CI configuration) are clean.clippy --all-featuresstill reports four pre-existing lints inddk/src/oracle/nostr.rsandp2p_derivatives.rsthat are untouched here and not part of the CI gate.