← Back to context

Comment by lunixbochs

9 years ago

Binary patching is a really common requirement in attack/defense CTF, and there are a few projects floating around to help with it.

Keypatch helps you do assembly overwrites in IDA Pro.

Binary Ninja lets you do assembly (and C shellcode!) overwrite patches, and even has undo.

I have my own project [1] for patching ELFs that relies on injecting additional segments and injecting a hook at any address, so as to not require in-place patches. It can also massage GCC/Clang output and inject that reliably into an existing binary.

[1] https://github.com/lunixbochs/patchkit

I have my own story about this as well. A few years ago I released a port of Uplink: Hacker Elite for the OpenPandora handheld with a few game engine patches, and some people were running into a bug: the game would enter the "new game" screen on every launch, even if you already had a save game to load.

I and couldn't find the exact source I'd used to build it and didn't want to spend time making sure I got all of my bugfixes into the vanilla repository, so... I went digging with IDA, found the topmost branch to the "new game" wizard, and patched the address to go to the main menu function instead. At that point you could still click "new game" from the menu and it wouldn't go through the patched address (so "new game" still worked), but you could also load an existing game, thus fixing the bug!

I still have nothing on Notaz, who statically recompiled StarCraft and Diablo for that community :)