Hack The Box — Sequel Solution

H1N
5 min readJun 6, 2023

--

Task 1
During our scan, which port do we find serving MySQL?

Ans: 3306

這題我們也是用nmap來掃描靶機,可以發現MySQL port為3306。

Task 2
What community-developed MySQL version is the target running?

Ans: MariaDB

根據我們剛剛的掃瞄,再加入 -sC 參數進行一次掃描,可以發現mysql-info Version: 5.5.5–10.3.27-MariaDB-0+deb10u1,輸入MariaDB。

-sV: 服務檢測

-sC : 執行腳本掃描

Task 3
When using the MySQL command line client, what switch do we need to use in order to specify a login username?

Ans: -u

這題要問的是mysql登入,我們可以用哪個指定的參數來指定登入的使用者,參數就是"-u"。

Task 4
Which username allows us to log into this MariaDB instance without providing a password?

Ans: root

這題在問我們要登入MariaDB的時候,哪個用戶名可以不用密碼就登入,但所有用戶登入其實都是需要密碼;這裡看提示猜測為"root"。

這是在網路搜尋找到的文章,裡面有說明三種方法可以免密碼登入MariaDB。

Task 5
In SQL, what symbol can we use to specify within the query that we want to display everything inside a table?

Ans: *

這裡在問我們可以用什麼符號來查詢我們想要顯示的所有內容,根據提示"This will make you starry-eyed."想到答案就是The asterisk symbol (*)。

Task 6
In SQL, what symbol do we need to end each query with?

Ans: ;

根據搜尋,In SQL Developer,SQL語句可以随意終止的符號為分號(;)。

Task 7
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?

Ans: htb

根據我們剛剛登入的MySQL

搜尋到的指令輸入show databases;

就可以看到目前所有的數據庫,照題目所說第四個獨有的數據庫就是"htb"。

Task 8

Submit Flag

Submit root flag

Ans: 7b4bec00d1a39e3dd4e021ec3d915da8

根據上題,繼續操作,找到使用數據庫的指令 "use <database name>",這裡來使用htb,然後看裡面有什麼表,逐一查詢表中有什麼數據。

https://www.fooish.com/sql/select.html

根據語法搜尋結果,我們要使用 select * from <table name>,來取得表中的內容。

可以發現我們所要的flag answer就在config裡,只要將value答案輸入即可。

--

--