Repository navigation
Write the swap confirmation as component markup, and confirm the source node before opening a channel #682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
markettes
wants to merge
2
commits into
main
Choose a base branch
from
refactor/swap-confirmation-markup-and-node-identity
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MEDIUM · authn — Node identity check trusts the endpoint's self-asserted pubkey
GetInfo returns whatever IdentityPubkey the answering server claims; it is not a proof of key. An attacker who sets a node's Endpoint and ChannelAdminMacaroon (a NodeManager/Superadmin editing the node in Nodes.razor, which permits both) points the node at a modified LND or fake gRPC server that answers GetInfo with the node's real pubkey — public information advertised on the Lightning network — and accepts the configured macaroon. GetNodeIdentityError returns null, so OpenChannel proceeds: the wallet's PSBT funds a 2-of-2 channel whose entire local balance sits on the attacker's LND and is spendable by them. Multisig signers approving the request see only the node name, not the endpoint, so the switch is invisible to them. TLS does not help: CreateLightningClient accepts any server certificate (LightningClientService.cs:71), so a network-position attacker can spoof the same exchange. A real binding would require SignMessage/VerifyMessage with the node key or pinning the LND TLS cert.
Threat: a NodeGuard user with node-edit rights (NodeManager role) running their own gRPC endpoint, or a network attacker between NodeGuard and the node, starting from an authenticated NodeGuard session with the NodeManager role (can edit a node's endpoint and channel admin macaroon), or a network position on the path to the endpoint → the check passes for an attacker-controlled LND, so an approved channel open funds a channel whose balance the attacker controls — the exact fund misdirection this PR's check claims to prevent
Checks
Ruled out: Checked GetInfo (LightningClientService.cs:143): response is self-asserted, only the macaroon authenticates. Checked TLS: DangerousAcceptAnyServerCertificateValidator (line 71, pre-existing) means the connection does not authenticate the LND either. Grepped for SignMessage/VerifyMessage: only proto definitions, no proof-of-key anywhere. Checked OpenChannel reuses the same source object/endpoint after the check, so no TOCTOU — the spoof is at the check itself.
Verified: Confirmed end to end. GetNodeIdentityError (src/Services/LightningService.cs:1639-1658) trusts GetInfo's self-asserted IdentityPubkey; no proof-of-key (SignMessage/VerifyMessage) exists outside proto stubs. Nodes.razor:72,91 lets a NodeManager edit both Endpoint and ChannelAdminMacaroon, and the open flow (LightningService.cs:373) gates wallet funding on this check before OpenChannel on the same endpoint — a NodeManager pointing the node at a rogue LND that echoes the public pubkey passes the check and receives the channel's local balance. TLS is no barrier: DangerousAcceptAnyServerCertificateValidator (LightningClientService.cs:71) also enables a network-position spoof. The check is introduced by this PR and its comment explicitly claims to mitigate edited endpoints, so it is not pre-existing or out of scope.
🤖 automated review — reply
not-an-issueto dismiss