隐式函数 __strcpy_chk() 调用

发布于 2024-08-27 14:11:20 字数 402 浏览 8 评论 0 原文

我现在根据文章 http://www.tenouk.com/Bufferoverflowc/Bufferoverflow4.html。然而我还没有达到目标。每次抛出段错误时都会伴随一些错误信息。

我编译源代码,并想使用 objdump 获取更多信息。转储出来的汇编代码中调用了函数__strcpy_chk,据说“__strcpy_chk()函数不在源标准中;它只在二进制标准中”。 这是编译器用来保护运行时堆栈的机制吗?要完成测试,如何绕过保护?

问候。

I'm now performing a stack buffer overflow attack test on my own PC( Ubuntu 9.10, gcc-4.4.1 ) based on the article http://www.tenouk.com/Bufferoverflowc/Bufferoverflow4.html. Yet I haven't achieved the goal. Each time a segfault is thrown accompanied with some error informaiton.

I compile the source code, and wanna get further information using objdump. Function __strcpy_chk is invoked in the assembly code dumped out, and it's said that "The __strcpy_chk() function is not in the source standard; it is only in the binary standard."
Does this the mechanism a compiler employed to protect runtime stack? To finish my test, how can I bypass the protection?

Regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无语# 2024-09-03 14:11:21

该函数试图检查您是否不会意外地把事情搞砸(即覆盖函数的返回地址),并且它是 strcpy 实现的一部分,而不是其规范的一部分。它只是针对 strcpy 问题的部分补丁,但它确实可以保护您免受该网页讨论的问题的影响,而且只需付出很小的代价。

如果您想避免这种情况,请编写您自己的 strcpy 版本。您“首先”想到的简单实现应该存在问题,并且可以很好地进行演示。

The function is attempting to check that you don't smash things up too badly by accident (i.e., overwriting the return address of the function) and it's part of the implementation of strcpy and not its specification. It's only a partial patch for the problems with strcpy, but it does protect you a fair bit against the problems that that webpage talks about, and only with a small cost.

If you want to avoid it, write your own version of strcpy. The naïve implementation you'll “first” think of should have the problem and will do nicely for demonstration.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文