我正在按照对这个问题的回答来更改 elf 可执行文件的字符串。无论我尝试多少次,我都无法修改字符串。我注意到问题可能出在 Rodata 部分的权限上。
[0x00001060]> iS
[Sections]
nth paddr size vaddr vsize perm name
―――――――――――――――――――――――――――――――――――――――――――――――――
...
16 0x00001060 0x185 0x00001060 0x185 -r-x .text
17 0x000011e8 0xd 0x000011e8 0xd -r-x .fini
18 0x00002000 0x12 0x00002000 0x12 -r-- .rodata
...
这部分有没有办法写?还是有另一种修改字符串的方法?
更新
这是程序
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
我想改变“Hello World!\n”,这就是我在radare2中改变字符串的方式
$ r2 -w modified_helloworld
[0x00001060]> iz
[Strings]
nth paddr vaddr len size section type string
―――――――――――――――――――――――――――――――――――――――――――――――――――――――
0 0x00002004 0x00002004 13 14 .rodata ascii Hello, World!
[0x00001060]> w Good, Bye!!!! @0x00002004
[0x00001060]> iz
[Strings]
nth paddr vaddr len size section type string
―――――――――――――――――――――――――――――――――――――――――――――――――――――――
0 0x00002004 0x00002004 13 14 .rodata ascii Hello, World!
[0x00001060]>
可以看出,我正在使用 w 命令,但是当我再次检查字符串时,没有任何变化。提前致谢。