CVE-2010-2425 - Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Severity

65%

Complexity

80%

Confidentiality

106%

Directory traversal vulnerability in TitanFTPd in South River Technologies Titan FTP Server 8.10.1125, and probably earlier versions, allows remote authenticated users to read or delete arbitrary files via "..//" sequences in a COMB command.

Directory traversal vulnerability in TitanFTPd in South River Technologies Titan FTP Server 8.10.1125, and probably earlier versions, allows remote authenticated users to read or delete arbitrary files via "..//" sequences in a COMB command.

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

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

First reported 14 years ago

2010-06-24 12:17:00

Last updated 6 years ago

2018-10-10 19:59:00

Affected Software

southrivertech:titan_ftp_server:1.0.17

1.0.17

southrivertech:titan_ftp_server:1.0.18

1.0.18

southrivertech:titan_ftp_server:1.0.19

1.0.19

southrivertech:titan_ftp_server:1.0.20

1.0.20

southrivertech:titan_ftp_server:1.0.21

1.0.21

southrivertech:titan_ftp_server:1.0.22

1.0.22

southrivertech:titan_ftp_server:1.0.23

1.0.23

southrivertech:titan_ftp_server:1.0.24

1.0.24

southrivertech:titan_ftp_server:1.0.25

1.0.25

southrivertech:titan_ftp_server:1.0.26

1.0.26

southrivertech:titan_ftp_server:1.0.27

1.0.27

southrivertech:titan_ftp_server:1.0.28

1.0.28

southrivertech:titan_ftp_server:1.0.29

1.0.29

southrivertech:titan_ftp_server:1.0.30

1.0.30

southrivertech:titan_ftp_server:1.0.31

1.0.31

southrivertech:titan_ftp_server:1.1.33

1.1.33

southrivertech:titan_ftp_server:1.11.34

1.11.34

southrivertech:titan_ftp_server:2.0.44 beta

2.0.44

southrivertech:titan_ftp_server:2.00.95

2.00.95

southrivertech:titan_ftp_server:2.01.96

2.01.96

southrivertech:titan_ftp_server:2.02.99

2.02.99

southrivertech:titan_ftp_server:2.10.119

2.10.119

southrivertech:titan_ftp_server:2.10.120

2.10.120

southrivertech:titan_ftp_server:2.10.121

2.10.121

southrivertech:titan_ftp_server:2.11.132

2.11.132

southrivertech:titan_ftp_server:2.20.140

2.20.140

southrivertech:titan_ftp_server:2.21.142

2.21.142

southrivertech:titan_ftp_server:2.30.151

2.30.151

southrivertech:titan_ftp_server:2.31.152

2.31.152

southrivertech:titan_ftp_server:2.40.155

2.40.155

southrivertech:titan_ftp_server:3.00.162

3.00.162

southrivertech:titan_ftp_server:3.01.163

3.01.163

southrivertech:titan_ftp_server:3.02.165

3.02.165

southrivertech:titan_ftp_server:3.10.169

3.10.169

southrivertech:titan_ftp_server:3.12.172

3.12.172

southrivertech:titan_ftp_server:3.20.175

3.20.175

southrivertech:titan_ftp_server:3.21.177

3.21.177

southrivertech:titan_ftp_server:3.22.178

3.22.178

southrivertech:titan_ftp_server:3.30.186

3.30.186

southrivertech:titan_ftp_server:4.00.245

4.00.245

southrivertech:titan_ftp_server:4.01.246

4.01.246

southrivertech:titan_ftp_server:4.02.248

4.02.248

southrivertech:titan_ftp_server:4.03.249

4.03.249

southrivertech:titan_ftp_server:4.05.252

4.05.252

southrivertech:titan_ftp_server:4.10.256

4.10.256

southrivertech:titan_ftp_server:4.11.257

4.11.257

southrivertech:titan_ftp_server:4.13.260

4.13.260

southrivertech:titan_ftp_server:4.14.261

4.14.261

southrivertech:titan_ftp_server:4.20.263

4.20.263

southrivertech:titan_ftp_server:4.21.264

4.21.264

southrivertech:titan_ftp_server:4.22.265

4.22.265

southrivertech:titan_ftp_server:4.23.266

4.23.266

southrivertech:titan_ftp_server:4.30.269

4.30.269

southrivertech:titan_ftp_server:4.31.272

4.31.272

southrivertech:titan_ftp_server:5.00.303

5.00.303

southrivertech:titan_ftp_server:5.01.306

5.01.306

southrivertech:titan_ftp_server:5.02.307

5.02.307

