OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Mohsen Hariri (mohsen_hariri_at_yahoo.com)
Date: Thu Oct 31 2002 - 00:56:06 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    Hi

    WindowsXP Service Pack 1 seems to have fixed the
    WM_TIMER message bug, which was the base for all
    shatter attacks.

    How was it fixed? as Matt Pietrek had written in his
    1997 MSJ article a list of all registered timer
    functions is saved, and any WM_TIMER message is
    checked against that list.

    I traced DispatchMessage api and found a function
    named _NtValidateCallbackProc which seems to do the
    checking(You need to have XP SP1 debug symbols
    installed to see its name). The attached program shows
    how a timer function is validated.

    MSJ article address :
    http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0397/hood/hood0397.htm&nav=/msj/0397/newnav.htm

    bye

    -------------
    Mohsen Hariri

    __________________________________________________
    Do you Yahoo!?
    HotJobs - Search new jobs daily now
    http://hotjobs.yahoo.com/

    // settimer.cpp : show the death of shatter attacks!
    // programmed by : Mohsen Hariri (mohsen_haririyahoo.com)

    #include <windows.h>
    #include <stdio.h>
    #include <tchar.h>

    VOID CALLBACK MyTimerProc(HWND,UINT,UINT_PTR,DWORD)
    {
            return;
    }

    int _tmain(int argc, _TCHAR* argv[])
    {

            DWORD (WINAPI *_NtValidateCallbackProc)(HWND, WPARAM, LPARAM);
            // this function is just valid in WindowsXP SP1
            *(DWORD *)(&_NtValidateCallbackProc) = 0x77D442F4;

            // if you comment out this line, timer proc is no longer valid
            SetTimer(NULL, 0, 0x10000, (TIMERPROC)MyTimerProc);

            DWORD ret = _NtValidateCallbackProc(NULL, 10, (LPARAM)MyTimerProc);
            if(ret)
                    printf("TimerProc is valid.\n");
            else
                    printf("TimerProc is not valid.\n");

            // just to force user32.dll to be loaded
            // cause _NtValidateCallbackProc is in that module
            IsWindow(NULL);

            return 0;
    }