HunterX v7 Network Mapping & Attack-Surface Topology Capability - Architecture & Reference

Status: Ratified (Sprint 010) Version: 1.0.0 Owner: HunterX Architecture Council


1. Purpose / Scope

The Network Mapping & Attack-Surface Topology Capability turns individual asset observations into a unified, queryable attack-surface topology. HunterX understands the relationships between targets, organizations, domains, subdomains, hostnames, IPs, CIDRs, ASNs, networks, ports, services, certificates and DNS infrastructure — and preserves that understanding as historical, evidence-backed intelligence.

Core principle

The topology is NOT a second database. The existing TIDB is the single system of record. The topology layer derives its state from canonical TIDB entities and relationships; it never introduces a parallel asset database, a separate graph truth, a second cache or a duplicate event system.

Two mandates:

  1. Derive. TopologyService (the application use-case) collects the canonical TIDB intelligence produced by Sprint 007–009 capabilities, optionally runs route-mapping tools through the guarded SDK lifecycle, derives relationships deterministically, correlates and de-duplicates them, preserves conflicts, diffs history, analyzes the graph and persists the derived topology back into the TIDB.
  2. Query. TopologyQueryService reads persisted topology relationships and answers the canonical graph queries (neighbors, ancestors, descendants, shortest relationship paths, shared infrastructure, clusters and the seven attack-surface views).

Scope: src/hunterx/domain/topology/, src/hunterx/application/topology.py, src/hunterx/tools/topology/, the tidb_topology_* TIDB entity set, the topology.* event catalog and the platform wiring in src/hunterx/platform/assembler.py.

Out of scope: exploitation paths, vulnerability scanning, and active scope expansion. Path analysis is infrastructure topology only — never attack execution.


2. Design Goals


3. Topology Model

The canonical node model (hierarchy of authority):

Organization → Target → Domain → Subdomain → Hostname → IP → CIDR → Port → Service → Certificate

Additional supported relations:

IP → ASN   ASN → Organization   Certificate → Domain
Certificate → IP   Hostname → IP   IP → Hostname
Domain → Nameserver   Domain → MX   Network → Asset   Asset → Asset

Entities

TopologyEntity is a canonical node with kind, name, key (stable kind:name), optional entity_id, label and meta. Kinds are enumerated in hunterx.domain.topology.enums.EntityKind.

Relationships

GraphRelationship is a correlated edge preserving:

Field Meaning
rel_type canonical RelationshipType
source / target canonical nodes
sources provenance sources that reported the edge
evidence merged per-source evidence
confidence merged [0, 1]
first_seen / last_seen temporal window
mission_id / execution_id / correlation_id provenance
in_scope authorization flag
source_id / target_id TIDB entity ids when known
key stable dedup key rel:src\|dst

Relationship types

RESOLVES_TO, POINTS_TO, HOSTED_ON, BELONGS_TO, PART_OF, ROUTES_TO, ANNOUNCED_BY, USES, EXPOSES, SERVES, CERTIFICATE_FOR, SIGNED_BY, DELEGATED_TO, MAILS_TO, RELATED_TO, DISCOVERED_BY, OBSERVED_WITH, SHARES_INFRASTRUCTURE_WITH, SHARES_CERTIFICATE_WITH, SHARES_IP_WITH, SHARES_NAMESERVER_WITH.


4. Entity Resolution

TopologyNormalizer collapses equivalent spellings:

EntityResolver keeps a per-run cache so an asset always has exactly one node in a build. Dissimilar names are never merged (www.example.com vs wwwexample.com stay distinct); merging is a deterministic function of the normalization rules, never fuzzy similarity.


5. Relationship Derivation

RelationshipDeriver turns canonical TIDB entities into raw RelationshipObservation records. Every edge records its provenance source (e.g. tidb:subdomain, tidb:ip) and evidence. Derivation rules:

