Word Game
Challenge
You are given a pattern like H??T and have to supply a word that fits, for example HOST. The pattern (ptrn) and the word (word) both come from the POST body, and I had the server source.
Approach
The pattern is turned into a regex and then used to validate the word:
| |
Since I control ptrn, I can send a run of ? characters that becomes . wildcards matching whatever length my word is. That bypasses the word validator, so any payload reaches checkWd.
checkWd builds its query by f-string:
| |
That is the injection point. The flag table name is dynamic, so it cannot be brute forced, but the query is built with string formatting and a {flagtable} placeholder is reachable, so the idea was:
| |
There is a second injectable query in getAns:
| |
getAns does not return the value directly, but the response tells you which character of your guess is wrong, which is enough to leak the answer one character at a time.