nextcloud / nextcloud/server

[Bug]: DnsPinMiddleware.php uses wrong concept of handling failed DNS responses

Open
#47,849 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 29-feedback bug security
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

If in DnsPinMiddleware.php in private function dnsResolve() retrieving the SOA record works and for some reason, for example because of packet loss, dnsResolve() doesn't return IP addresses with the second run the DNS record is negatively cached for the time of the minimum ttl of the SOA record.

The current implementation protects against missing IP addresses, i.e. missing DNS responses, with the minimum TTL of the SOA record. This implementation isn't correct.

Steps to reproduce
  1. Try an update of apps or installation of apps.
  2. Have missing DNS responses by accident.
  3. Now you are not able to do updates or installation of apps for 24 hours for example with Github sources.
Expected behavior

DNS pinning should protect against modified IP addresses with a user configurable TTL.

Nextcloud Server version

29

Operating system

Debian/Ubuntu

PHP engine version

None

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Updated from a MINOR version (ex. 28.0.1 to 28.0.2)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in DnsPinMiddleware.php and read the private dnsResolve() function, focusing on how SOA and IP responses are handled across repeated lookups. Trace the DNS caching behavior and the configurable DNS-pinning TTL. Done means transient missing responses do not impose the SOA minimum-TTL negative cache while modified IP addresses remain protected.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
networking, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.