I have no idea if this question is suitable for SO, but I posted it anyway because I'm curious to see if there are any concrete solutions to this.
I am using the MySQL Connector with my game, in order to provide a reliable and persistent connection to store, and retrieve server listings for gameservers within the game. I have to use the MySQL DLLs, thus it is quite obvious that I use MySQL for the connection.
This would be fine, however, a hacker friend of mine last week offered to test my encryption (MySQL password is stored in an encrypted form, and decrypted at runtime), and he succeeded in obtaining all the password, with only a single character missing.
He told me that he had searched for the mysql_connect()
function in one of the MySQL DLLs, and intercepted the code when run.
I looked at this, but no answers cover my situation (where the password string is being extracted), and I'm starting to get worried whether it was a mistake to use MySQL for my usage situation, but however I believe that the same thing could happen in any program.
Can I protect against this type of exploit?
Should my decrypt
function return something other than a string, or can anything from a function be intercepted?
One of the answers to the linked questions says this:
The simplest way is to encrypt them with something trivial like xor or rot-13, and then decrypt them on the fly when they're used. That will eliminate casual viewing of them, but it won't stop anyone with much experience at reversing.
I'm making the assumption that the hacker managed to reverse the encryption, to reveal the password.
Roughly the code:
string server = "crysiswars2.communication.zyboxinternational.com";
mysql_connect(server, decrypt("randomuser1"), decrypt("randompassword2"), decrypt("myport"));`