如何定位溢出点位置

程序:

#include <stdio.h>
void exploit()
{system("/bin/sh");
}
void func()
{char str[20];read(0,str,50);printf("the str is:%s\n",str);
}
int main()
{func();return 0;
}

关掉保护机制:

gcc -no-pie -fno-stack-protector -z execstack -m32 -o 3.exe 3.c

检查一下:

checksec 3.exe
0x01 kali自带
msf-pattern_create -l 100

创建长度为100的字符串
在这里插入图片描述
运行我们的程序:

start

一直下一步,直到需要填入参数:
在这里插入图片描述
这个时候程序报错了,表示有溢出了
在这里插入图片描述
我们来看看eip的值,0Ab1,表示溢出使返回的地址是这个
在这里插入图片描述
使用命令,查看在哪里溢出了

msf-pattern_offset -q 0Ab1

在这里插入图片描述
32位,我们可以修改从32位开始的数据,让程序跳转到我们指定的地址执行

0x02 peda
pattern create 100

生成长度为100字符串
在这里插入图片描述
使用命令r,让程序继续执行,复制我们生成的字符串,注意单引号不要复制
在这里插入图片描述
溢出了,查看现在的EIP,A)AA
使用命令查看溢出位置

pattern offset A)AA

在这里插入图片描述
32位

0x03 pwndbg插件
cyclic 100

生成长度为100的字符串,按照上面的顺序,得到溢出eip的值为iaaa
查找溢出位置:

cyclic -l iaaa

32位

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/380179.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

.net知识和学习方法系列(六)关于数值类型

过年总是忙&#xff0c;没有更多的时间来写博客&#xff0c;不过还是挺想念这块地方的。 本次博客说一下数值类型吧&#xff01; 不管那种语言&#xff0c;都为数据类型一说&#xff0c;在C#中也是&#xff0c;不过C#的数据类型分了两类&#xff0c;一是值类型&#xff0c;一是…

【竞赛题解】2021年广东工业大学第十五届文远知行杯程序设计竞赛(同步赛)

B 找山坡 题意&#xff1a;在数组中找到两相等元素相距最大的距离且这两元素间的元素都不小于该两端值 思路&#xff1a;采用单调栈 例如&#xff1a;a[] { 2 3 5 4 6 3 }&#xff0c;栈内存储元素的坐标&#xff08;从1开始&#xff09;&#xff0c;便于计算距离 首先将a[…

[转]JAVA AES 加密算法

本文转自&#xff1a;http://blog.sina.com.cn/s/blog_7c8eb1590100svr0.html package com.siro.tools;import javax.crypto.Cipher;import javax.crypto.spec.IvParameterSpec;import javax.crypto.spec.SecretKeySpec;import sun.misc.BASE64Decoder;import sun.misc.BASE64E…

java中Scanner类中 next()与nextLine()的区别

问题&#xff1a;提示用户输入一个英文字符串或者要解密的字符串&#xff0c;然后通过扫描仪获取用户输入的字符串&#xff0c;经过加密或者解密后&#xff0c;把字符串输出。 import java.util.Scanner;public class Encryption {public static void main(String[] args) {Sca…

操作系统中的处理机调度调度_操作系统中的流程分类和调度

操作系统中的处理机调度调度处理 (Process) In the operating system, there are numerous task and application program run simultaneously. A program is stored in the hard disk or any other form of secondary storage. When the program is executed it must be loade…

NX机制及绕过策略-ret2libc

程序&#xff1a; 1.c #include <stdio.h> void exploit() {system("/bin/sh"); } void func() {char str[0x20];read(0,str,0x50); } int main() {func();return 0; }0x01 NX介绍 溢出攻击的本质在于冯诺依曼计算机模型对数据和代码没有明确区分这一先天性缺…

网站SEO策略的制定

在对一个网站做SEO的时候&#xff0c;SEO技术水平类似的人&#xff0c;营销效果可能天壤之别&#xff0c;这是因为网站SEO策略的制定的不同&#xff01;-----这个是最根本的。 SEO技术非常的简单&#xff0c;因为SEO不是去寻找搜索引擎的漏洞&#xff0c;而是根据搜索引…

Python | 程序从列表中删除范围内的所有元素

