pdns icon indicating copy to clipboard operation
pdns copied to clipboard

Lua record function createForward6() throws exception when non-hex characters are in query for non-split full length format

Open ZaphodB opened this issue 1 year ago • 0 comments

Short description

When Lua record AAAA "createForward6()" encounters non-hex characters in non-split full length format queries it creates an exception. This is also happens when more than 8 parts separated by hyphens are encountered.

Environment

  • Operating system: Debian Bookworm 12.7
  • Software version: 4.9.1-1pdns.bookworm
  • Software source: PowerDNS repository

Steps to reproduce

  1. ENABLE-LUA-RECORDS via domain metadata
  2. add Lua record: AAAA "createForward6()"
  3. query for random string at least 32 characters long containing non-hex characters

Expected behaviour

no exception logged maybe NXDOMAIN answer sent instead of SERVFAIL

Actual behaviour

exception logged:

Sep 06 05:15:45 shinjuku pdns_server[1891040]: Exception building answer packet for 4yx5ax8swvnnx9wojgk95tj2u1czw0wz.static6.zaphods.net/AAAA (Exception thrown by a callback function called by Lua.
Sep 06 05:15:45 shinjuku pdns_server[1891040]: stack traceback:
Sep 06 05:15:45 shinjuku pdns_server[1891040]:         [C]: at 0x5596a08d9490) sending out servfail
Sep 06 12:33:27 shinjuku pdns_server[3373701]: Exception building answer packet for iyMMTxpB4J1Z5EoekT6PGwEcV5T0UKeC.static6.zaphods.net/AAAA (Exception thrown by a callback function called by Lua.
Sep 06 12:33:27 shinjuku pdns_server[3373701]: stack traceback:
Sep 06 12:33:27 shinjuku pdns_server[3373701]:         [C]: at 0x55f4ecef9490) sending out servfail
Sep 06 12:56:44 shinjuku pdns_server[3373701]: Exception building answer packet for 2001-67c-1400-1221-417-8f61-cd66-e42f-abc-abc.static6.zaphods.net/AAAA (Exception thrown by a callback function called by Lua.
Sep 06 12:56:44 shinjuku pdns_server[3373701]: stack traceback:
Sep 06 12:56:44 shinjuku pdns_server[3373701]:         [C]: at 0x55f4ecef9490) sending out servfail

SERVFAIL response sent:

➜  ~ dig @shinjuku.zaphods.net aaaa iyMMTxpB4J1Z5EoekT6PGwEcV5T0UKeC.static6.zaphods.net

; <<>> DiG 9.20.1 <<>> @shinjuku.zaphods.net aaaa iyMMTxpB4J1Z5EoekT6PGwEcV5T0UKeC.static6.zaphods.net
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 23264
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;iyMMTxpB4J1Z5EoekT6PGwEcV5T0UKeC.static6.zaphods.net. IN AAAA

;; Query time: 35 msec
;; SERVER: 2001:67c:1400:1220::25#53(shinjuku.zaphods.net) (UDP)
;; WHEN: Fri Sep 06 12:59:42 CEST 2024
;; MSG SIZE  rcvd: 81

Other information

ZaphodB avatar Sep 06 '24 11:09 ZaphodB