Skip to content

Inconsistent handling of malformed response #1298

@matsduf

Description

@matsduf

Observations of rfv.se

Testing rfv.se gives the following output (DNSSEC10):

$ zonemaster-cli rfv.se --test dnssec/dnssec10
Seconds Level    Testcase       Message
======= ======== ============== =======
   0.00 INFO     UNSPECIFIED    Using version v4.7.3 of the Zonemaster engine.
   2.69 ERROR    DNSSEC10       No response or error in response on an expected non-existent name. Fetched from the nameservers with IP addresses "194.71.70.189;194.71.70.190;2001:67c:2384:5003::189;2001:67c:2384:5003::190".
   2.69 INFO     DNSSEC10       The zone has NSEC3 records. Fetched from the nameservers with IP addresses "162.219.54.130;162.219.55.130;185.42.137.101;194.58.192.48;194.58.198.48;2620:10a:80eb::42;2620:10a:80ec::42;2a01:3f0:400::48;2a01:3f1:3048::53;2a01:3f1:48::53".

What is interesting here is No response or error in response on an expected non-existent name. I ran the the following command and looked for 194.71.70.189.

zonemaster-cli rfv.se --test dnssec/dnssec10 --level debug3 > rfv.se.log 

I found the following in the log file:

   2.35 DEBUG2   DNSSEC10       SYSTEM:DNSSEC10:QUERY flags={"dnssec":1,"usevc":0}; ip=194.71.70.189; name=xx--oplk4f3fgh9lksdfhu7h--xx.rfv.se; type=A
   2.35 DEBUG    DNSSEC10       SYSTEM:DNSSEC10:EXTERNAL_QUERY flags={"class":"IN","dnssec":1,"usevc":0}; ip=194.71.70.189; name=xx--oplk4f3fgh9lksdfhu7h--xx.rfv.se; type=A
   2.36 DEBUG    DNSSEC10       DNS query to ns1.sgit.se/194.71.70.189 for xx--oplk4f3fgh9lksdfhu7h--xx.rfv.se/A/IN failed with error: authority section incomplete.
   2.36 DEBUG3   DNSSEC10       SYSTEM:DNSSEC10:EMPTY_RETURN 
   2.36 DEBUG3   DNSSEC10       SYSTEM:DNSSEC10:CACHED_RETURN packet=undef

To note that Zonemaster says failed with error: authority section incomplete and that the response is cached as no response, i.e. as if there was no response at all.

And indeed there is something wrong (the query over UDP leads to a truncated response with a malformed packet):

$ dig @194.71.70.189 xx--oplk4f3fgh9lksdfhu7h--xx.rfv.se A +dnssec +norec +ignore +noidnin +noidnout
;; Warning: Message parser reports malformed message packet.

; <<>> DiG 9.18.14 <<>> @194.71.70.189 xx--oplk4f3fgh9lksdfhu7h--xx.rfv.se A +dnssec +norec +ignore +noidnin +noidnout
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 5265
;; flags: qr aa tc; QUERY: 1, ANSWER: 0, AUTHORITY: 6, ADDITIONAL: 1

;; QUESTION SECTION:
;xx--oplk4f3fgh9lksdfhu7h--xx.rfv.se. IN	A

;; AUTHORITY SECTION:
.			32768	CLASS4096 OPT	

;; Query time: 10 msec
;; SERVER: 194.71.70.189#53(194.71.70.189) (UDP)
;; WHEN: Fri Oct 20 14:49:00 UTC 2023
;; MSG SIZE  rcvd: 64

Note that it says "AUTHORITY: 6" but there are actually no records for the authority section. The one records shown there really belongs to the additional section.

The TC flag is set, and if a new query over TCP is sent, then a well-formed response is sent. If the +ignore parameter is removed, then dig will automatically retry with TCP:

$ dig @194.71.70.189 xx--oplk4f3fgh9lksdfhu7h--xx.rfv.se A +dnssec +norec +noidnin +noidnout
;; Warning: Message parser reports malformed message packet.
;; Truncated, retrying in TCP mode.
(...)

If dig is run with +tcp no malformed packet is reported.

Observations of riksforsakringsverket.se

riksforsakringsverket.se is a sister to rfv.se, but for that no error is reported by zonemaster-cli:

$ zonemaster-cli riksforsakringsverket.se --test dnssec/dnssec10
Seconds Level    Testcase       Message
======= ======== ============== =======
   0.00 INFO     UNSPECIFIED    Using version v4.7.3 of the Zonemaster engine.
   2.58 INFO     DNSSEC10       The zone has NSEC3 records. Fetched from the nameservers with IP addresses "162.219.54.130;162.219.55.130;185.42.137.101;194.58.192.48;194.58.198.48;194.71.70.189;194.71.70.190;2001:67c:2384:5003::189;2001:67c:2384:5003::190;2620:10a:80eb::42;2620:10a:80ec::42;2a01:3f0:400::48;2a01:3f1:3048::53;2a01:3f1:48::53".

However, both zones are hosted on the same set of NS. And when sending a query with dig, the same malformed response is returned for riksforsakringsverket.se:

$ dig @194.71.70.189 xx--oplk4f3fgh9lksdfhu7h--xx.riksforsakringsverket.se A +dnssec +norec +noidnin +noidnout +ignore
;; Warning: Message parser reports malformed message packet.

; <<>> DiG 9.18.14 <<>> @194.71.70.189 xx--oplk4f3fgh9lksdfhu7h--xx.riksforsakringsverket.se A +dnssec +norec +noidnin +noidnout +ignore
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 38980
;; flags: qr aa tc; QUERY: 1, ANSWER: 0, AUTHORITY: 3, ADDITIONAL: 1

;; QUESTION SECTION:
;xx--oplk4f3fgh9lksdfhu7h--xx.riksforsakringsverket.se. IN A

;; AUTHORITY SECTION:
.			32768	CLASS4096 OPT	

;; Query time: 10 msec
;; SERVER: 194.71.70.189#53(194.71.70.189) (UDP)
;; WHEN: Fri Oct 20 15:02:41 UTC 2023
;; MSG SIZE  rcvd: 82

Conclusions

  1. Preferably Zonemaster should in a case like rfv.se
    1. Output a message on ERROR level with the error message text from the system (translation is not required).
    2. Just like dig requery of TCP with the TC flag is set, even if the remaining of the packet is malformed.
  2. Preferably Zonemaster should discover the malformed packet also in the case of riksforsakringsverket.se

Metadata

Metadata

Assignees

Labels

T-BugType: Bug in software or error in test case description

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions