This is the query:
$mysqli->query("UPDATE `users` SET `user_age` = '$my_age', `user_sex` = '$my_gender', `user_description` = '$my_description'
, `user_sound` = $my_sound, `country` = '$my_country', `region` = '$my_region', `custom1` = '$mycust1', `custom2` = '$mycust2' WHERE `user_name` = '$me'");
What makes it vulnerable is the $my_sound
variable which isn't wrapped in the apostrophe ('). I've looked up many times on google but couldn't find much intel related to why SQL injections are doable when a variable in a query isn't wrapped in (')s.
How would an attacker exploit this query?
$my_sound = "2, `is_admin` = 1"
-- or if they want to DoS,"2, `pwd_hash` = "$2y$10000$so82Q5okFHd6sa8vRPC09OyGFlWzNMKir.c2lgXKsEaP/gG.I/2Y2"
, then try to log in repeatedly (Similar for Argon2:$argon2d$v=19$m=1048576,t=1048576,p=1$MTI1MnUxMml1M2l1Mml1MWl1M2kxdTRpMXU1aTF1MmkzdTFpdTFp$iGPeWxFFsuf3AITq7tUrZ5XlJ/o/jhiUz9CvBgvjiEU
). You can either spend a ton of time and effort trying to figure out every possible attack vector... or just use correct, parameterized SQL, so that they'll end up setting their sound to an invalid value instead of breaking your server.(SELECT SLEEP(5))
for example and time the response time if goes over 5 seconds.. This (blind) based time injection injection should work for UPDATE/INSERT/DELETE queries.. In a answer on stackoverflow (post off mine) explains it more in detail.