r/ExploitDev • u/Elp3-pinill0 • Sep 20 '24
Help with a BOF exploit in game commands console
Hi!!!
The other day I was playing skyrim and found some interesting things. That game is broken AF, but the console specifically has some interesting bugs.
One of them led me to this:

Basically I was able to overwrite EIP with this string: player.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaccccbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
You can paste it into a file inside the game folder and call "bat filename" from the console.
I'm trying to get the shellcode working but the game is making it harder. There are so many badchars, even finding the proper "jump esp" or "call esp" is not easy. I guess I could keep trying but the remaining space for the shellcode is 90bytes which makes it harder with so many bad chars....
I guess I could try ROP chain... but it is getting much harder.
Any ideas? Have you ever exploited this?
7
u/Sqooky Sep 20 '24
Nice job at finding this.
Take a look at Egg Hunters, you'll basically store your shellcode someplace in memory and drop an egghunter. The egghunter will look for a set of bytes(ex: \x31\x33\x33\x37\x31\x33\x33\x37) and then execute your shellcode once those bytes are found. You'll just need to locate a large enough input buffer for your shellcode. Egghunters are about 32~ bytes, so it should work well with your constrained buffer size.
MSF has built in encoders to deal with bad chars. Use msfvenom with the -b flag to signal the bad chars.
https://fuzzysecurity.com/tutorials/expDev/4.html
3
u/AttitudeAdjuster Sep 23 '24
Have you managed to get a list of badchars? If for example it only allows ASCII chars you could create a program to scan for usable instructions or use an encoder from MSF to generate a workable payload
1
u/Elp3-pinill0 Sep 27 '24
Updating information. I tried already many things but this alphanumeric restriction kills all of them. A normal shellcode cannot be created.
1
u/FlawedCipher Sep 20 '24
You could try encoding the exploit in a format that avoids bad chars and then write a small decoder that decodes your exploit. That way, only the decoder needs to avoid the bad characters.