Bug 1802786 (CVE-2020-7221) - CVE-2020-7221 mariadb: mysql_install_db allows privilege escalation due to unsafe chown and chmod operations
Summary: CVE-2020-7221 mariadb: mysql_install_db allows privilege escalation due to un...
Alias: CVE-2020-7221
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
Depends On: 1802788 1802787
Blocks: 1802789
TreeView+ depends on / blocked
Reported: 2020-02-13 20:42 UTC by Guilherme de Almeida Suckevicz
Modified: 2020-02-25 19:47 UTC (History)
21 users (show)

Fixed In Version: mariadb 10.5.1, mariadb 10.4.12
Doc Type: If docs needed, set a value
Doc Text:
A privilege escalation vulnerability was found in MariaDB, in the way it handled a `setuid` program during the installation process. A local MySQL user could abuse this flaw to escalate their privileges on the system, by gaining root privileges once the bash script `mysql_install_db.sh` is executed.
Clone Of:
Last Closed: 2020-02-24 15:39:14 UTC

Attachments (Terms of Use)

Description Guilherme de Almeida Suckevicz 2020-02-13 20:42:00 UTC
mysql_install_db in MariaDB 10.4.7 through 10.4.11 allows privilege escalation from the mysql user account to root because chown and chmod are performed unsafely, as demonstrated by a symlink attack on a chmod 04755 of auth_pam_tool_dir/auth_pam_tool. NOTE: this does not affect the Oracle MySQL product, which implements mysql_install_db differently.


Upstream commit:

Comment 1 Guilherme de Almeida Suckevicz 2020-02-13 20:43:20 UTC
Created mariadb tracking bugs for this issue:

Affects: fedora-all [bug 1802787]
Affects: openstack-rdo [bug 1802788]

Comment 2 Mauro Matteo Cascella 2020-02-24 14:47:39 UTC
Plugin `auth_pam_tool` was introduced in MariaDB upstream version 10.4.0 with the following commits:

The setuid permission was set in MariaDB upstream version 10.4.7 with commit:

Comment 3 Mauro Matteo Cascella 2020-02-24 15:26:47 UTC

This flaw did not affect the versions of MariaDB as shipped with Red Hat Enterprise Linux 7, and 8 as they did not include the vulnerable code, which was introduced in a newer version of the package. The same is true for the versions of MariaDB as shipped with Red Hat Software Collections 3.

Note You need to log in before you can comment on or make changes to this bug.