Resolves: RHEL-7858 - tcpslice: use-after-free in extract_slice()
This commit is contained in:
parent
09efe12c8e
commit
e13a9bf2e7
48
0019-CVE-2021-41043.patch
Normal file
48
0019-CVE-2021-41043.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From 030859fce9c77417de657b9bb29c0f78c2d68f4a Mon Sep 17 00:00:00 2001
|
||||
From: Denis Ovsienko <denis@ovsienko.info>
|
||||
Date: Thu, 30 Dec 2021 17:52:52 +0000
|
||||
Subject: [PATCH] CVE-2021-41043: Fix a use-after-free in extract_slice().
|
||||
|
||||
This issue was discovered by Mohammad Hosein Askari (@C0NSTANTINE110),
|
||||
see GitHub issue #11.
|
||||
|
||||
In extract_slice() pcap_dump_open() takes a pcap_t argument to tell
|
||||
which DLT to use for the output file. This used to be the pcap_t of the
|
||||
first input file, as main() requires at least one input file. However,
|
||||
the loop before pcap_dump_open() closes all, including the first, input
|
||||
files that don't meet a test condition. This way, when the first file
|
||||
didn't meet the condition, the call to pcap_dump_open() would end up as
|
||||
a use-after-free. Make the pcap_dump_open() call before the loop, when
|
||||
the first array element is always valid, and fix this problem.
|
||||
---
|
||||
diff --git a/tcpslice-1.2a3/tcpslice.c b/tcpslice-1.2a3/tcpslice.c
|
||||
index 6d08473..7c0f4a0 100644
|
||||
--- a/tcpslice-1.2a3/tcpslice.c
|
||||
+++ b/tcpslice-1.2a3/tcpslice.c
|
||||
@@ -841,6 +841,13 @@ extract_slice(struct state *states, const int numfiles, const char *write_file_n
|
||||
TV_SUB(start_time, base_time, &relative_start);
|
||||
TV_SUB(stop_time, base_time, &relative_stop);
|
||||
|
||||
+ /* Always write the output file, use the first input file's DLT. */
|
||||
+ dumper = pcap_dump_open(states[0].p, write_file_name);
|
||||
+ if (!dumper) {
|
||||
+ error("error creating output file '%s': %s",
|
||||
+ write_file_name, pcap_geterr(states[0].p));
|
||||
+ }
|
||||
+
|
||||
for (i = 0; i < numfiles; ++i) {
|
||||
s = &states[i];
|
||||
|
||||
@@ -879,12 +886,6 @@ extract_slice(struct state *states, const int numfiles, const char *write_file_n
|
||||
get_next_packet(s);
|
||||
}
|
||||
|
||||
- dumper = pcap_dump_open(states->p, write_file_name);
|
||||
- if (! dumper) {
|
||||
- error( "error creating output file %s: ",
|
||||
- write_file_name, pcap_geterr( states->p ) );
|
||||
- }
|
||||
-
|
||||
|
||||
/*
|
||||
* Now, loop thru all the packets in all the files,
|
||||
@ -2,7 +2,7 @@ Summary: A network traffic monitoring tool
|
||||
Name: tcpdump
|
||||
Epoch: 14
|
||||
Version: 4.9.3
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
License: BSD with advertising
|
||||
URL: http://www.tcpdump.org
|
||||
Group: Applications/Internet
|
||||
@ -28,6 +28,7 @@ Patch0015: 0015-CVE-2020-8037.patch
|
||||
Patch0016: 0016-direction-for-any.patch
|
||||
Patch0017: 0017-pgm-fix-the-way-we-step-through-the-packet.patch
|
||||
Patch0018: 0018-pgm-don-t-advance-bp-by-the-option-haeder-length-twi.patch
|
||||
Patch0019: 0019-CVE-2021-41043.patch
|
||||
|
||||
%define tcpslice_dir tcpslice-1.2a3
|
||||
|
||||
@ -93,6 +94,9 @@ exit 0
|
||||
%{_mandir}/man8/tcpdump.8*
|
||||
|
||||
%changelog
|
||||
* Fri Jan 05 2024 Michal Ruprich <mruprich@redhat.com> - 14:4.9.3-5
|
||||
- Resolves: RHEL-7858 - tcpslice: use-after-free in extract_slice()
|
||||
|
||||
* Wed Nov 01 2023 Pavol Žáčik <pzacik@redhat.com> - 14:4.9.3-4
|
||||
- Resolves: RHEL-10708 - Fix PGM option printing
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user