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

Вызов функций ядра из usermode

С win2003 не доступна из юзермода
http://wasm.ru/forum/viewtopic.php?id=36773

Да, видел, но возможно есть известные методы через отладочные функции, как писал карабас, ZwVdmControl, выход в Ring0 через либу Ms-Rem и т.п. или в вин7 это все не работает?

юзермодный аналог NtOpenSection - OpenFileMapping
Она тоже доступ запретит? Необходимо открыть "\Device\PhysicalMemory".
 
accelerator
Никакие решения (вызовов толи Nt толи Zw - шный ф-ий) на 7 семерке не помогут !!! так как uac включенный если выключите uac будет тоже что и на ХР но тогда многое тиряет смысл ))
выход в Ring0
на семерке не так то просто сделать это был сплоит позволяющий это сделать но дрырку залатали http://www.exploit-db.com/exploits/15609/
Под семерку сейчас что то стоющие сделать оч. сложно ))) да сплоит решение на время конечно найти бы пути изящней сплоита ))
 
Никакие решения (вызовов толи Nt толи Zw - шный ф-ий) на 7 семерке не помогут !!! так как uac включенный если выключите uac будет тоже что и на ХР но тогда многое тиряет смысл ))
Не все же функции Nt, Zw в вин7 заблокированы :) А NtOpenSection запрещает доступ к PhysicalMemory независимо от прав, даже с админом и выключенным UAC.

сплоит решение на время конечно найти бы пути изящней сплоита ))
Да, сплоит не лучшее решение..
 
нашел кодес - опять же наверное для XPшки , читают кернел мемори , тебе явно не поможет - но вцелом интересен для ознакомления
Код:
In my REcon talk I talked about this API, but I realized a lot of people were not aware of all the wonderful things you can do with it. Here is a small example of a really simple and naive rootkit detection code that is fully user-mode. It works with 100% of commercial spyware/keygens that I've tried, but of course not with the experimental "scene" rootkits that can use Kernel Object hooking, memory obfuscation to change the contents of this table, or even injecting code within the area that is being flagged. Nevertheless, it's a useful POC code for the API:
(A couple of entries ago I talked about an API I had discovered that no commercial rootkit seems to hook, this is NOT it).

NTSTATUS
ReadKernelMemory(IN PVOID BaseAddress,
                 OUT PVOID Buffer,
                 IN ULONG Length)
{
    NTSTATUS Status;
    SYSDBG_VIRTUAL DbgMemory;

    //
    // Setup the request
    //
    DbgMemory.Address = BaseAddress;
    DbgMemory.Buffer = Buffer;
    DbgMemory.Request = Length;

    //
    // Do the read
    //
    Status = NtSystemDebugControl(SysDbgReadVirtual,
                                  &DbgMemory,
                                  sizeof(DbgMemory),
                                  NULL,
                                  0,
                                  NULL);
    return Status;
}

PCHAR
FindDriverForAddress(IN PVOID Pointer)
{
    NTSTATUS Status;
    PRTL_PROCESS_MODULES ModuleInfo;
    PRTL_PROCESS_MODULE_INFORMATION ModuleEntry;
    ULONG ReturnedLength;
    ULONG i;

    //
    // Figure out how much size we need
    //
    Status = NtQuerySystemInformation(SystemModuleInformation,
                                      NULL,
                                      0,
                                      &ReturnedLength);
    if (Status != STATUS_INFO_LENGTH_MISMATCH) return NULL;

    //
    // Allocate a buffer large enough
    //
    ModuleInfo = RtlAllocateHeap(RtlGetProcessHeap(), 0, ReturnedLength);
    if (!ModuleInfo) return NULL;

    //
    // Now query the data again
    //
    Status = NtQuerySystemInformation(SystemModuleInformation,
                                      ModuleInfo,
                                      ReturnedLength,
                                      &ReturnedLength);
    if (!NT_SUCCESS(Status)) return NULL;

    //
    // Loop all the drivers
    //
    for (i = 0; i < ModuleInfo->NumberOfModules; i++)
    {
        //
        // Get the current entry and check if the pointer is within it
        //
        ModuleEntry = &ModuleInfo->Modules[i];
        if ((Pointer > ModuleEntry->ImageBase) &&
            (Pointer < ((PVOID)((ULONG_PTR)ModuleEntry->ImageBase +
                                ModuleEntry->ImageSize))))
        {
            //
            // Found a match, return it
            //
            return ModuleEntry->FullPathName;
        }
    }
}

