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

Disassemble .plt section and mark functions as thunks #60

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TSRBerry
Copy link
Contributor

This PR hopefully closes #19 by disassembling the entire .plt section and creating thunked functions for every PltEntry.

I used ghidra's ElfProgramBuilder as a template and added the necessary steps from it.

That said, I don't know a lot about ELF or file formats in general, so I'm not sure if there are any missing cases or if this solution is incorrect.
I tested it with a few binaries myself and the results look right, but I lack the experience to actually judge that.

@@ -274,6 +276,8 @@ protected void setupRelocations() throws AddressOutOfBoundsException, NotFoundEx
long pltStart = this.pltEntries.get(0).off;
long pltEnd = this.pltEntries.get(this.pltEntries.size() - 1).off + 0x10;
this.memBlockHelper.addSection(".plt", pltStart, pltStart, pltEnd - pltStart, true, false, false);
// Disassemble the entire section, so AARCH64PltThunkAnalyzer works.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially didn't include the part where the thunk functions are created, but even after disassembling the entire section the AARCH64PltThunkAnalyzer wasn't able to create the thunk functions.
So I ended up adding that step as well.

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

Successfully merging this pull request may close these issues.

Mark PLT Functions as Thunks
1 participant