InfoSec Write-ups

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties…

Follow publication

Member-only story

Directory Traversal

source: Internet security Tips

WHAT IS DIRECTORY TRAVERSAL?

Directory traversal or some say “path traversal” is a type of web security vulnerability, which if exploited by the attacker/hacker can result in the information leakage of the arbitrary files on the server which is handling the application.

This leaked information may include the application code data, sensitive info like credentials, username, or operating system-related files. If the attack is persistent then the attacker can write data in the application which can result in compromising the system.

So let’s have a peek at how all this begins. Consider any website of your choice that display images, to load these images in the backend some HTML code is running which looks something like this

<img src="/image?filename=1.png">

So what’s happening here is that the ‘image’ URL is taking the ‘filename’ parameter and returns the content of the specified file. By default, the images are themselves stored in the ‘/var/www/html’ location for the Linux system. To get the specified ‘1.png’ image the application will append the requested filename into the base directory using a filesystem API. So for the above specified eg. the file path would be :

/var/www/html/1.png

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in InfoSec Write-ups

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties and CTFs to vulnhub machines, hardware challenges and real life encounters. Subscribe to our weekly newsletter for the coolest infosec updates: https://weekly.infosecwriteups.com/

Written by Sagar

An Enthusiast learner who seeks to learn the tech in a whole new different perspective.

Responses (1)

Write a response

This is cool man keep up the good work, will try to implement it.

--