PCHAR
DetectDriver(VOID)
{
    BOOLEAN Old;
    NTSTATUS Status;
    ULONG_PTR MappedAddress;
    PVOID KernelBase, TableBase;
    UNICODE_STRING KernelName;
    ANSI_STRING TableName = RTL_CONSTANT_STRING("KeServiceDescriptorTable");
    RTL_PROCESS_MODULES ModuleInfo;
    ULONG Flags;
    KSERVICE_TABLE_DESCRIPTOR ServiceTable;

    //
    // Give our thread the debug privilege
    //
    Status = RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE, TRUE, FALSE, &Old);
    if (!NT_SUCCESS(Status)) return NULL;

    //
    // Query the kernel's module entry
    //
    Status = NtQuerySystemInformation(SystemModuleInformation,
                                      &ModuleInfo,
                                      sizeof(ModuleInfo),
                                      NULL);
    if (Status != STATUS_INFO_LENGTH_MISMATCH) return NULL;

    //
    // Initialize the kernel's full path name
    //
    Status = RtlCreateUnicodeStringFromAsciiz(&KernelName,
                                              ModuleInfo.Modules[0].FullPathName);
    if (!Status) return NULL;

    //
    // Keep only the short name
    //
    KernelName.Buffer = KernelName.Buffer +
                        (KernelName.Length / sizeof(WCHAR)) -
                        12;

    //
    // Map the kernel
    //
    Flags = IMAGE_FILE_EXECUTABLE_IMAGE;
    Status = LdrLoadDll(NULL, &Flags, &KernelName, &KernelBase);
    if (!NT_SUCCESS(Status)) return NULL;

    //
    // Find the address of KeServiceDescriptorTable
    //
    Status = LdrGetProcedureAddress(KernelBase, &TableName, 0, &TableBase);
    if (!NT_SUCCESS(Status)) return NULL;

    //
    // Unload the kernel image, we're done with it
    //
    Status = LdrUnloadDll(KernelBase);
    if (!NT_SUCCESS(Status)) return NULL;

    //
    // Get the virtual address we need
    //
    MappedAddress = (ULONG_PTR)ModuleInfo.Modules[0].ImageBase;
    MappedAddress -= (ULONG_PTR)KernelBase;
    MappedAddress += (ULONG_PTR)TableBase;

    //
    // Now read the SSDT
    //
    Status = ReadKernelMemory((PVOID)MappedAddress,
                              &ServiceTable,
                              sizeof(ServiceTable));
    if (!NT_SUCCESS(Status)) return NULL;

    //
    // Setup the argument table
    //
    ArgumentTable = RtlAllocateHeap(RtlGetProcessHeap(),
                                    0,
                                    ServiceTable.Limit * sizeof(ULONG_PTR));
    if (!ArgumentTable) return NULL;

    //
    // Now fill it up
    //
    Status = ReadKernelMemory(ServiceTable.Base,
                              ArgumentTable,
                              ServiceTable.Limit * sizeof(ULONG_PTR));
    if (!NT_SUCCESS(Status)) return NULL;

    //
    // Now scan it
    //
    for (i = 0; i < ServiceTable.Limit; i++)
    {
        //
        // Make sure no pointer is outside the kernel area
        //
        if (ArgumentTable[i] > 0x8FFFFFFF)
        {
            //
            // Find the driver file that this belongs to
            //
            return FindDriverForAddress(UlongToPtr(ArgumentTable[i]));
        }
    }

    //
    // If we got here, then you don't have any rootkit
    //
    return NULL;
}

потестите на XP , работает ли еще этот хаксор ? потому что на 7 точно не пашет
 
Клиф, комод и прочий шлак уязвим к пейджгвард атаке - аргументы сервиса в бкфер с PAGE_GUARD. ZA к таким атакам устойчив весьма, но как и остальные директорию не проверяет. Передаём описатель директории в OA и секция успешно откроется.
 


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