URN Logo
UNIX Resources » Linux » China Linux Forum » 系统和网络安全 » 7 » gcc<= 3.4.3 Unchecked Length Fields_LocalEXP(FAKE)
announcement 声明: 本页内容为中国Linux论坛的内容镜像,文章的版权以及其他所有的相关权利属于中国Linux论坛和相应文章的作者,如果转载,请注明文章来源及相关版权信息。
Resources
China Linux Forum(finished)
Linux Forum(finished)
FreeBSD China(finished)
linuxforum.net
  业界新闻与评论
  自由软件杂谈
  IT 人生
  Linux软件快递
  翻译作坊
  Linux图书与评论
  GNU Emacs/XEmacs
  Linux 中文环境和中文化
  Linux桌面与办公软件
  Linux 多媒体与娱乐版
  自由之窗Mozilla
  笔记本电脑上的Linux
  Gentoo
  Debian 一族
  网络管理技术
  Linux 安装与入门
  WEB服务器和FTP服务器
  域名服务器和邮件服务器
  Linux防火墙和代理服务器应用
  文件及打印服务器
  技术培训与认证
  Linux内核技术
  Linux 嵌入技术
  Linux设备驱动程序
  Linux 集群技术
  LINUX平台数据库
  系统和网络安全
  CPU 与 编译器
  系统计算研究所专栏
  Linux下的GUI软件开发
  C/C++编程版
  PHP 技 术
  Java&jsp技术
  Shell编程技术
  Perl 编 程
  Python 编 程
  XML/Web Service 技术
  永远的Unix
  FreeBSD世界
   
gcc<= 3.4.3 Unchecked Length Fields_LocalEXP(FAKE)
gcc<= 3.4.3 Unchecked Length Fields_LocalEXP(FAKE) - madsys [2005-01-10 14:15 | 5,749 byte(s)]
 
Re: GNU gcc <= 3.4.3 Unchecked Length Fields_Local - grip2 [2005-01-10 18:08 | 1,490 byte(s)]
 
 
 
 
Subject: gcc<= 3.4.3 Unchecked Length Fields_LocalEXP(FAKE)
Author: madsys    Posted: 2005-01-10 14:15    Length: 5,749 byte(s)
[Original] [Print] [Top]

/*
str0ke / tested on patched up debian box (nice local)
--------------------------------------------------------
[N]eo [S]ecurity [T]eam [NST]&reg; - Advisory #01 - 28/12/04
--------------------------------------------------------
Program: ld - The GNU linker
Homepage: http://gcc.gnu.org
Vulnerable Versions: GNU gcc 3.4.3 and prior
Risk: High!!
Impact: Unchecked lenght fields
---------------------------------------------------------

- Description
---------------------------------------------------------
$ LD_PRELOAD=/`perl -e 'print "A"x2000'`/ passwd
Value starts and ends with a slash and contains about 1200 characters.
LD_PRELOAD doesn't ignore setuid executables, like this one.
Unchecked lenght fields.

setuid(0);
setreuid(0,0);
int getuid() { return 0; }
int geteuid() { return 0; }
int getgid() { return 0; }
int getegid() { return 0; }

- Tested
---------------------------------------------------------
I have done minimal testing on this.
Slackware 10.0

- Explotation
---------------------------------------------------------
$gcc ld_xpl_nst.c -o ld_xp_nst
$./ld_xp_nst
sh-3.00# id
uid=0(root) gid=0(root) groups=100(users)
sh-3.00#

This will give you a root shell

- Solutions
--------------------------------------------------------
Not Yet or i don't know xD

- References
--------------------------------------------------------
href=http://neosecurityteam.org/Advisories/Advisory-01.txt>http://neosecurityteam.org/
Advisories/Advisory-01.txt



- Credits
-------------------------------------------------
Discovered by HaCkZaTaN <hck_zatan@hotmail.com>

[N]eo [S]ecurity [T]eam [NST]&reg; - href=http://neosecurityteam.org/>http://neosecurityteam.org/

Got Questions? href=http://neosecurityteam.org/foros/>http://neosecurityteam.org/foros/
*/

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

char NstCode[] =
"x69x6ex74x20x67x65x74x75x69"
"x64x28x29x20x7bx20x72x65x74"
"x75x72x6ex20x30x3bx20x7dx0a"
"x69x6ex74x20x67x65x74x65x75"
"x69x64x28x29x20x7bx20x72x65"
"x74x75x72x6ex20x30x3bx20x7d"
"x0ax69x6ex74x20x67x65x74x67"
"x69x64x28x29x20x7bx20x72x65"
"x74x75x72x6ex20x30x3bx20x7d"
"x0ax69x6ex74x20x67x65x74x65"
"x67x69x64x28x29x20x7bx20x72"
"x65x74x75x72x6ex20x30x3bx20"
"x7dx0ax0/bin/sh";

void FG(int Opt, int Colour);
void BG(int Colour);
void RC();

