Buffer Over Flow Vulnerability

记录一个简单的栈溢出的实例,具体的分析以后加进去。

程序源代码buffer.c:

#include <stdio.h>
#include <string.h>
void fun1(char *input)
{
char buffer[10];
strcpy(buffer,input);
printf("Call fun1,buffer=%s\n",buffer);
}
void fun2()
{
printf("Call fun2");
}
int main(int argc, char *argv[])
{
printf("Address Of fun2=%p\n",fun2);
fun1("0000000000000000000000\x79\x84\x04\x08");
return 0;
}

Linux编译命令:

1 首先关闭Linux系统的ASLR(地址随机化保护机制)

sudo sysctl -w kernel.randomize_va_space=0

2 使用gcc关闭栈保护机制进行编译

gcc -fno-stack-protector -o buffer buffer.c

3 生成汇编码查看

gcc -fno-stack-protector -S buffer.c

4 运行查看

./buffer

时间: 2024-10-07 05:45:37

Buffer Over Flow Vulnerability的相关文章

CVE-2016-2502-drivers/usb/gadget/f_serial.c in the Qualcomm USB driver in Android. Buffer Overflow Vulnerability reported by #plzdonthackme, Soctt.

CVE-2016-2502-drivers/usb/gadget/f_serial.c in the Qualcomm USB driver in Android.Buffer Overflow Vulnerability reported by #plzdonthackme, Soctt. struct ioctl_smd_write_arg_type { char *buf; unsigned int size; }; #define GSERIAL_BUF_LEN 256 char smd

TCP Data Flow and Window Management(2)

Flow Control and Window Management Every TCP segment (except those exchanged during connection establishment) includes a valid Sequence Number field, an ACK Number or Acknowledgment field, and a Window Size field (containing the window advertisement)

Android KeyStore Stack Buffer Overflow (CVE-2014-3100)

/* 本文章由 莫灰灰 编写,转载请注明出处. 作者:莫灰灰    邮箱: [email protected] */ 1. KeyStore Service 在Android中,/system/bin/keystore进程提供了一个安全存储的服务.在过去的版本中,其他程序主要用过UNIX socket的守护进程/dev/socket/keystore去访问这个服务.然而,现在我们可以通过Binder机制去访问它. 每一个Android用户都有一块其私有的安全存储区域.所有秘钥信息使用一个随机ke

Android linux kernel privilege escalation vulnerability and exploit (CVE-2014-4322)

In this blog post we'll go over a Linux kernel privilege escalation vulnerability I discovered which enables arbitrary code execution within the kernel. The vulnerability affected all devices based on Qualcomm chipsets (that is, based on the "msm&quo

PatentTips - Write Combining Buffer for Sequentially Addressed Partial Line Operations

SUMMARY OF THE INVENTION The present invention pertains to a write combining buffer for use in a microprocessor. The microprocessor fetches data and instructions which are stored by an external main memory. The data and instructions are sent over a b

The Bip Buffer - The Circular Buffer with a Twist

Introduction The Bip-Buffer is like a circular buffer, but slightly different. Instead of keeping one head and tail pointer to the data in the buffer, it maintains two revolving regions, allowing for fast data access without having to worry about wra

Buffer lab——20145326蔡馨熠

Buffer lab 缓冲区溢出攻击的原理 缓冲区溢出是指程序试图向缓冲区写入超出预分配固定长度数据的情况.这一漏洞可以被恶意用户利用来改变程序的流控制,甚至执行代码的任意片段.这一漏洞的出现是由于数据缓冲器和返回地址的暂时关闭,溢出会引起返回地址被重写.从逻辑上讲进程的堆栈是由多个堆栈帧构成的,其中每个堆栈帧都对应一个函数调用.当函数调用发生时,新的堆栈帧被压入堆栈:当函数返回时,相应的堆栈帧从堆栈中弹出.尽管堆栈帧结构的引入为在高级语言中实现函数或过程这样的概念提供了直接的硬件支持,但是由于

Pwn2Own 2014 - AFD.sys Dangling Pointer Vulnerability

这个内核漏洞在Pwn2Own 2014上用来提权绕过IE沙箱(保护模式),siberas公司后来公布了漏洞的细节及利用方法,通过其公开的文档已经能够准确定位漏洞成因及利用方法.(http://www.siberas.de/papers/Pwn2Own_2014_AFD.sys_privilege_escalation.pdf) 第一次分析double free类型的漏洞,并且想通过此漏洞进一步了解学习内核漏洞的利用技术.但分析到占位时,出现了WorkerFactory Object及contro

PatentTips - Virtual translation lookaside buffer

BACKGROUND OF THE INVENTION A conventional virtual-machine monitor (VM monitor) typically runs on a computer and presents to other software the abstraction of one or more virtual machines. Each virtual machine may function as a self-contained platfor