尝试将十六进制添加到二进制文件时出现分段错误
我可以在十六进制编辑器中编辑 Linux 可执行文件并用我自己的字符替换字符,但是当我尝试添加新字符时,它会给我分段错误。
I am able to edit in a hex editor a linux executable and replace a char with my own, but it gives me segmentation fault when i try to add a new character.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你期待什么?
ELF 可执行文件有很多内部结构,修改或添加随机字节会导致该结构损坏(自不一致)。
当动态加载器遇到这种损坏的 ELF 二进制文件时,它就会崩溃。虽然某些损坏可能不会立即导致崩溃,但这并不意味着您可以执行此操作并期望一切正常。
可以对 ELF 二进制文件进行一些“链接后”编辑,但需要了解ELF 格式,并保持其有效性。
What did you expect?
An ELF executable has a lot of internal structure, and modifying or adding random bytes to it causes that structure to become corrupt (self inconsistent).
When the dynamic loader encounteres such corrupt ELF binary, it simply crashes. While some corruptions may not cause an immediate crash, that doesn't mean you can do this and expect things to work.
Some "post-link" editing of ELF binaries is possible, but it requires that one understands the ELF format, and preserves its validity.