Skip to content

Refuse PSBTs that made lightningd abort in libwally - #9680

Open
kwsantiago wants to merge 2 commits into
ElementsProject:masterfrom
privkeyio:upstream-psbt-asserts
Open

kwsantiago wants to merge 2 commits into
ElementsProject:masterfrom
privkeyio:upstream-psbt-asserts

Conversation

@kwsantiago

Copy link
Copy Markdown
Contributor

Two PSBTs an RPC caller can pass make lightningd abort on a libwally assertion. A version 2 PSBT that does not allow adding outputs or inputs (no PSBT_GLOBAL_TX_MODIFIABLE, or without the relevant bit) aborts addpsbtoutput in psbt_add_output and addpsbtinput in psbt_append_input. A version 2 PSBT where one input requires a time locktime and another a height locktime has no valid locktime, and fundchannel_complete aborts on it in psbt_txid.

addpsbtoutput and addpsbtinput now refuse a PSBT that does not allow the addition, rather than override the flags, since a signer clears them once adding would invalidate its signature. psbt_from_b64 refuses a PSBT with no valid locktime, which covers every RPC parameter and plugin reply.

A version 2 PSBT without PSBT_GLOBAL_TX_MODIFIABLE, or without its
inputs or outputs bit, makes libwally refuse to add one, and
psbt_add_output and psbt_append_input assert on that. A signer clears
the bits once adding would invalidate its signature, so refuse rather
than override them.

Changelog-Fixed: `addpsbtoutput` and `addpsbtinput` refuse a version 2 PSBT that does not allow adding outputs or inputs, instead of crashing lightningd.
One input requiring a time locktime and another a height locktime leave
a version 2 PSBT no valid locktime, and psbt_txid asserts when it cannot
extract the transaction. Refuse such a PSBT when parsing it, which
covers every RPC parameter and plugin reply.

Changelog-Fixed: A PSBT whose inputs require both a time and a height locktime is refused, instead of crashing lightningd in `fundchannel_complete`.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant