Skip to content

Instantly share code, notes, and snippets.

@namuyan
Created September 28, 2019 11:01
Show Gist options
  • Save namuyan/054702a734953258a679e6d8c7df7e1d to your computer and use it in GitHub Desktop.
Save namuyan/054702a734953258a679e6d8c7df7e1d to your computer and use it in GitHub Desktop.
lightningのFoundingTXを検証しない問題

source

https://lists.linuxfoundation.org/pipermail/lightning-dev/2019-September/002174.html https://twitter.com/chaintope/status/1177771818007982081?s=21

abstract

LNの脆弱性は、チャネルオープン時のチェックが問題。 通常、既存のBOLTの仕様でチャネルをオープンする際は、資金提供者がFunding Txを作成し、そのTXIDとアウトプットの番号を受信者に渡す。 受信者はその情報から最初のコミットメントTxの署名を作成し、資金提供者に返す。その後資金提供者はFunding Txをブロードキャストしてチャネルをオープンする。

detail

ステップの中で、受信者がFunding Txのアウトプットの中身(量やscriptPubkey)やそのアウトプットの存在についてチェックしておらず、単にFunding TxのTXIDのチェーン上での承認数のみをチェックしていた。 そのため存在しないデポジットを元にオフチェーン決済するような動作が可能になっていた。 これはFunding OutputのチェックについてBOLTに記載されていなかったため、他の実装も同様にチェックが漏れていた模様。

solution

funding_createdで指定されたアウトポイントが、open_channelで指定されている額のFunding Outputにあっているかチェックを追加すること。

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