开发者

How can i prevent gdb from attaching to an exe?

开发者 https://www.devze.com 2023-01-11 16:38 出处:网络
I\'d lik开发者_运维百科e to prevent would-be hackers from attaching to my binary on Linux systems.I see that ptrace DENY_ATTACH can be used on OSX.Is there such option that can be used on linux?How ab

I'd lik开发者_运维百科e to prevent would-be hackers from attaching to my binary on Linux systems. I see that ptrace DENY_ATTACH can be used on OSX. Is there such option that can be used on linux? How about on Windows?

Thanks for any info!


Such a system call requires kernel support. Even if it existed in Linux, it would be fairly easy to disable by compiling your own kernel.


In linux, ptrace returns -1 if the process is being ptraced.

So, one solution would be, inside your program, try to attach to your process, and if you get a -1, you will know that the program is being ptraced.

0

精彩评论

暂无评论...
验证码 换一张
取 消