CVE-2022-26835 - Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Severity

49%

Complexity

12%

Confidentiality

60%

On F5 BIG-IP 16.1.x versions prior to 16.1.2.2, 15.1.x versions prior to 15.1.5.1, 14.1.x versions prior to 14.1.4.6, 13.1.x versions prior to 13.1.5, and all versions of 12.1.x and 11.6.x, directory traversal vulnerabilities exist in undisclosed iControl REST endpoints and TMOS Shell (tmsh) commands in F5 BIG-IP Guided Configuration, which may allow an authenticated attacker with at least resource administrator role privileges to read arbitrary files. Note: Software versions which have reached End of Technical Support (EoTS) are not evaluated

CVSS 3.1 Base Score 4.9. CVSS Attack Vector: network. CVSS Attack Complexity: low. CVSS Vector: (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N).

CVSS 2.0 Base Score 4. CVSS Attack Vector: network. CVSS Attack Complexity: low. CVSS Vector: (AV:N/AC:L/Au:S/C:P/I:N/A:N).

Demo Examples

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

CWE-22

The following code could be for a social networking application in which each user's profile information is stored in a separate file. All files are stored in a single directory.


               
print "</ul>\n";
print "<li>$_</li>\n";

While the programmer intends to access files such as "/users/cwe/profiles/alice" or "/users/cwe/profiles/bob", there is no verification of the incoming user parameter. An attacker could provide a string such as:


               
../../../etc/passwd

The program would generate a profile pathname like this:


               
/users/cwe/profiles/../../../etc/passwd

When the file is opened, the operating system resolves the "../" during path canonicalization and actually accesses this file:


               
/etc/passwd

As a result, the attacker could read the entire text of the password file.

Notice how this code also contains an error message information leak (CWE-209) if the user parameter does not produce a file that exists: the full pathname is provided. Because of the lack of output encoding of the file that is retrieved, there might also be a cross-site scripting problem (CWE-79) if profile contains any HTML, but other code would need to be examined.

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

CWE-22

In the example below, the path to a dictionary file is read from a system property and used to initialize a File object.


               
File dictionaryFile = new File(filename);

However, the path is not validated or modified to prevent it from containing relative or absolute path sequences before creating the File object. This allows anyone who can control the system property to determine what file is used. Ideally, the path should be resolved relative to some kind of application or user home directory.

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

CWE-22

The following code takes untrusted input and uses a regular expression to filter "../" from the input. It then appends this result to the /home/user/ directory and attempts to read the file in the final resulting path.


               
ReadAndSendFile($filename);

Since the regular expression does not have the /g global match modifier, it only removes the first instance of "../" it comes across. So an input value such as:


               
../../../etc/passwd

will have the first "../" stripped, resulting in:


               
../../etc/passwd

This value is then concatenated with the /home/user/ directory:


               
/home/user/../../etc/passwd

which causes the /etc/passwd file to be retrieved once the operating system has resolved the ../ sequences in the pathname. This leads to relative path traversal (CWE-23).

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

CWE-22

The following code attempts to validate a given input path by checking it against a whitelist and once validated delete the given file. In this specific case, the path is considered valid if it starts with the string "/safe_dir/".


               
}
f.delete()

An attacker could provide an input such as this:


               
/safe_dir/../important.dat

The software assumes that the path is valid because it starts with the "/safe_path/" sequence, but the "../" sequence will cause the program to delete the important.dat file in the parent directory

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

CWE-22

The following code demonstrates the unrestricted upload of a file with a Java servlet and a path traversal vulnerability. The HTML code is the same as in the previous example with the action attribute of the form sending the upload file request to the Java servlet instead of the PHP code.


               
</form>
<input type="submit" name="submit" value="Submit"/>

When submitted the Java servlet's doPost method will receive the request, extract the name of the file from the Http request header, read the file contents from the request and output the file to the local upload directory.


               
}
{...}// the starting position of the boundary header// verify that content type is multipart form data
// output the file to the local upload directory
bw.close();
}
bw.flush();
// output successful upload response HTML page
// output unsuccessful upload response HTML page
...

