Bug 1628754 (CVE-2018-16741)

Summary: CVE-2018-16741 mgetty: command injection in faxrunq
Product: [Other] Security Response Reporter: Laura Pardo <lpardo>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: abhgupta, dbaker, jokerman, msekleta, rschiron, sthangav, trankin, zdohnal
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
A command injection flaw was discovered in mgetty in the faxrunq script used to send queued faxes. The shell script faxrunq does not properly escape the arguments passed to faxsend before evaluating the command allowing a user, who has permissions to queue faxes in the system, to execute arbitrary command with elevated privileges.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-25 22:16:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1628755, 1630791    
Bug Blocks: 1628756    
Attachments:
Description Flags
upstream patch none

Description Laura Pardo 2018-09-13 21:44:43 UTC
An issue was discovered in mgetty before 1.2.1. The shell script faxrunq does not properly escape arguments passed to faxsend and that may lead to command injection. A local user may use faxq-helper to sneak in some shell metacharacters (e.g. ||, &&, >) in the fax job file, that will be later parsed by faxrunq.


References:
https://lists.debian.org/debian-lts-announce/2018/09/msg00012.html
https://www.x41-dsec.de/lab/advisories/x41-2018-007-mgetty/

Comment 1 Laura Pardo 2018-09-13 21:45:04 UTC
Created mgetty tracking bugs for this issue:

Affects: fedora-all [bug 1628755]

Comment 3 Riccardo Schirone 2018-09-19 09:26:14 UTC
Created attachment 1484634 [details]
upstream patch

This patch was extracted from mgetty-1.2.1

Comment 4 Riccardo Schirone 2018-09-19 09:30:40 UTC
faxrunq SHELL script does not properly escape the parameters before evaluating
the command to send the fax, thus the characters that sneak in thanks to loose
checks in faxq-helper.c:do_activate() can be used to inject commands.

Comment 6 Riccardo Schirone 2018-09-19 09:35:01 UTC
Mitigation:

Allow only trusted users to run the faxq-helper binary, by correctly setting the /etc/mgetty+sendfax/fax.allow configuration file.

Comment 7 Riccardo Schirone 2018-09-19 09:36:31 UTC
By default /etc/mgetty+sendfax/fax.allow does not exist on RHEL and only root is allowed to run faxq-helper binary, thus only root can exploit this flaw.

Comment 8 Fedora Update System 2019-02-27 01:15:26 UTC
mgetty-1.1.37-10.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2019-02-27 03:28:16 UTC
mgetty-1.1.37-11.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.