what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Whitepaper Called File Traverse Fopen

Whitepaper Called File Traverse Fopen
Posted Mar 28, 2010
Authored by GlaDiaT0R

Whitepaper called File Traverse Fopen.

tags | paper
SHA-256 | 604e557f4ebab611f3a8d12f17fe7ddd68bbb849d7488f6f072ea1c3779428c6

Whitepaper Called File Traverse Fopen

Change Mirror Download


###################################################
# [+]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:
---
<p><input type="radio" name="filnename" value="livre.html"></p>
---
<p><input type="hidden" name="filnename" value="livre.html"></p>
---
<p><input type="checkbox" name="filnename" value="livre.html"></p>
---

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

<?php

$filename = stripslashes($_POST['filename']);
$mess = stripslashes($_POST['mess']);
$nom = stripslashes($_POST['nom']);
$nom = htmlspecialchars($_POST['nom']);
$mess = htmlspecialchars($_POST['mess']);
$fp = @fopen("livre/{$_POST['filename']}", 'a');
@fputs($fp,"$nom - $mess <hr size=\"1\" color=\"black\">");
@fclose($fp);
?>

<form name="form1" action="testtrasvers.php" method="post">
<p align="center"><font color="black">Pseudo :

<input type="text" name="nom">


Message :

</font><input type="text" name="mess"></textarea>
</font> <p><input type="hidden" name="filename" value="livre.html"></p>
<center>
<input type="reset" name="Submit" value="Effacer">
<input name="go" type="submit" value="Envoyer" onClick="javascript:this.style.visibility ='hidden';">
<center>
</form>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Message</title>
</head>
<body>
<center>
<a href="testtrasvers.php">[/url]

<font color="#CCCCCC" size="1"></font>
<?php @include('livre/livre.html'); ?>
</center>
</body>
</html>


-------------------------------------------------------
Fopen Manual : http://php.net/manual/en/function.fopen.php



Login or Register to add favorites

File Archive:

July 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    27 Files
  • 2
    Jul 2nd
    10 Files
  • 3
    Jul 3rd
    35 Files
  • 4
    Jul 4th
    27 Files
  • 5
    Jul 5th
    18 Files
  • 6
    Jul 6th
    0 Files
  • 7
    Jul 7th
    0 Files
  • 8
    Jul 8th
    28 Files
  • 9
    Jul 9th
    44 Files
  • 10
    Jul 10th
    24 Files
  • 11
    Jul 11th
    25 Files
  • 12
    Jul 12th
    11 Files
  • 13
    Jul 13th
    0 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    0 Files
  • 16
    Jul 16th
    0 Files
  • 17
    Jul 17th
    0 Files
  • 18
    Jul 18th
    0 Files
  • 19
    Jul 19th
    0 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close