CVE-2017-18078 : Détail

CVE-2017-18078

7.8
/
Haute
A01-Broken Access Control
0.06%V3
Local
2018-01-29
04h00 +00:00
2021-06-29
12h09 +00:00
Notifications pour un CVE
Restez informé de toutes modifications pour un CVE spécifique.
Gestion des notifications

Descriptions du CVE

systemd-tmpfiles in systemd before 237 attempts to support ownership/permission changes on hardlinked files even if the fs.protected_hardlinks sysctl is turned off, which allows local users to bypass intended access restrictions via vectors involving a hard link to a file for which the user lacks write access, as demonstrated by changing the ownership of the /etc/passwd file.

Informations du CVE

Faiblesses connexes

CWE-ID Nom de la faiblesse Source
CWE-59 Improper Link Resolution Before File Access ('Link Following')
The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.

Métriques

Métriques Score Gravité CVSS Vecteur Source
V3.1 7.8 HIGH CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Base: Exploitabilty Metrics

The Exploitability metrics reflect the characteristics of the thing that is vulnerable, which we refer to formally as the vulnerable component.

Attack Vector

This metric reflects the context by which vulnerability exploitation is possible.

Local

The vulnerable component is not bound to the network stack and the attacker’s path is via read/write/execute capabilities.

Attack Complexity

This metric describes the conditions beyond the attacker’s control that must exist in order to exploit the vulnerability.

Low

Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success when attacking the vulnerable component.

Privileges Required

This metric describes the level of privileges an attacker must possess before successfully exploiting the vulnerability.

Low

The attacker requires privileges that provide basic user capabilities that could normally affect only settings and files owned by a user. Alternatively, an attacker with Low privileges has the ability to access only non-sensitive resources.

User Interaction

This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable component.

None

The vulnerable system can be exploited without interaction from any user.

Base: Scope Metrics

The Scope metric captures whether a vulnerability in one vulnerable component impacts resources in components beyond its security scope.

Scope

Formally, a security authority is a mechanism (e.g., an application, an operating system, firmware, a sandbox environment) that defines and enforces access control in terms of how certain subjects/actors (e.g., human users, processes) can access certain restricted objects/resources (e.g., files, CPU, memory) in a controlled manner. All the subjects and objects under the jurisdiction of a single security authority are considered to be under one security scope. If a vulnerability in a vulnerable component can affect a component which is in a different security scope than the vulnerable component, a Scope change occurs. Intuitively, whenever the impact of a vulnerability breaches a security/trust boundary and impacts components outside the security scope in which vulnerable component resides, a Scope change occurs.

Unchanged

An exploited vulnerability can only affect resources managed by the same security authority. In this case, the vulnerable component and the impacted component are either the same, or both are managed by the same security authority.

Base: Impact Metrics

The Impact metrics capture the effects of a successfully exploited vulnerability on the component that suffers the worst outcome that is most directly and predictably associated with the attack. Analysts should constrain impacts to a reasonable, final outcome which they are confident an attacker is able to achieve.

Confidentiality Impact

This metric measures the impact to the confidentiality of the information resources managed by a software component due to a successfully exploited vulnerability.

High

There is a total loss of confidentiality, resulting in all resources within the impacted component being divulged to the attacker. Alternatively, access to only some restricted information is obtained, but the disclosed information presents a direct, serious impact. For example, an attacker steals the administrator's password, or private encryption keys of a web server.

Integrity Impact

This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information.

High

There is a total loss of integrity, or a complete loss of protection. For example, the attacker is able to modify any/all files protected by the impacted component. Alternatively, only some files can be modified, but malicious modification would present a direct, serious consequence to the impacted component.

Availability Impact

This metric measures the impact to the availability of the impacted component resulting from a successfully exploited vulnerability.

High

There is a total loss of availability, resulting in the attacker being able to fully deny access to resources in the impacted component; this loss is either sustained (while the attacker continues to deliver the attack) or persistent (the condition persists even after the attack has completed). Alternatively, the attacker has the ability to deny some availability, but the loss of availability presents a direct, serious consequence to the impacted component (e.g., the attacker cannot disrupt existing connections, but can prevent new connections; the attacker can repeatedly exploit a vulnerability that, in each instance of a successful attack, leaks a only small amount of memory, but after repeated exploitation causes a service to become completely unavailable).

Temporal Metrics

The Temporal metrics measure the current state of exploit techniques or code availability, the existence of any patches or workarounds, or the confidence in the description of a vulnerability.

Environmental Metrics

These metrics enable the analyst to customize the CVSS score depending on the importance of the affected IT asset to a user’s organization, measured in terms of Confidentiality, Integrity, and Availability.

[email protected]
V2 4.6 AV:L/AC:L/Au:N/C:P/I:P/A:P [email protected]

EPSS

