KyDNS is a self-hosted local DNS and service directory. Operators are responsible for securing the host, network, and credentials.
Do not disclose suspected vulnerabilities in a public issue. Report them privately through GitHub:
- Open this repository's Security tab and choose Report a vulnerability.
- Describe the affected component and versions, the impact, reproduction steps, and any suggested mitigation.
- Do not disclose it publicly until a fix is released.
If you cannot use GitHub, email hello@busnes.app with "Security" in the subject.
We acknowledge your report within 2 business days, then send a severity assessment and a timeline. Target time to public disclosure is 30 days for critical issues (unauthenticated data access, authentication bypass, remote code execution), 60 days for high, and 90 days for moderate. The fix is released before the advisory is published, and we credit you in the release notes unless you would rather stay anonymous.
- DNS clients are untrusted input and must not be able to change records.
Queries are answered only from the
allow_queryranges; everything else getsREFUSED. - Administrative endpoints require authentication and authorization.
- Beyond loopback, protect the plain-HTTP admin listener with a TLS-terminating
reverse proxy and network controls that allow only the proxy to reach it.
KYDNS_TRUSTED_PROXIEStrusts forwarded headers, not access: it is empty by default and refuses/0; forwarded headers from other peers are ignored. - The first-run setup token is written to
<data_dir>/setup-token, mode 0600, and logged, including under systemd. Restrict journal and container-log access until setup is complete; readers of those logs can obtain the setup token. <data_dir>/kydns.dband its-waland-shmfiles are mode 0600, like the keys and tokens beside them; opening tightens a database an older version created more loosely.- The container runs as uid 65532 with every capability dropped. Ports below
1024 come from
net.ipv4.ip_unprivileged_port_start=0in the container's own network namespace, never the host's. - OIDC login uses authorization code with PKCE and verifies the ID token's signature, issuer, audience, expiry, non-empty subject, and per-login nonce. Userinfo may enrich profile and role claims only when its subject matches the verified ID token.
POST /auth/sso/backchannel-logoutaccepts OpenID Connect Back-Channel Logout tokens. Anyone can reach it; only a token the configured provider signed for this client, unexpired, withiat, asuborsid, the logout event and nononce(andtyplogout+jwtwhen present) ends anything. It ends the sessions of that issuer'ssid, or that subject's logins whose ID token was issued byiat, never a password session or another issuer's. Either kind is fenced for ten minutes, so a callback already holding an ID token from before the logout answers 401 instead of signing in. SSO sessions are dated by their ID token'siat, not by when the callback finished. It is not rate limited, so the provider's retries are never refused. Discovery runs once per configured issuer and client ID (a failure is retried after 30 seconds) and the key set stays cached; only a token whose signature fails the cached keys refetches the key set, one fetch at a time, which is go-oidc's key-rotation path.- Upstream resolvers are reached over DNS-over-TLS or DNS-over-HTTPS with
certificate verification always on. Plain
udp://is per-upstream opt-in. With local DNSSEC validation off it clears the authenticated-data bit on anything it answers; with it on, the bit means KyDNS checked the chain itself. - Local DNSSEC validation trusts only the root anchors built into the binary. Signature checks are bounded (8 per RRset, 64 per answer; NSEC3 iterations above 150 count as insecure). While the clock is provably untrustworthy, only signature dates are skipped, and the dashboard says so.
- Discovery sources such as DHCP and Docker are configuration inputs and must be validated before their data is published.
- With the built-in DHCP server enabled, KyDNS parses packets from any device
on the segment rather than reading a lease file. A malformed packet is
dropped and is never fatal. It is deliberately not counted: a tally of
unparseable broadcasts on a shared segment is not something an operator acts
on, and
GET /api/v1/statsis where a drop counter would be surfaced if that ever changes. No untrusted device can push the lease table past the configured range — a dynamic address is only ever taken from inside it, and validation caps the range at 65536 addresses. A reservation an administrator makes may sit outside the range, though never outside the interface's subnet, and only an administrator can make one. Hostnames arrive in option 12, which any device on the LAN chooses, so each one is cut to a single lowercase DNS label of letters, digits, and hyphens, or dropped, and a lease can never shadow a service, an alias, or a manual record in any view, nor claimwpad,isatap,localhost,ns,kydnsor the node's own hostname. This holds for lease files too. DHCP does not authenticate clients, so a RELEASE changes state only when its MAC and client address match the active lease and its server identifier names this KyDNS listener; malformed or foreign releases are ignored. The ordinary packet exchange is not logged, because MACs and hostnames identify people's devices; only the exceptions are — a declined address, a reservation another device already answers to, an address that answered a conflict probe, two clients claiming one name, an exhausted range, a lease the database refused to store or delete, and an unparseable row dropped when the table is reloaded at boot — and those name the device because there is nothing to act on otherwise. - Remote blacklist sources are untrusted input: fetched only over HTTPS with certificate verification, redirects followed only while they stay HTTPS, a 32 MB response body ceiling, a ceiling on parsed entries per list, no code execution of list contents, and applied atomically; they must never override authoritative local records. Only an authenticated administrator can change blacklist policy (lists, rules, and the filtering toggle), and an administrator can delegate rules, list refreshes and bounded pauses to an AI agent token with write access.
- The local registry contains private service names and addresses. It also holds the admin password hash and API tokens (admin and agent), so write access to the database file is equivalent to administrative access.
- Query history is sensitive operational data. Query logging is off by default, and logging client IPs is a separate opt-in.
- AI agents use
/mcpon the admin listener with an agent token: a bearer token whose access level (mcp:read,mcp:write, plus a separate query-log grant) lives in its database row. Agent tokens never authenticate/api/v1, admin tokens never authenticate/mcp, any request with anOriginheader is refused, and a token unused for 90 days is revoked. Agents cannot change upstreams, listeners or other settings. Domain names returned to an agent are untrusted strings and are labelled so; an agent with write access can be steered by anyone who can message it, which is why write access and the query log are each opt-in. See docs/AI-AGENTS.md. - Server settings live in the database and are changed only by an authenticated
administrator, through the web UI,
PATCH /api/v1/settings, orkydns settings set. All three go through one validation and write path, and a change either validates, persists, and applies in full or does none of those. The config file seeds those settings on the first run and is ignored afterwards, so a file an attacker edits on a running install changes nothing.
The admin listener assumes a hostile web page in the operator's browser (the Joplin Web Clipper leak, GHSA-9728-v7ww-mxjv, was exactly that: wildcard CORS, no Origin check, and a consent prompt that did not say who was asking).
- No response carries
Access-Control-Allow-Origin, wildcard or otherwise. The UI is same-origin and needs no CORS;/mcpis for agents, never browsers, and refuses any request with anOriginheader. - Every state-changing request (UI,
/api/v1,/mcp) from another origin, withOrigin: null, or withSec-Fetch-Site: cross-site/same-siteis refused, and cross-origin preflights are refused. UI forms also need the session and its CSRF token. - The UI, API and
/mcpanswer only tolocalhost, IP literals and the names inKYDNS_ADMIN_HOSTNAMES, which defeats DNS rebinding. With no names configured, a request through the trusted HTTPS proxy passes on any name, since a rebound name fails the proxy's TLS handshake; KyDNS warns at start. - Tokens are minted only by an administrator, in the UI, the API or the CLI. There is no pairing or approval flow a third party can start, and the screen that shows a new token names who it is for and what it grants.
- Validate domain names, record types, addresses, and aliases.
- Record administrative events without logging credentials, private keys, raw request bodies, or sensitive answers.
- Keep upstream credentials and private keys out of YAML and JSON exports.
- Keep public DNS names separate from private service names by default.
- Bind administrative services only to intended interfaces and protect them with the operator's network controls or a trusted TLS-terminating proxy.
- Fetch blacklist sources only over verified HTTPS, without sending query or
client identity data to list providers. Send a fixed
User-Agent: kydnsheader and no other identifying headers.
allow_query is the list of ranges KyDNS answers at all; everything else gets
REFUSED. Widening it past the operator's own network is the one settings
change that can turn a homelab resolver into an open resolver, so it is the one
change that is not a single click.
What counts as private. A prefix is private when it sits wholly inside
loopback (127.0.0.0/8, ::1/128), RFC1918 (10.0.0.0/8, 172.16.0.0/12,
192.168.0.0/16), ULA (fc00::/7), link-local (169.254.0.0/16, fe80::/10),
or CGNAT (100.64.0.0/10, which is what Tailscale uses). Containment, not
overlap: 0.0.0.0/0 overlaps every one of those ranges without being any of
them, and is public.
Adding a public prefix takes a confirmation. The exact canonical, masked
form of the prefix has to be retyped in the same request — the confirmation box
in the settings form, confirm_public on PATCH /api/v1/settings, or
--confirm-public on kydns settings set. Canonical form is the point: an
entry written as 192.168.1.99/0 behaves as 0.0.0.0/0 while reading as a LAN
address, so the operator confirms what the prefix actually matches, not what it
looks like. The confirmation is never derived from the value being saved, is
never stored, and is never returned.
Only new exposure is confirmed. A public prefix already stored counts as already accepted, so changing an unrelated setting, or narrowing the list, never asks again. Removing a prefix and re-adding it does ask, because by then it is no longer in the stored list.
Exposure stays visible. For as long as any public prefix is configured, the dashboard and the Settings screen carry a standing banner naming it, and KyDNS logs a warning naming it at every start. Neither can be dismissed; removing the prefix is what clears them.
A public prefix in an existing config file is grandfathered. Upgrading a
deployment whose kydns.yaml already sets a public allow_query seeds that
value and starts. It is not refused. Refusing to start would take a working
household's DNS offline over a file that was legal when it was written, which
trades a real outage for a risk the operator already chose to run. The warning
and the banner are what keep that choice visible instead of silent.
Import cannot introduce one. There is no place to type a confirmation in an
import document, so a document whose allow_query carries a public prefix the
server is not already serving is refused. In replace mode that check runs before
the destructive replacement, so a rejected import leaves the existing registry
and settings exactly as they were. Restore the backup without the prefix, then
add it with a confirmation.
docs/STRONG-CRYPTO.md inventories supported key/TLS boundaries and migration without replacing existing node/backup keys. OIDC always refuses newly fetched RSA signing keys below 2048 bits; the optional process profile additionally enforces TLS key policy and direct HTTPS OIDC endpoints. Health certificate opt-out remains outside that profile. The operator's HTTPS proxy is a separate boundary and must be configured too.
- With "Validate DNSSEC locally" off (an upgraded install that has not
turned it on), KyDNS does not verify DNSSEC signatures: an
ADbit means the upstream said it validated. With it on, there is no RFC 5011 trust-anchor rollover (a new root key arrives in a release), a client'sCDbit does not get it bogus data, and names under the automatic negative trust anchors are never validated. - With validation off, every configured upstream should be a validating resolver. A DNSSEC
rejection from any encrypted upstream is final: a
SERVFAILcarrying a DNSSEC Extended DNS Error (RFC 8914) goes to the client, without any records it carried, and the next upstream is not asked. ASERVFAILwithout one is treated as an outage and the next upstream is tried, so a validator that sends no such error can still be bypassed by a later upstream that does not validate. Audp://upstream's error is not trusted, since anyone on its path could forge one to stop the failover. - The admin listener speaks plain HTTP. It defaults to
127.0.0.1:8053. Beyond loopback, put it behind a TLS-terminating reverse proxy and restrict direct access with network controls. ConfigureKYDNS_TRUSTED_PROXIESfor forwarded headers. The proxy's hop to KyDNS is still plain HTTP, so keep it on the same host or a network you trust. - Blacklist filtering is domain filtering, not traffic inspection, parental control, or a malware guarantee.
- Anyone with write access to the database file can reset the admin password
with
kydns admin reset-password. They can already read every hash and token in that file, so this adds no exposure — but the file is the trust boundary.
Linked-server replication ships, and these are the properties it has to keep. Peer connections are TLS 1.3, and each side pins the other's certificate fingerprint rather than trusting a CA. A peer is enrolled only by an operator, with a one-time pairing code and a fingerprint the operator compares against the one the other node printed; a peer the operator declines is sent nothing at all. A replica pulls the whole configuration and applies it in one transaction, so a retried or resumed pull converges instead of compounding. API tokens, the admin account, per-node settings such as the built-in DHCP server's configuration and its leases, and DNS query history are never replicated.
A group has exactly one primary, and it is the only node that takes administrative writes. A replica refuses every authenticated write in the web UI and in the admin API rather than accepting an edit the next pull would silently discard. The one exception is its own DHCP settings, which are node-local: a pull cannot discard them, so a replica may configure them and be prepared as a standby. A write on that route reaching any other setting is refused whole, and a replica still never serves DHCP until it is promoted. A replica that cannot reach its primary reports itself stale, and reports health it cannot verify as unknown rather than as the last value it saw.
KyRecovery pairing accepts only HTTPS origins resolving to public, non-reserved addresses and refuses redirects. Its bearer token is encrypted under a mode-0600 node-local key and is never returned by status endpoints or rendered in HTML. Capsules are sealed to the pinned suite recovery public key; receipt digest, size, and capsule ID must match before a deposit is recorded. Capsule downloads are marked no-store and nosniff. Restore shares are accepted on standard input, never command arguments.
Private and CGNAT targets are refused unless KYDNS_BACKUP_ALLOW_PRIVATE_RECOVERY
is set, which is logged at startup and named on the pairing audit row; loopback, link-local,
multicast, unspecified, and reserved ranges are refused regardless. Plain HTTP is never
accepted. The operator compares fingerprints because TLS protects the wire, not the capsule.
A suite with no KyRecovery to pair with pins the recovery public key by hand, from the
ceremony page, on Settings → Disaster recovery or with kydns backup-pin-key. The
pin is write-once: a second, different key is refused with 409, so a capsule cannot be
quietly re-sealed to a key the custodians never split.
Unpairing removes the KyRecovery URL and the sealed token rows and nothing else. The key pin, the receipts and the local copies stay, and the screen says so. The deposit credential itself is dead only when the KyRecovery admin revokes it — KyDNS can forget a token, it cannot invalidate one.
See DESIGN.md for the architecture, LOGGING.md for privacy-safe logging requirements, docs/ASSURANCE-CASE.md for the threat model and the argument that these protections hold, and docs/VERIFYING-RELEASES.md to verify a release and rebuild its binary.