Security Advisories (1)
CVE-2026-81928 (2026-09-01)

Net::DNS versions before 1.57 for Perl allow memory exhaustion via unbounded recursion in sig_data when re-encoding a message with a misplaced TSIG record. sig_data signs a message by re-encoding it, and removes TSIG records only from the additional section. A TSIG decoded into the answer or authority section survives that step and is signed again, so encoding re-enters sig_data with no termination condition. Decoding does not reject such a message: a TSIG that is not the last record on the wire raises "misplaced or corrupt TSIG", but the error is caught, reported as a warning, and the record is left in the packet. RFC 8945 section 5.2 requires the message to be dropped. The recursion is reached only when the decoded TSIG carries an empty MAC, since a MAC recovered from the wire short-circuits the signing step. It is reached only from code that re-encodes a message it decoded, such as a forwarder or a proxy. A decoded message that is never re-encoded is unaffected. Message direction does not matter: a query reaches the same path as a response. Each cycle re-encodes the whole message, so fewer than 100 bytes on the wire exhaust available memory and terminate the process.

NAME

Net::DNS::DomainName - DNS name representation

SYNOPSIS

use Net::DNS::DomainName;

$object = Net::DNS::DomainName->new('example.com');
$name = $object->name;
$data = $object->encode;

( $object, $next ) = Net::DNS::DomainName->decode( \$data, $offset );

DESCRIPTION

The Net::DNS::DomainName module implements the concrete representation of DNS domain names used within DNS packets.

Net::DNS::DomainName defines methods for encoding and decoding wire format octet strings. All other behaviour is inherited from Net::DNS::Domain.

The Net::DNS::DomainName1035 and Net::DNS::DomainName2535 packages implement disjoint domain name subtypes which provide the name compression and canonicalisation specified by RFC1035 and RFC2535. These are necessary to meet the backward compatibility requirements introduced by RFC3597.

METHODS

new

$object = Net::DNS::DomainName->new('example.com');

Creates a domain name object which identifies the domain specified by the character string argument.

decode

$object = Net::DNS::DomainName->decode( \$buffer, $offset, $hash );

( $object, $next ) = Net::DNS::DomainName->decode( \$buffer, $offset, $hash );

Creates a domain name object which represents the DNS domain name identified by the wire-format data at the indicated offset within the data buffer.

The argument list consists of a reference to a scalar containing the wire-format data and specified offset. The optional reference to a hash table provides improved efficiency of decoding compressed names by exploiting already cached compression pointers.

The returned offset value indicates the start of the next item in the data buffer.

encode

$data = $object->encode;

Returns the wire-format representation of the domain name suitable for inclusion in a DNS packet buffer.

canonical

$data = $object->canonical;

Returns the canonical wire-format representation of the domain name as defined in RFC2535(8.1).

Net::DNS::DomainName1035

Net::DNS::DomainName1035 implements a subclass of domain name objects which are to be encoded using the compressed wire format defined in RFC1035.

$data = $object->encode( $offset, $hash );

The arguments are the offset within the packet data where the domain name is to be stored and a reference to a hash table used to index compressed names within the packet.

Note that RFC3597 implies that only the RR types defined in RFC1035(3.3) are eligible for compression of domain names occuring in RDATA.

If the hash reference is undefined, encode() returns the lower case uncompressed canonical representation defined in RFC2535(8.1).

Net::DNS::DomainName2535

Net::DNS::DomainName2535 implements a subclass of domain name objects which are to be encoded using uncompressed wire format.

$data = $object->encode( $offset, $hash );

The arguments are the offset within the packet data where the domain name is to be stored and a reference to a hash table used to index names already encoded within the packet.

If the hash reference is undefined, encode() returns the lower case uncompressed canonical representation defined in RFC2535(8.1).

Note that RFC3597, and latterly RFC4034, specifies that the lower case canonical form is to be used for RR types defined prior to RFC3597.

COPYRIGHT

Copyright (c)2009-2011 Dick Franks.

All rights reserved.

LICENSE

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the original copyright notices appear in all copies and that both copyright notice and this permission notice appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

SEE ALSO

perl Net::DNS Net::DNS::Domain RFC1035 RFC2535 RFC3597 RFC4034