This code does not check the filename that is provided in the header, so an attacker can use "../" sequences to write to files outside of the intended directory. Depending on the executing environment, the attacker may be able to specify arbitrary files to write to, leading to a wide variety of consequences, from code execution, XSS (CWE-79), or system crash.

Also, this code does not perform a check on the type of the file being uploaded. This could allow an attacker to upload any executable file or other file with malicious code (CWE-434).

Overview

Type

F5

First reported 2 years ago

2022-05-05 17:15:00

Last updated 2 years ago

2022-05-12 16:25:00

Affected Software

F5 Networks BIG-IP Local Traffic Manager 11.6.1

11.6.1

F5 Big-IP Local Traffic Manager (LTM) 12.1.2

12.1.2

F5 BIG-IP Advanced Firewall Manager (AFM) 12.1.0

12.1.0

F5 Big-IP Access Policy Manager (APM) 12.1.2

12.1.2

F5 Networks BIG-IP Global Traffic Manager 11.6.1

11.6.1

F5 Big-IP Domain Name System (DNS) 12.1.2

12.1.2

F5 BIG-IP Policy Enforcement Manager (PEM) 12.1.1

12.1.1

F5 Big-IP Policy Enforcement Manager (PEM) 12.1.2

12.1.2

F5 Big-IP Advanced Firewall Manager (AFM) 12.1.2

12.1.2

F5 BIG-IP Application Security Manager (ASM) 12.1.1

12.1.1

F5 BIG-IP Access Policy Manager (APM) 12.1.0

12.1.0

F5 BIG-IP Access Policy Manager (APM) 12.1.1

12.1.1

F5 Networks BIG-IP Advanced Firewall Manager 11.6.1

11.6.1

F5 BIG-IP Advanced Firewall Manager (AFM) 12.1.1

12.1.1

F5 Networks BIG-IP Analytics 11.6.1

11.6.1

F5 BIG-IP Analytics 12.1.0

12.1.0

F5 Big-IP Analytics 12.1.2

12.1.2

F5 Networks BIG-IP Application Acceleration Manager 11.6.1

11.6.1

F5 Networks BIG-IP Application Acceleration Manager 12.1.0

12.1.0

F5 BIG-IP Application Acceleration Manager (AAM) 12.1.1

12.1.1

F5 Big-IP Application Acceleration Manager (AAM) 12.1.2

12.1.2

F5 Networks BIG-IP Application Security Manager 11.6.1

11.6.1

F5 BIG-IP Application Security Manager (ASM) 12.1.0

12.1.0

F5 BIG-IP Domain Name System (DNS) 12.1.0

12.1.0

F5 Networks BIG-IP Link Controller 11.6.1

11.6.1

F5 BIG-IP Link Controller 12.1.0

12.1.0

F5 BIG-IP Link Controller 12.1.1

12.1.1

F5 Big-IP Link Controller 12.1.2

12.1.2

F5 BIG-IP Local Traffic Manager (LTM) 12.1.0

12.1.0

F5 Networks BIG-IP Policy Enforcement Manager 11.6.1

11.6.1

F5 Networks BIG-IP Access Policy Manager 11.6.1

11.6.1

F5 Big-IP Access Policy Manager (APM) 13.1.0

13.1.0

F5 BIG-IP Access Policy Manager (APM) 14.1.0

14.1.0

F5 Big-IP Advanced Firewall Manager (AFM) 13.1.0

13.1.0

F5 BIG-IP Advanced Firewall Manager 14.1.0

14.1.0

F5 BIG-IP Advanced Firewall Manager (AFM) 15.1.0

15.1.0

F5 BIG-IP Analytics 12.1.1

12.1.1

F5 Big-IP Analytics 13.1.0

13.1.0

F5 BIG-IP Analytics 14.1.0

14.1.0

F5 Big-IP Application Acceleration Manager (AAM) 13.1.0

13.1.0

F5 BIG-IP Application Acceleration Manager 14.1.0

14.1.0