Given a list and we have to remove elements in a range from the list in Python. 给定一个列表&#xff0c;我们必须从Python中的列表中删除范围内的元素。 删除列表(开始索引&#xff0c;结束索引) (del list(start_index, end_index)) del() method is used to remove a…

面向对象 (接口 Interface)

1&#xff0c;面向对象(接口的概述及其特点) A:接口概述 从狭义的角度讲就是指java中的interface从广义的角度讲对外提供规则的都是接口 B:接口特点 a:接口用关键字interface表示 interface 接口名 {}b:类实现接口用implements表示 class 类名 implements 接口名 {}c:接口…

android unbound prefix

少一个命名空间加上就行了&#xff1a;xmlns:android"http://schemas.android.com/apk/res/android" 转载于:https://www.cnblogs.com/nizuimeiabc1/archive/2011/10/09/4254310.html

【竞赛题解】第22次CCF计算机软件能力认证 B

今天&#xff08;准确说是昨天&#xff0c;一下子就过12点了&#xff09;下午刚参加了CSP认证考试&#xff0c;大概是考了220&#xff08;前两题AC&#xff0c;第三题太折磨了懒得看了&#xff0c;后面两题各混了10分&#xff09;&#xff0c;唯一有点参与感的就是B题了&#x…

gbd调试64位程序关键

程序&#xff1a; 4.c&#xff1a; #include<stdio.h> void exploit() {system("/bin/sh"); } void main() {char buf[20];gets(buf); }编译&#xff1a; gcc -no-pie -fno-stack-protector -m64 -o 4.exe 4.cNX保护&#xff0c;栈数据不可执行 使用命令&…

C#全局鼠标键盘Hook (备查)

using System; using System.Collections.Generic; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; namespace DCIEngine.FrameWork.Snap { /// <summary> /// 这个类可以让你得到一个在…

fcfs调度算法_FCFS:先来先服务调度算法

fcfs调度算法The FCFS, which stands for First Come First Serve Scheduling Algorithm, is a non-preemptive scheduling algorithm, which means that if a process once starts executing in the processor, then it cannot be preempted in between the processing. Thus,…

亲和数

Problem Description 古希腊数学家毕达哥拉斯在自然数研究中发现&#xff0c;220的所有真约数(即不是自身的约数)之和为&#xff1a; 1245101120224455110&#xff1d;284。 1* 220220&#xff1b;2* 110220&#xff1b;4* 55220&#xff1b;5* 44220&#xff1b;10*20220;…

转:JNI jstring与c++字符串类型转换函数

jstring与c字符串类型转换函数 jstring str2jstring(JNIEnv* env,const char* pat) {//定义java String类 strClassjclass strClass (env)->FindClass("Ljava/lang/String;");//获取String(byte[],String)的构造器,用于将本地byte[]数组转换为一个新Stringjmetho…

python字符串转浮点数_如何在Python中检查字符串是否为数字(浮点数)?

python字符串转浮点数Using python it is very to interconvert the datatypes of a variable. A string can be easily converted to an integer or a float. However, asserting a string to be a float is a task by itself. Python provides an option to assert if a stri…

nhibernate学习之三级联(Ternary Associations)篇

1) 学习目标通过进一步学习Nhibernate基础知识&#xff0c;掌握用Nhiberate实现对级联的支持&#xff0c;通过一个简单的用户角色权限系统来体验nhibernate对级联的强大支持。2&#xff09;开发环境和必要准备 开发环境为:windows 2003,Visual studio .Net 2005,Sql server 200…

【竞赛题解】Codeforces Round #715 (Div. 2) C

C. The Sports Festival 题意&#xff1a;对于给定的整型数组aaa&#xff0c;每次选择其中一个元素aia_iai​&#xff08;不能重复选择同一元素&#xff09;&#xff0c;每次计算已选择的元素的极差&#xff08;最大元素减最小元素的差&#xff09;&#xff0c;输出最后极差和…

C和汇编---sizeof运算符和strlen函数

sizeof sizeof是C语言的内置运算符&#xff0c;以字节为单位给出指定类型的大小。 程序&#xff1a; #include <stdio.h>int main(void) {int a8;int b sizeof(a);//printf("a占用字节%u\n",sizeof(a));printf("a占用字节%d\n",b);return 0; }反汇…