Open DragonDev1906 opened 1 year ago
It should be possible to implement a wire adapter that provides authentication. AFAIR, there is an implementation that utilizes libp2p to achieve encryption and authentication. @tinnendo should be able to point you to it.
You can send arbitrary Envelopes over any connection and afaik, there is no check that would bind a single connection to a single sender. Neither the wire/net.Bus nor the wire/net.ioConn check for the Sender field of the envelopes, and all received envelopes get multiplexed over a central wire.Publisher.
Location
Problem
Sender not authenticated
While each message currently contains a
sender
andrecipient
wire address in itsEnvelope
, those are not yet authenticated, there is no signature in wire.proto. This means anyone can send a message coming from SENDER, without needing the private key, thus allowing to spoof any wire identity.No TLS
As far as I can tell we're currently using TCP without TLS for the communication. This means that, even when there is a signature in the handshake message (
AuthResponseMsg
), an Adversary could eavesdrop the communication channel and use theAuthResponseMsg
in his own session, thus stealing the wire identity. He could not send updates to the existing channel since he doesn't have the private key for the channel identity, but he could propose new channels (at least they (probably) won't be funded), but it still locks up some resources (time, computation, storage and ETH) for some time while waiting for the channel to be funded.Proposal (all three are likely needed)
AuthResponseMsg
and check this signature (AuthResponseMsg
message can be completely removed if every envelope contains this signature)AuthResponseMsg
)AuthResponseMsg
MUST NOT be valid if there was noAuthResponseMsg
for this sender on this session. - Important: This does not protect against a malicious middle-man proxy that terminates TLS.