我试图ltrace在这个文件上运行:
./launcher:ELF 32 位 LSB 共享对象,英特尔 80386,版本 1 (SYSV),动态链接,解释器 /lib/ld-linux.so.2,用于 GNU/Linux 2.6.32,BuildID[sha1]=f6f8cf3307e0ee26723f4d03ec66d85e0 , 剥离
当我在 ghidra 中打开它并查看反编译的 c 时,我可以看到它将程序流程更改为我不想在 ltrace 运行时出现的某个地方。
attached_to_ptrace = ptrace(PTRACE_TRACEME,0,1,0);
if (attached_to_ptrace == -1) {
puts("I am not your property!");
exit_code = 1;
}
else {
// execute main loop
}
查看 的手册页ptrace,我看到:
long ptrace(enum __ptrace_request request, pid_t pid,
void *addr, void *data);
意思是如果程序?或ltrace?如果要使用不同的 PID 运行,我将能够使用 ltrace 成功运行我的程序。
这是我在运行程序时得到的当前输出ltrace:
~/ctf/cyberstart/level13/04 [master|…1] $ ltrace ./launcher
__libc_start_main(0x565a86f0, 1, 0xff837be4, 0x565a8970 <unfinished ...>
ptrace(0, 0, 1, 0) = 0xffffffff
puts("I am not your property!"I am not your property!
) = 24
+++ exited (status 1) +++
没有 ltrace:
~/ctf/cyberstart/level13/04 [master|…1] $ ./launcher
Enter the password:
password
Away now, you anklebiter!
[1]+ Stopped ./launcher
(这是我的第二个缓冲区溢出 CTF 挑战,主要目标是弄乱这段代码:)
int iVar1;
char local_1e [10];
int local_14;
int local_10;
local_10 = 0;
puts("\nEnter the password: ");
gets(local_1e);
iVar1 = strcmp(local_1e,"PAssw0rd");
if (iVar1 == 0) {
puts("Well done! Unfortunately, you have to try harder.");
local_10 = 0;
}
else {
puts("Away now, you anklebiter!");
}
if (local_10 != 0) {
printf("Unexpected error condition. Control char is %d\n",local_10);
local_14 = param_2 * local_10;
(*(code *)(local_14 + param_1))();
}
我怎样才能以一种不被检测到的方式运行 ltrace?