Go to file
maxv 71ad96023a Fix a buffer overflow in ip6_get_prevhdr. Doing
mtod(m, char *) + len

is wrong, an option is allowed to be located in another mbuf of the chain.
If the offset of an option within the chain is bigger than the length of
the first mbuf in that chain, we are reading/writing one byte of packet-
controlled data beyond the end of the first mbuf.

The length of this first mbuf depends on the layout the network driver
chose. In the most difficult case, it will allocate a 2KB cluster, which
is bigger than the Ethernet MTU.

But there is at least one way of exploiting this case: by sending a
special combination of nested IPv6 fragments, the packet can control a
good bunch of 'len'. By luck, the memory pool containing clusters does not
embed the pool header in front of the items, so it is not straightforward
to predict what is located at 'mtod(m, char *) + len'.

However, by sending offending fragments in a loop, it is possible to
crash the kernel - at some point we will hit important data structures.

As far as I can tell, PF protects against this difficult case, because
it kicks nested fragments. NPF does not protect against this. IPF I don't
know.

Then there are the more easy cases, if the MTU is bigger than a cluster,
or if the network driver did not allocate a cluster, or perhaps if the
fragments are received via a tunnel; I haven't investigated these cases.

Change ip6_get_prevhdr so that it returns an offset in the chain, and
always use IP6_EXTHDR_GET to get a writable pointer. IP6_EXTHDR_GET
leaves M_PKTHDR untouched.

This place is still fragile.
2018-01-30 14:49:25 +00:00
bin Remove trailing whitespace and Tn macro. 2018-01-27 18:59:38 +00:00
common Add bunch of missing includes of namespace.h in libc 2018-01-04 20:57:28 +00:00
compat
crypto Fixed potential NULL pointer dereference (CID: 978477) 2018-01-30 13:11:28 +00:00
dist/pf Add DragonFly BSD fingerprints. 2017-12-16 07:52:08 +00:00
distrib Shrink ramdisk to fit INSTALL kernel within 5MB: 2018-01-28 01:09:57 +00:00
doc Note import of dhcpcd-7.0.1 2018-01-29 11:14:12 +00:00
etc Remove port-acorn26 2018-01-24 09:04:40 +00:00
external Sync 2018-01-29 11:13:06 +00:00
extsrc
games Don't skip the superfluous "is" argument if it's not superfluous! 2018-01-17 03:03:59 +00:00
include Merge autofs support from: Tomohiro Kusumi 2018-01-09 03:31:12 +00:00
lib Merge tzcode2018c [ changelog with changes to tzdata sections removed ] 2018-01-25 22:48:42 +00:00
libexec Use a protocol-agnostic URL (don't degrade HTTPS->HTTP) 2018-01-28 13:37:39 +00:00
regress Don't test call gates, they are not supported anymore. 2017-08-30 15:46:19 +00:00
rescue Extra flags for static PIE 2017-10-08 15:02:33 +00:00
sbin It's not literal "-options" so use .Ar 2018-01-24 12:04:47 +00:00
share explain how to allow coverity to use sysroot 2018-01-27 23:59:17 +00:00
sys Fix a buffer overflow in ip6_get_prevhdr. Doing 2018-01-30 14:49:25 +00:00
tests implement 32-bit compat support for raidframe. 2018-01-18 00:32:48 +00:00
tools Remove port-acorn26 2018-01-24 09:04:40 +00:00
usr.bin drop main() prototype 2018-01-23 22:12:52 +00:00
usr.sbin Cosmetics: fix the order of calloc() arguments. 2018-01-29 16:24:23 +00:00
build.sh Remove port-acorn26 2018-01-24 09:04:40 +00:00
BUILDING regen 2017-12-29 03:05:13 +00:00
Makefile Include somewhat misleadingly named do-x11 into BUILDTARGETS even with 2017-12-06 19:34:00 +00:00
Makefile.inc
UPDATING Minor tweak to the vadvise entry. 2017-12-27 08:29:02 +00:00