F5 BIG-IP Application Acceleration Manager (AAM) 15.1.0

15.1.0

F5 Big-IP Application Security Manager (ASM) 12.1.2

12.1.2

F5 Big-IP Application Security Manager (ASM) 13.1.0

13.1.0

F5 BIG-IP Application Security Manager 14.1.0

14.1.0

F5 BIG-IP Domain Name System 11.6.1

11.6.1

F5 BIG-IP Domain Name System (DNS) 12.1.1

12.1.1

F5 Big-IP Domain Name System (DNS) 13.1.0

13.1.0

F5 BIG-IP Domain Name System 14.1.0

14.1.0

F5 Big-IP Fraud Protection Service (FPS) 11.6.1

11.6.1

F5 Big-IP Fraud Protection Service (FPS) 12.1.0

12.1.0

F5 Big-IP Fraud Protection Service (FPS) 13.1.0

13.1.0

F5 BIG-IP Fraud Protection Service 14.1.0

14.1.0

F5 BIG-IP Global Traffic Manager 12.1.0

12.1.0

F5 BIG-IP Global Traffic Manager 12.1.1

12.1.1

F5 BIG-IP Global Traffic Manager 12.1.2

12.1.2

F5 Big-IP Global Traffic Manager (GTM) 13.1.0

13.1.0

F5 BIG-IP Global Traffic Manager 14.1.0

14.1.0

F5 Big-IP Link Controller 13.1.0

13.1.0

F5 BIG-IP Link Controller 14.1.0

14.1.0

F5 BIG-IP Local Traffic Manager (LTM) 12.1.1

12.1.1

F5 Big-IP Local Traffic Manager (LTM) 13.1.0

13.1.0

F5 BIG-IP Local Traffic Manager 14.1.0

14.1.0

F5 BIG-IP Local Traffic Manager (LTM) 15.1.0

15.1.0

F5 Networks BIG-IP Policy Enforcement Manager (PEM) 11.6.2

11.6.2

F5 BIG-IP Policy Enforcement Manager (PEM) 12.1.0

12.1.0

F5 Networks BIG-IP Policy Enforcement Manager (PEM) 12.1.3

12.1.3

F5 Big-IP Policy Enforcement Manager (PEM) 13.1.0

13.1.0

F5 BIG-IP Policy Enforcement Manager 14.1.0

14.1.0

F5 BIG-IP Policy Enforcement Manager (PEM) 15.1.0

15.1.0

F5 Big-IP Access Policy Manager (APM) 11.6.2

11.6.2

F5 Big-IP Access Policy Manager (APM) 11.6.3

11.6.3

F5 BIG-IP Access Policy Manager (APM) 11.6.4

11.6.4

F5 Big-IP Access Policy Manager (APM) 11.6.5

11.6.5

F5 Big-IP Access Policy Manager (APM) 12.1.3

12.1.3

F5 BIG-IP Access Policy Manager (APM) 12.1.4

12.1.4

F5 Big-IP Access Policy Manager (APM) 12.1.5

12.1.5

F5 Big-IP Access Policy Manager (APM) 13.1.1

13.1.1

F5 BIG-IP Access Policy Manager (APM) 13.1.3

13.1.3

F5 Big-IP Access Policy Manager (APM) 14.1.2

14.1.2

F5 BIG-IP Access Policy Manager (APM) 15.1.0

15.1.0

F5 Big-IP Advanced Firewall Manager (AFM) 11.6.2

11.6.2

F5 Big-IP Advanced Firewall Manager (AFM) 11.6.3

11.6.3

F5 BIG-IP Advanced Firewall Manager (AFM) 11.6.4

11.6.4

F5 Big-IP Advanced Firewall Manager (AFM) 11.6.5

11.6.5

F5 Big-IP Advanced Firewall Manager (AFM) 12.1.3

12.1.3

F5 BIG-IP Advanced Firewall Manager 12.1.4

12.1.4

F5 Big-IP Advanced Firewall Manager (AFM) 12.1.5

12.1.5

F5 Big-IP Advanced Firewall Manager (AFM) 13.1.1

