Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any function to resize section/segment after modification? #3

Open
vegedreamgagnoa opened this issue Jun 30, 2022 · 2 comments

Comments

@vegedreamgagnoa
Copy link

It seems like strongarm does not automatically resize/readjust section/segment size after modification. If the provided data has more length or size than the actual data (I am trying to edit a string here), then it will also overflow/leak into the next section.

How can I implement this feature? Do you have any suggestion? @codyd51

Thanks.

@codyd51
Copy link
Contributor

codyd51 commented Jul 25, 2022

Hi! strongarm doesn't currently automatically resize the container structures for you. For now, you'll have to update the size pointers in the container structure by hand. If the data you'd like to write would spill over into the next section, you may have to shift all the following structures in the binary forward. This'll involve lots of pointer rewriting, and you may also need to update the dyld rebasing data; I think this case would be a complicated effort. I would happily welcome a PR if either of these are functionality you're willing to implement!

@codyd51
Copy link
Contributor

codyd51 commented Jul 29, 2022

Worth noting: MachoBinary.insert_load_dylib_cmd (here) handles updating some segment metadata, as an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants