Commit Graph

498 Commits

Author SHA1 Message Date
Guy Harris
866c60236c CVE-2017-13687/CHDLC: Add a test.
This is for the fix made a few commits before, which had no tests.

Add a test using the capture file supplied by Kamil Frankowicz.
2017-09-13 12:25:44 +01:00
Denis Ovsienko
d6ba8dc548 Split bgp-aigp-oobr into two custom tests too.
For the same reason as for bgp-as-path-oobr (TCP-MD5).
2017-09-13 12:25:44 +01:00
Guy Harris
ffde45acf3 CVE-2017-12994/BGP: Move a test inside a loop.
The loop can be executed more than once (that's kinda the whole point of
a loop), so the check has to be made each time through the loop, not
just once before the loop is executed.

Do some additional length checks while we're at it.

This fixes a buffer over-read discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
6ec0c6fa63 CVE-2017-12902/Zephyr: Add an additional test.
File from Kamil Frankowicz.
2017-09-13 12:25:44 +01:00
Guy Harris
b534e30456 CVE-2017-12993/Juniper: Add more bounds checks.
This fixes a buffer over-read discovered by Kamil Frankowicz.

Add tests using the capture files supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Denis Ovsienko
d3aae71930 Split bgp-as-path-oobr into two custom tests.
tcpdump printout for TCP-MD5 is different depending on whether it was
compiled with or without the crypto support. This means a standard test
with TCP-MD5 will always fail at least one of the cases (with and
without). Replace the standard test with two custom tests and run that
test that should pass but skip the other.
2017-09-13 12:25:44 +01:00
Guy Harris
e942fb84fb CVE-2017-12992/RIPng: Clean up bounds checking.
Do bounds checking as we access items.

Scan the list of netinfo6 entries based on the supplied packet length,
without taking the captured length into account; let the aforementioned
bounds checking handle that.

This fixes a buffer over-read discovered by Kamil Frankowicz.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
db24063b01 CVE-2017-12989/RESP: Make sure resp_get_length() advances the pointer for invalid lengths.
Make sure that it always sends *endp before returning and that, for
invalid lengths where we don't like a character in the length string,
what it sets *endp to is past the character in question, so we don't
run the risk of infinitely looping (or doing something else random) if a
character in the length is invalid.

This fixes an infinite loop discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
2ecb9d2c67 CVE-2017-12987/Another test for the TIM IE bug, from Kamil Frankowicz. 2017-09-13 12:25:44 +01:00
Guy Harris
8934a7d630 CVE-2017-12988/TELNET: Add a missing bounds check.
This fixes a buffer over-read discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
c2ef693866 CVE-2017-12990/Fix printing of ISAKMPv1 Notification payload data.
The closest thing to a specification for the contents of the payload
data is draft-ietf-ipsec-notifymsg-04, and nothing in there says that it
is ever a complete ISAKMP message, so don't dissect types we don't have
specific code for as a complete ISAKMP message.

While we're at it, fix a comment, and clean up printing of V1 Nonce,
V2 Authentication payloads, and v2 Notice payloads.

This fixes an infinite loop discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
50a44b6b8e CVE-2017-12991/BGP: Add missing bounds check.
This fixes a buffer over-read discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
99798bd9a4 CVE-2017-12987/IEEE 802.11: Fix processing of TIM IE.
The arguments to memcpy() were completely wrong.

This fixes a buffer over-read discovered by Kamil Frankowicz.

Add a test using the capture file supplied by Brian 'geeknik' Carpenter.
2017-09-13 12:25:44 +01:00
Guy Harris
d17507ffa3 CVE-2017-12902/Zephyr: Fix bounds checking.
Use ND_TTEST() rather than comparing against ndo->ndo_snapend ourselves;
it's easy to get the tests wrong.

Check for running out of packet data before checking for running out of
captured data, and distinguish between running out of packet data (which
might just mean "no more strings") and running out of captured data
(which means "truncated").

This fixes a buffer over-read discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
de981e6070 CVE-2017-12901/EIGRP: Do more length checks.
This fixes a buffer over-read discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
7ac73d6cd4 CVE-2017-12986/IPv6 R.H.: Update to reflect the actual IPv6 RFC.
In RFC 1883, the Type 0 routing header had a 1-byte reserved field and a
3-byte strict/loose bit map; in RFC 2460, that changed to a 4-byte
reserved field.

This fixes a buffer over-read discovered by Brian 'geeknik' Carpenter (by
making an ND_TCHECK() call check for the presence in the captured data
of all 4 bytes of the reserved field; we were printing it as a 4-byte
field, so we needed to check for them).

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
66df248b49 CVE-2017-12985/IPv6: Check for print routines returning -1 when running past the end.
rt6_print(), ah_print(), and esp_print() return -1 if they run up
against the end of the packet while dissecting; if that happens, stop
dissecting, don't try to fetch the next header value, because 1) *it*
might be past the end of the packet and 2) we won't be using it in any
case, as we'll be exiting the loop.