13.1.1

F5 Big-IP Advanced Firewall Manager (AFM) 13.1.3

13.1.3

F5 Big-IP Advanced Firewall Manager (AFM) 14.1.2

14.1.2

F5 BIG-IP Analytics 15.1.0

15.1.0

F5 BIG-IP Application Security Manager (ASM) 15.1.0

15.1.0

F5 BIG-IP Domain Name System (DNS) 15.1.0

15.1.0

F5 BIG-IP Fraud Protection Service (FPS) 15.1.0

15.1.0

F5 BIG-IP Global Traffic Manager (GTM) 15.1.0

15.1.0

F5 BIG-IP Link Controller 15.1.0

15.1.0

F5 Big-IP Analytics 11.6.2

11.6.2

F5 Big-IP Analytics 11.6.3

11.6.3

F5 BIG-IP Analytics 11.6.4

11.6.4

F5 Big-IP Analytics 11.6.5

11.6.5

F5 Big-IP Analytics 12.1.3

12.1.3

F5 BIG-IP Analytics 12.1.4

12.1.4

F5 Big-IP Analytics 12.1.5

12.1.5

F5 Big-IP Analytics 13.1.1

13.1.1

F5 Big-IP Analytics 13.1.3

13.1.3

F5 Big-IP Analytics 14.1.2

14.1.2

F5 Big-IP Application Acceleration Manager (AAM) 11.6.2

11.6.2

F5 Big-IP Application Acceleration Manager (AAM) 11.6.3

11.6.3

F5 BIG-IP Application Acceleration Manager (AAM) 11.6.4

11.6.4

F5 Big-IP Application Acceleration Manager (AAM) 11.6.5

11.6.5

F5 Big-IP Application Acceleration Manager (AAM) 12.1.3

12.1.3

F5 BIG-IP Application Acceleration Manager 12.1.4

12.1.4

F5 Big-IP Application Acceleration Manager (AAM) 12.1.5

12.1.5

F5 Big-IP Application Acceleration Manager (AAM) 13.1.1

13.1.1

F5 Big-IP Application Acceleration Manager (AAM) 13.1.3

13.1.3

F5 Big-IP Application Acceleration Manager (AAM) 14.1.2

14.1.2

F5 Big-IP Application Security Manager (ASM) 11.6.2

11.6.2

F5 Big-IP Application Security Manager (ASM) 11.6.3

11.6.3

F5 BIG-IP Application Security Manager (ASM) 11.6.4

11.6.4

F5 Big-IP Application Security Manager (ASM) 11.6.5

11.6.5

F5 Big-IP Application Security Manager (ASM) 12.1.3

12.1.3

F5 BIG-IP Application Security Manager 12.1.4

12.1.4

F5 Big-IP Application Security Manager (ASM) 12.1.5

12.1.5

F5 Big-IP Application Security Manager (ASM) 13.1.1

13.1.1

F5 Big-IP Application Security Manager (ASM) 13.1.3

13.1.3

F5 Big-IP Application Security Manager (ASM) 14.1.2

14.1.2

F5 Big-IP Fraud Protection Service (FPS) 13.1.1

13.1.1

F5 Big-IP Fraud Protection Service (FPS) 13.1.3

13.1.3

F5 Big-IP Fraud Protection Service (FPS) 14.1.2

14.1.2

F5 Big-IP Global Traffic Manager (GTM) 11.6.2

11.6.2

F5 Big-IP Global Traffic Manager (GTM) 11.6.3

11.6.3

F5BIG-IP Global Traffic Manager (GTM) 11.6.4

11.6.4

F5 Big-IP Global Traffic Manager (GTM) 11.6.5

11.6.5

F5 Big-IP Global Traffic Manager (GTM) 12.1.3

12.1.3

F5 BIG-IP Global Traffic Manager 12.1.4

12.1.4

F5 Big-IP Global Traffic Manager (GTM) 12.1.5

12.1.5

F5 Big-IP Global Traffic Manager (GTM) 13.1.1

13.1.1

