]> The Tcpdump Group git mirrors - tcpdump/commitdiff
PPP: report invalid PAP AACK/ANAK packets
authorMichael Haardt <[email protected]>
Tue, 18 Mar 2014 17:54:35 +0000 (17:54 +0000)
committerDenis Ovsienko <[email protected]>
Sun, 16 Oct 2016 17:54:35 +0000 (18:54 +0100)
I just came across a broken PPP PAP ACK packet which was just 4 bytes
long, because it lacked the message-length octet.

pppd 2.4.5 accepts such truncated PPP PAP ACKs and only logs a debugging
message, but at least it generates 5 byte packets. LWIP copied that
code. TI NDK accepts truncated packets as well, although it also
generates them, so perhaps it counts less. Wireshark correctly detects
truncated authentication ACKs for PAP in PPP, but tcpdump does not.

print-ppp.c

index c16801fba31f6d02a877d6465a602e5385c1f4cd..0cc030b3f8305d85306e8ea8c775784af0688a27 100644 (file)
@@ -972,6 +972,13 @@ handle_pap(netdissect_options *ndo,
                break;
        case PAP_AACK:
        case PAP_ANAK:
+               /* Although some implementations ignore truncation at
+                * this point and at least one generates a truncated
+                * packet, RFC 1334 section 2.2.2 clearly states that
+                * both AACK and ANAK are at least 5 bytes long.
+                */
+               if (len < 5)
+                       goto trunc;
                if (length - (p - p0) < 1)
                        return;
                ND_TCHECK(*p);