0

I'm dealing with a reverse engineering challenge involving a binary application that was statically compiled with a legacy library. While the legacy library is not vulnerable, it lacks certain features that would significantly improve the functionality of the binary. Importantly, I have access to the open-source code of this library.

My goal is to enhance the binary by incorporating these missing features from the new version of the library. Specifically, I want to:

  1. Take the binary compiled with the legacy library.
  2. Integrate the additional features from the new version of the library into the binary.
  3. Rebuild or modify the binary so that it utilizes the enhanced library functionality.

Is this feasible, and if so, what are the general steps or techniques involved in achieving this task? Have you ever heard about something like that?

Any advice or insights would be greatly appreciated.

1 Answer 1

1

This is what I have done in similar cases but adapted to your scenario:

  • Build the new open source library as a standard SO or DLL that is loadable by your target. If you're unlucky, you might need to use an old compiler...
  • Patch the entry point of your target to load the SO/DLL as soon as it's safe or, alternatively, directly modify the binary to add a new library to it so you don't have to load it yourself.
  • Hook the exported functions of the library statically linked inside your binary and forward them to the newly built library. If you're unlucky, the functions are in-lined and then your life would not be so nice (but most likely the functions aren't in-lined).

By doing this you minimize the number of pure assembler patches you need to write and once it's working, you will almost "magically" have your target working with newest versions of your target library (but you will have to test to verify it's compatible and they didn't break something).

Oh, by the way! Naturally, you will need to find first where the library is inside the binary. You can diff with Diaphora a version of your open source library against your target and import the symbols you need.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.