CVE-2017-16997
High · 7.8CVSS
7.8
EPSS
2.9%
Published
Dec 18, 2017
CISA due date
—
Cloudanix analysis
A common library used by almost every Linux program can be tricked by a logged-in user into running attacker code with full system privileges.
- Exploitation
- Local Privilege
- Attacker needs
- Local User
- Complexity
- Low
- Impact
- Privilege Gain
- Component
- Library
- Class
- Privilege Escalation
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The flaw in glibc's dl-load.c mishandles $ORIGIN tokens within RPATH/RUNPATH entries for setuid or AT_SECURE binaries, treating an empty token as the current working directory and allowing a local attacker to force loading of an attacker-controlled shared library.
Why it matters to the business
Local users on affected Linux systems can obtain root or elevated privileges, enabling full host compromise, data theft, or persistence that disrupts operations and requires incident response.
How an attack unfolds
An attacker compiles a malicious shared library, places it in a writable directory, and executes a privileged binary whose RPATH/RUNPATH contains $ORIGIN or an empty token; glibc then loads the Trojan library, granting elevated privileges without authentication.
How to fix it
Upgrade the GNU C Library to a version later than 2.26 on all affected distributions; rebuild and redeploy any custom setuid binaries that embed $ORIGIN in RPATH/RUNPATH; remove or harden such binaries where possible.
How to confirm the fix worked
Verify installed glibc version is newer than 2.26; scan setuid binaries for RPATH/RUNPATH entries containing $ORIGIN or empty tokens using readelf or objdump; confirm no untrusted libraries are loaded when executing those binaries from unprivileged directories.
Typical attack path
- Identify or create a setuid binary whose RPATH/RUNPATH includes $ORIGIN or an empty token
- Place a malicious library with the expected soname in the current working directory
- Execute the setuid binary so that glibc resolves and loads the attacker library
- Execute arbitrary code with the privileges of the setuid binary owner
How to detect it
Review process execution logs and library load events for setuid binaries; search for unexpected shared objects appearing in user-writable directories at the same time as elevated-privilege process starts; correlate with authentication or sudo logs for local sessions.
What your security team should do
- Apply glibc updates immediately across all Linux hosts
- Audit and rebuild any internally developed setuid or AT_SECURE programs
- Restrict write access to directories containing setuid binaries
- Enable SELinux or AppArmor to limit library loading for privileged processes
The record
elf/dl-load.c in the GNU C Library (aka glibc or libc6) 2.19 through 2.26 mishandles RPATH and RUNPATH containing $ORIGIN for a privileged (setuid or AT_SECURE) program, which allows local users to gain privileges via a Trojan horse library in the current working directory, related to the fillin_rpath and decompose_rpath functions. This is associated with misinterpretion of an empty RPATH/RUNPATH token as the "./" directory. NOTE: this configuration of RPATH/RUNPATH for a privileged program is apparently very uncommon; most likely, no such program is shipped with any common Linux distribution.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | glibc | 0 | 2.25-6 |
| Debian:12 | glibc | 0 | 2.25-6 |
| Debian:13 | glibc | 0 | 2.25-6 |
| Mageia:5 | glibc | 0 | 2.20-27.mga5 |
| Mageia:6 | glibc | 0 | 2.22-27.mga6 |
| Mageia:6 | locales | 0 | 2.22-7.mga6 |
| Red Hat:enterprise_linux:7::client | glibc | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::client | glibc-common | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::client | glibc-debuginfo | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::client | glibc-debuginfo-common | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::client | glibc-devel | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::client | glibc-headers | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::client | glibc-static | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::client | glibc-utils | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::client | nscd | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::computenode | glibc | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::computenode | glibc-common | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::computenode | glibc-debuginfo | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::computenode | glibc-debuginfo-common | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::computenode | glibc-devel | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::computenode | glibc-headers | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::computenode | glibc-static | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::computenode | glibc-utils | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::computenode | nscd | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::server | glibc | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::server | glibc-common | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::server | glibc-debuginfo | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::server | glibc-debuginfo-common | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::server | glibc-devel | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::server | glibc-headers | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::server | glibc-static | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::server | glibc-utils | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::server | nscd | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::workstation | glibc | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::workstation | glibc-common | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::workstation | glibc-debuginfo | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::workstation | glibc-debuginfo-common | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::workstation | glibc-devel | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::workstation | glibc-headers | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::workstation | glibc-static | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::workstation | glibc-utils | 0 | 0:2.17-260.el7 |
| Red Hat:enterprise_linux:7::workstation | nscd | 0 | 0:2.17-260.el7 |
| SUSE:Linux Enterprise Desktop 12 SP2 | glibc | 0 | 2.22-62.3.4 |
| SUSE:Linux Enterprise Desktop 12 SP3 | glibc | 0 | 2.22-62.3.4 |
| SUSE:Linux Enterprise Server 12 SP2 | glibc | 0 | 2.22-62.3.4 |
| SUSE:Linux Enterprise Server 12 SP3 | glibc | 0 | 2.22-62.3.4 |
| SUSE:Linux Enterprise Server for Raspberry Pi 12 SP2 | glibc | 0 | 2.22-62.3.4 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP2 | glibc | 0 | 2.22-62.3.4 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP3 | glibc | 0 | 2.22-62.3.4 |
| SUSE:Linux Enterprise Software Development Kit 12 SP2 | glibc | 0 | 2.22-62.3.4 |
| SUSE:Linux Enterprise Software Development Kit 12 SP3 | glibc | 0 | 2.22-62.3.4 |
| Ubuntu:14.04:LTS | eglibc | 0 | 2.19-0ubuntu6.14 |
| Ubuntu:16.04:LTS | glibc | 0 | 2.23-0ubuntu10 |
| Ubuntu:18.04:LTS | glibc | 0 | 2.27-3ubuntu1 |
| openSUSE:Tumbleweed | glibc | 0 | 2.34-1.2 |
Related vulnerabilities
- CVE-2021-35942 The wordexp function in the GNU C Library (aka glibc) through 2.33 may crash or read… Also affects glibc
- CVE-2021-3326 The iconv function in the GNU C Library (aka glibc or libc6) 2.32 and earlier, when… Also affects glibc
- CVE-2020-1752 A use-after-free vulnerability introduced in glibc upstream version 2.14 was found in the… Also affects glibc
- CVE-2020-10029 The GNU C Library (aka glibc or libc6) before 2.32 could overflow an on-stack buffer… Also affects glibc
- CVE-2009-5155 In the GNU C Library (aka glibc or libc6) before 2.28, parse_reg_exp in posix/regcomp.c… Also affects glibc
- CVE-2019-9169 In the GNU C Library (aka glibc or libc6) through 2.29, proceed_next_node in… Also affects glibc
- CVE-2017-15804 The glob function in glob.c in the GNU C Library (aka glibc or libc6) before 2.27… Also affects glibc
- CVE-2017-15671 The glob function in glob.c in the GNU C Library (aka glibc or libc6) before 2.27, when… Also affects glibc