Skip to content

Add anti-probing penalty to ProbabilisticScorer #1555

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

Merged

Conversation

tnull
Copy link
Contributor

@tnull tnull commented Jun 21, 2022

Currently, channel balances may be rather easily discovered through probing. This however poses a privacy risk, since the analysis of balance changes over adjacent channels could in the worst case empower an adversary to mount an end-to-end deanonymization attack, i.e., track who payed whom.

The penalty added here is applied so we prefer nodes with a smaller htlc_maximum_msat, which makes balance discovery attacks harder to execute. As this improves privacy network-wide, we treat such nodes preferentially and hence create an incentive to restrict htlc_maximum_msat.

Closes #1515

@tnull tnull marked this pull request as draft June 21, 2022 14:38
@tnull
Copy link
Contributor Author

tnull commented Jun 21, 2022

Currently figuring out how to make a test happen, therefore still in draft mode.

@codecov-commenter
Copy link

codecov-commenter commented Jun 21, 2022

Codecov Report

Merging #1555 (800ccec) into main (79e2af9) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1555      +/-   ##
==========================================
- Coverage   91.04%   91.03%   -0.01%     
==========================================
  Files          80       80              
  Lines       44072    44101      +29     
  Branches    44072    44101      +29     
==========================================
+ Hits        40125    40148      +23     
- Misses       3947     3953       +6     
Impacted Files Coverage Δ
lightning/src/routing/gossip.rs 91.94% <100.00%> (+<0.01%) ⬆️
lightning/src/routing/scoring.rs 96.80% <100.00%> (+0.10%) ⬆️
lightning/src/chain/onchaintx.rs 93.98% <0.00%> (-0.93%) ⬇️
lightning/src/ln/functional_tests.rs 97.19% <0.00%> (-0.03%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 79e2af9...800ccec. Read the comment docs.

@tnull tnull force-pushed the 2022-06-prefer-small-htlc-max branch from 846cd6b to d7a72a0 Compare June 21, 2022 15:56
@tnull tnull marked this pull request as ready for review June 21, 2022 15:56

let network_graph = self.network_graph.read_only();
let mut anti_probing_penalty_msat = 0;
if let Some(chan) = network_graph.channels().get(&short_channel_id) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't do a lookup here, we should instead shove the relevant info into EffectiveCapacity so we can read it via the usage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmpf, I agree that the lookup (especially on every invocation) is unfortunate. I now went this way with d19827e, but I'm not really happy about breaking the so far pretty clean interface of EffectiveCapacity. At lest we will soon be able to remove the Option<> around htlc_maximum_msat and probably Unknown.

@tnull tnull force-pushed the 2022-06-prefer-small-htlc-max branch 2 times, most recently from 97bb6eb to f92934d Compare June 22, 2022 15:41
Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically LGTM

@TheBlueMatt
Copy link
Collaborator

TheBlueMatt commented Jun 24, 2022

Looks like this needs rebase after #1550. Feel free to squash when you do so.

@tnull tnull force-pushed the 2022-06-prefer-small-htlc-max branch from e348b09 to 9ddfdfe Compare June 24, 2022 16:40
@tnull
Copy link
Contributor Author

tnull commented Jun 24, 2022

Squashed and rebased.

TheBlueMatt
TheBlueMatt previously approved these changes Jun 24, 2022
Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes #1519 all the more important.

@tnull tnull dismissed stale reviews from valentinewallace and TheBlueMatt via 85b7a7f June 25, 2022 14:52
@tnull tnull force-pushed the 2022-06-prefer-small-htlc-max branch from 9ddfdfe to 85b7a7f Compare June 25, 2022 14:52
Currently, channel balances may be rather easily discovered through
probing. This however poses a privacy risk, since the analysis of
balance changes over adjacent channels could in the worst case empower an adversary to
mount an end-to-end deanonymization attack, i.e., track who payed whom.

The penalty added here is applied so we prefer nodes with a smaller `htlc_maximum_msat`, which makes
balance discovery attacks harder to execute. As this improves privacy network-wide, we
treat such nodes preferentially and hence create an incentive to restrict
`htlc_maximum_msat`.
@tnull tnull force-pushed the 2022-06-prefer-small-htlc-max branch from 85b7a7f to 800ccec Compare June 25, 2022 18:06
@valentinewallace valentinewallace merged commit 92ca7ff into lightningdevkit:main Jun 27, 2022
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.

Prefer channels with a max_htlc_in_flight < channel capacity
4 participants