Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 702488 (CVE-2019-18276) - <app-shells/bash-5.0_p11-r1: when effective UID is not equal to its real UID the saved UID is not dropped (CVE-2019-18276)
Summary: <app-shells/bash-5.0_p11-r1: when effective UID is not equal to its real UID ...
Alias: CVE-2019-18276
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Gentoo Security
Whiteboard: B1 [glsa+ cve]
Depends on:
Reported: 2019-12-10 18:52 UTC by Hank Leininger
Modified: 2021-05-26 10:30 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Hank Leininger 2019-12-10 18:52:01 UTC
CVE-2019-18276 (

  An issue was discovered in disable_priv_mode in shell.c in GNU Bash through
  5.0 patch 11. By default, if Bash is run with its effective UID not equal to
  its real UID, it will drop privileges by setting its effective UID to its real
  UID. However, it does so incorrectly. On Linux and other systems that support
  "saved UID" functionality, the saved UID is not dropped. An attacker with
  command execution in the shell can use "enable -f" for runtime loading of a
  new builtin, which can be a shared object that calls setuid() and therefore
  regains privileges. However, binaries running with an effective UID of 0 are

Note I think actual exposure to this should be minor, because setuid bash is a bad idea anyway, and the normal way for a privileged process (sshd, /bin/login, etc.) to launch bash as a user is to fork, drop privs, and then exec.  If they do so correctly, bash won't have any privs to misuse; if they do not, that is a bug in them.

There is a patch sitting in bash's devel branch, mixed in with other changes:

The latest release version, 5.0_p11, does not include the fix (despite p11 being released well after that fix was added to devel).

I will submit a PR that includes a trimmed-down version of this patch to include only the relevant fixes.
Comment 1 Sam James archtester gentoo-dev Security 2020-05-02 22:11:35 UTC

"The vulnerability requires suid what we don't do and therefore is not exploitable on reasonable configurations."

@maintainer(s), is this included in bug 719942?
Comment 2 Mike Gilbert gentoo-dev 2020-05-03 02:39:00 UTC
(In reply to Sam James (sec padawan) from comment #1)
> @maintainer(s), is this included in bug 719942?

I don't believe so.
Comment 3 John Helmert III gentoo-dev Security 2021-01-07 00:25:30 UTC
Appears to have been fixed in the release of Bash 5.1. From changelog (

	- disable_priv_mode: if we have setres[ug]id, use them over
	  set[ug]id, which only set the save user-id and group-id if the
	  process is running as root. From Ian Eldred Pudney

So, we're waiting on stabilization.
Comment 4 NATTkA bot gentoo-dev 2021-01-07 00:29:15 UTC Comment hidden (obsolete)
Comment 5 Lars Wendler (Polynomial-C) gentoo-dev 2021-01-07 00:31:42 UTC
app-shells/bash-5.1* is not yet ready for stabilization!
Comment 6 NATTkA bot gentoo-dev 2021-01-07 00:33:12 UTC Comment hidden (obsolete)
Comment 7 Larry the Git Cow gentoo-dev 2021-01-07 00:48:47 UTC
The bug has been referenced in the following commit(s):

commit ba53be405112d10b85e88cc2637156804b88bd91
Author:     Hank Leininger <>
AuthorDate: 2019-12-11 22:06:45 +0000
Commit:     Lars Wendler <>
CommitDate: 2021-01-07 00:48:45 +0000

    app-shells/bash: fix CVE-2019-18276 (priv-dropping bug)
    Cherry-picked the relevant parts of
    and modified the patches to apply.
    Note that the existing bash-5.0*patch files are applied with -p0, which
    is not the norm for eapply, etc.  I simply followed what was required
    to work with the rest of the existing patches.
    Signed-off-by: Hank Leininger <>
    Package-Manager: Portage-2.3.81, Repoman-2.3.18
    Signed-off-by: Lars Wendler <>

 app-shells/bash/bash-5.0_p11-r1.ebuild             | 266 +++++++++++++++++++++
 .../files/bash-5.0_p11-disable_priv_mode.patch     |  85 +++++++
 2 files changed, 351 insertions(+)
Comment 8 Sam James archtester gentoo-dev Security 2021-01-07 02:35:37 UTC
x86 done
Comment 9 Sam James archtester gentoo-dev Security 2021-01-07 05:10:00 UTC
ppc done
Comment 10 Sam James archtester gentoo-dev Security 2021-01-07 05:10:21 UTC
arm64 done
Comment 11 Sam James archtester gentoo-dev Security 2021-01-07 05:10:36 UTC
arm done
Comment 12 Sam James archtester gentoo-dev Security 2021-01-07 10:05:26 UTC
amd64 done
Comment 13 Sam James archtester gentoo-dev Security 2021-01-07 11:13:19 UTC
ppc64 done
Comment 14 Sam James archtester gentoo-dev Security 2021-01-10 09:34:45 UTC
sparc done
Comment 15 Rolf Eike Beer 2021-01-17 12:34:44 UTC
hppa stable
Comment 16 Sam James archtester gentoo-dev Security 2021-01-24 04:33:06 UTC
s390 done

all arches done
Comment 17 Thomas Deutschmann gentoo-dev Security 2021-05-25 19:19:37 UTC
New GLSA request filed.
Comment 18 GLSAMaker/CVETool Bot gentoo-dev 2021-05-26 10:30:59 UTC
This issue was resolved and addressed in
 GLSA 202105-34 at
by GLSA coordinator Thomas Deutschmann (whissi).