Hack Forums
Modify strings of executable file (Windows) - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45)
+--- Forum: Blackhat • Red Team • Offensive Security (https://hackforums.net/forumdisplay.php?fid=447)
+---- Forum: Blackhat Training (https://hackforums.net/forumdisplay.php?fid=405)
+----- Forum: Reverse Engineering (https://hackforums.net/forumdisplay.php?fid=229)
+----- Thread: Modify strings of executable file (Windows) (/showthread.php?tid=6294284)



Modify strings of executable file (Windows) - loomixx - Mar 14, 2025

I need to increase the length of a string inside a binary, but I keep running into issues. Here’s what I’ve tried so far:
1. Replacing the string while keeping the same length - it works fine as long as the new string is the same size as the old one.
2. Shortening the string - it also works if I replace unused space with 00.

Heres what i tried:
I wrote simple hello world in C.
The target string was "Hello, World!" (in hex 48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21)

I changed it via HxD to:
48 65 6C 6C 6F 2C 20 57 6F 00 00 00 00
It resulted in "Hello, Wo" (since \0 terminates it).
The program printed "Hello, Wo", which I expected

The problem comes when I increase the string length. If I change original string to this:
48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21 21
(added an extra "!"), the program just refuses to run.

It seems like I’m overwriting something critical, or the binary expects a fixed size.

How do I properly increase a string’s length in an executable without breaking it? Is this even possible?