HTB: Sequel
Sequel is a Very Easy Linux machine that demonstrates the risks of misconfigured MySQL/MariaDB services allowing root access without a password. The machine showcases how to enumerate databases, tables, and extract sensitive information including flags through SQL queries.
Path to root, at a glance:
- Scan the target → discover port
3306(MySQL/MariaDB) open - Connect to MariaDB with root user and no password
- Enumerate databases → find htb database
- Explore tables → find config table containing the flag
Nmap
┌──(r3vpwnx㉿r3vpwnx)-[~/CTF/HTB/Sequel] |
The scan reveals:
- Port 3306/tcp: MySQL/MariaDB service
- Version: MariaDB 10.3.27 (Debian)
- Status: Accepting connections
The Service: MariaDB
MariaDB is a community-developed fork of MySQL. Key characteristics:
- Port: 3306 (default)
- Authentication: Username/password (often misconfigured)
- Type: Relational Database Management System (RDBMS)
- Common vulnerabilities: Default credentials, no password, weak permissions
Exploitation: Database Misconfiguration
Initial Connection Attempt
First attempt to connect with root user:
┌──(r3vpwnx㉿r3vpwnx)-[~/CTF/HTB/Sequel] |
The error indicates SSL issues. We need to disable SSL:
┌──(r3vpwnx㉿r3vpwnx)-[~/CTF/HTB/Sequel] |
Note: No password was required! The MariaDB server is configured to allow root access without authentication.
Database Enumeration
List all databases:
MariaDB [(none)]> show databases; |
The htb database looks promising.
Exploring the htb Database
Select the database:
MariaDB [(none)]> use htb; |
List tables in the database:
MariaDB [htb]> show tables; |
Examining the users Table
MariaDB [htb]> select * from users; |
The users table contains admin and user emails but no flag.
Finding the Flag
Examine the config table:
MariaDB [htb]> select * from config; |
The flag is in the config table under the flag field!
Flag Captured !!!
Task Answers
- During our scan, which port do we find serving MySQL?
3306 - What community-developed MySQL version is the target running?
MariaDB - When using the MySQL command line client, what switch do we need to use in order to specify a login username?
-u - Which username allows us to log into this MariaDB instance without providing a password?
root - In SQL, what symbol can we use to specify within the query that we want to display everything inside a table?
* - In SQL, what symbol do we need to end each query with?
; - There are three databases in this MySQL instance that are common across all MySQL instances. What is the name of the fourth that’s unique to this host?
htb - What is the command in MySQL to select a database to interact with?
use - What is the command in MySQL to show the different columns for a given table?
describe - Which table has an entry that contains a value called flag in one of it’s columns?
config





