fix(services): reject non-routable ENR targets in DAS Guardian scan - #817
Open
damilolaedwards wants to merge 1 commit into
Open
fix(services): reject non-routable ENR targets in DAS Guardian scan#817damilolaedwards wants to merge 1 commit into
damilolaedwards wants to merge 1 commit into
Conversation
POST /api/v1/das-guardian/scan takes an arbitrary ENR from any unauthenticated caller (enabled by default, no auth required) and had dora's server dial whatever IP:port the ENR encoded, via eth-das-guardian's ConnectNode -> host.Connect. Neither the handler, services.DasGuardian, nor the library itself filtered the target - confirmed by driving the actual library dial code end-to-end against a local victim listener and observing the connection arrive. This let an anonymous caller use dora's server as an outbound proxy: internal network reconnaissance (loopback/RFC1918 targets), or cloud metadata endpoints (169.254.169.254) on AWS/GCP/Azure deployments. Fix: validate the parsed ENR's IP in both services.DasGuardian.ScanNode and ScanNodeWithCallback (the two entry points a request can take, covering the plain and random-slot-selection modes) before it ever reaches the dial path. Rejects loopback, RFC1918/ULA private ranges, link-local (which covers the cloud metadata range), unspecified, and multicast addresses using net.IP's standard classifiers. Tests: a table test covering every rejected class plus an ordinary public address that must still pass, and an end-to-end test that drives the real fixed ScanNode against a loopback target and asserts no connection ever reaches a victim listener - the same scenario the original PoC used to prove the bug. Confirmed the end-to-end test fails to build without validateScanTarget (the protection doesn't exist), then restored the fix. go build, go vet, gofmt, and the full services test suite (including -race) are clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /api/v1/das-guardian/scantakes an arbitrary ENR from any unauthenticated caller (enabled by default, no auth required) and had dora's server dial whatever IP:port the ENR encoded, viaeth-das-guardian'sConnectNode->host.Connect. Neither the handler,services.DasGuardian, nor the library itself filtered the target, confirmed by driving the actual library dial code end-to-end against a local victim listener and observing the connection arrive.This let an anonymous caller use dora's server as an outbound proxy: internal network reconnaissance (loopback/RFC1918 targets), or cloud metadata endpoints (
169.254.169.254) on AWS/GCP/Azure deployments.Fix
Validate the parsed ENR's IP in both
services.DasGuardian.ScanNodeandScanNodeWithCallback(the two entry points a request can take, covering the plain and random-slot-selection modes) before it ever reaches the dial path. Rejects loopback, RFC1918/ULA private ranges, link-local (which covers the cloud metadata range), unspecified, and multicast addresses usingnet.IP's standard classifiers.Tests
ScanNodeagainst a loopback target and asserts no connection ever reaches a victim listener, the same scenario used to prove the bug in the first place.Confirmed the end-to-end test fails to build without
validateScanTarget(the protection doesn't exist), then restored the fix.go build,go vet,gofmt, and the fullservicestest suite (including-race) are clean.