PID-file symlink attack in NLnet Labs Unbound and NSD can cause denial of service

Note: This data is for reference and cybersecurity research purposes only.CyStack advises users not to use this information for unlawful purposes.

What is CVE-2020-28935?

CVE-2020-28935 is a vulnerability classified as Improper Link Resolution Before File Access, affecting Unbound (affected versions: <= 1.12.0) and NSD (affected versions: <= 4.3.3). This vulnerability is rated Medium, with a CVSS score of 5.5. There is not enough data to determine whether this vulnerability has been exploited.

Overview

Original source data

NLnet Labs Unbound, up to and including version 1.12.0, and NLnet Labs NSD, up to and including version 4.3.3, contain a local vulnerability that would allow for a local symlink attack. When writing the PID file, Unbound and NSD create the file if it is not there, or open an existing file for writing. In case the file was already present, they would follow symlinks if the file happened to be a symlink instead of a regular file. An additional chown of the file would then take place after it was written, making the user Unbound/NSD is supposed to run as the new owner of the file. If an attacker has local access to the user Unbound/NSD runs as, she could create a symlink in place of the PID file pointing to a file that she would like to erase. If then Unbound/NSD is killed and the PID file is not cleared, upon restarting with root privileges, Unbound/NSD will rewrite any file pointed at by the symlink. This is a local vulnerability that could create a Denial of Service of the system Unbound/NSD is running on. It requires an attacker having access to the limited permission user Unbound/NSD runs as and point through the symlink to a critical file on the system.

Affected products and scope

  • Unbound: versions up to and including 1.12.0 are affected. NLnet Labs identifies 1.13.0 as patched. The manual patch is documented for the range from 1.6.6 through 1.12.0.
  • NSD: version 4.3.3 and earlier versions are affected. NLnet Labs identifies 4.3.4 as patched. The manual patch is documented for the range from 4.2.3 through 4.3.3.
  • Do not infer the status of distribution backports or parallel release branches from upstream version numbers alone; confirm the fix with the relevant package vendor.

Technical details

NLnet Labs Unbound and NSD write the PID file by creating it when absent or opening an existing file for writing, but they did not check whether the existing file was a symlink. If the PID path pointed to a symlink, the daemon followed it, wrote to the target file, and then performed chown, making the Unbound or NSD service account the new owner of the target. Exploitation requires local access to the limited-permission account used by the daemon, replacement of the PID file with a symlink, and a symlink target that is important to the system. If the daemon is killed while the PID file remains, a restart with root privileges can rewrite the file referenced by the symlink. The affected component is PID-file writing and ownership handling; the available evidence does not identify specific system calls or distribution-specific PID paths.

Exploitability

The vulnerability is locally reachable; the available evidence does not describe a network-only attack path. The attacker needs access to the limited-permission service account used by Unbound or NSD and must preserve the symlink at the PID-file location until the daemon is restarted with root privileges. The supplied record characterizes the required privilege as low and user interaction as none after the attack conditions have been prepared. The supplied record does not establish known exploitation, a public exploit, or a ransomware campaign; this is not a claim that such activity does not exist.

Technical impact

The flaw allows the daemon to rewrite the file referenced by a symlink at the PID-file location when the daemon restarts with root privileges. If the target is a critical file, the result can be loss or corruption of that file and denial of service for the system or DNS service. The documented scope is local and unchanged; the available evidence does not establish confidentiality loss, privilege escalation, or arbitrary code execution. The extent of damage depends on which file the attacker can cause the symlink to reference.

Business impact

A successful attack could modify or overwrite a critical file selected through the symlink, causing loss of host availability. Depending on the target, the result could range from interruption of the DNS daemon to a broader system outage requiring file restoration and service recovery. The documented consequence is primarily service disruption and denial of service, not data disclosure. The available evidence does not establish account takeover, arbitrary code execution, or a data breach scenario.

Remediation

  1. Upgrade using the vendor fix. Move Unbound to 1.13.0 and NSD to 4.3.4, or use a vendor package that explicitly confirms inclusion of the corresponding fix. These are the releases identified by NLnet Labs as patched.
  2. If an upgrade is not immediately possible, apply the upstream patches manually to the supported source ranges, then rebuild and install the daemon. For Unbound, the documented command is patch -p1 < patch_cve-2020-28935_unbound.diff; for NSD, it is patch -p1 < patch_cve-2020-28935_nsd.diff. The advisory also directs administrators to run make install after applying the patch.
  3. Verify the deployed fix. Confirm that the running binary or package is the intended patched build, validate the PID-file path and ownership, and perform the normal service restart procedure.
  4. The Gentoo advisory identifies no workaround for NSD. Temporary permission changes or PID-file monitoring should not be treated as substitutes for the vendor fix.

Detection

  1. Inventory hosts running Unbound or NSD and identify the actual binary, package, and version in use.
  2. Determine each service's PID-file path and check whether the path resolves to a symlink or a regular file, including ownership and permissions.
  3. Review the service privilege model, especially deployments that start the daemon with root privileges and then switch to a limited-permission service account.
  4. Review service stop, restart, and recovery activity where the PID file may have remained after the daemon stopped.
  5. As a precaution, compare the contents and metadata of critical files after unusual service restarts; this is not a confirmed indicator of compromise.
  6. No specific log event or indicator is supplied by the evidence, and the absence of suspicious evidence does not prove that the host is safe.
Sources (23)
Learn more

Run an in-depth assessment with complete web risk management

CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.