Skip to content

answer_from assumes the response comes from the supplied nameserver #183

Description

@shoulders

My setup

  • Windows 11 Pro
  • Xampp (php 8.2.12)
  • pfSense router acting as my DNS server
    • with standard DNS (port 53) and DoT (853) available
    • DoT is using self-signed certs
  • NetDNS2 v2.0.8

the issue

  • Consider the code below. It assigns the current nameserver to the answer_from variable.
  • This is good for identifying which of the nameservers from the supplied array of nameservers that this request belongs.
  • This code assumes that it is the supplied nameserver that responds, it does not take into account for DNS requests being redirect to another DNS server (e.g. DNS Hijacking).

netdns2/src/NetDNS2/Client.php

Lines 1162 to 1166 in 37dcffa

//
// add the name server that the response came from to the response object, and the socket type that was used.
//
$response->answer_from = $_ns;
$response->answer_socket_type = \NetDNS2\Socket::SOCK_STREAM;

Feature request

Is it possible to get the real IP or domain name of the responding server from the response packet populate answer_from and not just assume that it is the supplied nameserver (eg $_ns).

so:

  • answer_from should be the IP the response packet comes from (i.e. source IP), or the FQDN and the IP if they can be grabbed from the response
  • send_toshould be equal too $_ns

thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions