Commit Graph

211 Commits

Author SHA1 Message Date
Guy Harris
b20e1639db CVE-2017-13026/IS-IS: Clean up processing of subTLVs.
Add bounds checks, do a common check to make sure we captured the entire
subTLV, add checks to make sure the subTLV fits within the TLV.

This fixes a buffer over-read discovered by Bhargava Shastry,
SecT/TU Berlin.

Add tests using the capture files supplied by the reporter(s), modified
so the capture files won't be rejected as an invalid capture.

Update existing tests for changes to IS-IS dissector.
2017-09-13 12:25:44 +01:00
Guy Harris
c177cb3800 CVE-2017-13016/ES-IS: Fix printing of addresses in RD PDUs.
Always print the SNPA, and flag it as such; only print it as a MAC
address if it's 6 bytes long.

Identify the NET as such.

This fixes a buffer over-read discovered by Bhargava Shastry,
SecT/TU Berlin.

Add tests using the capture files supplied by the reporter(s), modified
so the capture files won't be rejected as an invalid capture.
2017-09-13 12:25:44 +01:00
Guy Harris
979dcefd7b CVE-2017-12998/IS-IS: Check for 2 bytes if we're going to fetch 2 bytes.
Probably a copy-and-pasteo.

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
3b32029db3 CVE-2017-12999/IS-IS: Add a missing length check.
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
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
Hannes Gredler
ff8464bffd zero change: update Hannes Gredler's email 2017-07-28 17:44:12 +02:00
Guy Harris
8432c2a9f3 Cast ISIS_COMMON_HEADER_SIZE to u_int before printing it with %u.
It's a sizeof, so it's not necessarily the right size for %u.
2017-06-05 13:37:24 -07:00
Guy Harris
c88fd3333f Get rid of last printer use of ndo_snaplen. 2017-06-02 20:06:29 -07: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
Guy Harris
fe62ab3744 Clean up white space. 2017-01-18 09:16:42 +01:00
Guy Harris
b553848e3e CVE-2017-5486/Do ND_TCHECK2 bounds checks on source and destination addresses.
Those are needed in addition to the checks against li.

This should fix GitHub issue #562.  I suspect issue #563 is a separate
problem.

Tweak length check messages to be more like the IS-IS ones, and fix both
to print unsigned values with %u, while we're at it.
2017-01-18 09:16:42 +01:00
Guy Harris
8851b44c8d Add more checks.
Check that the destination and source addresses are present before
printing them.

Check the length value from the length indiator as we dissect the CLNS
header.  Make sure that header doesn't go past the on-the-network length
of the packet.

Check to make sure an option's content doesn't go past the length of the
option.

Also, don't print the body of an unknown option type twice with -vv and
more.
2017-01-18 09:16:41 +01:00
Francois-Xavier Le Bail
909fb30769 CVE-2017-5202/ISOCLNS: Add two bounds checks
This fix GitHub issue #558
2017-01-18 09:16:41 +01:00
Francois-Xavier Le Bail
8a47f3a757 Avoid reinventing ND_TCHECK or ND_TCHECK2 2016-09-24 16:43:50 +02:00
Francois-Xavier Le Bail
11d3a01319 Move the printer summaries from INSTALL.txt to each printer
with the tag '\summary:' for greping.
Remark: Currently some printers have no summary line.

Moreover:
Summarize all printers with a single line in INSTALL.txt
2016-08-14 17:03:43 +02:00
Guy Harris
7b1cba646d If HAVE_LIBCRYPTO isn't defined, define a stub signature_verify().
That cleans up its callers.
2015-12-27 18:09:33 -08:00
Guy Harris
c995065620 We no longer need <stdlib.h> as signature_verify() does the allocation now. 2015-12-27 18:00:30 -08:00
Guy Harris
59caec8a01 Have signature_verify() do the copying and clearing.
Just pass it a pointer to a routine to do the clearing and a pointer to
the data that needs to be cleared; signature_verify() will relocate all
pointers to stuff that needs to be cleared to point into the copy, clear
the signature itself, and call the routine to clear anything else.
2015-12-27 17:59:56 -08:00
Guy Harris
20f164f5e4 Don't overwrite packet data when checking the signature.
Instead, make a copy, and overwrite that.
2015-12-27 16:58:52 -08:00
Francois-Xavier Le Bail
255a101c7e ISOCLNS: Filter out non-printable characters
Use fn_printzp().

Moreover:
Delete extra blank lines.
2015-11-11 15:48:20 +01:00
Francois-Xavier Le Bail
be8e9c9dea ISOCLNS: Fix a segmentation fault
Moreover:
Avoid two consecutive truncation messages.
2015-11-04 23:10:49 +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
Guy Harris
11f73ad248 Don't require IPv6 library support in order to support IPv6 addresses.
Have our own routines to convert between IPv4/IPv6 addresses and
strings; that helps if, for example, we want to build binary versions of
tcpdump for Windows that can run both on NT 5 (W2K/WXP), which doesn't
have inet_ntop() or inet_pton(), and NT 6 (Vista/7/8/10), which do.  It
also means that we don't require IPv6 library support on UN*X to print
addresses (if somebody wants to build tcpdump for older UN*Xes lacking
IPv6 support in the system library or in add-on libraries).