Also, change mobility_print() to return -1 if it runs up against the
end of the packet, and stop dissecting if it does so.

This fixes a buffer over-read discovered by Brian 'geeknik' Carpenter.

Add tests using the capture files supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
0318fa8b61 CVE-2017-12900/Properly terminate all struct tok arrays.
This fixes a buffer over-read discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.

Add tests using the capture files supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
2b62d1dda4 CVE-2017-12895/ICMP: Check the availability of data before checksumming it.
This fixes a buffer over-read discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.

Add tests using the capture files supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
730fc35968 CVE-2017-12894/In lookup_bytestring(), take the length of the byte string into account.
Otherwise, if, in our search of the hash table, we come across a byte
string that's shorter than the string we're looking for, we'll search
past the end of the string in the hash table.

This fixes a buffer over-read discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
6f5ba2b651 CVE-2017-12893/SMB/CIFS: Add a bounds check in name_len().
After we advance the pointer by the length value in the buffer, make
sure it points to something in the captured data.

This fixes a buffer over-read discovered by Forcepoint's security
researchers Otto Airamo & Antti Levomäki.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
c6e0531b5d CVE-2017-12899/DECnet: Fix bounds checking.
If we're skipping over padding before the *real* flags, check whether
the real flags are in the captured data before fetching it.  This fixes
a buffer over-read discovered by Kamil Frankowicz.

Note one place where we don't need to do bounds checking as it's already
been done.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
19d25dd878 CVE-2017-12898/NFS: Fix bounds checking.
Fix the bounds checking for the NFSv3 WRITE procedure to check whether the
length of the opaque data being written is present in the captured data,
not just whether the byte count is present in the captured data.
furthest forward in the packet, not the item before it.  (This also lets
us eliminate the check for the "stable" argument being present in the
captured data; rewrite the code to print that to make it a bit clearer.)

Check that the entire ar_stat field is present in the capture.

Note that parse_wcc_attr() is called after we've already checked whether
the wcc_data is present.

Check before fetching the "access" part of the NFSv3 ACCESS results.
This fixes a buffer over-read discovered by Kamil Frankowicz.

Include a test for the "check before fetching the "access" part..." fix,
using the capture supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
1dcd10acea CVE-2017-12897/ISO CLNS: Use ND_TTEST() for the bounds checks in isoclns_print().
This fixes a buffer over-read discovered by Kamil Frankowicz.

Don't pass the remaining caplen - that's too hard to get right, and we
were getting it wrong in at least one case; just use ND_TTEST().

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Guy Harris
f76e7feb41 CVE-2017-12896/ISAKMP: Do bounds checks in isakmp_rfc3948_print().
This fixes a buffer over-read discovered by Kamil Frankowicz.

Add a test using the capture file supplied by the reporter(s).
2017-09-13 12:25:44 +01:00
Ulrich Windl
071190f7a9 tests/TESTonce: More verbose failure message
Add the reason for not executing a test and the status if the command
exited with a non-zero status.
2017-09-12 20:37:26 -07:00
Guy Harris
7039327875 CVE-2017-11543/Make sure the SLIP direction octet is valid.
Report if it's not, and don't use it as an out-of-bounds index into an
array.

This fixes a buffer overflow discovered by Wilfried Kirsch.

Add a test using the capture file supplied by the reporter(s), modified
so the capture file won't be rejected as an invalid capture.
2017-09-02 21:36:44 +01:00
Guy Harris
21d702a136 CVE-2017-11541: In safeputs(), check the length before checking for a NUL terminator.
safeputs() doesn't do packet bounds checking of its own; it assumes that
the caller has checked the availability in the packet data of all maxlen
bytes of data.  This means we should check that we're within the
specified limit before looking at the byte.

This fixes a buffer over-read discovered by Kamil Frankowicz.

Add a test using the capture file supplied by the reporter(s).
2017-09-02 21:36:44 +01:00
Guy Harris
bed48062a6 CVE-2017-11542/PIMv1: Add a bounds check.
This fixes a buffer over-read discovered by Kamil Frankowicz.

Add a test using the capture file supplied by the reporter(s).
2017-09-02 21:36:44 +01:00
Guy Harris
a02b7aa397 Report *all* non-zero exit codes from the tcpdump command.
That will report, for example, exit code 139, which is issued for
SIGSEGV crashes.
2017-08-30 21:53:12 -07:00
Guy Harris
1e5cac716f Count the complex tests correctly, and pick up the counts correctly. 2017-08-30 21:36:24 -07:00
Guy Harris
a9ec709f70 Count the complex tests as passed or failed. 2017-08-30 21:10:41 -07:00
Guy Harris
d9e65de3d9 CVE-2017-11108/Fix bounds checking for STP.
Check whether the flags are in the captured data before printing them in
an MSTP BPDU.

