I can replace a string inside an ELF binary if it has smaller or equal length but a segfault happens when replacing with a longer string. Why does it segfault? What other things must be changed so it works?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depending on whether you are talking about a fully linked binary (
ET_EXECorET_DYN) or an object file (ET_REL), your statement above may or may not be correct.You can’t safely edit a string in
.dynstrsection of a fully-linked binary, because doing so would corrupt the dynamic symbol hashtable.What did you expect? An ELF binary contains structured data. If you corrupt the structure of that data, you should expect all kinds of problems. You are lucky that you’ve got a segfault. It could have been much worse (e.g. it could have silently corrupted the data you write on disk).