README 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. "badpacket" is a tool intended to test that a nameserver can cope with
  2. incorrectly-formatted DNS messages.
  3. This particular incarnation of the tool allows the flags field of a DNS message
  4. (the third and fourth bytes) to be set to any bit combination (including ones
  5. that invalid in a query). As well as setting the bits to a particular
  6. combination, it is possible to specify ranges for bit/field values; when this
  7. is done, the tool will send a set of packets so that each combination of flag
  8. bits is checked.
  9. To illustrate this, consider the following command:
  10. badpacket --address 192.0.2.21 --port 5301 --aa 0-1 --cd 1
  11. --rc 0-2 ftp.example.com
  12. (The command has been split across two lines for clarity.)
  13. The address and port flags are self-evident. The other flags specify settings
  14. for the AA bit (0 and 1), CD bit (always 1) and the RCODE field (0, 1, 2). (The
  15. remaining fields are not specified, so will always be zero.) There are six
  16. combinations of these values, so six packets will sent to the remote server with
  17. the following settings:
  18. AA RCODE CD Rest
  19. 0 0 1 0
  20. 0 1 1 0
  21. 0 2 1 0
  22. 1 0 1 0
  23. 1 1 1 0
  24. 1 2 1 0
  25. Each packet will cause a line to be output to stdout, which will have the
  26. following form:
  27. SUCCESS: (QR:0 OP:0 AA:0 TC:0 RD:0 RA:0 Z:0 AD:0 CD:1 RC:0)
  28. (qr:1 op:0 aa:0 tc:0 rd:0 ra:1 z:0 ad:0 cd:1 rc:0)
  29. (Again the text has been split across two lines for clarity.)
  30. Each lines contains a status (SUCCESS indicates that a response was received,
  31. regardless of the contents of the response), the state of the fields in the
  32. flags word of the packet sent (in upper-case letters) and the state of the
  33. fields in the flags word of the response (in lower-case letters).
  34. TODO: At the moment the tool is limited to just alerting the flags field.
  35. Future work should extend the program to other bad packets. Ideas are:
  36. * Flasify the values in the various count fields
  37. * Add data to sections that should be empty.
  38. * Deliberately mangle the names placed in the message sections (e.g. by altering
  39. the label count fields).