I was following the response to this question to change the string of an elf executable. No matter how many times I try, I just can't modify the string. I notice that probably the issue lies in the permissions of rodata section.
[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
...
Is there a way to write in this section? or is there another way to modify strings?
update
this is the program
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}
I want to change "Hello World!\n", this is how I am changing the string in 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]>
As can be seen, I'm using the w command but when I check the string again, there are no changes. Thanks in advance.