southrivertech:titan_ftp_server:5.03.308

5.03.308

southrivertech:titan_ftp_server:5.03.309

5.03.309

southrivertech:titan_ftp_server:5.03.310

5.03.310

southrivertech:titan_ftp_server:5.04.311

5.04.311

southrivertech:titan_ftp_server:5.04.312

5.04.312

southrivertech:titan_ftp_server:5.04.313

5.04.313

southrivertech:titan_ftp_server:5.04.314

5.04.314

southrivertech:titan_ftp_server:5.04.315

5.04.315

southrivertech:titan_ftp_server:5.05.316

5.05.316

southrivertech:titan_ftp_server:5.05.317

5.05.317

southrivertech:titan_ftp_server:5.05.318

5.05.318

southrivertech:titan_ftp_server:5.05.319

5.05.319

southrivertech:titan_ftp_server:5.05.320

5.05.320

southrivertech:titan_ftp_server:5.05.321

5.05.321

southrivertech:titan_ftp_server:5.05.322

5.05.322

southrivertech:titan_ftp_server:5.05.323

5.05.323

southrivertech:titan_ftp_server:5.05.324

5.05.324

southrivertech:titan_ftp_server:5.05.325

5.05.325

southrivertech:titan_ftp_server:5.05.326

5.05.326

southrivertech:titan_ftp_server:5.05.327

5.05.327

southrivertech:titan_ftp_server:5.10.328

5.10.328

southrivertech:titan_ftp_server:5.10.329

5.10.329

southrivertech:titan_ftp_server:5.11.330

5.11.330

southrivertech:titan_ftp_server:5.11.331

5.11.331

southrivertech:titan_ftp_server:5.12.332

5.12.332

southrivertech:titan_ftp_server:5.12.333

5.12.333

southrivertech:titan_ftp_server:5.12.334

5.12.334

southrivertech:titan_ftp_server:5.12.335

5.12.335

southrivertech:titan_ftp_server:5.12.336

5.12.336

southrivertech:titan_ftp_server:5.20.342

5.20.342

southrivertech:titan_ftp_server:5.21.347

5.21.347

southrivertech:titan_ftp_server:5.22.350

5.22.350

southrivertech:titan_ftp_server:5.23.351

5.23.351

southrivertech:titan_ftp_server:5.24.352

5.24.352

southrivertech:titan_ftp_server:5.25.356

5.25.356

southrivertech:titan_ftp_server:5.26.361

5.26.361

southrivertech:titan_ftp_server:5.27.362

5.27.362

southrivertech:titan_ftp_server:5.30.367

5.30.367

southrivertech:titan_ftp_server:5.31.373

5.31.373

southrivertech:titan_ftp_server:5.32.376

5.32.376

southrivertech:titan_ftp_server:5.33.380

5.33.380

southrivertech:titan_ftp_server:5.33.381

5.33.381

southrivertech:titan_ftp_server:5.35.385

5.35.385

southrivertech:titan_ftp_server:5.36.386

5.36.386

southrivertech:titan_ftp_server:5.37.387

5.37.387

southrivertech:titan_ftp_server:5.38.388

5.38.388

southrivertech:titan_ftp_server:5.39.389

5.39.389

southrivertech:titan_ftp_server:6.00.492

6.00.492

southrivertech:titan_ftp_server:6.01.512

6.01.512

southrivertech:titan_ftp_server:6.03.537

6.03.537

southrivertech:titan_ftp_server:6.04.545

6.04.545

southrivertech:titan_ftp_server:6.05.550

6.05.550

southrivertech:titan_ftp_server:6.06.555

6.06.555

southrivertech:titan_ftp_server:6.10.560

6.10.560

southrivertech:titan_ftp_server:6.20.587

6.20.587

southrivertech:titan_ftp_server:6.21.596

6.21.596

southrivertech:titan_ftp_server:6.23.616

6.23.616

southrivertech:titan_ftp_server:6.24.621

6.24.621

southrivertech:titan_ftp_server:6.25.622

6.25.622

southrivertech:titan_ftp_server:6.26.630

6.26.630

southrivertech:titan_ftp_server:7.00

7.00

southrivertech:titan_ftp_server:7.01

7.01

southrivertech:titan_ftp_server:7.02

7.02

southrivertech:titan_ftp_server:7.10

7.10

southrivertech:titan_ftp_server:7.12

7.12

southrivertech:titan_ftp_server:8.00

8.00

southrivertech:titan_ftp_server:8.01

8.01

southrivertech:titan_ftp_server:8.10

8.10

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.