Source TIDB data Relationship
Subdomain.domain_idDomain subdomain PART_OF domain
Domain.parent_domain_id domain PART_OF parent
Hostname name suffix hostname PART_OF domain
IPAddress.hostname_idHostname hostname RESOLVES_TO ip
IPAddress.cidr_idCIDR ip PART_OF cidr
IPAddress.asn_idASN / CIDR.asn_id ip|cidr ANNOUNCED_BY asn
Port.ip_address_idIPAddress ip EXPOSES port
Service.port_idPort port SERVES service
Certificate.hostname_id / SAN entries hostname USES cert, cert CERTIFICATE_FOR name
Domain.dns_servers / Nameserver domain DELEGATED_TO ns
Domain.mx / MXRecord domain MAILS_TO mx
DNSRecord A/AAAA / CNAME / MX name RESOLVES_TO\|POINTS_TO\|MAILS_TO value
Domain/Hostname/IP.target_idTarget entity BELONGS_TO target
source_tool entity DISCOVERED_BY tool
host/service observations entity OBSERVED_WITH other

routes_to edges are produced by the traceroute tool adapter (tools/topology/): consecutive route hops form a directed ROUTES_TO chain.


6. Validation & Correlation

TopologyValidator drops structurally or semantically invalid observations (self-loops, unknown relationship types, routes_to non-IP targets, part_of IPs outside their CIDR).

TopologyCorrelator groups observations by their stable key and merges them into one GraphRelationship:

Duplicate observations from multiple tools become one edge, never two.


7. Conflicts

TopologyConflictResolver detects endpoint pairs reported under more than one relationship type. All observations are preserved; the canonical value is selected by combined confidence with a human-readable reason, and the conflict is recorded as a TopologyConflict (persisted to the TIDB and surfaced via the topology.conflict.detected event). Intelligence is never silently overwritten.


8. Temporal History

TopologyHistory.diff compares the previous persisted topology with the newly correlated one:

Merged edges preserve the earliest first_seen while advancing last_seen, so the temporal model is append-only and explainable. Changes persist as TopologyChange entities.


9. Topology Analysis

TopologyAnalyzer computes deterministic analytics over the correlated graph:


10. Attack-Surface Views

TopologyViewBuilder projects the graph into serializable views:

  1. Asset inventory graph
  2. Network graph (IP/CIDR/ASN/port/service)
  3. DNS graph (domain/subdomain/hostname/NS/MX/resolution)
  4. Service graph (host → port → service)
  5. Certificate graph
  6. Organization infrastructure graph
  7. External attack surface (all in-scope edges)
  8. Shared infrastructure & asset clusters
  9. Historical changes view

11. Path Analysis (safe queries only)

TopologyGraph + TopologyPathFinder support safe, read-only navigation:

No exploitation paths. These are infrastructure-intelligence queries only; they never mutate state or act on targets.


12. Topology Queries

TopologyQueryService (application layer) answers, from persisted TIDB relationships:

neighbors, ancestors, descendants, shortest_path, related_assets, shared_infrastructure, asset_cluster, service_cluster, certificate_relationships, network_relationships, historical_relationships, plus the view builders and the analysis summary.


13. Performance


14. Caching

Derived/query data may be cached through the existing CachePort abstraction; canonical intelligence always lives in the TIDB. No new cache system is created.


15. Events

Emitted under the topology.* namespace (see domain/events/catalog.py and typed events in domain/events/types.py):

topology.build.started, topology.relationship.discovered, topology.relationship.updated, topology.relationship.removed, topology.entity.correlated, topology.conflict.detected, topology.cluster.created, topology.analysis.started, topology.analysis.completed, topology.build.completed, topology.build.failed.


16. Observability

Every build persists a TopologyBuild record capturing: entities processed, relationships processed, new/updated/removed relationships, conflicts, duration and a summary. Per-source TopologyExecutionSummary records report tool vs TIDB contribution. These feed reporting and the topology.* event stream.


17. TIDB Integration

Topology entities map to the canonical TIDB (domain/entities/tidb/topology.py

Schema-gap policy: if a required relationship cannot be represented, the capability STOPS, documents the gap and extends the approved TIDB architecture via migration. No undocumented side database is ever created.


18. Security & Scope Control


19. Tools

traceroute (integrated, Sprint 010)

Evaluated and not integrated: RustScan (naabu/masscan already cover port discovery), Nmap graph features (nmap already integrated under Live Host & Service Discovery). BBOT relationship data is covered by its existing integration. Only tools providing information unavailable through existing capabilities are integrated.


20. Platform Wiring

platform/assembler.py registers the traceroute adapter on the ExecutionEngine, its profile on the Tool Intelligence Platform, and builds TopologyService + TopologyQueryService against the TIDB stores, event bus and cache. Both services are available on the Platform composition root and in the dependency container.


21. Testing


22. Developer Extension Guide