Get rid of files in the missing directory that we don't need, and
various no-longer-necessary autoconf tests.
2015-09-17 14:56:44 -07:00
Francois-Xavier Le Bail
99c91c3aec Rename 'tcpdump-stdinc.h' to 'netdissect-stdinc.h'
Get the full log via: git log --follow netdissect-stdinc.h
2015-09-10 08:50:40 +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
Francois-Xavier Le Bail
c1c3c77463 Printers must include 'netdissect.h', not 'interface.h' 2015-09-05 23:35:58 +02:00
Francois-Xavier Le Bail
e847135d66 Functions in libnetdissect must use ndo_error() function 2015-09-05 22:52:11 +02:00
Francois-Xavier Le Bail
bf88d85d00 ISOCLNS: Fix some warnings
The warnings were:
./print-isoclns.c: In function 'osi_print_cksum':
./print-isoclns.c:3107:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             || length > ndo->ndo_snaplen
                       ^
./print-isoclns.c:3108:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             || checksum_offset > ndo->ndo_snaplen
                                ^
2015-07-14 20:53:32 +02:00
Hannes Gredler
be03cc0b4a add support for IS-IS Purge Originator Identifier as per RFC6232. 2015-05-19 15:49:40 +02:00
Guy Harris
bce91cc243 Fix one more de-constifying cast. 2015-04-28 10:55:24 -07:00
Guy Harris
30870e3e2a Not all C compilers accept C++/C99 comments by default.
Use "#if 0" instead to comment out code.
2015-04-13 18:32:17 -07:00
Denis Ovsienko
38700c7f24 dismiss NETDISSECT_REWORKED macro
The purpose of this macro was to enable the file-by-file switch to NDO,
after which only tcpdump.c had a use of it and the definitions guarded
by it. Update tcpdump.c not to require them any more and dismiss the
unused definitions.
2015-03-22 10:06:15 +00:00
Guy Harris
ca9a02c55e Add a missing space to a printout.
Fix some warnings while we're at it.
2015-03-11 12:51:32 -07:00
Michael Richardson
2d26a39f67 protected osi_print_cksum is more general fashion 2015-03-10 23:14:34 -07:00
Michael Richardson
364b00185b some patches to deal with kday pcap files
Author:    Michael Richardson <mcr@sandelman.ca>
2015-03-10 23:13:30 -07:00
Denis Ovsienko
60a835d80f clean K&R style up in function declarations a bit
The function body should have its opening brace on the next line.
2015-03-05 10:35:03 +00:00
Guy Harris
840d0bb8b4 Don't run past the snaplength when printing a packet with a too-short LI.
Fixes GitHub issue #437.
2015-03-01 11:01:14 -08:00
Guy Harris
efe8a2be5a Squelch a Coverity warning.
For unknown PDU types, we return 0 whether print_unknown_data() succeeds
or fails; don't bother checking whether it succeeds, Just Do It.
2015-02-06 11:42:00 -08:00
Guy Harris
a6f81d534d Leave it up to ip6_print() to handle non-IPv6-capable systems.
Always define and declare ip6_print(), always compile print-ip6.c, and
always call it if we recognize a payload as IPv6.  If INET6 isn't
defined, ip6_print() will just print the length and note that printing
isn't supported.

That way, we don't do weird dissection of IPv6 packets on systems
without IPv6 support, due to, for example, ethertype_print() returning 0
("not dissected") for IPv6 packets on those systems (IPv6-over-Frame
Relay was dissected weirdly due to this).
2014-10-01 15:32:11 -07:00
Guy Harris
ed85e20e4d u_intN_t is dead, long live uintN_t.
And, as we require at least autoconf 2.61, and as autoconf 2.61 and
later have AC_TYPE_UINTn_T and AC_TYPE_INTn_T macros, we use them to
define the uintN_t and intN_t macros if the system doesn't define them
for us.

This lets us get rid of bitypes.h as well.
2014-04-23 00:20:40 -07:00
Guy Harris
1cde6435df Netdissectify the to-name resolution routines.
Have them take a netdissect_options * argument, and get the "no name
resolution" flag from it.

Move the declaration of dnaddr_string to addrtoname.h, along with the
other XXX-to-string routines.
2014-04-04 00:43:46 -07:00
Denis Ovsienko
8863fc0e5d NDOize some generic code 2014-04-03 17:43:33 +04:00
Denis Ovsienko
fc6f112b40 NDOize LLDP, PPP and RSVP decoders 2014-04-02 18:22:28 +04:00
Denis Ovsienko
5797b57c44 improve some recent conversions 2014-03-29 08:35:54 +04:00
Denis Ovsienko
2210a967cb NDOize ISO CLNS decoder 2014-03-28 14:08:48 +04:00
Denis Ovsienko
bed843855d NDOize Frame Relay, LMP and RADIUS decoders 2014-03-18 16:30:50 +04:00
Guy Harris
6bfa3ea6aa Fix a compiler warning.
It's not necessarily safe to do pre-increment or post-increment in an
argument to an EXTRACT_ macro.
2014-02-01 14:08:25 -08:00
Denis Ovsienko
fe3253b9b8 remove tcpdump's own CVS keywords
Remove lots of $Header's and a few $Id's that all belong to the former
CVS repository of tcpdump itself. These keywords have been frozen since
the migration to git in late 2008.
2014-01-03 00:59:08 +04:00
Michael Richardson
ac910c086e ndo-ize print-ascii: hex_print_with_offset() 2014-01-01 21:31:18 -05:00
Michael Richardson
a97fb2f3ae whitespace changes 2014-01-01 21:31:18 -05:00