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/

Follow publication

File Inclusion — TryHackMe Simple Write-up | 2023

TryHackMe’s File Inclusion — This room introduces file inclusion vulnerabilities, including Local File Inclusion (LFI), Remote File Inclusion (RFI), and directory traversal | Karthikeyan Nagaraj

Karthikeyan Nagaraj
InfoSec Write-ups
Published in
4 min readApr 23, 2023

Make Sure to Connect with TryHackMe’s VPN to Attack box to access the Machine

Task 2

Deploy the Machine

Task 3 — Path Traversal

  • Also known as Directory traversal, a web security vulnerability allows an attacker to read operating system resources, such as local files on the server running an application.
  • The attacker exploits this vulnerability by manipulating and abusing the web application’s URL to locate and access files or directories stored outside the application’s root directory.
  • Path traversal vulnerabilities occur when the user’s input is passed to a function such as file_get_contents in PHP.

1. What function causes path traversal vulnerabilities in PHP?

Ans: file_get_contents

Task 4 — Local File Inclusion — LFI

  1. Give Lab #1 a try to read /etc/passwd. What would the request URI be?
Ans: /lab1.php?file=/etc/passwd

2. In Lab #2, what is the directory specified in the include function?

Ans: includes

Task 5— Local File Inclusion — LFI #2

  1. Give Lab #3 a try to read /etc/passwd. What is the request look like?

If we put our payload into the text field “File Name” the path gets encoded, so we have to inject the payload into the search bar as below

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 Karthikeyan Nagaraj

Entrepreneur | Writer | Cyber Security Consultant | AI Researcher TopMate - https://topmate.io/cyberw1ng

Responses (1)

Write a response

Hey bro, can you text me on any of your social handle? I tried contacting you on twitter, but it seems you weren't available. my twitter ID: 0xWednesday ( Winnish Allwin ).

--