EPSS est un modèle de notation qui prédit la probabilité qu'une vulnérabilité soit exploitée.

Score EPSS

Le modèle EPSS produit un score de probabilité compris entre 0 et 1 (0 et 100 %). Plus la note est élevée, plus la probabilité qu'une vulnérabilité soit exploitée est grande.

Percentile EPSS

Le percentile est utilisé pour classer les CVE en fonction de leur score EPSS. Par exemple, une CVE dans le 95e percentile selon son score EPSS est plus susceptible d'être exploitée que 95 % des autres CVE. Ainsi, le percentile sert à comparer le score EPSS d'une CVE par rapport à d'autres CVE.

Informations sur l'Exploit

Exploit Database EDB-ID : 43935

Date de publication : 2018-01-28 23h00 +00:00
Auteur : Michael Orlitzky
EDB Vérifié : No

Product: systemd (systemd-tmpfiles) Versions-affected: 236 and earlier Author: Michael Orlitzky Fixed-in: commit 5579f85 , version 237 Bug-report: https://github.com/systemd/systemd/issues/7736 Acknowledgments: Lennart Poettering who, instead of calling me an idiot for not realizing that systemd enables fs.protected_hardlinks by default, went out of his way to harden the non-default configuration. == Summary == Before version 237, the systemd-tmpfiles program will change the permissions and ownership of hard links. If the administrator disables the fs.protected_hardlinks sysctl, then an attacker can create hard links to sensitive files and subvert systemd-tmpfiles, particularly with "Z" type entries. Systemd as PID 1 with the default fs.protected_hardlinks=1 is safe. == Details == When running as PID 1, systemd enables the fs.protected_hardlinks sysctl by default; that prevents an attacker from creating hard links to files that he can't write to. If, however, the administrator should decide to disable that sysctl, then hard links may be created to any file (on the same filesystem). Before version 237, the systemd-tmpfiles program will voluntarily change the permissions and ownership of a hard link, and that is exploitable in a few scenarios. The most problematic and easiest to exploit is the "Z" type tmpfiles.d entry, which changes ownership and permissions recursively. For an example, consider the following tmpfiles.d entries, d /var/lib/systemd-exploit-recursive 0755 mjo mjo Z /var/lib/systemd-exploit-recursive 0755 mjo mjo Whenever systemd-tmpfiles is run, those entries make mjo the owner of everything under and including /var/lib/systemd-exploit-recursive. After the first run, mjo can create a hard link inside that directory pointing to /etc/passwd. The next run (after a reboot, for example) changes the ownership of /etc/passwd. A proof-of-concept can be run from the systemd source tree, using either two separate terminals or sudo: root # sysctl -w fs.protected_hardlinks=0 root # sysctl -w kernel.grsecurity.linking_restrictions=0 root # ./build/systemd-tmpfiles --create mjo $ ln /etc/passwd /var/lib/systemd-exploit-recursive/x root # ./build/systemd-tmpfiles --create mjo $ /bin/ls -l /etc/passwd -rwxr-xr-x 2 mjo mjo 1504 Dec 20 14:27 /etc/passwd More elaborate exploits are possible, and not only the "Z" type is vulnerable. == Resolution == The recursive change of ownership/permissions does not seem to be safely doable without fs.protected_hardlinks enabled. In version 237 and later, systemd-tmpfiles calls fstatat() immediately after obtaining a file descriptor from open(): fd = open(path, O_NOFOLLOW|O_CLOEXEC|O_PATH); if (fd < 0) { ... } if (fstatat(fd, "", &st, AT_EMPTY_PATH) < 0) The st->st_nlink field is then checked to determine whether or not fd describes a hard link. If it does, the ownership/permissions are not changed, and an error is displayed: if (hardlink_vulnerable(&st)) { log_error("Refusing to set permissions on hardlink...", path); return -EPERM; } There is still a tiny window between open() and fstatat() where the attacker can fool this countermeasure by removing an existing hard link to, say, /etc/passwd. In that case, st->st_nlink will be 1, but fd still references /etc/passwd. The attack succeeds, but is much harder to do, and the window is as narrow as possible. More to the point, it seems unavoidable when implementing the tmpfiles.d specification. == Mitigation == Leave the fs.protected_hardlinks sysctl enabled.

Products Mentioned

Configuraton 0

Systemd_project>>Systemd >> Version To (excluding) 237

Configuraton 0

Debian>>Debian_linux >> Version 8.0

Configuraton 0

Opensuse>>Leap >> Version 42.3

Références

http://www.openwall.com/lists/oss-security/2018/01/29/3
Tags : mailing-list, x_refsource_MLIST
https://www.exploit-db.com/exploits/43935/
Tags : exploit, x_refsource_EXPLOIT-DB
https://www.openwall.com/lists/oss-security/2018/01/29/4
Tags : mailing-list, x_refsource_MLIST