From lf-lists at mattcorallo.com Sat Oct 21 01:03:49 2023 From: lf-lists at mattcorallo.com (Matt Corallo) Date: Fri, 20 Oct 2023 21:03:49 -0400 Subject: [Lightning-dev] [bitcoin-dev] Full Disclosure: CVE-2023-40231 / CVE-2023-40232 / CVE-2023-40233 / CVE-2023-40234 "All your mempool are belong to us" In-Reply-To: References: <64VpLnXQLbeoc895Z9aR7C1CfH6IFxPFDrk0om-md1eqvdMczLSnhwH29T6EWCXgiGQiRqQnAYsezbvNvoPCdcfvCvp__Y8BA1ow5UwY2yQ=@protonmail.com> <1a84a36c-ec23-43b5-9a61-1aafdc188892@mattcorallo.com> Message-ID: <24a18bdd-eef6-4f96-b8a5-05f64130a5c5@mattcorallo.com> On 10/20/23 8:15 PM, Peter Todd wrote: > On Fri, Oct 20, 2023 at 05:05:48PM -0400, Matt Corallo wrote: >> Sadly this only is really viable for pre-anchor channels. With anchor >> channels the attack can be performed by either side of the closure, as the >> HTLCs are now, at max, only signed SIGHASH_SINGLE|ANYONECANPAY, allowing you >> to add more inputs and perform this attack even as the broadcaster. >> >> I don't think its really viable to walk that change back to fix this, as it >> also fixed plenty of other issues with channel usability and important >> edge-cases. > > What are anchor outputs used for other than increasing fees? > > Because if we've pre-signed the full fee range, there is simply no need for > anchor outputs. Under any circumstance we can broadcast a transaction with a > sufficiently high fee to get mined. Indeed, that is what anchor outputs are for. Removing the pre-set feerate solved a number of issues with edge-cases and helped address the fee-inflation attack. Now, just using pre-signed transactions doesn't have to re-introduce those issues - as long as the broadcaster gets to pick which of the possible transactions they broadcast its just another transaction of theirs. Still, I'm generally really dubious of the multiple pre-signed transaction thing, (a) it would mean more fee overhead (not the end of the world for a force-closure, but it sucks to have all these individual transactions rolling around and be unable to batch), but more importantly (b) its a bunch of overhead to keep track of a ton of variants across a sufficiently granular set of feerates for it to not result in substantially overspending on fees. Like I mentioned in the previous mail, this is really a policy bug - we're talking about a transaction pattern that might well happen where miners aren't getting the optimal value in transaction fees (potentially by a good bit). This needs to be fixed at the policy/Bitcoin Core layer, not in the lightning world (as much as its pretty resource-intensive to fix in the policy domain, I think). Matt