8000 Document discouragement logic with regards to malicious exploitation by ariard · Pull Request #19147 · bitcoin/bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Document discouragement logic with regards to malicious exploitation #19147

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

Closed
wants to merge 1 commit into from

Conversation

ariard
Copy link
@ariard ariard commented Jun 2, 2020

Beyond cases where an attacker is sending invalid data to a honest
peer and those one relaying it forward therefore provoking its
temporary ban, a direct impersonation is possible. An attacker
can directly sends invalid data spoofing IP address of a honest
reachable peer. Such scenario assumes infrastructure capabilities and
therefore is less concerning with regards to state-of-the-art
infrastructure attacks with same threat model (Erebus).

@fanquake fanquake added the Docs label Jun 2, 2020
@fanquake fanquake requested a review from naumenkogs June 3, 2020 02:37
@naumenkogs
Copy link
Member
naumenkogs commented Jun 3, 2020

This is a quite exotic case. As you mention, there are much worse thing that can be done if an attacker (even temporarily) can MitM a connection.

I think it may be a good idea to document this property of BanMan, but I'd prefer to be more brief.
Something like this:

BanMan can be exploited by an on-path attacker: not necessarily user's hosting ISP, but any "critical" ISP on the way. An attacker would have to spoof packets to trigger honest sane nodes banning each other. This may be used to influence the network topology.

uchibeke
uchibeke approved these changes Jun 3, 2020
@fanquake fanquake requested a review from amitiuttarwar June 4, 2020 02:46
src/banman.h Outdated
// With regards to impersonation attack, i.e a malicious
// actor sending us directly invalid data while IP-spoofing
// an address of honest reacheable peers, thus triggering an
// unlawful ban of those:
Copy link
Member

Choose a reason for hiding this comment

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

"unlawful"?

Copy link
Author

Choose a reason for hiding this comment

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

Yes I need a better wording here, with regards to banning a misbehavior is qualified but in reality both peers are honest ?

Copy link
Member

Choose a reason for hiding this comment

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

undesirable?

src/banman.h Outdated
// Tier2 or Tier1, ...), assuming IP packets forgeability
// capabilities, a malicious packet can be injected, i.e
// a mutated block received by node 1 from node 2 therefore
// provoking ban of node 2 for 24h. Such threat model scenario
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't such attackers just block the connection ?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, an on-path attacker can drop the connection, but if honest peers have another connection path without him on it, that's still work. I would say banning is more harmful than a connection drop, and so more interesting ?

@ariard ariard force-pushed the 2020-06-doc-banman-infra branch from 743cb6e to a0f23ae Compare June 5, 2020 21:45
@ariard
Copy link
Author
ariard commented Jun 5, 2020

Thanks @naumenkogs, updated with your wording with still a reference to Erebus to provide context and threat model comparison.

@ariard
Copy link
Author
ariard commented Jun 5, 2020

@mzumsande you may be interested based on review club IRC discussion IIRC

@naumenkogs
Copy link
Member

Almost ACK the text now. I see some English grammar issues ("pursue with", and this sentence is just too long).

Also, I don't understand the part about less efficient attack Also not sure about "peers can be hijacked".
I'd drop that part because:

  1. What do you mean efficient? We don't really now what an actual full attack based on this thing may be, so it's hard to compare.
  2. I feel like even in a year, maybe 10% of the readers of this text would understand what Erebus is

Copy link
Member
@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

Some suggestions. I think Erebus is good to mention and fairly widely known now (and since the release of 0.20, articles and podcasts have been describing Erebus to explain the reason for the new -asmap feature).

@ariard ariard force-pushed the 2020-06-doc-banman-infra branch 2 times, most recently from 7eae737 to 4f512fc Compare June 9, 2020 06:53
@ariard
Copy link
Author
ariard commented Jun 9, 2020

@naumenkogs

What do you mean efficient? We don't really now what an actual full attack based on this thing may be, so it's hard to compare.

Right, what I intended by documenting is raising awareness about this potential vector of exploitation. It's hard to compare with the state of your knowledge, so I modified to say that any mitigation deployed for same threat model (e.g Erebus) is likely to benefit here too.

I feel like even in a year, maybe 10% of the readers of this text would understand what Erebus is

I think that worst-case scenario of mentioning Erebus is someone googling or asking to learn about it :)

src/banman.h Outdated
@@ -37,6 +37,16 @@ class CSubNet;
// dangerous, because it can cause a network split
// between nodes running old code and nodes running
// new code.
//
// BanMan can be exploited by an on-path attacker: not
Copy link
Member

Choose a reason for hiding this comment

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

