WEB Basic Practice 3

tags: WEB Basic

Статистика пройденных атак:

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 →

SQL-injection уязвимости:

1) Обход логина

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 →

Нажмём на My account и введём рандомные символы в поле логина и пароля:

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 →

В это же время включим Burp Suite и нажмём на Log in в браузере:

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 →

Поменяем поле username на administrator'

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 →

2) Извлечение скрытых данных

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 →

Зайдём в раздел Lifestyle, например:

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 →

Перейдём в Burp:

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 →

Допишем '+OR+1=1

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 →

3) UNION-атака, позволяющая извлекать информацию из других таблиц

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 →

Перейдём в раздел Gifts, например:

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 →

Допишем к Gifts '+UNION+SELECT+'abc','def', чтобы проверить количество столбцов в таблице:

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 →

Увидим, что столбца как минимум 2:

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 →

Попробуем дописать ещё один столбец в UNION-конструкцию:

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 →

Увидим, что столбца в таблице всё-таки 2:

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 →

Изменим немного конструкцию UNION, которая вывыводит имена и пароли пользователей из таблицы с пользователеми:

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 →

Увидим пароль carlos и administrator, он нам и нужен:

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 →

4) Запрос типа и версии базы данных на MySQL и Microsoft

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 →

Перейдём в категорию Pets:

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 →

Допишем UNION-конструкцию, чтобы узнать, сколько столбцов в таблице, однако на конце вместо будет #

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 →

Увидим, что столбца как минимум 2:

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 →

Изменим UNION-конструкцию, написав в первый столбец параметр version, а во второй NULL:

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 →

В самом низу видно номер версии используемой базы данных MySQL:

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 →

XSS уязвимости:

1) Сохраненный XSS в контексте HTML без каких-либо кодировок

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 →

Вернёмся назад, где увидим, что скрипт сработал:

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 →

2) DOM XSS в document.write с использованием исходного кода

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 →

Увидим, что наш поисковой запрос записывается в img src:

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 →

3) Отраженный XSS в строку JavaScript с угловыми скобками, закодированный в HTML

Напишем случайную строчку в поисковике:

Поймаем запрос с помощью Burp:

И отправим его в Repeater:

Нажмём на Send и найдём упоминания этой строчки в ответе на запрос, где увидим, что строчка записалась в переменную JS:

Введём команду, что выводит единицу:

4) Отраженный DOM XSS

Введём в поиск рандомный запрос:

Найдём запрос в Burp Suite:

Перейдём в другую вкладку:

Отправим этот запрос ещё раз и получим ответ от сервера:

Введём команду, что выводит единицу:

CSRF:

1) Уязвимость CSRF без защиты

Залогинимся как wiener и пароль peter:

Изменим email:

Найдём запрос на изменение email:

Так как версия Burp Community, то скопируем скрипт и вставим нужные параметры на сервер, а затем отправим этот скрипт:

2) CSRF, где проверка токена зависит от метода запроса

Залогинимся как и в прошлой лабораторной:

Поменяем email:

Найдём запрос на изменение email:

Отправим запрос в Repeater:

Поменяем метод с Post на Get:

Напишем скрипт, подставив свои значения, и отправим его:

SSRF:

1) Базовый SSRF против локального сервера

Если попробовать прописать /admin на конце сайтовой строки, то увидим следующее:

Нажмём на check stock с включенным Burp:

Нажмём на forward:

Увидим, где появляется текст на сайте:

Отправим отслеженный запрос в Repeater и нажмём на send, где увидим ссылку на удаление carlos:

Пропишем в StockApi следующую ссылку, чтобы удалить пользователя carlos:

2) SSRF с обходом фильтра через открытую уязвимость перенаправления

Нажмём на Check stock:

Пропишем в параметре crsf http://192.168.0.12:8080/admin

И увидим следующее оповещение под списка:

Перейдём на следующую страницу в магазине и отправим forward:

Запрос отправим в Repeater и нажмём send:

После этого высветятся пользователи:

Изменим stockApi на следующую строчку, что удалит пользователя, и перейдём обратно на вкладку Proxy, где нажмём на forward:

RCE:

1) Внедрение команды ОС, простой случай

Перейдём на страницу продукта и нажмём Check store:

Перейдём в burp, который был до этого включён:

Изменим параметр storeId, дописав |whoami

Увидим имя пользователя:

Path traversal:

1) Обход пути к файлу, простой случай

Откроем картинку в новой вкладке:

Поменяем параметр filename на путь к файлу с пользователями:

Отправим запрос в Repeater и нажмём send, после чего увидим файл /etc/passwd:

2) Обход пути к файлу, последовательности обхода заблокированы с обходом абсолютного пути

Откроем картинку в новой вкладке, включив Burp:

Отправим запрос в Repeater:

Поменяем параметр filename, прописав /etc/passwd, и нажмём на send: