Bug 1760457 (CVE-2018-14879)

Summary: CVE-2018-14879 tcpdump: out of bounds read/write in in get_next_file() in tcpdump.c
Product: [Other] Security Response Reporter: Pedro Sampaio <psampaio>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: luhliari, mlichvar, mruprich, msehnout, msekleta, thozza
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tcpdump 4.9.3 Doc Type: If docs needed, set a value
Doc Text:
A out-of-bounds write was discovered in tcpdump while reading the file passed to the -V option of the command line program. An attacker may trick a victim user into using a malicious file with the -V option, which would make the program read one byte before a stack-based allocated buffer and potentially write a NULL byte to it.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1791694, 1791695, 1760626    
Bug Blocks: 1760628    

Description Pedro Sampaio 2019-10-10 15:09:33 UTC
The command-line argument parser in tcpdump before 4.9.3 has a buffer overflow in tcpdump.c:get_next_file().

Upstream patch:

https://github.com/the-tcpdump-group/tcpdump/commit/9ba91381954ad325ea4fd26b9c65a8bd9a2a85b6

References:

https://github.com/the-tcpdump-group/tcpdump/blob/tcpdump-4.9/CHANGES

Comment 1 Pedro Sampaio 2019-10-11 00:01:46 UTC
Created tcpdump tracking bugs for this issue:

Affects: fedora-all [bug 1760626]

Comment 2 Riccardo Schirone 2020-01-15 11:10:44 UTC
tcpdump provides the `V` flag when you want to provide a list of filenames to use, either by stdin or by reading the content of a file. The attack scenario for this flaw is an attacker who tricks a victim user into executing `tcpdump -V` on a malicious file with a NULL byte as a first byte. This would make the program read one byte before the expected stack-allocated buffer and potentially write back a NULL byte in that same position.

This could cause other effects and potentially execute code on the victim' system.

Comment 3 Riccardo Schirone 2020-01-15 11:14:41 UTC
Given what said in comment 2:
- AV:L: the attack would be Local because the user should download the malicious file first and then run `tcpdump -V` on it
- UI:R: it is necessary that the victim user runs the program himself, an attacker cannot perform the attack without him doing something
- C:H/I:H/A:H: an out-of-bounds read+write on the stack could potentially lead to code execution
- AC:H: the complexity is High as the attacker cannot directly influence what's written outside the buffer and he would need anyway to bypass security measures as ASLR, at least (not assuming data-only attacks).