###### tags: `module9` `OSINT` `сбор информации` `анализ` `domain tools`
[ToC]
# Занятие 1. Анализ внешнего периметра.
## Видео запись урока
{%youtube F23xsZw-_LA %}
### timecode
00:00 вступление
24:52 начало темы сбор
35:00 сбор
41:00 проникновение
1:15:00 перерыв и треп
1:33:00 проникновение
2:00:00 практика
2:21:00 перерыв и треп
2:31:40 практика
2:35:10 спасите Витю
2:39:00 практика
3:08:00 домашка и треп.
:a: обратить внимание на способы проникновения https://adam-toscher.medium.com/top-five-ways-the-red-team-breached-the-external-perimeter-262f99dc9d17
## Сбор информации. Необходим для анализа перед атакой на объект.
1) Сбор общей информации: доступный web, документы, телефоны, адреса и пр.
- Google, Yandex
- Гос-ные каталоги и реестры доступные в интернете.
2) Анализ доменов
- поиск поддоменов и их IP адресов
3) Анализ IP адресов объекта: порты, сервисы и приложения, уязвимости
- поисковики [Shodan](https://www.shodan.io/), [Censys](https://censys.io/), [zoomeye](https://www.zoomeye.org/), [FOFA](https://fofa.so/), [Spyse](https://spyse.com)
- расширения для броузера [PunkSPIDER](https://chrome.google.com/webstore/detail/punkspider-browser-extens/ogdehjeacimkleoocfolppfbkckleach/related?hl=en-US) (WEB)
- софт: Nmap; Nessus, Greenbone/OpenVAS, Routersploit(RouterScan),[rapidscan](https://github.com/skavngr/rapidscan)
==========
основные порты и сервисы
**telnet**(23), **ftp**(21), ssh/sftp(22), web(80,443,8080,8888) **rdp**(3389), mgmt, elastic, sql(3306), vpn(443,1741,500,4500), mail(25,495,..)
==========
** [ivre](https://github.com/ivre/ivre) Network recon framework, published by @cea-sec & @ANSSI-FR. Build your own, self-hosted and fully-controlled alternatives to Shodan / ZoomEye / Censys and GreyNoise, run your Passive DNS service, collect and analyse network intelligence from your sensors, and much more!
** [osintframework](https://osintframework.com/) - лучший старт для OSINT
Работа с большинством из этих поисковых систем потребует немного практики, прежде чем они станут действительно эффективными инструментами. Но будет интересно просто посмотреть, как они работают и какие результаты выдают. Для тех же, кто давно не новичок, эти поисковики могут стать мощными инструментами. Очень полезными они могут оказаться и для разработчиков. Так что если поисковые запросы «SMTP server» или «APC AOS cryptlib sshd» вызывают у вас улыбку понимания, вам настоятельно рекомендуется попробовать все вышеописанные поисковые системы.
## Проникновение внутрь инфраструктуры, точки входа:
- Credentials leaked. Для начала ищем доступные слитые пароли объекта.
- Fishing -> вредоносы, подменные ресурсы направленные на сотрудников
- Insider
a. Revers-shell
b. Tunneling (VPN-тоннели)
c. Forwarding (SSH-forwarding)
- Wi-Fi
- Попасть в сеть через уязвимости точки или пароля. *Возможны ситуации, что сеть у небольшого объекта может быть одноранговой wifi+lan.*
- Извлечение данных использую поддельную точку. *На пример, корпоративный портал для сбора авторизационных данных пользователей объекта*
- Exploiting - эксплуатация уязвимостей доступных извне систем объекта или уже после первичного проникновения в сеть объекта.
- Bruteforce. В целом долго, а также требует ресурсов.
- по словарю. Относительно быстрый способ,но может быть ограничен по кол-во обращений
- символьным перебором. Для оптимизации необходимо знать вероятный пароль (символы кол-во/какие?чем точнее данные тем быстрее перебор).
- Mobile device -> на устройства сотрудников
- Hardware/Software editions -> на поставщиков объекта. Один из самых известных случаев [взлом SolarWind](https://xakep.ru/2021/01/11/solarwinds-new-victims/)
:::info
Очень простые рекомендации для надежных паролей.
* Пароль должен состоять из 3-4 слов желательно с ошибкой в слове/ах и смена только в случае компроментации.
* Чем длиннее пароль, тем меньше требований к наличию всех типов символов (low,up,digits,simbols).
* Увы, для каждой системы нужен свой пароль. любая система может быть скомпроментирована и тогда ваш пароль для всех ваших систем будет доступен при переборе.
:::
## Практика
### Сбор информации о доменах
#### whois
```
whois yandex.ru
% By submitting a query to RIPN's Whois Service
% you agree to abide by the following terms of use:
% http://www.ripn.net/about/servpol.html#3.2 (in Russian)
% http://www.ripn.net/about/en/servpol.html#3.2 (in English).
domain: YANDEX.RU
nserver: ns1.yandex.ru. 213.180.193.1, 2a02:6b8::1
nserver: ns2.yandex.ru. 93.158.134.1, 2a02:6b8:0:1::1
nserver: ns9.z5h64q92x9.net.
state: REGISTERED, DELEGATED, VERIFIED
org: YANDEX, LLC.
registrar: RU-CENTER-RU
admin-contact: https://www.nic.ru/whois
created: 1997-09-23T09:45:07Z
paid-till: 2022-09-30T21:00:00Z
free-date: 2022-11-01
source: TCI
Last updated on 2021-12-14T16:51:30Z
```
Общая информация о домене: ns, даты создания и регистрации, регистратор.
#### subfinder
https://github.com/projectdiscovery/subfinder
```
apt install subfinder
subfinder -nW -oI -o ./logs/fbmse.txt -d fbmse.ru
```
> -oI Write output in Host,IP format
-nW Remove Wildcard & Dead Subdomains from output
-o string File to write output to (optional)
-d string Domain to find subdomains for
```
cat ./logs/fbmse.txt | cut -f1 -d , | sort -u
15.fbmse.ru
20.fbmse.ru
adm.fbmse.ru
adn.fbmse.ru
dmarc.fbmse.ru
dns.fbmse.ru
fckr.fbmse.ru
iasfcr.fbmse.ru
lms.fbmse.ru
mail.fbmse.ru
mx.fbmse.ru
nnn.fbmse.ru
ns.fbmse.ru
old.fbmse.ru
sb.fbmse.ru
spf.fbmse.ru
test.fbmse.ru
uc.fbmse.ru
www.48.fbmse.ru
www.fbmse.ru
```
результат 20 поддоменов
#### assetfinder
https://github.com/tomnomnom/assetfinder
```
apt install assetfinder
assetfinder fbmse.ru
dmarc.fbmse.ru
old.fbmse.ru
spf.fbmse.ru
mail.fbmse.ru
adm.fbmse.ru
iasfcr.fbmse.ru
fckr.fbmse.ru
ns.fbmse.ru
dns.fbmse.ru
test.fbmse.ru
www.fbmse.ru
mx.fbmse.ru
www.fckr.fbmse.ru
fbmse.ru
adm.fbmse.ru
fbmse.ru
test.fbmse.ru
fckr.fbmse.ru
www.fckr.fbmse.ru
fbmse.ru
fbmse.ru
```
найден 21 поддомен
#### spiderfoot (GUI)
SpiderFoot is an open source intelligence (OSINT) automation tool. It integrates with just about every data source available and utilises a range of methods for data analysis, making that data easy to navigate.
SpiderFoot has an embedded web-server for providing a clean and intuitive web-based interface but can also be used completely via the command-line. It's written in Python 3 and GPL-licensed.
https://github.com/smicallef/spiderfoot
https://kali.tools/?p=76
Установите зависимости
```
pip install lxml netaddr M2Crypto cherrypy mako
```
Другие модули, такие как MetaPDF, SOCKS и т. д. Уже включены в пакет SpiderFoot, поэтому необязательно их устанавливать отдельно.
Скачайте архив с программой http://www.spiderfoot.net/download/
Распакуйте и перейдите в каталог с программой:
```
~$ tar zxvf spiderfoot-X.X.X-src.tar.gz
~$ cd spiderfoot-X.X.X
~/spiderfoot-X.X.X$
```
Запуск программы
```
./sf.py
Или так
python ./sf.py
```
В браузере перейдите по адресу http://127.0.0.1:5001/
Некоторые сервисы требуют наличия API ключей (даются бесплатно при регистрации), об этих сервисах и о получении API ключей написано на странице документации: http://www.spiderfoot.net/documentation/
#### getallurls (gau)
https://github.com/lc/gau
Утилита для сбора всех урлов сайта методом crowling'a
Установка компилятора golang https://zalinux.ru/?p=1245
```
apt install golang
export GOPATH=/root/go
export PATH=${PATH}:$GOROOT/bin:/home/$USER/go/bin
/root/go/bin/gau -o ./logs/fbmse-subs.txt -subs fbmse.ru
head -30 ./logs/fbmse-subs.txt 1 ⨯
https://fbmse.ru/about/ekspertnye-sostavy/
https://fbmse.ru/about/istoriya/
https://fbmse.ru/about/nashi-dni/
https://fbmse.ru/appeals/
https://fbmse.ru/appeals/citizens/
https://fbmse.ru/appeals/citizens/chasto-zadavaemye-voprosy/
https://fbmse.ru/appeals/organizations/
https://fbmse.ru/dataprot/
https://fbmse.ru/documents/
https://fbmse.ru/errors/404/
https://fbmse.ru/interaction/faq/
https://fbmse.ru/interaction/ipra/
https://fbmse.ru/ispolnenie-419-fz
https://fbmse.ru/nauchno-metodicheskij-centr
https://fbmse.ru/news/
https://fbmse.ru/otdel-socialnoj-ekspertno-reabilitacionnoj-diagnostiki-adaptacii-i-podbora-tsr
https://fbmse.ru/printprod/conferencies/
https://fbmse.ru/printprod/intclass/
https://fbmse.ru/printprod/statcom/
https://fbmse.ru/protivodejstvie/
https://fbmse.ru/robots.txt
....
....
....
```
#### amass
> Amass — это инструмент глубокого перечисления DNS и составления карты сети, написан на Go.
https://github.com/OWASP/Amass (приложение и установка)
https://kali.tools/?p=4325 (help/manual)
https://900913.ru/tldr/common/en/amass-intel/
https://hackware.ru/?p=6964
```
sudo snap install amass
```
>enum Выполняет DNS перечисление и составление карты сети систем, доступных через Интернет
-src Вывести все источники для обнаруженных имён
-brute Выполнить перебор доменов методом брутфорса (перечислением всех вариантов)
-ip Показать IP адреса для обнаруженных имён
-min-for-recursive Количество меток в поддомене перед рекурсивным перебором
-d Доменные имена разделённые запятыми (можно использовать несколько раз)
```
amass enum -v -src -ip -brute -min-for-recursive 2 -d fbmse.ru
Querying AbuseIPDB for fbmse.ru subdomains
Querying N45HT for fbmse.ru subdomains
Querying PKey for fbmse.ru subdomains
Querying ThreatCrowd for fbmse.ru subdomains
....
Querying HackerTarget for fbmse.ru subdomains
Querying FullHunt for fbmse.ru subdomains
Querying HyperStat for fbmse.ru subdomains
Querying HackerOne for fbmse.ru subdomains
Querying Maltiverse for fbmse.ru subdomains
Querying GoogleCT for fbmse.ru subdomains
Querying IPv4Info for fbmse.ru subdomains
Querying Gists for fbmse.ru subdomains
Querying HAW for fbmse.ru subdomains
Querying Greynoise for fbmse.ru subdomains
DNS wildcard detected: Resolver 76.76.19.19:53: *.fbmse.ru: type: 1
[DNS] ns.fbmse.ru 212.45.0.5
[DNS] mail.fbmse.ru 82.138.54.82
[Brute Forcing] ftp.fbmse.ru 82.138.54.85
[Wayback] nnn.fbmse.ru 82.138.54.86
[Wayback] uc.fbmse.ru 82.138.54.86
[Wayback] iasfcr.fbmse.ru 82.138.54.86
[ArchiveIt] www.fbmse.ru 82.138.54.86
[Brute Forcing] dns.fbmse.ru 82.138.54.82
[DNS] fbmse.ru 82.138.54.86
[BufferOver] dmarc.fbmse.ru 82.138.54.82
[ArchiveIt] old.fbmse.ru 82.138.54.86
[Wayback] 15.fbmse.ru 82.138.54.86
[CertSpotter] adm.fbmse.ru 82.138.54.86
[BufferOver] spf.fbmse.ru 82.138.54.82
[Wayback] lms.fbmse.ru 82.138.54.86
[Crtsh] fckr.fbmse.ru 82.138.54.86
[Wayback] adn.fbmse.ru 82.138.54.86
[CertSpotter] test.fbmse.ru 82.138.54.86
[Wayback] sb.fbmse.ru 82.138.54.86
[Brute Forcing] mx.fbmse.ru 82.138.54.82
OWASP Amass v3.15.2 https://github.com/OWASP/Amass
--------------------------------------------------------------------------------
20 names discovered - dns: 3, brute: 3, archive: 10, api: 1, cert: 3
--------------------------------------------------------------------------------
ASN: 8732 - COMCOR-AS Moscow
212.45.0.0/21 1 Subdomain Name(s)
82.138.32.0/19 19 Subdomain Name(s)
```
отработал быстро нашел 20 субдоменов
> 20 names discovered - dns: 3, brute: 3, archive: 10, api: 1, cert: 3
```
amass enum -active -ip -brute -min-for-recursive 3 -d fbmse.ru
test.fbmse.ru 82.138.54.86
uc.fbmse.ru 82.138.54.86
15.fbmse.ru 82.138.54.86
ns.fbmse.ru 212.45.0.5
lms.fbmse.ru 82.138.54.86
dmarc.fbmse.ru 82.138.54.82
iasfcr.fbmse.ru 82.138.54.86
nnn.fbmse.ru 82.138.54.86
old.fbmse.ru 82.138.54.86
spf.fbmse.ru 82.138.54.82
mail.fbmse.ru 82.138.54.82
sb.fbmse.ru 82.138.54.86
mx.fbmse.ru 82.138.54.82
adn.fbmse.ru 82.138.54.86
www.48.fbmse.ru 82.138.54.86
www.fbmse.ru 82.138.54.86
fbmse.ru 82.138.54.86
ftp.fbmse.ru 82.138.54.85
dns.fbmse.ru 82.138.54.82
adm.fbmse.ru 82.138.54.86
fckr.fbmse.ru 82.138.54.86
OWASP Amass v3.15.2 https://github.com/OWASP/Amass
--------------------------------------------------------------------------------
21 names discovered - archive: 10, dns: 4, api: 2, brute: 2, cert: 3
--------------------------------------------------------------------------------
ASN: 8732 - COMCOR-AS Moscow, RU
82.138.32.0/19 20 Subdomain Name(s)
212.45.0.0/21 1 Subdomain Name(s)
The enumeration has finished
Discoveries are being migrated into the local database
```
в результате найден еще один дополнительный домен.
> intel Выполняет разведку по открытым источником для исследования целевой организации
-whois Все обнаруженные домены пропускаются через обратный whois
```
amass intel -whois -d fbmse.ru
gbmse.ru
fbmse.ru
clinica-fbmse.ru
mserf.ru
rfmse.ru
f7mse.ru
```
найдено 6 домен на том же ip адресе, как и домен fbmse.ru
#### altdns
Altdns is a DNS recon tool that allows for the discovery of subdomains that conform to patterns. Altdns takes in words that could be present in subdomains under a domain (such as test, dev, staging) as well as takes in a list of subdomains that you know of.
https://github.com/infosec-au/altdns

List of subdomains input
>-i INPUT, --input INPUT
-o OUTPUT, --output OUTPUT Output location for altered subdomains
-w WORDLIST, --wordlist WORDLIST List of words to alter the subdomains with
-r, --resolve Resolve all altered subdomains
-s SAVE, --save SAVE File to save resolved altered subdomains to
```
altdns -i subdomains.txt -o output -w words.txt -r -s results.txt
```
#### dnsgen
This tool generates a combination of domain names from the provided input. Combinations are created based on wordlist. Custom words are extracted per execution. Refer to Techniques section to learn more.
dnsgen is very similar to altdns. It does not contain DNS resolver. You should use massdns for DNS resolution.
https://github.com/ProjectAnte/dnsgen
```
cat d.txt | dnsgen -
....
mail.fbmse.ru
-mail.fbmse.ru
merchant.fbmse.ru
-merchant.fbmse.ru
nautilus.fbmse.ru
-nautilus.fbmse.ru
cat d.txt | dnsgen - | wc -l
1260
```
#### massdns
MassDNS is a simple high-performance DNS stub resolver targeting those who seek to resolve a massive amount of domain names in the order of millions or even billions. Without special configuration, MassDNS is capable of resolving over 350,000 names per second using publicly available resolvers.
https://github.com/blechschmidt/massdns
>-t --type Record type to be resolved. (Default: A)
-r --resolvers Text file containing DNS resolvers.
-o --output Flags for output formatting.
--flush Flush the output file whenever a response was received.
Output flags:
L - domain list output
S - simple text output
F - full text output
B - binary output
J - ndjson output
```
wget https://raw.githubusercontent.com/ProjectAnte/dnsgen/master/dnsgen/words.txt
cat d.txt | dnsgen - | massdns -r ./resolvers.txt -t A -o J --flush
Processed queries: 1260
Received packets: 21555
Progress: 100.00% (00 h 00 min 25 sec / 00 h 00 min 25 sec)
Current incoming rate: 792 pps, average: 842 pps
Current success rate: 0 pps, average: 24 pps
Finished total: 1050, success: 630 (60.00%)
Mismatched domains: 20925 (97.08%), IDs: 0 (0.00%)
Failures: 0: 51.90%, 1: 7.52%, 2: 0.57%, 3: 0.00%, 4: 0.00%, 5: 0.00%, 6: 0.00%, 7: 0.00%, 8: 0.00%, 9: 0.00%, 10: 0.00%, 11: 0.00%, 12: 0.00%, 13: 0.00%, 14: 0.00%, 15: 0.00%, 16: 0.00%, 17: 0.00%, 18: 0.00%, 19: 0.00%, 20: 0.00%, 21: 0.00%, 22: 0.00%, 23: 0.00%, 24: 0.00%, 25: 0.00%, 26: 0.00%, 27: 0.00%, 28: 0.00%, 29: 0.00%, 30: 0.00%, 31: 0.00%, 32: 0.00%, 33: 0.00%, 34: 0.00%, 35: 0.00%, 36: 0.00%, 37: 0.00%, 38: 0.00%, 39: 0.00%, 40: 0.00%, 41: 0.00%, 42: 0.00%, 43: 0.00%, 44: 0.00%, 45: 0.00%, 46: 0.00%, 47: 0.00%, 48: 0.00%, 49: 0.00%, 50: 40.00%,
Response: | Success: | Total:
OK: | 630 (100.00%) | 11131 ( 51.64%)
NXDOMAIN: | 0 ( 0.00%) | 0 ( 0.00%)
SERVFAIL: | 0 ( 0.00%) | 6910 ( 32.06%)
REFUSED: | 0 ( 0.00%) | 0 ( 0.00%)
FORMERR: | 0 ( 0.00%) | 0 ( 0.00%)
cat ./logs/dnsgen.txt | grep -v "82.138.54.86"
mail.fbmse.ru. A 82.138.54.82
```
> в результате генерации списка и отсева всех записей с адресом 82.138.54.86,
> так как на это ip адрес по умолчанию отвечают все поддомены fbmse.ru.
> Очень много ложнопозитивных результатов
#### subbrute
SubBrute is a community driven project with the goal of creating the fastest, and most accurate subdomain enumeration tool. Some of the magic behind SubBrute is that it uses open resolvers as a kind of proxy to circumvent DNS rate-limiting (https://www.us-cert.gov/ncas/alerts/TA13-088A). This design also provides a layer of anonymity, as SubBrute does not send traffic directly to the target's name servers.
https://github.com/TheRook/subbrute
````
git clone https://github.com/TheRook/subbrute.git
./subbrute.py fbmse.ru
mail.fbmse.ru
dns.fbmse.ru
ftp.fbmse.ru
ru.fbmse.ru
sasibloglist.fbmse.ru
mx.fbmse.ru
ns.fbmse.ru
admpc.fbmse.ru
andyv.fbmse.ru
click1.mail.fbmse.ru
coralreef.fbmse.ru
````
Процесса поиска долгий и был прерван. 90% лодные находки.
>Может быть использован в своих питон скриптах
>
```
import subbrute
for d in subbrute.run("google.com"):
print d
```
#### sublist3r
Sublist3r is a python tool designed to enumerate subdomains of websites using OSINT. It helps penetration testers and bug hunters collect and gather subdomains for the domain they are targeting. Sublist3r enumerates subdomains using many search engines such as Google, Yahoo, Bing, Baidu and Ask. Sublist3r also enumerates subdomains using Netcraft, Virustotal, ThreatCrowd, DNSdumpster and ReverseDNS.
[subbrute](#subbrute) was integrated with Sublist3r to increase the possibility of finding more subdomains using bruteforce with an improved wordlist. The credit goes to TheRook who is the author of subbrute.
https://github.com/aboul3la/Sublist3r
https://kali.tools/?p=809
```
apt install sublist3r
sublist3r -b -d fbmse.ru
____ _ _ _ _ _____
/ ___| _ _| |__ | (_)___| |_|___ / _ __
\___ \| | | | '_ \| | / __| __| |_ \| '__|
___) | |_| | |_) | | \__ \ |_ ___) | |
|____/ \__,_|_.__/|_|_|___/\__|____/|_|
# Coded By Ahmed Aboul-Ela - @aboul3la
[-] Enumerating subdomains now for fbmse.ru
[-] Searching now in Baidu..
[-] Searching now in Yahoo..
[-] Searching now in Google..
[-] Searching now in Bing..
[-] Searching now in Ask..
[-] Searching now in Netcraft..
[-] Searching now in DNSdumpster..
[-] Searching now in Virustotal..
[-] Searching now in ThreatCrowd..
[-] Searching now in SSL Certificates..
[-] Searching now in PassiveDNS..
[!] Error: Virustotal probably now is blocking our requests
[-] Starting bruteforce module now using subbrute..
adm.fbmse.ru
dns.fbmse.ru
fckr.fbmse.ru
www.fckr.fbmse.ru
ftp.fbmse.ru
mail.fbmse.ru
mx.fbmse.ru
ns.fbmse.ru
spf.fbmse.ru
test.fbmse.ru
```
Найдено 10 поддоменов.
#### Recon-ng
Recon-ng — это полнофункциональный фреймвок веб-разведки, написанный на Python. В комплекте независимые модули, взаимодействие с базой данных, удобные встроенные функции, интерактивная помощь и завершение команд. Recon-ng обеспечивает мощное окружение, в котором разведка на основе открытых веб-источников может быть проведена быстро и тщательно.
Recon-ng схож с Metasploit Framework, благодаря этому требуется меньше времени на обучение для овладевания фреймворком. Тем не менее, он немного другой. Recon-ng не ставит целью конкурировать с существующими фреймворками, он создан исключительно для разведки на основе открытых веб-источников. Если вы хотите эксплуатировать уязвимости, то используйте Metasploit Framework. Если вам нужна социальная инженерия, используйте Social-Engineer Toolkit. Если вы проводите разведку, используйте Recon-ng!
Recon-ng — это полностью модульный фреймворк, что делает написание новых модулей простым даже для начинающих разработчиков на Python'е. Каждый модуль — это подкласс класса "module". Класс "module" — это настроенный интерпретатор "cmd", снабжённый встроенной функциональностью, которая обеспечивает простые интерфейсы для популярных задач, таких как стандартизированный вывод, взаимодействие с базой данных, создание веб-запросов и управление API ключами. Таким образом, вся трудная работа уже сделана. Создание модулей — это просто и занимает немного более нескольких минут.
https://kali.tools/?p=319
https://codeby.net/threads/recon-ng-frejmvork-dlja-razvedki.68864/
https://forum.antichat.ru/threads/473931/
```
apt install recon-ng
recon-ng
[*] Version check disabled.
_/_/_/ _/_/_/_/ _/_/_/ _/_/_/ _/ _/ _/ _/ _/_/_/
_/ _/ _/ _/ _/ _/ _/_/ _/ _/_/ _/ _/
_/_/_/ _/_/_/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/_/_/
_/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/_/ _/ _/
_/ _/ _/_/_/_/ _/_/_/ _/_/_/ _/ _/ _/ _/ _/_/_/
/\
/ \\ /\
Sponsored by... /\ /\/ \\V \/\
/ \\/ // \\\\\ \\ \/\
// // BLACK HILLS \/ \\
www.blackhillsinfosec.com
____ ____ ____ ____ _____ _ ____ ____ ____
|____] | ___/ |____| | | | |____ |____ |
| | \_ | | |____ | | ____| |____ |____
www.practisec.com
[recon-ng v5.1.2, Tim Tomes (@lanmaster53)]
[*] No modules enabled/installed.
[recon-ng][default] >
```
на старте фрэймворк голый и нужно установить модули
```
[recon-ng][default] >marketplace refresh
[recon-ng][default] >marketplace install all
```
смотрим какие проекты уже существуют и создаем новый fbmse.ru
```
[recon-ng][default] > workspaces list
+----------------------------------+
| Workspaces | Modified |
+----------------------------------+
| default | 2021-12-14 15:50:09 |
+----------------------------------+
[recon-ng][default] > workspaces create fbmse.ru
[!] 'bing_api' key not set. bing_linkedin_contacts module will likely fail at runtime. See 'keys add'.
```
Могут возникнуть ошибки из за того что не настроены апи ключи к сервисам.
```
db insert domains fbmse.ru (добавляем необходимые нас домены в базу данных)
db insert domains clinica-fbmse.ru
db insert domains mserf.ru
[recon-ng][fbmse.ru] > modules search domain
[*] Searching installed modules for 'domain'...
Recon
-----
recon/companies-domains/censys_subdomains
recon/companies-domains/pen
recon/companies-domains/viewdns_reverse_whois
recon/companies-domains/whoxy_dns
recon/contacts-domains/migrate_contacts
recon/domains-companies/censys_companies
recon/domains-companies/pen
recon/domains-companies/whoxy_whois
recon/domains-contacts/hunter_io
recon/domains-contacts/pen
recon/domains-contacts/pgp_search
recon/domains-contacts/whois_pocs
recon/domains-contacts/wikileaker
recon/domains-credentials/pwnedlist/api_usage
recon/domains-credentials/pwnedlist/domain_ispwned
recon/domains-credentials/pwnedlist/leak_lookup
recon/domains-credentials/pwnedlist/leaks_dump
recon/domains-domains/brute_suffix
recon/domains-hosts/binaryedge
recon/domains-hosts/bing_domain_api
recon/domains-hosts/bing_domain_web
recon/domains-hosts/brute_hosts
recon/domains-hosts/builtwith
recon/domains-hosts/censys_domain
recon/domains-hosts/certificate_transparency
recon/domains-hosts/google_site_web
recon/domains-hosts/hackertarget
recon/domains-hosts/mx_spf_ip
recon/domains-hosts/netcraft
recon/domains-hosts/shodan_hostname
recon/domains-hosts/spyse_subdomains
recon/domains-hosts/ssl_san
recon/domains-hosts/threatcrowd
recon/domains-hosts/threatminer
recon/domains-vulnerabilities/ghdb
recon/domains-vulnerabilities/xssed
recon/hosts-domains/migrate_hosts
[recon-ng][fbmse.ru] > module load recon/domains-domains/brute_suffix
[!] Invalid command: module load recon/domains-domains/brute_suffix.
[recon-ng][fbmse.ru] > modules load recon/domains-domains/brute_suffix
[recon-ng][fbmse.ru][brute_suffix] > options set SOURCE fbmse.ru
SOURCE => fbmse.ru
[recon-ng][fbmse.ru][brute_suffix] > show domains
+-------------------------------------------------+
| rowid | domain | notes | module |
+-------------------------------------------------+
| 1 | fbmse.ru | | user_defined |
| 2 | clinica-fbmse.ru | | user_defined |
| 3 | mserf.ru | | user_defined |
+-------------------------------------------------+
```
```
[recon-ng][fbmse.ru] > modules load recon/domains-hosts/brute_hosts
[recon-ng][fbmse.ru][brute_hosts] > options set SOURCE fbmse.ru
SOURCE => fbmse.ru
[recon-ng][fbmse.ru][brute_hosts] > info
Name: DNS Hostname Brute Forcer
Author: Tim Tomes (@lanmaster53)
Version: 1.0
Description:
Brute forces host names using DNS. Updates the 'hosts' table with the results.
Options:
Name Current Value Required Description
-------- ------------- -------- -----------
SOURCE fbmse.ru yes source of input (see 'info' for details)
WORDLIST /root/.recon-ng/data/hostnames.txt yes path to hostname wordlist
Source Options:
default SELECT DISTINCT domain FROM domains WHERE domain IS NOT NULL
<string> string representing a single input
<path> path to a file containing a list of inputs
query <sql> database query returning one column of inputs
[recon-ng][fbmse.ru][brute_hosts] > run
-------
SUMMARY
-------
[*] 5 total (5 new) hosts found.
[recon-ng][fbmse.ru][brute_hosts] >
[recon-ng][fbmse.ru][brute_hosts] > show hosts
+------------------------------------------------------------------------------------------------------+
| rowid | host | ip_address | region | country | latitude | longitude | notes | module |
+------------------------------------------------------------------------------------------------------+
| 1 | dns.fbmse.ru | 82.138.54.82 | | | | | | brute_hosts |
| 2 | ftp.fbmse.ru | 82.138.54.85 | | | | | | brute_hosts |
| 3 | mail.fbmse.ru | 82.138.54.82 | | | | | | brute_hosts |
| 4 | mx.fbmse.ru | 82.138.54.82 | | | | | | brute_hosts |
| 5 | ns.fbmse.ru | 212.45.0.5 | | | | | | brute_hosts |
+------------------------------------------------------------------------------------------------------+
[*] 5 rows returned
[recon-ng][fbmse.ru][brute_hosts] >
```
```
[recon-ng][fbmse.ru] > modules load recon/domains-hosts/certificate_transparency
[recon-ng][fbmse.ru][certificate_transparency] > options set SOURCE fbmse.ru
[recon-ng][fbmse.ru][certificate_transparency] > show hosts
+-----------------------------------------------------------------------------------------------------------------------+
| rowid | host | ip_address | region | country | latitude | longitude | notes | module |
+-----------------------------------------------------------------------------------------------------------------------+
| 1 | dns.fbmse.ru | 82.138.54.82 | | | | | | brute_hosts |
| 2 | ftp.fbmse.ru | 82.138.54.85 | | | | | | brute_hosts |
| 3 | mail.fbmse.ru | 82.138.54.82 | | | | | | brute_hosts |
| 4 | mx.fbmse.ru | 82.138.54.82 | | | | | | brute_hosts |
| 5 | ns.fbmse.ru | 212.45.0.5 | | | | | | brute_hosts |
| 6 | fbmse.ru | | | | | | | certificate_transparency |
| 7 | adm.fbmse.ru | | | | | | | certificate_transparency |
| 8 | test.fbmse.ru | | | | | | | certificate_transparency |
| 9 | fckr.fbmse.ru | | | | | | | certificate_transparency |
| 10 | www.fckr.fbmse.ru | | | | | | | certificate_transparency |
| 11 | *.fbmse.ru | | | | | | | certificate_transparency |
+-----------------------------------------------------------------------------------------------------------------------+
```
#### theHarvester
theHarvester — это инструмент для сбора e-mail адресов, имён поддоменов, виртуальных хостов, открытых портов/банеров и имён работников из различных открытых источников (поисковые системы, сервера ключей pgp).
Это по-настоящему простой инструмент, но эффективный на ранних этапах тестирования на проникновение или чтобы узнать, какую информацию могут собрать о вашей компании через Интернет.
https://kali.tools/?p=2286
https://github.com/laramies/theHarvester
```
theHarvester -d fbmse.ru -b all -l 1000
...
[*] Searching Linkedin.
[*] No Twitter users found.
[*] No LinkedIn users found.
[*] LinkedIn Links found: 0
---------------------
[*] No Trello URLs found.
[*] IPs found: 6
-------------------
81.177.140.241
82.138.54.86
212.45.0.5
[*] Emails found: 30
----------------------
clinic@fbmse.ru
contact@fbmse.ru
dmochka@fbmse.ru
fbmse@fbmse.ru
gbmse01@fbmse.ru
gbmse04@fbmse.ru
gbmse05@fbmse.ru
gbmse07@fbmse.ru
gbmse09@fbmse.ru
gbmse13@fbmse.ru
gbmse16@fbmse.ru
gbmse19@fbmse.ru
gbmse22@fbmse.ru
gbmse34@fbmse.ru
gbmse39@fbmse.ru
gbmse41@fbmse.ru
gbmse42@fbmse.ru
gbmse48@fbmse.ru
gbmse54@fbmse.ru
gbmse58@fbmse.ru
gbmse69@fbmse.ru
gbmse78@fbmse.ru
gbmse79@fbmse.ru
gbmse82@fbmse.ru
sinkovskiy@fbmse.ru
terskov_sv@fbmse.ru
tselishcheva_ev@fbmse.ru
uc@fbmse.ru
zubkov_ov@fbmse.ru
[*] Hosts found: 67
---------------------
adm.fbmse.ru:82.138.54.86
dmarc.fbmse.ru:82.138.54.82
dns.fbmse.ru:82.138.54.82
fbmse.ru:mail.fbmse.ru
fckr.fbmse.ru:82.138.54.86
iasfcr.fbmse.ru:82.138.54.86
lms.fbmse.ru:82.138.54.86
mail.fbmse.ru:82.138.54.82
mx.fbmse.ru:82.138.54.82
ns.fbmse.ru:212.45.0.5
old.fbmse.ru:82.138.54.86
spf.fbmse.ru:82.138.54.82
test.fbmse.ru:82.138.54.86
www.dszn.ru.www.fbmse.ru
www.fbmse.ru:82.138.54.86
www.fckr.fbmse.ru:82.138.54.86
www.fckr.fbmse.ru
```
theHarvester -d mserf.ru -b all -l 1000
theHarvester -d f7mse.ru -b all -l 1000
theHarvester -d rfmse.ru -b all -l 1000
theHarvester -d clinica-fbmse.ru -b all -l 1000
theHarvester -d gbmse.ru -b all -l 1000
.
=====
по результатам анализа доменов на себя обращают внимание два домена
открыты системы авторизации и регистрации, проверить можно ли зайти
iasfcr.fbmse.ru:82.138.54.86
открыта авторизация
test.fbmse.ru:82.138.54.86
adm.fbmse.ru:82.138.54.86
отвечает но не пускает в корень, можно попробовать брут форсе.
lms.fbmse.ru:82.138.54.86
в качестве пользователей можно пробовать использовать следующие ящики
clinic@fbmse.ru
contact@fbmse.ru
dmochka@fbmse.ru
fbmse@fbmse.ru
sinkovskiy@fbmse.ru
terskov_sv@fbmse.ru
tselishcheva_ev@fbmse.ru
uc@fbmse.ru
zubkov_ov@fbmse.ru
найдены ip адреса
212.45.0.5
82.138.54.82
82.138.54.85
82.138.54.86
### Анализ доменов,IP адресов и сетей
Для анализа публичных IP адресов мы можем использовать различные публичные сервисы и поисковые машины
#### yandex.ru
отправляем запросы к яндексу в попытке найти полезную информацию
[site:fbmse.ru filetype:pdf](https://yandex.ru/search/?text=site%3Afbmse.ru+filetype%3Apdf&lr=10313)
site:fbmse.ru filetype:docx сотрудников
Находим файл со списком сотрудников, может пригодиться для опреления словаря учетных записей и паролей

Не плохо, все в одном месте. Открываем

Не пригодился -)
#### spyse.com
https://spyse.com/target/ip/82.138.54.82

https://spyse.com/target/ip/82.138.54.85

https://spyse.com/target/ip/82.138.54.86

https://spyse.com/target/ip/212.45.0.5

Кроме этого мы можем использовать и различные утилиты для сканирования или сканеры уязвимостей
#### nmap
Nmap ("Network Mapper") is a free and open source (license) utility for network discovery and security auditing. Many systems and network administrators also find it useful for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. It was designed to rapidly scan large networks, but works fine against single hosts. Nmap runs on all major computer operating systems
https://nmap.org/
https://heritage-offshore.com/net-admin/shpargalka-nmap/

```
┌──(root💀kali)-[/home/kali/tools]
└─# nmap -F 82.138.54.82 -open
Starting Nmap 7.92 ( https://nmap.org ) at 2021-12-15 05:17 EST
Nmap scan report for spf.fbmse.ru (82.138.54.82)
Host is up (0.085s latency).
Not shown: 84 closed tcp ports (reset), 11 filtered tcp ports (no-response)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT STATE SERVICE
25/tcp open smtp
110/tcp open pop3
587/tcp open submission
2000/tcp open cisco-sccp
5060/tcp open sip
Nmap done: 1 IP address (1 host up) scanned in 1.82 seconds
┌──(root💀kali)-[/home/kali/tools]
└─# nmap -F 82.138.54.85 -open
Starting Nmap 7.92 ( https://nmap.org ) at 2021-12-15 05:17 EST
Nmap scan report for 82.138.54.85
Host is up (0.084s latency).
Not shown: 84 closed tcp ports (reset), 14 filtered tcp ports (no-response)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT STATE SERVICE
2000/tcp open cisco-sccp
5060/tcp open sip
Nmap done: 1 IP address (1 host up) scanned in 1.85 seconds
┌──(root💀kali)-[/home/kali/tools]
└─# nmap -F 82.138.54.86 -open
Starting Nmap 7.92 ( https://nmap.org ) at 2021-12-15 05:17 EST
Nmap scan report for 82.138.54.86
Host is up (0.082s latency).
Not shown: 77 closed tcp ports (reset), 17 filtered tcp ports (no-response)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT STATE SERVICE
25/tcp open smtp
80/tcp open http
110/tcp open pop3
443/tcp open https
2000/tcp open cisco-sccp
5060/tcp open sip
Nmap done: 1 IP address (1 host up) scanned in 1.88 seconds
┌──(root💀kali)-[/home/kali/tools]
└─# nmap -F 212.45.0.5 -open 130 ⨯
Starting Nmap 7.92 ( https://nmap.org ) at 2021-12-15 05:18 EST
Nmap scan report for 212.45.0.5
Host is up (0.079s latency).
Not shown: 64 closed tcp ports (reset), 33 filtered tcp ports (no-response)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT STATE SERVICE
53/tcp open domain
111/tcp open rpcbind
514/tcp open shell
Nmap done: 1 IP address (1 host up) scanned in 1.81 seconds
```
проверить
==2000/tcp open cisco-sccp==
проверяем rpcbind
```
nmap -sSUC -p111 212.45.0.5 > ./logs/212.45.0.5.txt
┌──(root💀kali)-[/home/kali/tools]
└─# cat ./logs/212.45.0.5.txt
Starting Nmap 7.92 ( https://nmap.org ) at 2021-12-15 08:27 EST
Nmap scan report for 212.45.0.5
Host is up (0.077s latency).
PORT STATE SERVICE
111/tcp open rpcbind
| rpcinfo:
| program version port/proto service
| 100000 2,3,4 111/tcp rpcbind
| 100000 2,3,4 111/udp rpcbind
| 100000 3,4 111/tcp6 rpcbind
| 100000 3,4 111/udp6 rpcbind
| 100021 1,2,3,4 4045/tcp nlockmgr
| 100021 1,2,3,4 4045/tcp6 nlockmgr
| 100021 1,2,3,4 4045/udp nlockmgr
| 100021 1,2,3,4 4045/udp6 nlockmgr
| 100024 1 39151/tcp status
| 100024 1 43412/udp6 status
| 100024 1 51949/udp status
| 100024 1 57496/tcp6 status
| 100133 1 39151/tcp nsm_addrand
| 100133 1 43412/udp6 nsm_addrand
| 100133 1 51949/udp nsm_addrand
| 100133 1 57496/tcp6 nsm_addrand
| 1073741824 1 48145/tcp6 fmproduct
|_ 1073741824 1 63361/tcp fmproduct
111/udp open|filtered rpcbind
| rpcinfo:
| program version port/proto service
| 100000 2,3,4 111/tcp rpcbind
| 100000 2,3,4 111/udp rpcbind
| 100000 3,4 111/tcp6 rpcbind
| 100000 3,4 111/udp6 rpcbind
| 100021 1,2,3,4 4045/tcp nlockmgr
| 100021 1,2,3,4 4045/tcp6 nlockmgr
| 100021 1,2,3,4 4045/udp nlockmgr
| 100021 1,2,3,4 4045/udp6 nlockmgr
| 100024 1 39151/tcp status
| 100024 1 43412/udp6 status
| 100024 1 51949/udp status
| 100024 1 57496/tcp6 status
| 100133 1 39151/tcp nsm_addrand
| 100133 1 43412/udp6 nsm_addrand
| 100133 1 51949/udp nsm_addrand
| 100133 1 57496/tcp6 nsm_addrand
| 1073741824 1 48145/tcp6 fmproduct
|_ 1073741824 1 63361/tcp fmproduct
Nmap done: 1 IP address (1 host up) scanned in 15.88 seconds
```
похоже пусто и ловить тут нечего
проверяем версии сервисов на узле .86
```
┌──(root💀kali)-[/home/kali/tools]
└─# nmap 82.138.54.86 -sV
Starting Nmap 7.92 ( https://nmap.org ) at 2021-12-15 05:53 EST
Nmap scan report for 82.138.54.86
Host is up (0.083s latency).
Not shown: 971 closed tcp ports (reset)
PORT STATE SERVICE VERSION
25/tcp open nagios-nsca Nagios NSCA
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
110/tcp open pop3
443/tcp open ssl/http nginx
2000/tcp open tcpwrapped
5060/tcp open tcpwrapped
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port110-TCP:V=7.92%I=7%D=12/15%Time=61B9C92E%P=x86_64-pc-linux-gnu%r(NU
SF:LL,4C,"\+OK\x20mail\.fbmse\.ru\x20POP3\x20ready\x20<F202112151347\.AA47
SF:32277MD8440@mail\.fbmse\.ru>\r\n")%r(GenericLines,68,"\+OK\x20mail\.fbm
SF:se\.ru\x20POP3\x20ready\x20<F202112151347\.AA4732277MD8440@mail\.fbmse\
SF:.ru>\r\n-ERR\x20unknown\x20POP3\x20command!\r\n")%r(HTTPOptions,68,"\+O
SF:K\x20mail\.fbmse\.ru\x20POP3\x20ready\x20<F202112151347\.AA4742258MD581
SF:4@mail\.fbmse\.ru>\r\n-ERR\x20unknown\x20POP3\x20command!\r\n");
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 46.74 seconds
```
проверим 25/tcp open nagios-nsca Nagios NSCA, судя по ответу не похоже на Nagios
```
└─# nc 82.138.54.86 25 130 ⨯
220-mail.fbmse.ru ESMTP Wed, 15 Dec 2021 14:07:00 +0300
220 iPO6OT
HELO
501 5.5.4 Invalid or missing command argument(s)
HELO ddd.com
```
сохранив все найденные ip адреса в файл fbmse.ru.ip выполняем сканирование.
```
nmap -Pn -p- -sV -sC -d --open -iL ./fbmse.ru.ip >> nmap_rezult_fbmse.txt
```
>
> ssl-cert: Subject: commonName=fbmse.ru
Subject Alternative Name: DNS:adm.fbmse.ru, DNS:fbmse.ru, DNS:test.fbmse.ru
#### OpenVAS/GreenBone
OpenVAS is a full-featured vulnerability scanner. Its capabilities include unauthenticated and authenticated testing, various high-level and low-level internet and industrial protocols, performance tuning for large-scale scans and a powerful internal programming language to implement any type of vulnerability test.
The scanner obtains the tests for detecting vulnerabilities from a feed that has a long history and daily updates.
OpenVAS has been developed and driven forward by the company Greenbone Networks since 2006. As part of the commercial vulnerability management product family "Greenbone Security Manager" (GSM), the scanner forms the Greenbone Vulnerability Management together with other Open Source
modules.
https://www.greenbone.net/en/vulnerability-management/
https://github.com/greenbone/
https://hackertarget.com/openvas-tutorial-tips/
https://hackware.ru/?p=15689
VM - https://www.greenbone.net/en/testnow/#toggle-id-2
OpenVAS - https://www.openvas.org/
man - https://habr.com/ru/post/203766/
пошаговую настройку лучше посмореть тут у [@KobanenkoAA](https://hackmd.io/@KobanenkoAA/HyYPlqKXF#2-GreenBone)
устанавливаем
```
┌──(root💀kali)-[/home/kali/tools]
└─# apt install gvm -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
doc-base greenbone-security-assistant greenbone-security-assistant-common gvm-tools gvmd gvmd-common libgvm21 libhiredis0.14 libmicrohttpd12 libradcli4 libuuid-perl libyaml-tiny-perl openvas-scanner
ospd-openvas python3-defusedxml python3-deprecated python3-gvm python3-impacket python3-ldapdomaindump python3-ospd python3-psutil python3-wrapt
Suggested packages:
dhelp | dwww | dochelp | doc-central | yelp | khelpcenter pnscan strobe python-gvm-doc python-psutil-doc
The following NEW packages will be installed:
doc-base greenbone-security-assistant greenbone-security-assistant-common gvm gvm-tools gvmd gvmd-common libgvm21 libhiredis0.14 libmicrohttpd12 libradcli4 libuuid-perl libyaml-tiny-perl
openvas-scanner ospd-openvas python3-defusedxml python3-deprecated python3-gvm python3-impacket python3-ldapdomaindump python3-ospd python3-psutil python3-wrapt
0 upgraded, 23 newly installed, 0 to remove and 8 not upgraded.
Need to get 6,412 kB of archives.
After this operation, 34.5 MB of additional disk space will be used.
Do you want to continue? [Y/n]
```
Сканеру нужен запущенный сервер Redis для временного хранение собранной информации по сканированным хостам. Настройка сервера Redis делается так (эти команды нужно выполнить один раз):
wget https://raw.githubusercontent.com/greenbone/openvas-scanner/master/config/redis-openvas.conf
sudo cp redis-openvas.conf /etc/redis/
sudo chown redis:redis /etc/redis/redis-openvas.conf
echo 'db_address = /run/redis-openvas/redis.sock' | sudo tee /etc/openvas/openvas.conf
Запуск сервера Redis (нужно делать после каждой перезагрузки компьютера):
sudo systemctl start redis-server@openvas.service
Или, если хотите, добавьте его в автозагрузку:
sudo systemctl enable redis-server@openvas.service
Служба Greenbone Vulnerability Management (gvmd) действует как клиент OSP для подключения к сканерам и управления ими. openvas не действует как служба OSP — для этого вам понадобится модуль OSPD-OpenVAS. Фактические пользовательские интерфейсы (например, GSA или GVM-Tools) будут взаимодействовать только с gvmd и/или ospd-openvas, но не со сканером. Вы можете запустить openvas, чтобы загрузить плагины в Redis, используя следующую команду:
sudo openvas -u
Поскольку openvas будет запускаться из процесса ospd-openvas с помощью sudo, в файле sudoers требуется следующая конфигурация:
sudo visudo
добавьте эту строку, чтобы позволить пользователю, запускающему ospd-openvas, запускать openvas с правами root
ПОЛЬЗОВАТЕЛЬ ALL = NOPASSWD: /usr/sbin/openvas
Замените ПОЛЬЗОВАТЕЛЬ на имя вашего пользователя Linux
Настройка Greenbone Vulnerability Management (GVM):
Greenbone Vulnerability Manager — это центральная служба управления между сканерами безопасности и пользовательскими клиентами.
Скрипт развёртывания (вместо openvas-setup) - Этот скрипт нужно запустить только один раз.
```
┌──(root💀kali)-[/home/kali/tools]
└─# gvm-setup [>] Starting PostgreSQL service
[-] ERROR: The default PostgreSQL version (13) is not 14 that is required by libgvmd
[-] ERROR: Use pg_upgradecluster to update your PostgreSQL cluster
┌──(root💀kali)-[/home/kali/tools]
└─# dpkg -l | grep postgresql
ii postgresql 14+232 all object-relational SQL database (supported version)
ii postgresql-13 13.4-3 amd64 The World's Most Advanced Open Source Relational Database
ii postgresql-14 14.1-1 amd64 The World's Most Advanced Open Source Relational Database
ii postgresql-client-13 13.4-3 amd64 front-end programs for PostgreSQL 13
ii postgresql-client-14 14.1-1 amd64 front-end programs for PostgreSQL 14
ii postgresql-client-common 232 all manager for multiple PostgreSQL client versions
ii postgresql-common 232 all PostgreSQL database-cluster manager
┌
┌──(root💀kali)-[/home/kali/tools]
└─# pg_lsclusters 127 ⨯
Ver Cluster Port Status Owner Data directory Log file
13 main 5432 online postgres /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log
14 main 5433 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
┌──(root💀kali)-[/home/kali/tools]
└─# pg_upgradecluster 13 main
Error: target cluster 14/main already exists
┌──(root💀kali)-[/home/kali/tools]
└─# apt --purge remove postgresql-13
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
postgresql-13*
0 upgraded, 0 newly installed, 1 to remove and 8 not upgraded.
After this operation, 49.2 MB disk space will be freed.
Do you want to continue? [Y/n] y
```
после удаления 13 версии установка продолжилась
```
┌──(root💀kali)-[/home/kali/tools]
└─# gvm-setup
[>] Starting PostgreSQL service
/usr/bin/gvm-setup: line 30: [: =: unary operator expected
/usr/bin/gvm-setup: line 34: [: -ne: unary operator expected
[>] Creating GVM's certificate files
[>] Creating PostgreSQL database
[*] Creating database user
[*] Creating database
....
[+] GVM feeds updated
[*] Checking Default scanner
[*] Modifying Default Scanner
Scanner modified.
[+] Done
[i] Admin user already exists for GVM
[i] If you have forgotten it, you can change it. See gvmd manpage for more information
[>] You can now run gvm-check-setup to make sure everything is correctly configured
```
```
┌──(root💀kali)-[/home/kali/tools]
└─# gvm-check-setup
gvm-check-setup 21.4.3
Test completeness and readiness of GVM-21.4.3
Step 1: Checking OpenVAS (Scanner)...
OK: OpenVAS Scanner is present in version 21.4.3.
OK: Server CA Certificate is present as /var/lib/gvm/CA/servercert.pem.
Checking permissions of /var/lib/openvas/gnupg/*
OK: _gvm owns all files in /var/lib/openvas/gnupg
OK: redis-server is present.
OK: scanner (db_address setting) is configured properly using the redis-server socket: /run/redis-openvas/redis.sock
OK: redis-server is running and listening on socket: /run/redis-openvas/redis.sock.
OK: redis-server configuration is OK and redis-server is running.
OK: _gvm owns all files in /var/lib/openvas/plugins
OK: NVT collection in /var/lib/openvas/plugins contains 79241 NVTs.
Checking that the obsolete redis database has been removed
Could not connect to Redis at /var/run/redis-openvas/redis-server.sock: No such file or directory
OK: No old Redis DB
OK: ospd-OpenVAS is present in version 21.4.3.
Step 2: Checking GVMD Manager ...
OK: GVM Manager (gvmd) is present in version 21.4.4.
Step 3: Checking Certificates ...
OK: GVM client certificate is valid and present as /var/lib/gvm/CA/clientcert.pem.
OK: Your GVM certificate infrastructure passed validation.
Step 4: Checking data ...
OK: SCAP data found in /var/lib/gvm/scap-data.
OK: CERT data found in /var/lib/gvm/cert-data.
Step 5: Checking Postgresql DB and user ...
OK: Postgresql version and default port are OK.
gvmd | _gvm | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
ERROR: No users found. You need to create at least one user to log in.
FIX: create a user by running 'sudo runuser -u _gvm -- gvmd --create-user=<name> --password=<password>'
ERROR: Your GVM-21.4.3 installation is not yet complete!
Please follow the instructions marked with FIX above and run this
script again.
```
Ошибка говорит, что пользователя нет и предлагает его создать.
создаем пользователя.
==В процессе возможны и другие ошибки, часть из них рассмотрена в ссылка по теме.==
```
┌──(root💀kali)-[/home/kali/tools]
└─# runuser -u _gvm -- gvmd --create-user=admin --password=123
User created.
```
утанавливаем права на папку согами
```chmod 666 /var/log/gvm/*```
пробуем запустить
```
┌──(root💀kali)-[/home/kali/tools]
└─# gvm-start
```
>В результате видим, что всё нормально запустилось, кроме greenbone-security-assistant, то есть gsa, то есть Web UI (Greenbone Security Assistant), ну то есть веб-интерфейса.
Не удалось запустить https демон.
У gsad есть опция —http-only которая запускает только HTTP без HTTPS. Воспользуемся ею:
```
┌──(root💀kali)-[/home/kali/tools]
└─# gsad --http-only
Oops, secure memory pool already initialized
```
Опять будет выведено очередное сообщение, что что-то не так
Тем не менее, веб-интерфейс должен быть доступен по адресу: http://server_ip:9392
но по какой-то причине не доступно и по http.
в какой-то момент пробую остановить все сервисы
```
┌──(root💀kali)-[/home/kali/tools]
└─# gsad stop
Oops, secure memory pool already initialized
```
и
```
┌──(root💀kali)-[/home/kali/tools]
└─# gvm-stop
[>] Stopping GVM services
○ greenbone-security-assistant.service - Greenbone Security Assistant (gsad)
Loaded: loaded (/lib/systemd/system/greenbone-security-assistant.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:gsad(8)
https://www.greenbone.net
○ gvmd.service - Greenbone Vulnerability Manager daemon (gvmd)
Loaded: loaded (/lib/systemd/system/gvmd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:gvmd(8)
Dec 15 11:44:19 kali systemd[1]: Starting Greenbone Vulnerability Manager daemon (gvmd)...
Dec 15 11:44:19 kali systemd[1]: gvmd.service: Can't open PID file /run/gvm/gvmd.pid (yet?) after start: Operation not permitted
Dec 15 11:44:20 kali systemd[1]: Started Greenbone Vulnerability Manager daemon (gvmd).
Dec 15 11:53:33 kali systemd[1]: Stopping Greenbone Vulnerability Manager daemon (gvmd)...
Dec 15 11:53:33 kali systemd[1]: gvmd.service: Deactivated successfully.
Dec 15 11:53:33 kali systemd[1]: Stopped Greenbone Vulnerability Manager daemon (gvmd).
Dec 15 11:53:33 kali systemd[1]: gvmd.service: Consumed 1min 43.444s CPU time.
○ ospd-openvas.service - OSPd Wrapper for the OpenVAS Scanner (ospd-openvas)
Loaded: loaded (/lib/systemd/system/ospd-openvas.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:ospd-openvas(8)
man:openvas(8)
Dec 15 11:49:17 kali systemd[1]: Stopping OSPd Wrapper for the OpenVAS Scanner (ospd-openvas)...
Dec 15 11:49:18 kali systemd[1]: ospd-openvas.service: Deactivated successfully.
Dec 15 11:49:18 kali systemd[1]: Stopped OSPd Wrapper for the OpenVAS Scanner (ospd-openvas).
Dec 15 11:49:18 kali systemd[1]: ospd-openvas.service: Consumed 8.416s CPU time.
Dec 15 11:50:11 kali systemd[1]: Starting OSPd Wrapper for the OpenVAS Scanner (ospd-openvas)...
Dec 15 11:50:12 kali systemd[1]: Started OSPd Wrapper for the OpenVAS Scanner (ospd-openvas).
Dec 15 11:53:33 kali systemd[1]: Stopping OSPd Wrapper for the OpenVAS Scanner (ospd-openvas)...
Dec 15 11:53:36 kali systemd[1]: ospd-openvas.service: Deactivated successfully.
Dec 15 11:53:36 kali systemd[1]: Stopped OSPd Wrapper for the OpenVAS Scanner (ospd-openvas).
Dec 15 11:53:36 kali systemd[1]: ospd-openvas.service: Consumed 43.005s CPU time.
```
и снова запускаю
```
┌──(root💀kali)-[/home/kali/tools]
└─# gvm-start 3 ⨯
[>] Please wait for the GVM services to start.
[>]
[>] You might need to refresh your browser once it opens.
[>]
[>] Web UI (Greenbone Security Assistant): https://127.0.0.1:9392
● greenbone-security-assistant.service - Greenbone Security Assistant (gsad)
Loaded: loaded (/lib/systemd/system/greenbone-security-assistant.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2021-12-15 11:53:54 EST; 32ms ago
Docs: man:gsad(8)
https://www.greenbone.net
Process: 193234 ExecStart=/usr/sbin/gsad --listen=127.0.0.1 --port=9392 (code=exited, status=0/SUCCESS)
Main PID: 193235 (gsad)
Tasks: 1 (limit: 3491)
Memory: 1.9M
CPU: 44ms
CGroup: /system.slice/greenbone-security-assistant.service
└─193235 /usr/sbin/gsad --listen=127.0.0.1 --port=9392
Dec 15 11:53:54 kali systemd[1]: Starting Greenbone Security Assistant (gsad)...
● gvmd.service - Greenbone Vulnerability Manager daemon (gvmd)
Loaded: loaded (/lib/systemd/system/gvmd.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2021-12-15 11:53:49 EST; 5s ago
Docs: man:gvmd(8)
Process: 193196 ExecStart=/usr/sbin/gvmd --osp-vt-update=/run/ospd/ospd.sock --listen-group=_gvm (code=exited, status=0/SUCCESS)
Main PID: 193202 (gvmd)
Tasks: 2 (limit: 3491)
Memory: 184.1M
CPU: 433ms
CGroup: /system.slice/gvmd.service
├─193202 "gvmd: Waiting for incoming connections" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
└─193225 "gvmd: Syncing SCAP: Updating CPEs" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
Dec 15 11:53:45 kali systemd[1]: Starting Greenbone Vulnerability Manager daemon (gvmd)...
Dec 15 11:53:45 kali systemd[1]: gvmd.service: Can't open PID file /run/gvm/gvmd.pid (yet?) after start: Operation not permitted
Dec 15 11:53:49 kali systemd[1]: Started Greenbone Vulnerability Manager daemon (gvmd).
● ospd-openvas.service - OSPd Wrapper for the OpenVAS Scanner (ospd-openvas)
Loaded: loaded (/lib/systemd/system/ospd-openvas.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2021-12-15 11:53:45 EST; 9s ago
Docs: man:ospd-openvas(8)
man:openvas(8)
Process: 193192 ExecStart=/usr/bin/ospd-openvas --config /etc/gvm/ospd-openvas.conf --log-config /etc/gvm/ospd-logging.conf --unix-socket /run/ospd/ospd.sock --pid-file /run/ospd/ospd-openvas.pid --log-file /var/log/gvm/ospd-openvas.log --lock-file-dir /var/lib/openvas (code=exited, status=0/SUCCESS)
Main PID: 193194 (ospd-openvas)
Tasks: 4 (limit: 3491)
Memory: 27.0M
```
смотрим запись в логах
```
journalctl -xeu ospd-openvas.service
Dec 15 11:50:12 kali systemd[1]: Started OSPd Wrapper for the OpenVAS Scanner (ospd-openvas).
░░ Subject: A start job for unit ospd-openvas.service has finished successfully
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit ospd-openvas.service has finished successfully.
░░
░░ The job identifier is 123201.
```
на всякий случай проверяем какие порты слушает сервер VAS
```
ss -ltpn
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 1024 0.0.0.0:8834 0.0.0.0:* users:(("nessusd",pid=881,fd=18))
LISTEN 0 4096 127.0.0.1:9392 0.0.0.0:* users:(("gsad",pid=193235,fd=5))
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=41294,fd=3))
LISTEN 0 244 127.0.0.1:5432 0.0.0.0:* users:(("postgres",pid=192412,fd=6))
LISTEN 0 4096 *:443 *:* users:(("gsad",pid=193077,fd=10))
LISTEN 0 1024 [::]:8834 [::]:* users:(("nessusd",pid=881,fd=20))
LISTEN 0 4096 *:80 *:* users:(("gsad",pid=193045,fd=10))
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=41294,fd=4))
LISTEN 0 244 [::1]:5432 [::]:* users:(("postgres",pid=192412,fd=5))
```
Все запустилось.
==не сразу. пришлось сначала отановить и запустить сервис, возможно еще что-то повлияло, но в результате заработало на 443 порту.==
заходим на https://server_ip
видим страницу с авторизацией и заходим с учетными данными созданного пользователя.

пробуем созадать новую задачу и просканировать себя же, но получаем ошибку.
Как и при попытке просканить любой другой узел.

ошибка описана [тут](https://github.com/greenbone/gsa/issues/2497).
>@greenbone/gsa-dev I guess this should be moved into the gvmd repository.
>
>@montjoie 33d0cd82-57c6-11e1-8ed1-406186ea4fc5 is the "All IANA assigned TCP" which is shipped with the GVMD_DATA feed since 20.08. If you're getting this message it is very likely that the following is valid for you as well:
>
>You're probably have missed to set the Feed Import user:
>
>https://github.com/greenbone/gvmd/blob/v20.8.0/INSTALL.md#set-the-feed-import-owner
>
>or haven't synced the GVM_DATA feed yet / before:
>
>https://github.com/greenbone/gvmd/blob/v20.8.0/INSTALL.md#keeping-the-feeds-up-to-date
>
>greenbone/gvmd#1315 (comment)
```
┌──(root💀kali)-[/home/kali/tools]
└─# runuser -u _gvm -- gvmd --get-scanners
08b69003-5fc2-4037-a479-93b440211c73 OpenVAS /run/ospd/ospd-openvas.sock 0 OpenVAS Default
6acd0832-df90-11e4-b9d5-28d24461215b CVE 0 CVE
┌──(root💀kali)-[/home/kali/tools]
└─# runuser -u _gvm -- gvmd --get-users --verbose
admin 3c968056-e079-453d-ae9c-90fa5c331bfa
┌──(root💀kali)-[/home/kali/tools]
└─# runuser -u _gvm -- gvmd --modify-scanner 08b69003-5fc2-4037-a479-93b440211c73 --value 3c968056-e079-453d-ae9c-90fa5c331bfa
┌──(root💀kali)-[/home/kali/tools]
└─# gvmd --modify-setting 78eceaec-3385-11ea-b237-28d24461215b --value 3c968056-e079-453d-ae9c-90fa5c331bfa
```
В итоге, полноценно запустить его на kali не смог. надо пробовать на отдельном сервере.
все снес и начал ставить заново
```
service postgresql stop
systemctl stop ospd-openvas.service
apt --purge remove postgresql
apt --purge remove gvm
apt autoremove
apt install postgresql
apt install gvm
gvm-setup
gvm-check-setup
```
==```openvas -u``` будет выполнен при исполнение команды```gvm-setup```==
Updating Vulnerability Tests info into Redis store from VT files
После gvm-check-setup нет необходимости выполнять gvm-start, так как похоже что сервис стартует при выполение gvm-check-setup. ==проверить==
после этого сервис был снова остановлен и снова запущен так не отвечал ни по одному из своих портов
Только после следующей команды он стал доступен на 443. возможно и рестарты не причем.
```
gvm -p 443
```
Запустил скан самого себя и найденных ранее узлов.

Прочее:
```
sudo gvm-cli
sudo gvm-feed-update
sudo gvm-manage-certs
sudo gvm-pyshell
gvm-script
```
В будущем для обновления сигнатур запускайте иногда команду:
```runuser -u _gvm -- greenbone-nvt-sync```
Если что-то не работает, то посмотреть журнал можно командой:
```cat /var/log/gvm/gvmd.log```
Отсутсвие конфигураций сканирования исправляется вот так, и ошибка https тоже, после необходимо запустить обновление сигнатур:
```apt-get upgrade gvm```
#### Nessus - https://www.tenable.com/products/nessus
Инструкция по установке
https://hackmd.io/q9pf7SWfTvCbvnK1qx_S0A?view#How-to-download-Nessus-on-Windows-2016Standart
### Анализ сайта
http://fckr.fbmse.ru/page.php?slug=contact
http://fckr.fbmse.ru/assets/uploads/
([ссылка на Ильдра](https://hackmd.io/@sadykovildar/Hy9ca9wft))
tags: `module9` `OSINT` `проникновение`