I think this is formulated confusingly: these are attacks on address management in general, and to an extent to banning logic specifically. But it isn't an attack on BanMan, which is just a storage object for keeping track lf bans that were decided elsewhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. This content is interesting, but I don't think it should be a code comment in BanMan. It's describing a consequence of the misbehaviour -> disconnect logic.

Note that peers that are disconnected for misbehaviour are still allowed to reconnect, but are preferred for peer eviction over other peers. There's currently a PR open to change the terminology to 'discouraged' (#19219)

Copy link
Author
@ariard ariard Jun 17, 2020

Choose a reason for hiding this comment

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

@sipa Actually when I look on it at first, current way we store it, i.e by IP address sounds to me a bit insecure, it would let IP spoofing to disconnect UDP-based connections. Using TCP by default, and this protocol mandating a handshake it prevents exploitation by any Internet host. But agree, it should be a comment on address management/banning logic.

@jnewbery do you suggest this code should go around net_processing Misbehaving ? Our disconnect logic isn't encapsulated in a specific location.

Thanks to pointing to me our current "disconnection" handling differences between automatic misbehavior ban and other sources. Interestingly, we don't use ban information at peer selection, especially with regards to outbound peers. I think it makes attacker I'm documenting a bit less concerning, because even triggering bans on outbound peers don't prevent to reconnect to them, the set of potential outbound peers stays constant. I agree the whole Ban terminology is confusing right now and should be changed in or after #19219.

Copy link
Contributor

Choose a reason for hiding this comment

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

do you suggest this code should go around net_processing Misbehaving ? Our disconnect logic isn't encapsulated in a specific location.

I think it's unrealistic to expect code comments to document all the implications of the logic. It can document the general principals, and how the code is implementing them, but any more detailed documentation probably lives outside the codebase, perhaps in somewhere like https://github.com/bitcoin-core/bitcoin-devwiki/wiki/P2P-Design-Philosophy.

Copy link
Member

Choose a reason for hiding this comment

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

@ariard Yes, I completely agree. But this are exploits related to banning as a concept; it isn't an exploit of BanMan (by stating it this way it sounds like you're talking about a DoS attack on its data structures or something).

@DrahtBot
Copy link
Contributor
DrahtBot commented Jun 18, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@sipa
Copy link
Member
sipa commented Jul 7, 2020

This probably needs redoing after the changes from #19219.

Byond cases where an attacker is sending invalid data to a honest
peer and those one relaying it forward therefore provoking its
temporary disconnection, a direct impersonation is possible. An
attacker can directly sends invalid data spoofing IP address of a
honest reachable peer. Such scenario assumes infrastructure capabilites
and therefore would benefit from mitigations against infrastructure
attacks with same threat model (e.g Erebus).
@ariard ariard force-pushed the 2020-06-doc-banman-infra branch from 4f512fc to c09ee55 Compare August 29, 2020 00:06
@ariard
Copy link
Author
ariard commented Aug 29, 2020

Rebased and changed to explicit mention discouragement logic, no more BanMan.

Thanks @naumenkogs, @jonatack and @sipa for past reviews. I stopped sleeping on this, if you think this is still worthy to get in, I invite you to review again.

@jnewbery it seems your comment leans towards a Concept NACK. I understand the concern of over-documentation, I would like to point a) banning/discouragement logics limitations with regards to DoS attacks are already considered just above b) such infrastructure attack scenario is already in Core's threat model as works on asmap try to mitigate.

Generally, I would like to document better all assumptions around critical pieces of peer selection/addr management like the eviction logic, connection types, addr relay, etc. Each time we're reviewing a change there we lose a lot of time re-stating assumptions/properties and have a hard-time evaluating proposed improvement (cf. #17428 as an example). Now, where such documentation should belong ? I don't know but that would be great to have a guideline once for all, maybe a topic for next p2p meeting ?

@ariard ariard changed the title Document BanMan with regards to malicious exploitation Document discouragement logic with regards to malicious exploitation Aug 29, 2020
@jnewbery
Copy link
Contributor

where such documentation should belong ?

My suggestion was https://github.com/bitcoin-core/bitcoin-devwiki/wiki/P2P-Design-Philosophy

@ariard
Copy link
Author
ariard commented Sep 3, 2020

I think that such P2P design philosophy is too high-level when describing the context of one logic in particular as this PR was aiming for. And documentation-around-code is more timeless than documentation-around-external-web-platform. But let's close it, we can still get back to it when we have a more consensual idea on how to effectively organize p2p documentation.

@ariard ariard closed this Sep 3, 2020
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants
0