################################################### # [+]Title: [File Traverse Fopen] ################################################### # [+] About : ################################################### # Written by : GlaDiaT0R the_gl4di4t0r[AT]hotmail[DOT]com # Team : Tunisian Power Team ( DarkGh0st.Com ) # Greetz: Boomrang_victim , M4rw3n_Neo & all my friends in security Challenge days 2010 ################################################### # [+] Summary: I* # [1]-Intro # [2]-Detection & Exploitation # [3]-Source Code Vulnerable ################################################### ------------------------------------------ 1 : INTRO Fopen function is common in PHP applications can then writing a page on third fopen may be subject to several as XSS vulnerability - ActivX (VBS) injection - malicious code HTML - PHP Injection and others. File Fopen The Traverse is a vulnerability that would allow an attacker to using fopen in a way hijacked giving it the ability to write it on any other directory than the original (to make easier, it can write the entire question). This vulnerability is due to the fact that the source code on vulnerable predefined page name changed, or write a variable contained in hidden field, which can then be modified by the attacker to use malicious. ------------------------------------------ 2 : DETECTION Une possible détection peut se faire rapidement en vérifiant les valeurs des variables contenue dans les champs cachés soit par le code source , soit en vérifiant la requête passé ( le contenue des variable POST ou GET ) . example of "input" with the preset value is not directly visible on the page: ---

---

---

--- it suffices to modify the contents of the variable (in our example filename valued livre.html) by a third location Example: "livre.html" becomes ".. / index.php" which will write the index.php page in the directory prior to the location previously defined. it is possible to change the preset destination writing of Fopen pampers your but can also change the extension. Changing the extension could in some cases allow the writing and execution of PHP code or otherwise. ----------------------------------------- 3 : SOURCE CODE VULNERABLE "); @fclose($fp); ?>

Pseudo : Message :

Message
[/url]
------------------------------------------------------- Fopen Manual : http://php.net/manual/en/function.fopen.php