F5 Big-IP Global Traffic Manager (GTM) 13.1.3

13.1.3

F5 Big-IP Global Traffic Manager (GTM) 14.1.2

14.1.2

F5 Big-IP Link Controller 11.6.2

11.6.2

F5 Big-IP Link Controller 11.6.3

11.6.3

F5 BIG-IP Link Controller 11.6.4

11.6.4

F5 Big-IP Link Controller 11.6.5

11.6.5

F5 Big-IP Link Controller 12.1.3

12.1.3

F5 BIG-IP Link Controller 12.1.4

12.1.4

F5 Big-IP Link Controller 12.1.5

12.1.5

F5 Big-IP Link Controller 13.1.1

13.1.1

F5 Big-IP Link Controller 13.1.3

13.1.3

F5 Big-IP Link Controller 14.1.2

14.1.2

F5 Big-IP Local Traffic Manager (LTM) 11.6.2

11.6.2

F5 Big-IP Local Traffic Manager (LTM) 11.6.3

11.6.3

F5 BIG-IP Local Traffic Manager (LTM) 11.6.4

11.6.4

F5 Big-IP Local Traffic Manager (LTM) 11.6.5

11.6.5

F5 Big-IP Local Traffic Manager (LTM) 12.1.3

12.1.3

F5 BIG-IP Local Traffic Manager 12.1.4

12.1.4

F5 Big-IP Local Traffic Manager (LTM) 12.1.5

12.1.5

F5 Big-IP Local Traffic Manager (LTM) 13.1.1

13.1.1

F5 BIG-IP Local Traffic Manager (LTM) 13.1.3

13.1.3

F5 BIG-IP Local Traffic Manager (LTM) 14.1.2

14.1.2

F5 Big-IP Policy Enforcement Manager (PEM) 11.6.3

11.6.3

F5 BIG-IP Policy Enforcement Manager (PEM) 11.6.4

11.6.4

F5 Big-IP Policy Enforcement Manager (PEM) 11.6.5

11.6.5

F5 BIG-IP Policy Enforcement Manager 12.1.4

12.1.4

F5 Big-IP Policy Enforcement Manager (PEM) 12.1.5

12.1.5

F5 Big-IP Policy Enforcement Manager (PEM) 13.1.1

13.1.1

F5 Big-IP Policy Enforcement Manager (PEM) 13.1.3

13.1.3

F5 Big-IP Policy Enforcement Manager (PEM) 14.1.2

14.1.2

F5 Big-IP Domain Name System (DNS) 11.6.2

11.6.2

F5 Big-IP Domain Name System (DNS) 11.6.3

11.6.3

F5 BIG-IP Domain Name System (DNS) 11.6.4

11.6.4

F5 Big-IP Domain Name System (DNS) 11.6.5

11.6.5

F5 Big-IP Domain Name System (DNS) 12.1.3

12.1.3

F5 BIG-IP Domain Name System 12.1.4

12.1.4

F5 Big-IP Domain Name System (DNS) 12.1.5

12.1.5

F5 Big-IP Domain Name System (DNS) 13.1.1

13.1.1

F5 Big-IP Domain Name System (DNS) 13.1.3

13.1.3

F5 Big-IP Domain Name System (DNS) 14.1.2

14.1.2

F5 Big-IP Fraud Protection Service (FPS) 11.6.2

11.6.2

F5 Big-IP Fraud Protection Service (FPS) 11.6.3

11.6.3

F5 BIG-IP Fraud Protection Service (FPS) 11.6.4

11.6.4

F5 Big-IP Fraud Protection Service (FPS) 11.6.5

11.6.5

F5 Big-IP Fraud Protection Service (FPS) 12.1.1

12.1.1

F5 Big-IP Fraud Protection Service (FPS) 12.1.2

12.1.2

F5 Big-IP Fraud Protection Service (FPS) 12.1.3

12.1.3

F5 BIG-IP Fraud Protection Service (FPS) 12.1.4

12.1.4

F5 Big-IP Fraud Protection Service (FPS) 12.1.5

12.1.5

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.