libp2p / libp2p/go-libp2p

ConnectionGater.InterceptAccept encourages acting upon unauthenticated information

Open
#1,003 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
6.9k
Forks
1.3k
Avg merge
13d 21h
Merged PRs (30d)
1

Description

InterceptAccept allows rejecting of connections before completion of the libp2p handshake. In the case of TCP, this means right after the 3-way-handshake.

This allows a man-on-the-side attacker to inject a DISCONNECT message. More importantly, if the endpoint that initiated the connection interprets this message as "I was blacklisted. No need to retry a connection to this peer for the next x days", the attacker would have succeeded in effectively blocking libp2p for a long time period.

While an attacker can of course always inject a TCP Reset (this attacks, and countless variants thereof, are the most common way nation-state firewalls work), the interpretation of this will likely be different from the interpretation of a DISCONNECT.
In the case of QUIC, it will soon be possible to perform a handshake that is not susceptible to injection attacks at all. All we need is support for ECH (Encrypted Client Hello), which is still being developed by the IETF.

Unfortunately, deciding to not act upon unauthenticated information means that rejecting a connection would only be possible after completing the handshake. This is not a pleasant outcome, as handshakes aren't computationally cheap, and they take one RTT. It seems like this is a price we have to pay to make the protocol more robust against censorship.

cc @aarshkshah1992

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ConnectionGater.InterceptAccept and trace how TCP and QUIC connection rejection is handled before and after the libp2p handshake. Review how a DISCONNECT message is interpreted by the initiating endpoint, and define the desired behavior for unauthenticated rejection and completed handshakes. Done requires an agreed protocol behavior and corresponding validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.