int main()
{
FILE *Nst_C;
int x, y;
for(x = 1; x < 2; x++)
for(y = 37; y < 38; y++) {
FG(x,y);
printf("[N]eo [S]ecurity [T]eam [N][S][T]! ");
}
RC();
Nst_C=fopen("/tmp/nst.c","w");
fprintf(Nst_C,"%s",NstCode);
fclose(Nst_C);
system("gcc -shared -o /tmp/nst.nfo /tmp/nst.c;rm -f /tmp/nst.c");
system("LD_PRELOAD=/tmp/nst.nfo /bin/sh");
for(x = 1; x < 2; x++)
for(y = 37; y < 38; y++) {
FG(x,y);
printf("[N]eo [S]ecurity [T]eam [N][S][T]! ");
}
RC();
return 0;
}

void FG(int Opt, int Colour) {
printf("33[%d;%dm", Opt, Colour);
}

void RC() {
printf("33[0;m");
}

/* Bash Code:

#! /bin/bash
echo -e "x69x6ex74x20x67x65x74x75x69x64x28x29x20x7bx20x72x65"
>/tmp/nst.c
echo -e "x74x75x72x6ex20x30x3bx20x7dx0ax69x6ex74x20x67x65x74"
>/tmp/nst.c
echo -e "x65x75x69x64x28x29x20x7bx20x72x65x74x75x72x6ex20x30"
>/tmp/nst.c
echo -e "x3bx20x7dx0ax69x6ex74x20x67x65x74x67x69x64x28x29x20"
>/tmp/nst.c
echo -e "x7bx20x72x65x74x75x72x6ex20x30x3bx20x7dx0ax69x6ex74"
>/tmp/nst.c
echo -e "x20x67x65x74x65x67x69x64x28x29x20x7bx20x72x65x74x75"
>/tmp/nst.c
echo -e "x72x6ex20x30x3bx20x7dx0ax0/bin/sh">/tmp/nst.c

sleep 1
gcc -shared -o /tmp/nst.nfo /tmp/nst.c
rm -rf /tmp/nst.c
sleep 4
echo -e " "
export LD_LIBRARY_PATH=/tmp
LD_PRELOAD=/tmp/nst.nfo /bin/sh
*/

----
getting oops...
[Original] [Print] [Top]
Subject: Re: GNU gcc <= 3.4.3 Unchecked Length Fields_LocalEXP
Author: coolq    Posted: 2005-01-10 15:01    Length: 32 byte(s)
[Original] [Print] [Top]
有人明白这个漏洞是个什么意思么?
[Original] [Print] [Top]
Subject: Re: GNU gcc <= 3.4.3 Unchecked Length Fields_Local
Author: grip2    Posted: 2005-01-10 18:02    Length: 8 byte(s)
[Original] [Print] [Top]
假的:(
----
The stars are not afraid to appear like fireflies.
[Original] [Print] [Top]
Subject: Re: GNU gcc <= 3.4.3 Unchecked Length Fields_Local
Author: grip2    Posted: 2005-01-10 18:08    Length: 1,490 byte(s)
[Original] [Print] [Top]

000006c4 <__i686.get_pc_thunk.bx>:
6c4: 8b 1c 24 mov (%esp,1),%ebx
6c7: c3 ret

000006c8 <getuid>:
6c8: 55 push %ebp
6c9: 89 e5 mov %esp,%ebp
6cb: b8 00 00 00 00 mov $0x0,%eax
6d0: 5d pop %ebp
6d1: c3 ret

000006d2 <geteuid>:
6d2: 55 push %ebp
6d3: 89 e5 mov %esp,%ebp
6d5: b8 00 00 00 00 mov $0x0,%eax
6da: 5d pop %ebp
6db: c3 ret

000006dc <getgid>:
6dc: 55 push %ebp
6dd: 89 e5 mov %esp,%ebp
6df: b8 00 00 00 00 mov $0x0,%eax
6e4: 5d pop %ebp
6e5: c3 ret

000006e6 <getegid>:
6e6: 55 push %ebp
6e7: 89 e5 mov %esp,%ebp
6e9: b8 00 00 00 00 mov $0x0,%eax
6ee: 5d pop %ebp
6ef: c3 ret
----
The stars are not afraid to appear like fireflies.
[Original] [Print] [Top]
Subject: Re: GNU gcc <= 3.4.3 Unchecked Length Fields_Local
Author: coolq    Posted: 2005-01-10 19:57    Length: 78 byte(s)
[Original] [Print] [Top]
丫的,耍了个障眼法。我说怎么看都不明白呢,原来
id命令的结果就是假的。
[Original] [Print] [Top]
« Previous thread
Linux kernel i386 SMP page fault handler privilege
系统和网络安全
7
Next thread »
[精华] module injection in 2.6 kernel
     

Copyright © 2007 UNIX Resources Network, All Rights Reserved.      About URN | Privacy & Legal | Help | Contact us
备案序号: 京ICP备05006143    webmaster: webmaster@unixresources.net
This page created on 2008-07-17 03:45:00, cost 0.06608510017395 ms.