BadCompressLoop4 - Pointer Loop in CNAME Field (Variant 1)

BadCompressLoop4 - Pointer Loop in CNAME Field (Variant 1)

The DNS protocol supports compressing domain names to save space by reducing redundancy for repeated domain names within DNS messages. This compression scheme can be applied to various record (resource) types, such as A, CNAME, MX, or PTR records.

This particular module is designed to respond with a single answer containing a CNAME record (alias) where the CNAME field is compressed.

The compression pointer in the CNAME field points to itself. This forms a direct loop, preventing it from being assembled into a valid domain name.

Category: Bad compression

RFCs: RFC1035

Format

badcompressloop4.yourdomain.com

This module has no parameters.

Examples

In this example, we can see that the client (dig) is unable to process the response because of the compression loop:

# dig badcompressloop4.yourdomain.com @127.0.0.1

;; Got bad packet: bad compression pointer
63 bytes
9d fb 84 00 00 01 00 01 00 00 00 00 10 62 61 64          .............bad
63 6f 6d 70 72 65 73 73 6c 6f 6f 70 34 0a 79 6f          compressloop4.yo
75 72 64 6f 6d 61 69 6e 03 63 6f 6d 00 00 01 00          urdomain.com....
01 c0 0c 00 05 00 01 00 00 00 3c 00 02 c0 3d             ..........<...=

Download PCAP File

By examining the PCAP file in Wireshark, we can see that it detects the loop and displays the error message <Name contains a pointer that loops> while parsing the field. However, different DNS resolvers and clients may handle such malformed responses in vastly different ways, making this an intriguing use case for testing.


Like other features, you can append anything to the feature name to avoid receiving cached responses from the target DNS resolver. This forces the target resolver to actively communicate with our PolarDNS server instead of responding with cached answers. Using a random number is the most effective strategy:

# dig badcompressloop4${RANDOM}.yourdomain.com @10.211.55.2

;; Got bad packet: bad compression pointer
68 bytes
9a 40 84 00 00 01 00 01 00 00 00 00 15 62 61 64          .@...........bad
63 6f 6d 70 72 65 73 73 6c 6f 6f 70 34 32 35 31          compressloop4251
37 34 0a 79 6f 75 72 64 6f 6d 61 69 6e 03 63 6f          74.yourdomain.co
6d 00 00 01 00 01 c0 0c 00 05 00 01 00 00 00 3c          m..............<
00 02 c0 42                                              ...B

Download PCAP File


From the same category


Go back to catalogue.