A script to find and verify bad chars whilst creating exploits for buffer overflows.
You're still going to have to most of the hardwork.
However, this script helps you by
- saving you the pain of finding the missing/replaced character
- making sure you did'nt miss anything.
Clone this repo Python 3.8+ (i have used f strings)
python3 badchars.py [foundBadChars]
-
Ofcourse, start with triggering a overflow with all chars int the buffer
-
Copy the portion of the dump where the chars are (make sure you select the right starting point) (do a binary copy - select --> right click --> binary --> binary copy)
-
Paste the contents into a file (you can name the file as chars)
-
Run "python3 badchars.py chars"
-
This might call out a single bad char. Else you are good to go.
-
Say you got a bad char 0A in the previous step. Remove that char from your buffer and trigger buffer overflow again.
-
Do steps 2 and 3 again
-
Now when you call the script, do "python3 badchars.py chars 0A"
-
Say now you found another bad char 0D. Remove that char from your buffer and trigger buffer overflow again.
-
Do steps 2 and 3 again. Now when you call the script, do "python3 badchars.py chars 0A0D"
-
Repeat till script says "All Good"
Im thinking similar instructions can be followed for other debuggers too. Feel free to Raise an issue / PR if additional support is needed.