Check whether V4 length is in the captured data before fetching it.
This fixes a vulnerability discovered by Kamil Frankowicz.

Include a test for the "check whether the V4 length is..." fix, using
the capture supplied by Kamil Frankowicz.
2017-07-22 23:57:42 +01:00
Denis Ovsienko
d72adb9406 Fix a bug in test scripts (exposed in GH #613).
crypto.sh ran its tests as expected but only indicated a failure
upstream when the last test failed. Add necessary checks and modify
the other "complex" tests in a similar manner to make sure the same
bug does not creep into these scripts later. Fix some indentation
while at it.
2017-07-13 21:18:23 +01:00
Guy Harris
27634837cc Force -t on in TESTonce.
These tests may be performed in an arbitrary time zone, so they *must*
run tcpdump with an option to print the time in a time-zone-independent
fashion.  Force -t on in TESTonce, just as we do for -n, and remove it
from TESTLIST and the conditional test scripts.
2017-07-01 23:17:02 +01:00
Guy Harris
a26c2b2425 Clean up IS-IS printing.
Check the packet length as well as the captured length.

Don't have separate "non-verbose" and "verbose" cases, so we don't
duplicate the length checks.

Print the right value for some length check errors.

Clean up the TLV parsing code - keep parsing until we completely run out
of data, but make sure, before we look at the TLV header, that we
haven't run past the end of the packet as well as that we haven't run
past the end of the captured data.

In the OSI checksum routine:

Have it take an unsigned length, so we don't have to worry about it
being negative.

Use ND_TTEST2 to check whether the checksum offset is within the
bounds of the packet.

If we don't have all the packet data to checksum, just report
"unverified", don't return a "truncated" error.
2017-06-02 20:05:12 -07:00
Job Snijders
edf4c90c34 Add support to decode a BGP Shutdown Communication
The draft-ietf-idr-shutdown-07 document specifies a mechanism to
transmit a short free form UTF-8 [RFC3629] message as part of a Cease
NOTIFICATION message [RFC4486] to inform the peer why the BGP session is
being shutdown or reset.

Hat tip to Peter van Dijk <peter.van.dijk@powerdns.com>
2017-04-17 14:46:38 +02:00
Steven H. Wang
99f6d01b24 add NSH ethertype
https://tools.ietf.org/html/draft-ietf-sfc-nsh-12#section-12.1
2017-04-02 09:08:17 +01:00
SUGYO Kazushi
08eea54b99 convert KAME "setkey -D" to esp-secrets-file
This resolves GitHub issue #26 completely.
2017-02-02 11:37:56 +00:00
Francois-Xavier Le Bail
12d939c3e9 The option -n is useless in TESTLIST
This option is already set in TESTonce.
2017-01-18 09:16:42 +01:00
Denis Ovsienko
77b9208db0 CVE-2017-5205/add a test case
The .pcap file comes from Francois-Xavier Le Bail.
2017-01-18 09:16:42 +01:00
Denis Ovsienko
f152c1268f CVE-2017-5485/add the test case 2017-01-18 09:16:42 +01:00
Denis Ovsienko
d07f724227 CVE-2017-5486/add the test case 2017-01-18 09:16:42 +01:00
Denis Ovsienko
5d214e36ee CVE-2017-5484/ATM: fix an incorrect bounds check
The function sig_print() did receive a correct caplen parameter value
but didn't use it correctly and could overread by one byte as Brian
Carpenter has demonstrated. Fix it by switching to the standard macros.
2017-01-18 09:16:42 +01:00
Denis Ovsienko
eec1624f7b CVE-2017-5483/SNMP: improve ASN.1 bounds checks
Kamil Frankowicz had found that truncated BE_STR and BE_SEQ ASN.1
elements could lead to an overread, from the source code it looked like
other ids could have this problem too. Move the checks introduced in
commit 72e501f out of the switch blocks to cover all ids by default.
This fixes GH#559 and GH#566.
2017-01-18 09:16:41 +01:00
Denis Ovsienko
c39c1d99ac CVE-2017-5482/Q.933: add a missing bounds check
Brian Carpenter had found that regardless of CVE-2016-8575 q933_print()
still could overread the buffer trying to parse a short packet. This
change fixes the problem.
2017-01-18 09:16:41 +01:00
Denis Ovsienko
0db4dcafe5 CVE-2017-5342/pass correct caplen value to ether_print()
In that function the "length" parameter means off-the-wire length, that
is, the length declared inside the outer header. The "caplen" parameter
means the amount of bytes actually available in the captured packet.

gre_print_0() and the functions modelled after it passed the value of
"length" instead of the value of "caplen", this could make ether_print()
access beyond the memory allocated for the captured packet. Brian
Carpenter had demonstrated this for the OTV case.

Fix the involved functions that call ether_print() to pass the correct
value and leave a comment to dismiss "caplen" later as its value can be
reliably derived from the other ether_print() parameters.
2017-01-18 09:16:41 +01:00
Denis Ovsienko
409ffe9452 CVE-2017-5341/OTV: add missing bounds checks
Interleave the bounds checking with printing to make it visible which
last protocol field was OK. This fixes a vulnerability discovered by
Brian Carpenter.
2017-01-18 09:16:41 +01:00
Denis Ovsienko
d6913f7e3f CVE-2017-5204/IPv6: fix header printing
Add a few checks to ip6_print() to make it stop decoding the IPv6
headers immediately when the header-specific functions signal an error
condition. Without this it tried to fetch the next header selector for
the next round regardless and could run outside of the allocated packet
space on a specially crafted IPv6 packet.

Brian Carpenter has demonstrated this for the Hop-by-Hop Options header.
Fix that specific case and also the Destination Options and Fragment
header processing as those use the same logic.
2017-01-18 09:16:41 +01:00
Denis Ovsienko
4804e66125 TCP: put TCP-AO option decoding right
As it was correctly pointed out in GitHub issue #516, the TCPOPT_TCPAO
(formerly TCPOPT_AUTH) case had an issue with option length processing,
though without significant consequences thanks to a check elsewhere.
Besides that, the old code (introduced in 2005) decoded a structure
similar to a proposed encoding variant of the early (first published in
2007) revisions of the Internet-Draft but different from the encoding
of RFC 5925 (published in 2010). These issues are now addressed and the
TCP option renamed to TCP-AO.
2017-01-18 09:16:41 +01:00
Denis Ovsienko
e9ac8b2c85 amend the TCP authentication test case
Edit the .pcap file to change the TCP option kind from 20 to 29 to
match the changes done to the decoder. Now the code flow and hence
the text output are back to how they were before that change.
2017-01-18 09:16:41 +01:00
Denis Ovsienko
6b09339831 TCP: add a test case for the previous commit
The SCPS TCP option is malformed as discussed in GitHub issue #516 and
is printed as such. The .pcap file was contributed by Patrik Lundquist.
2017-01-18 09:16:41 +01:00
Guy Harris
d3a64d8365 Do better checking of RESP packets.
Don't call strtol() on the contents of a packet; there is *no* guarantee
that it won't run past the end of the buffer, as the buffer isn't a
null-terminated string.  Instead, have our own routine to parse ASCII
numbers (based on the FreeBSD strtol()), which uses ND_TCHECK() and
checks against the on-the-wire length to ensure it doesn't go past the
end of the packet or the end of the captured data.  Have it check for
other errors as well, such as checking for negative lengths that aren't
-1.

Clean up other aspects of the packet parsing.  Have them check the
on-the-wire length as well as the captured length.

Update the results of the resp_3 test.
2017-01-18 09:16:41 +01:00
Guy Harris
3b841a3852 Update the test results.
The output is different with some recent changes.
2017-01-18 09:16:40 +01:00
Francois-Xavier Le Bail
c37100fd4c Add a test file for a previous fix
Fix was: "Don't overflow the Opaque_Handle buffer."
2017-01-18 09:16:40 +01:00
Guy Harris
ed0237af69 Adjust for fix to TCP option printout. 2017-01-18 09:16:39 +01:00
Guy Harris
ce9bc5af51 Tests for Frame Relay problems.
The problems were found by Hanno Böck with American Fuzzy Lop.
2017-01-18 09:16:39 +01:00
Francois-Xavier Le Bail
9281ad283a Fix indentation in "make check" output 2017-01-18 09:16:39 +01:00
Francois-Xavier Le Bail
81c7798d00 ISOCLNS: Manage a test as GCC-specific 2017-01-18 09:16:39 +01:00
Francois-Xavier Le Bail
56844d158c Update a test output for a previous fix
Fix was: "RSVP: Add bounds and length checks"
(commit 2bdecbfb10)
2017-01-18 09:16:39 +01:00
Francois-Xavier Le Bail
266489c6c9 Add a test file for a previous fix
Fix was: "OSPF: Fix a segmentation fault"
(commit 046f10da38)
2017-01-18 09:16:39 +01:00
Francois-Xavier Le Bail
b3c215000f Add a test file for a previous fix
Fix was: "UDLD: Fix an infinite loop"
(commit 9759a5bc71)
2017-01-18 09:16:39 +01:00
Francois-Xavier Le Bail
cb922d07cc CVE-2016-7934,7935,7937/RTP: Fix two segmentation faults
Add two test files for these fixes.
Add more bounds checks in VAT, RTP and RTCP printers.

Moreover:
Add and use *_tstr[] strings.
Update the output of a test accordingly.
Remove spaces before tabs.
2017-01-18 09:16:39 +01:00
Francois-Xavier Le Bail
8343c39e2f Add a test file for the previous fix 2017-01-18 09:16:39 +01:00
Francois-Xavier Le Bail
8d8f0953cd STP: Remove trailing spaces in output 2017-01-18 09:16:39 +01:00
Francois-Xavier Le Bail
5cb03afb57 STP: Filter out non-printable characters
Use fn_printzp().

Moreover:
Add a missing comma in output.
Use ND_TCHECK_32BITS instead of ND_TTEST_32BITS.
Add a test for spb_bpduv4.pcap with verbose output.
2017-01-18 09:16:38 +01:00
Francois-Xavier Le Bail
51557701bf Add a test file for a previous fix
Fix was: "ISOCLNS: Fix a segmentation fault"
(commit be8e9c9dea)
2017-01-18 09:16:38 +01:00
Francois-Xavier Le Bail
54c0c24b22 Add test files for a previous fix
Fix was: "ISOCLNS: Fix two segmentation faults"
(commit 8db57a4b90)

Moreover:
group together IS-IS tests.
Fix typos.
2017-01-18 09:16:38 +01:00
Francois-Xavier Le Bail
9ad34901e9 Fix the interface capture length of some fuzzed pcap files
They will be always usable with the new interface capture length sanity
check.
(old length: 808464432, new length: 262144)
2017-01-18 09:16:38 +01:00
Francois-Xavier Le Bail
75f84b8eec Fix the file capture length of a fuzzed pcap file
It will be always usable with the new file capture length sanity check.
(old length: 808464432, new length: 262144)
2017-01-18 09:16:38 +01:00
Francois-Xavier Le Bail
3fea8eb0be Add test file for a previous fix
Fix was: "RSVP: Fix an infinite loop"
(commit d7d269e8c6)
2017-01-18 09:16:38 +01:00
Francois-Xavier Le Bail
29d28b1a3f Fix the pcap version in some tests/ fuzzed pcap files
They will be always usable with the upcoming libpcap versions sanity checks.
pcap: old version: 12336.12336, new version: 2.4
pcap-ng: old version: 1.12336, new version: 1.0
2017-01-18 09:16:38 +01:00
Guy Harris
07a361befe Tests for the relts changes. 2017-01-18 09:16:38 +01:00
Guy Harris
7bf069c251 CVE-2016-7983,7984/Don't use strchr() to scan packet data.
It can't be told to stop at the end of the packet data.  Add a
fn_printztn() that prints null-terminated strings, with a length check,
and which returns the number of bytes processed, or 0 if we ran out of
data.  That means it does the scanning we need, but safely.

Use it in the TFTP and BOOTP printers.

Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:37 +01:00
Guy Harris
5e48a55754 CVE-2016-7929/Make sure a Juniper header TLV isn't bigger than what's left in the packet.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:37 +01:00
Guy Harris
64f6392084 CVE-2016-7923/Don't assume the target hardware address is <= 6 octets long.
It might not be, either because an unusual hardware type is using ARP or
because a maliciously-constructed packet was sent.  Instead of comparing
against a 6-octet string of zeros with memcmp(), check each octet of the
address against 0.

Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:37 +01:00
Guy Harris
968776fbf5 CVE-2016-7940/Add a bunch of bounds checks, and fix some printing.
The bounds checks fix some heap overflows found with American Fuzzy Lop
by Hanno Böck.

Add some ND_TTEST_/ND_TCHECK_ macros to extract.h to simplify writing
bounds checks for code that uses the other macros in that file.

Fix the printing of the SPB BPDU agreement digest - I don't think the
intent was to print the value of the first 4 bytes, that value + 4, that
value + 8, etc., I suspect it was to print the first 4 bytes, the next 4
bytes, etc..
2017-01-18 09:16:37 +01:00
Guy Harris
e8a7716282 CVE-2016-7974/Don't try to dissect something with other than 4 as the IP version.
Bad Things could happen, e.g. the dissector we call thinking it's been
handed an IPv6 header when we haven't handed it anything that large.

Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.

Update some .out files to correspond to that change.
2017-01-18 09:16:37 +01:00
Guy Harris
69ead2a09c CVE-2016-7931/Add bounds and length checks.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
b56aab3862 CVE-2016-7973/Add bounds and length checks.
Fixes heap overflows found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
cb696b8e91 CVE-2016-7936/Add a bounds check.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
9845aa1860 CVE-2016-7930/Add a bounds check.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
a36c495ef4 CVE-2016-7928/Check whether we have the CPI before we fetch it.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
ec88d36bcd CVE-2016-7975/Make sure we have the data offset field before fetching it.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
d9dbb118f2 CVE-2016-7924/Add some bounds checks.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.

Also, get rid of the return value for oam_print(), as it's not used and
not useful.
2017-01-18 09:16:36 +01:00
Guy Harris
6b8ed9649e CVE-2016-7975/Fix another bounds check.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
8be5413f3a CVE-2016-7926/Do some additional bounds checking before calling isoclns_print().
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
da946bdc6c CVE-2016-7927/Do bounds checking on last_presentp before dereferencing it.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
6bc44295cf CVE-2016-7985,7986/Change the way protocols print link-layer addresses.
If a protocol that runs under a link-layer protocol would print the
link-layer addresses for the packet as source and destination addresses
for the packet, don't have it blithely assume those link-layer addresses
are present or are at a particular offset from the beginning of that
protocol's data; Ethertypes, for example, are used by a number of
protocols, not all of which have Ethernet headers and not all of which
have any MAC headers.

Instead, pass the printers for those protocols structures with a pointer
to the address data and a pointer to a routine that prints the address.

Fixes some heap overflows found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
237efcf593 CVE-2016-7939/Add some bounds checks.
Fixes heap overflows found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:36 +01:00
Guy Harris
99806d08b7 Update test output for the previous change. 2017-01-18 09:16:36 +01:00
Guy Harris
3e00e6a4b8 CVE-2016-7975/Fix a bounds check.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:35 +01:00
Guy Harris
df259cada3 CVE-2016-7932/Add some bounds checking.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:35 +01:00
Guy Harris
3998839886 CVE-2016-7974/Add an additional bounds check.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:35 +01:00
Guy Harris
c4744fc29a CVE-2016-7925/Add more bounds checks.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:35 +01:00
Guy Harris
f6ae2501fe CVE-2016-7933/Add some bounds checks.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:35 +01:00
Guy Harris
b3d1e972e0 Another test for the print-atalk.c fix. 2017-01-18 09:16:35 +01:00
Guy Harris
5356a9ea69 CVE-2016-7973/Add some bounds checks.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:35 +01:00
Guy Harris
4ef024c8e9 CVE-2016-7992/When comparing against an LLC+SNAP header, check only the bytes we have.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.

Fix a length value to be unsigned while we're at it.
2017-01-18 09:16:35 +01:00
Guy Harris
98f666f243 CVE-2016-7974/Check before fetching the IP protocol version.
Fixes a heap overflow found with American Fuzzy Lop by Hanno Böck.
2017-01-18 09:16:35 +01:00
Denis Ovsienko
b39c831bf2 Revert "TCP: add a test case for the previous commit"
This reverts commit cfb06c27a2.
2017-01-18 09:16:35 +01:00
Eliot Lear
01e8e1485f Implement IANA OUI and LLDP MUD option
The changes associated with this commit introduce the IANA subtree
for LLDP and its first element, the MUDURL, as documented in
draft-ietf-opsawg-mud.  This is similar to the changes made for
DHCP and DHCPv6.

[updated to use fn_printn]
2016-12-31 08:17:55 +01:00
Eliot Lear
38fce5474f Updated to include dhcp-mud tests. 2016-12-08 15:00:03 +01:00
Eliot Lear
890cd83ed7 These are test files for Manufacturer Usage Descriptions and an updated test list. 2016-12-08 14:53:46 +01:00
Denis Ovsienko
cfb06c27a2 TCP: add a test case for the previous commit
The SCPS TCP option is malformed as discussed in GitHub issue #516 and
is printed as such. The .pcap file was contributed by Patrik Lundquist.
2016-11-01 15:16:11 +00:00
Pier Carlo Chiodi
e2adb166ec BGP: Update LARGE_COMMUNITY Path Attribute early allocation IANA value
Update test files accordingly
2016-10-27 10:24:36 +02:00
Denis Ovsienko
a8e7abd8ea update a comment in TESTonce 2016-10-17 17:14:02 +01:00
Michael Haardt
d08a095df2 add a test case for the previous commit 2016-10-16 21:45:22 +01:00
Francois-Xavier Le Bail
151c0cb295 Add a test file for BGP LARGE_COMMUNITY Path Attribute 2016-10-13 11:26:47 +02:00
Francois-Xavier Le Bail
90dc6cb575 IPv6 mobility: Fix printing of 'truncated' string
Moreover:
Fix spaces before tabs
2016-10-09 20:38:57 +02:00
Antonin Décimo
0f4d2ff49f HNCP: update test file 2016-09-02 14:18:31 +02:00
Francois-Xavier Le Bail
4e01870063 RPKI-RTR: Remove printing when truncated condition already detected
Moreover:
Remove redundant 'truncated' messages.
Add and use tstr[].
Update output of some tests accordingly.
2016-08-18 13:59:52 +02:00
Francois-Xavier Le Bail
19ea00958b BFD: Update to print optional authentication field
Moreover:
Add test files with 'Simple Password', 'Keyed MD5' and
'Meticulous Keyed SHA1' authentications.
Update specification from draft to RFC 5881 for BFD_CONTROL_PORT and
BFD_ECHO_PORT in udp.h.
Add specification RFC 5881 in print-bfd.c.
2016-08-17 11:46:54 +02:00
Michael Richardson
db752b7f79 Merge pull request #534 from MisterDA/hncp-20160728
HNCP support (RFCs 7787 and 7788)
2016-07-29 16:38:05 +02:00
Jean-Raphaël GAGLIONE
0a9a602a8c Add test for HNCP. 2016-07-28 21:22:31 +02:00
Michael Richardson
292d58b784 dagid is always an IPv6 address, not an opaque 128-bit string 2016-07-09 17:22:18 -04:00
Guy Harris
549aab2173 Use strtol(), not atoi(), to parse integral values.
strtol()'s error behavior is standardized; atoi()'s isn't.
2016-04-26 03:04:21 -07:00
Andrew Darqui
fc213645d4 Initial support for the REdis Serialization Protocol known as RESP.
This commit adds support for RESP as defined in: http://redis.io/topics/protocol.
It also supports inline commands and pipelining. Due to the popularity of RESP,
numerous services are emerging that use this protocol. You may decode RESP packets
on arbitrary ports using the "-T resp" option.

Example captures can be found in tests/resp_*.

A simple way to test this parser is to start redis-server and then run
redis-cli commands such as "redis-cli set key value".

Traditionally, redis-cli monitor is used to debug redis. Unfortunately,
the "monitor" command can cause significant load on a redis-server in
production. This parser may be used as a non-invasive alternative to
redis-cli monitor.
2016-04-26 11:00:21 +02:00
bugyo
ba8a8cd5a3 Add printing function for Generic Protocol Extension for VXLAN
and Network Service Header.

This code stands for following internet drafts:

- VXLAN GPE: draft-ietf-nvo3-vxlan-gpe-01
- NSH: draft-ietf-sfc-nsh-01
2016-03-22 16:59:03 +01:00
Francois-Xavier Le Bail
35e410ca1f Add three test cases for already fixed CVEs
CVEs by Steffen Bauch
CVE-2014-8767: OLSR
CVE-2014-8768: Geonet
CVE-2014-8769: AODV
2016-02-06 15:26:14 +01:00
Francois-Xavier Le Bail
fdc13e28cf VXLAN: Add a test case 2016-01-31 11:34:39 +01:00
Guy Harris
ea1182b7f3 Fix the radiotap printer to handle the special bits correctly.
Process bits 29, 30, and 31 in code that's independent of what namespace
we're in:

  If we're switching to the radiotap namespace, reset the bit numbers to
  start back at 0.

  If we're switching to a vendor namespace, get the vendor OUI and
  subspace, and the skip length.

  Keep trace of which namespace we're in.

  If we're *in* a vendor namespace, skip over the data specified by the
  skip length (and reset it, as we've processed all the vendor namespace
  data and, if there's a subsequent bitmap in the same namespace,
  there's nothing more to process.  Use cpack_align_and_reserve() to
  skip that, so we check that we don't go past the end of the packet
  data.

Fixes GitHub tcpdump issue #498.

This removes some bogus errors; update the test output to reflect that.
2016-01-11 15:47:31 -08:00
Francois-Xavier Le Bail
b713410ff2 Ethernet: Print the Length/Type field as length when needed
Reference: IEEE Std 802.3-2012
"If the value of this field is less than or equal to 1500 decimal
(05DC hexadecimal), then the Length/Type field indicates the number
of MAC client data octets contained in the subsequent MAC Client Data
field of the basic frame (Length interpretation)."

Update the output of a test accordingly.
2015-12-16 15:59:39 +01:00
Herwin Weststrate
266720f258 Translate UDP/1700 as RADIUS
Used for Cisco CoA/Disconnect, as shown on https://supportforums.cisco.com/discussion/11719766/ise-112-change-authorization-avaya-switches-5520. The RFC says port 3799, but Cisco does this otherwise, which means this is not an officially reserved port for RADIUS.
2015-12-15 18:42:04 +01:00
Francois-Xavier Le Bail
4b870b6496 Add missing output files for MPLS/ICMP extensions capture file
Add the test cases accordingly.
Complete Hannes's commit fad6704f63.
2015-11-27 15:25:35 +01:00
Francois-Xavier Le Bail
ba983e34ca LISP: Add and use istr[] and tstr[] strings
Update the output of a test accordingly.

Moreover:
Delete extra blank lines.
2015-11-21 10:41:05 +01:00
Francois-Xavier Le Bail
9759a5bc71 UDLD: Fix an infinite loop
Moreover:
Update reference from draft to RFC5171.
Add bounds and length checks.
Fix TLV length printout. It is the length of the type, length, and value
fields.
Filter out non-printable characters.
Print the Echo TLV with fn_printn(). Note: The format of this list of ID
pairs is not documented in the RFC.
Update the output of a test accordingly.
Add and use istr[] and tstr[] strings.
Comment on the TLV format.
Update some comments.
2015-11-20 20:23:11 +01:00
Francois-Xavier Le Bail
f06ad54406 RADIUS: Filter out non-printable characters
Update a test according to this change.
2015-11-09 20:09:04 +01:00
Francois-Xavier Le Bail
8db57a4b90 ISOCLNS: Fix two segmentation faults
Moreover:
Add/fix a lot of bounds and length checks.
Add and use tstr[] string.
Fix some typos.
Update the output of a test according to these changes.
2015-10-17 22:54:47 +02:00
Gisle Vanem
2862abfda0 Fix a test name 2015-10-15 16:55:22 +02:00
Francois-Xavier Le Bail
8e23441356 Add missing output files for LSP-Ping capture files 2015-10-13 16:31:45 +02:00
Francois-Xavier Le Bail
5ef7141caa Add test files for pcap-ng invalid versions 2015-10-10 18:54:46 +02:00
Francois-Xavier Le Bail
9cb72d9469 Add test files for pcap invalid versions 2015-10-10 18:22:22 +02:00
Francois-Xavier Le Bail
e32088572e Fix the pcap version in tests/cve2015-0261-crash.pcap
It will be always usable with the upcoming libpcap versions sanity checks.
(old version: 12336.12336, new version: 2.4)
2015-10-10 14:36:08 +02:00
Francois-Xavier Le Bail
eea2b6d5dd LISP: We always support IPv6 addresses now
INET6 is no more used.
2015-10-05 09:25:46 +02:00
ritsz
823644a72d Initial commit for support of Type 3 and Type 4 LISP packets.
Fixing Travis CI build for LISP commit

Adding testcases for lisp notify and register

Fixing build warnings

Added ND_TCHECK for relevant headers

Fixing ND_TCHECK2 issues

Adding support for multiple LOC records for same EID entry

Fixing review issues, adding detailed tests

Adding support for verbose outputs

Adding RFC information for UDP PORT defination

Removing Spaces in type names

Print EID record related flags in verbose mode

Using tok2str

Fixing -Wpedantic issues

Negative testcases, Packet structure comments, verbose mode flag printing

Printing Map Version

Print auth_data, decouple type and xtr_present extraction, handle malformed packets correctly

Tests for latest code changes

Printing useful info incase not built with IPv6 support
2015-10-04 12:47:13 +02:00
Guy Harris
c632b5f3d1 Fix check for MCS field being present.
Fix test file while we're at it.
2015-09-28 20:09:53 -07:00
Guy Harris
5da6c2b8c9 Update tests for 11n fix. 2015-09-28 18:50:40 -07:00
Francois-Xavier Le Bail
d52f811775 The Option -n is useless in TESTLIST
This option is already set in TESTonce.
2015-09-17 10:16:59 +02:00
Francois-Xavier Le Bail
7ea344d76a Use the word 'invalid' for 'malformed' or 'corrupted' packets
An invalid packet could be:
1) built malformed originally by the sender or a fuzz tester,
2) became corrupted in transit.
2015-09-06 13:44:54 +02:00
Guy Harris
668e3cf744 Fix to reflect dBm radiotap values now being displayed as "dBm" rather than "dB". 2015-08-26 12:01:28 -07:00
Guy Harris
05c341d86b Add a test that makes unaligned accesses.
From GitHub issue #478, in which tcpdump crashed on SPARC due to making
an unaligned access.
2015-08-25 11:18:38 -07:00
Denis Ovsienko
a128ac4e04 update the DNSSEC test case after the last change 2015-07-10 11:57:24 +01:00
Denis Ovsienko
47294c7678 add a DNSSEC test case
This is related to GH #445 and GH #467.
2015-07-10 11:53:33 +01:00
Francois-Xavier Le Bail
ab941c35f9 BGP: Add support for the AIGP attribute (RFC7311)
Based on a patch from Hannes Gredler
2015-05-22 12:41:40 +02:00
Hannes Gredler
9ab2f17922 Merge branch 'master' of github.com:the-tcpdump-group/tcpdump 2015-05-20 19:30:11 +02:00
Hannes Gredler
f449a39c38 add testcases for IS-IS POI (rfc6232) 2015-05-20 19:29:29 +02:00
Francois-Xavier Le Bail
ce1470b1ac Update test output for the previous change 2015-05-19 20:25:16 +02:00
Ferry Huberts
672112b1f4 olsr: add a test to cover a HNA sgw case
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
2015-05-03 17:30:47 +02:00
Francois-Xavier Le Bail
8da466fa75 MEDSA: fix indent 2015-04-25 22:44:15 +02:00