PQ1 gambling exploit
Posted: Sat May 11, 2024 9:04 pm
I found this on Youtube:
The short version is that the amount of money in your wallet is stored in an 8-bit unsigned integer (0-255). To make it appear that you have more money, the game just appends a "0" at the end. So the variable stores a 68, but displays $680. And this is where the exploit comes in. If you bring the money you have to only $10, when you go to zero while gambling, your money will roll over back to 255 (or $2550) since the variable can't go negative. The game thinks you made a killing in the game and you automatically advance. Makes sense.
Except...
I remembered that if you buy a drink at the bar, they cost $5. Which means that sometimes the money in your wallet can end in a 0 or a 5. So I tried this out, and if you enter the poker game with just $5 in your wallet, your money will suddenly become $2555 after you pay the $10 ante. So what appears to be happening is that there is a separate flag which determines if a 0 or a 5 gets displayed at the end. And if you look at your wallet, when you have just $5 left, it will actually display $05. 0 with a 5 at the end. What I can't figure out is, why do it this way? Wouldn't it be simpler to use a 16-bit integer?
The short version is that the amount of money in your wallet is stored in an 8-bit unsigned integer (0-255). To make it appear that you have more money, the game just appends a "0" at the end. So the variable stores a 68, but displays $680. And this is where the exploit comes in. If you bring the money you have to only $10, when you go to zero while gambling, your money will roll over back to 255 (or $2550) since the variable can't go negative. The game thinks you made a killing in the game and you automatically advance. Makes sense.
Except...
I remembered that if you buy a drink at the bar, they cost $5. Which means that sometimes the money in your wallet can end in a 0 or a 5. So I tried this out, and if you enter the poker game with just $5 in your wallet, your money will suddenly become $2555 after you pay the $10 ante. So what appears to be happening is that there is a separate flag which determines if a 0 or a 5 gets displayed at the end. And if you look at your wallet, when you have just $5 left, it will actually display $05. 0 with a 5 at the end. What I can't figure out is, why do it this way? Wouldn't it be simpler to use a 16-bit integer?