Commit Graph

4797 Commits

Author SHA1 Message Date
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
3c4d7c0ee3 CVE-2017-13725/IPv6 R.H.: Check for the existence of all fields before fetching them.
Don't fetch the length field from the header until after we've checked
for the existence of a field at or after that field.

(Found by code inspection, not by a capture.)
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
Denis Ovsienko
a1eefe9860 CVE-2017-13687/CHDLC: Improve bounds and length checks.
Prevent a possible buffer overread in chdlc_print() and replace the
custom check in chdlc_if_print() with a standard check in chdlc_print()
so that the latter certainly does not over-read even when reached via
juniper_chdlc_print(). Add length checks.
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
0d8f07921a Clean up pcap_findalldevs() call to find the first interface.
If it returns -1, it's an error; report the error.

If it returns 0, but the list is empty, that's not an error in
pcap_findalldevs(); report it explicitly as "no interfaces available for
capture".
2017-09-09 10:39:50 -07:00
Herwin Weststrate
df13dce54d Added RADIUS attributes from RFC7155
Originating Line Info (94)
2017-09-07 20:48:59 +01:00
Herwin Weststrate
e398c5f1bf Added RADIUS attributes from RFC4849
NAS Filter Rule (92)
2017-09-07 20:48:59 +01:00
Guy Harris
c724af9222 MSVC doesn't allow __declspec(noreturn) to be applied to function pointers. 2017-09-06 11:02:15 -07:00
Denis Ovsienko
19961761ae Travis CI: enable fast_finish
This will signal the build failure as soon as any job has failed
(libpcap has this enabled already).
2017-09-06 11:11:44 +01:00
Denis Ovsienko
74e12dfb8d AppleTalk: Address a few cppcheck style notices.
[print-atalk.c:283]: (style) The scope of the variable 'c' can be
reduced.
[print-atalk.c:380]: (style) The scope of the variable 'c' can be
reduced.
[print-atalk.c:360]: (style) Variable 'c' is assigned a value that is
never used.
2017-09-06 09:58:36 +01:00
Denis Ovsienko
eb02553274 ForCES: Fix undefined behaviour in op_valid().
[print-forces.c:316] -> [print-forces.c:323]: (warning) Shifting 32-bit
value by 32767 bits is undefined behaviour. See condition at line 323.
[print-forces.c:316]: (error) Shifting by a negative value is undefined
behaviour
2017-09-06 00:52:57 +01:00
Denis Ovsienko
2dfa645e86 ForCES: Fixup a cppcheck style notice.
[print-forces.c:281]: (style) Checking if unsigned variable 'opt' is
less than zero.
2017-09-06 00:31:29 +01:00
Denis Ovsienko
2c1666e522 syslog: squelch a cppcheck warning (GH #568)
[print-syslog.c:98]: (style) Array index 'msg_off' is used before limits
check.

Even though this is a false positive in this specific case, let's not
have it around, this will make it less likely missing a real one.
2017-09-05 23:03:21 +01:00
Denis Ovsienko
80deba151a NTP: Add missing bounds checks.
This change adds checks that were missing from the recent NTP code and
could cause a buffer over-read vulnerability (see earlier commits for
rationale).
2017-09-04 12:40:36 +01:00
Denis Ovsienko
0dd013253d NTP: Update length checks after the recent commit.
Rename NTP_MSG_MINLEN to NTP_TIMEMSG_MINLEN for clarity and introduce and
use NTP_CTRLMSG_MINLEN. With this change ntp_control_print() can detect
invalid packets better.
2017-09-04 12:31:26 +01:00
Denis Ovsienko
60128eebca NTP: Use nd_XXXXX integer types in the structures.
This prevents alignment issues when the structures are used to access
the input buffer (see earlier commits for more detailed rationale).
2017-09-04 12:31:20 +01:00
Denis Ovsienko
febd0bc5aa NTP: Use tstr for truncation indicator.
This implements the same convention as in all other decoders.
2017-09-04 12:30:20 +01:00
Ulrich Windl
c2e2a18f27 print-ntp.c: Handle NTP Control Messages
In print-ntp.c:
Rename struct ntpdata into struct ntp_time_data and add new
struct ntp_control_data to map NTP Control messages.

Add figure of NTP Control Message Header as comment.

Add union ntpdata to provide a common view on NTP messages.

Rename ntp_print() to ntp_time_print(), using new structures.
Improve comment and re-arrange fields in ntp_print().

Add ntp_control_print() to handle NTP Control Messages.
Output R, E, M, OpCode, Sequence, Status, Assoc, Offset, and Count in
ntp_control_print().

A new ntp_print() will decode only the very basics (VN, LI and Mode)
to call ntp_time_print() or ntp_control_print(), depending on Mode.
2017-09-04 11:52:16 +01:00
Guy Harris
c78c621010 Squelch a warning.
poll() is a system API on UN*Xes, so calling a variable "poll" causes
"declaration of 'poll' shadows a global declaration" warnings in some
compilers.  Call the argument "poll_interval" instead.
2017-09-04 00:42:14 -07:00
Guy Harris
8dda56aa5a We also turn of *all* protocol name resolution with -n. 2017-09-03 12:12:23 -07:00
Denis Ovsienko
069b2e3920 Mention more changes for the future 4.9.2 release. 2017-09-03 12:12:42 +01: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
Denis Ovsienko
e40c0ca2d9 Add a section for future 4.9.2 release to CHANGES. 2017-09-02 21:36:44 +01:00
Guy Harris
6f0750ee0c Make the ESP decryption not crash with OpenSSL 1.1.
While we're at it, free the cipher context if we fail to allocate the
output buffer for decryption.
2017-09-01 04:00:38 -07:00
Guy Harris
0d2cdb5dad The cipher context must be initialized before we can get the block size. 2017-08-31 00:03:59 -07: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