Relative Paths
🎯 What You'll Learn
- Difference between absolute and relative paths
- How
. and .. work
- Path traversal techniques
📖 The Concept
Absolute vs Relative Paths
Absolute Path: Full path from the root
/home/user/documents/file.txt
http://example.com/images/logo.png
Relative Path: Path from current location
./file.txt (current directory)
../other/file.txt (parent directory)
images/logo.png (subdirectory)
Special Path Components
| Symbol |
Meaning |
Example |
. |
Current directory |
./file.txt = file.txt |
.. |
Parent directory |
../file.txt = one level up |
/ |
Root (absolute) |
/etc/passwd |
Path Traversal Examples
Starting at: /var/www/html/images/
./photo.jpg → /var/www/html/images/photo.jpg
../index.html → /var/www/html/index.html
../../config.txt → /var/www/config.txt
../css/style.css → /var/www/html/css/style.css
Web URL Path Traversal
Current URL: http://site.com/blog/posts/
./image.png → http://site.com/blog/posts/image.png
../about → http://site.com/blog/about
../../contact → http://site.com/contact
🚀 Your Challenge
You're in /start/here/. Navigate using relative paths to find the flag!
curl http://challenge/start/here/
Use .. to move up directories and find flag.txt hidden elsewhere in the tree.
Good luck! 🍀
Connect with SSH
Link your
SSH key, then connect with:
ssh hacker@dojo.idg.ctf