Infrastructure Security

DNS Security and Software Distribution: The Foundation Nobody Secures

Every software download, package install, and API call starts with a DNS query. DNS compromise redirects your supply chain at the most fundamental level — and most organizations have no visibility.

Alex
Infrastructure Security Lead
5 min read

DNS: The Invisible Foundation

Every npm install, pip install, docker pull, and apt update begins with DNS resolution. Your package manager resolves registry.npmjs.org, pypi.org, or docker.io to an IP address, then connects to that address to download software. If DNS returns the wrong address, your package manager connects to the wrong server and downloads whatever that server provides.

DNS compromise is the ultimate supply chain attack because it is invisible to application-layer security controls. TLS certificate verification provides some protection, but DNS-based attacks have been demonstrated that circumvent even this safeguard.

Despite its foundational role, DNS security receives minimal attention in most software supply chain security discussions.

Attack Vectors

DNS Hijacking

DNS hijacking redirects domain resolution to attacker-controlled servers. Methods include:

Registrar compromise. Attackers gain access to the domain registrar account and change nameserver records. This happened to several cryptocurrency exchanges and has affected major companies.

DNS server compromise. Compromising the authoritative DNS server for a domain allows arbitrary record modification. The DNSpionage campaign compromised DNS servers to redirect government and telecommunications domains.

BGP hijacking of DNS. By announcing false BGP routes for DNS server IP addresses, attackers can intercept DNS queries and return malicious responses. This is a network-level attack that individual organizations cannot prevent.

DNS Cache Poisoning

DNS resolvers cache responses to improve performance. Cache poisoning injects false records into resolver caches, causing all users of that resolver to receive incorrect IP addresses for targeted domains.

The Kaminsky attack demonstrated that DNS cache poisoning was practical at scale. DNSSEC was designed to prevent this, but adoption remains incomplete.

DNS Rebinding

DNS rebinding attacks manipulate TTL and response timing to trick browsers into connecting to internal network resources. While not directly a supply chain attack, DNS rebinding can be used to attack internal package registries and development infrastructure.

Impact on Software Distribution

Package Registry Redirection

If an attacker can redirect DNS for a package registry (npmjs.org, pypi.org, rubygems.org), they can serve malicious packages to every developer and CI/CD system that resolves to their server. The attack is transparent — the developer runs npm install and receives malicious code that passes checksum verification because the attacker controls both the registry and the checksums.

TLS certificates provide some protection: if the attacker cannot obtain a valid certificate for the registry domain, the connection will fail with a certificate error. However:

  • Some package managers can be configured to ignore certificate errors
  • Certificate authorities have been compromised in the past
  • Certificate transparency logs may detect fraudulent certificates but not prevent their initial use

Update Server Compromise

Software update mechanisms that resolve update server addresses through DNS are vulnerable to the same redirection. Operating system updates, application auto-updates, and configuration management tools all depend on DNS to locate their update servers.

Internal Registry Attacks

Organizations running private package registries (Artifactory, Nexus, GitLab Package Registry) on internal infrastructure face DNS-based attacks from inside the network. A compromised internal system that can poison DNS or modify local hosts files can redirect package installations to malicious servers.

DNSSEC: The Incomplete Solution

DNSSEC adds cryptographic signatures to DNS responses, allowing resolvers to verify that responses were not tampered with. In theory, DNSSEC prevents cache poisoning and response modification.

In practice, DNSSEC adoption is inconsistent:

  • Not all domains are signed (many package registries and cloud providers support DNSSEC, but not all)
  • Not all resolvers validate DNSSEC signatures
  • DNSSEC does not protect against registrar compromise (the attacker can modify DNSSEC records along with other records)
  • DNSSEC key management adds operational complexity

Organizations should enable DNSSEC validation on their resolvers and use DNSSEC-signed domains where possible, but should not rely on DNSSEC as the sole DNS security control.

Practical Mitigations

Use trusted DNS resolvers. Configure your systems and CI/CD infrastructure to use reputable DNS resolvers that support DNSSEC validation (Cloudflare 1.1.1.1, Google 8.8.8.8, or enterprise DNS services).

Enable DNS-over-HTTPS or DNS-over-TLS. Encrypted DNS prevents network-level interception and modification of DNS queries. Configure your resolvers to use DoH or DoT where supported.

Implement DNS monitoring. Monitor DNS resolution for critical domains (package registries, update servers, cloud provider APIs) and alert on unexpected changes in resolved addresses.

Use certificate pinning for critical connections. For connections to package registries and update servers, certificate pinning prevents attackers from using fraudulent certificates even if DNS is compromised.

Cache DNS locally. Local DNS caching reduces exposure to upstream DNS attacks by reducing the number of queries that traverse the network. Combine with DNSSEC validation for cached records.

Mirror critical registries. Running local mirrors of package registries eliminates DNS dependencies for package downloads. Packages are served from your own infrastructure with DNS you control.

How Safeguard.sh Helps

DNS-based supply chain attacks target the distribution mechanism, not the software itself. Safeguard complements DNS security controls by verifying the integrity of the software you receive regardless of how it was delivered. SBOM generation and vulnerability monitoring catch compromised packages whether they arrived through DNS hijacking, cache poisoning, or any other distribution attack. When your DNS controls are bypassed, Safeguard's component-level verification provides the next layer of defense.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.