Skip to content

Commit

Permalink
CVE-2017-12899/DECnet: Fix bounds checking.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
guyharris authored and infrastation committed Sep 13, 2017
1 parent 19d25dd commit c6e0531
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions print-decnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ decnet_print(netdissect_options *ndo,
length -= padlen;
caplen -= padlen;
rhp = (const union routehdr *)&(ap[sizeof(short)]);
ND_TCHECK(rhp->rh_short.sh_flags);
mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags);
}

Expand Down Expand Up @@ -613,6 +614,7 @@ print_decnet_ctlmsg(netdissect_options *ndo,
register const union routehdr *rhp, u_int length,
u_int caplen)
{
/* Our caller has already checked for mflags */
int mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags);
register const union controlmsg *cmp = (const union controlmsg *)rhp;
int src, dst, info, blksize, eco, ueco, hello, other, vers;
Expand Down
1 change: 1 addition & 0 deletions tests/TESTLIST
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ hoobr_safeputs hoobr_safeputs.pcap hoobr_safeputs.out
isakmp-rfc3948-oobr isakmp-rfc3948-oobr.pcap isakmp-rfc3948-oobr.out
isoclns-oobr isoclns-oobr.pcap isoclns-oobr.out
nfs-attr-oobr nfs-attr-oobr.pcap nfs-attr-oobr.out
decnet-oobr decnet-oobr.pcap decnet-oobr.out

# bad packets from Wilfried Kirsch
slip-bad-direction slip-bad-direction.pcap slip-bad-direction.out -ve
Expand Down
4 changes: 4 additions & 0 deletions tests/decnet-oobr.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
30:30:30:30:30:30 > 30:30:30:30:30:30, ethertype Unknown (0x3030), length 808464432:
0x0000: 3030 3030 3030 3030 3030 3030 3030 3030 0000000000000000
0x0010: 3030 3030 0000
MEDSA 16.6:48: [|decnet]
Binary file added tests/decnet-oobr.pcap
Binary file not shown.

0 comments on commit c6e0531

Please sign in to comment.