Tips

File inclusion and path traversal tips

Path traversal and file inclusion let input choose which file the server reads or includes, exposing source code and configuration or, with inclusion, running code. Downloads, templates and language files are the usual places.

Published tips, newest first. Payloads and commands are shown as plain text.

  • Test File Access Control

    When testing a web application for path traversal vulnerabilities, first determine if user input can control the file path. Look for features that load files, such as images or reports, and check if the file path can be influenced through parameters like file=, page=, or doc=. If

    File inclusion and path traversalDiscovery

  • Test named pipe clients for path traversal

    When a target uses named pipes for IPC, test whether the server-side process properly validates the client's input. Try to send a message with a path that traverses outside the expected directory, such as `..\

    File inclusion and path traversalExploitation

  • Test API for LFI via controller parameter

    To test for Local File Inclusion (LFI) via the controller parameter, send a request to the API with a modified controller value that includes a directory traversal sequence (../) and a target file with a .php extension. If the API is vulnerable, it may include and execute the sp…

    File inclusion and path traversalDiscovery

  • Test file access with traversal sequences

    Try accessing files on target.com by sending a GET request with a filename parameter that contains traversal sequences like ../ or absolute paths like /etc/passwd. The response will show whether the bug is present. You can also try encoding the traversal sequence with %2e and %2f

    File inclusion and path traversalDiscovery

File inclusion and path traversal: how to hunt it

Where to look

  • Parameters that name a file, template, page or language, and download and export endpoints.
  • Encodings that get past filters: URL and double encoding, overlong UTF-8 and Unicode slashes.
  • Archive extraction that trusts the names inside the archive (zip slip).
  • Differences between the path a proxy checks and the path the application uses, such as ..;/ in front of Tomcat.

What proves it

Read a harmless, well-known file such as /etc/hostname, and show the request that crosses the directory boundary.

Read further

Writeups on File inclusion and path traversal, by hunters and researchers, most with a short summary.

Related classes