Hello again loyal readers.
I’ve had a lot of ideas rattling around in my head lately. Malware related things. For example, what if someone used Gopher for C&C? Who the hell uses gopher anymore?
The API’s for handling gopher, while deprecated, are still around. Though you would probably have to load it from an older Wininet.dll with LoadLibrary() from XP box.
The API’s are still referenced / documented.
Maybe I’ll get bored one day and make use of it.
Then I have this idea for a conceptual malware attack using a little known Win32 API called SetProcessShutdownParameters. What it does is change the order in which the calling process gets shut down. Here is where my idea comes into play:
What if the antivirus program doesn’t call SetProcessShutdownParameters()’s dwLevel to be shut down last in the shutdown range? Theoretically malware could set the shutdown range to be shutdown AFTER the AV, but BEFORE the OS. All processes start at shutdown level 0x280 (640 in decimal) before modification. This would present a window of opportunity for a piece of malicious code to execute after the AV has been closed. No reporting of this event would occur in the case of something like a Host Based Intrusion Detection System. The malware would need only sleep until the system is shutdown – I’ve already shown how this would be done with window hooks.
Here is the code for messing with the function:
Caveat? Applications that run in the system security context are not shut down by the OS, instead they are notified of shutdown / logoff events via the callback function installable via SetConsoleCtrlHandler()’s callback function.I haven’t had a chance to test this theory yet on an AV, but hope to do so in the coming weeks.