-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
C:p2pComponent: P2P pkgComponent: P2P pkgT:bugType Bug (Confirmed)Type Bug (Confirmed)T:securityType: Security (specify priority)Type: Security (specify priority)
Milestone
Description
Issue was discovered by a security auditor.
We don't close inbound connection objects when we reject them for max peers:
Lines 487 to 500 in 05a76fb
| func (sw *Switch) listenerRoutine(l Listener) { | |
| for { | |
| inConn, ok := <-l.Connections() | |
| if !ok { | |
| break | |
| } | |
| // ignore connection if we already have enough | |
| // leave room for MinNumOutboundPeers | |
| maxPeers := sw.config.MaxNumPeers - DefaultMinNumOutboundPeers | |
| if maxPeers <= sw.peers.Size() { | |
| sw.Logger.Info("Ignoring inbound connection: already have enough peers", "address", inConn.RemoteAddr().String(), "numPeers", sw.peers.Size(), "max", maxPeers) | |
| continue | |
| } |
This can be easily exploited to cause nodes to panic from use of too many file descriptors (and may partially explain some of the high fd usage we've been seeing on testnets).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C:p2pComponent: P2P pkgComponent: P2P pkgT:bugType Bug (Confirmed)Type Bug (Confirmed)T:securityType: Security (specify priority)Type: Security (specify priority)