The truth about personal firewalls

modern-web-guidance-src(TypeScript) 「modern-web-guidance-src(TypeScript)」是开源项目(TypeScript)。项目简介:Keep your coding agent up to date with the latest web best practices源码完整,下载解压即可查看使用,适合学习参考、课程设计与二次开发。 立即下载
文章作者:MaD.
信息来源:邪恶八进制信息安全团队( www.eviloctal.com)

There are several ways to protect your computer against malicious software, such as software firewall protection, viruses and rootkits activity detection. All this protection software based on some well-known techniques, that are used almost without improvements and how you might already know, implementation of those security products is not perfect. It’s awful, usually. The companies that truly thinks that their products are the most advanced, they include newest features, that are “must have” for users, but if you take a look under the cover, look inside, you will see, that there are more bugs and failures than in your school project. The main idea is to make a product the first one – it’s a good strong advertisement. And yeah, heavy advertisement combined with faked tests that can demonstrate for a user the “power” of some product can result in a strong feeling like “Yeah, I really need it”. Bullshit.


It’s a good idea – protect your PC against attacks from outside of your machine, and from strangers inside. Some heuristic ways to protect your PC from trojans and spyware is good and they are really work. It’s pretty nice idea to pay 30-50$ per every-second-protection and updates, if it’s working. But actually, it doesn’t.

First of all, I wanted to apologize for my awful English. And our talking will be about such products:

ZoneAlarm Firewall 6.x
Outpost Firewall 3.x and 4.x
Look'n'Stop Firewall 2.0
Kerio Firewall 4.3
Sygate Firewall 5.6
Jetico Firewall 1.0
PortsLock Firewall 1.9
Tiny Firewall 6.5
Norton Internet Security 8.0
Comodo Firewall 2.4
OnlineArmor Firewall 2.1


Protection of personal software firewalls consist of two basic levels – NDIS (Network Driver Interface Specification) and TDI (Transport Data Interface). NDIS-level is standing over the TCP/IP stack and protection on that level can help to prevent attacks, based on bugs in TCP/IP stack, even if you didn’t update your stack, or it can prevent many spoofing, flood and DDoS attacks. Firewalls, who don’t use NDIS automatically become an outsiders. The losers are PortsLock Firewall, Norton Internet Security, Comodo Firewall etc. Will you really pay 35€ per single license of PortsLock, who even doesn’t protect you against low-level TCP/IP attacks? Or 79$ for Comodo? Sad for your system. The real firewalls are sitting on a NDIS level. And here can be two different protection methods based on NDIS. The first one is a NDIS-hooking protection. Main idea of this – the first firewall hooks NdisRegisterProtocol()/NdisOpenAdapter() (and it can be EAT patching or even splicing method as Tiny Firewall does). Then firewall being notified when a NDIS protocol is trying to be registered or when it’s binding to some adapter, and the key moment – firewall is hooking a handlers of NDIS_PROTOCOL_BLOCK and NDIS_OPEN_BLOCK and when the system wants to send a packet or receive it, firewall will be notified when it will happened. It’s interesting when firewalls is trying to set their hooks – almost everybody is hooking handlers right in the NDIS_PROTOCOL_BLOCK, but several firewalls, such as Sygate, Kerio and Jetico are hooking handlers right in the NDIS_PROTOCOL_CHARACTERISTICS, than they call the real NdisRegisterProtocol(), and after that they are moving back an old handlers. More safe, right? So, firewall should work independent from that how much protocols will be registered and how much bindings will be. And yeah, everybody supports that. For example, when ZoneAlarm is hooking a handler, it is allocating non-pageable memory and putting there several instructions:

pop        eax        ; 58
push        HookData    ; 68 XX XX XX XX
push        eax        ; 50
jmp        HookedHandler    ; E9 XX XX XX XX


after that, it puts some valuable information in other piece of memory, called HookData, and all hooked handlers in NDIS_PROTOCOL_BLOCK:

OpenAdapterCompleteHandler
CloseAdapterCompleteHandler
BindAdapterHandler
UnbindAdapterHandler

And NDIS_OPEN_BLOCK:

SendHandler
ReceiveHandler
ReceivePacketHandler
SendPacketsHandler


Will be like that:
For NDIS_PROTOCOL_BLOCK:


VOID
  HookedOpenAdapterComplete(
    PVOID HookData,
    IN NDIS_HANDLE  ProtocolBindingContext,
    IN NDIS_STATUS  Status,
    IN NDIS_STATUS  OpenErrorStatus
    );

The real OpenAdapterComplete() handler is placing right here: [HookData + 0x770]


VOID
  HookedCloseAdapterComplete(
    PVOID HookData,
    IN NDIS_HANDLE  ProtocolBindingContext,
    IN NDIS_STATUS  Status
    );

The real CloseAdapterComplete() handler is placing right here: [HookData + 0x774]


VOID
  HookedBindAdapter(
    PVOID HookData,
    OUT PNDIS_STATUS Status,
    IN NDIS_HANDLE  BindContext,
    IN PNDIS_STRING  DeviceName,
    IN PVOID  SystemSpecific1,
    IN PVOID  SystemSpecific2
    );

The real BindAdapter() handler is placing right here: [HookData + 0x764]


VOID
  HookedUnbindAdapter(
    PVOID HookData,
    OUT PNDIS_STATUS  Status,
    IN NDIS_HANDLE  ProtocolBindingContext,
    IN NDIS_HANDLE  UnbindContext
    );

The real UnbindAdapter() handler is placing right here: [HookData + 0x768]

For NDIS_OPEN_BLOCK:


VOID
  HookedSend(
    PVOID HookData,
    IN NDIS_HANDLE  NdisBindingHandle,
    IN  PNDIS_PACKET  Packet
);

The real Send() handler is placing right here: [HookData + 0x1A4]


VOID
  HookedReceive(
    PVOID HookData,
    IN  NDIS_HANDLE             ProtocolBindingContext,
    IN  NDIS_HANDLE             MacReceiveContext,
    IN  PVOID                   HeaderBuffer,
    IN  UINT                    HeaderBufferSize,
    IN  PVOID                   LookAheadBuffer,
    IN  UINT                    LookaheadBufferSize,
    IN  UINT                    PacketSize
);

The real Receive() handler is placing right here: [HookData + 0x4D0]


VOID
  HookedReceivePacket(
    PVOID HookData,
    IN  NDIS_HANDLE             ProtocolBindingContext,
    IN  PNDIS_PACKET            Packet
);

The real ReceivePacket() handler is placing right here: [HookData + 0x570]


VOID
  HookedSendPackets(
    PVOID HookData,
    IN NDIS_HANDLE              MiniportAdapterContext,
    IN PPNDIS_PACKET            PacketArray,
    IN UINT                     NumberOfPackets
);

The real SendPackets() handler is placing right here: [HookData+2E4h]

Damn you ZoneAlarm, it’s so easy to get a pointer to the real handlers and restore it.

I said, that everybody supports numerous of registered protocols. Actually, not everybody. Sygate thinks that it will be enough to hold all information about protocols and open blocks right in his .data section. Nah, bad idea. His handlers hooking way is similar to ZoneAlarm, but that instructions, for which memory should be allocated, is placing right in the Sygate’s driver Teefer.sys:

pop        eax        ; 58
push        HookData    ; 68 XX XX XX XX
push        eax        ; 50
jmp        FakeHandler    ; E9 XX XX XX XX


HookData is placing in .data too (btw, it’s 448 bytes long) and totally Sygate can hook 576 handlers (including protocol and open blocks handlers). So, it can be approximately 40-50 NDIS_PROTOCOL_BLOCK and NDIS_OPEN_BLOCK can be hooked (don’t forget that several open blocks can be attached to one protocol block). Maybe 40-50 blocks it’s enough, but it’s really bad practice to code that way, say hello to a buffer overflow.

I have another good example about how necessary to know `what’ and `how much’ to hook. Guys from Kerio Firewall team didn’t know that. Yep, as a nice firewall, it’s setting hooks on NdisRegisterProtocol(), NdisDeregisterProtocol(), NdisOpenAdapter(), NdisCloseAdapter() and hooking a handlers. As I said, Kerio is hooking handlers right in the NDIS_PROTOCOL_CHARACTERISTICS and just then call NdisRegisterProtocol(), but it doesn’t move handlers back to NDIS_PROTOCOL_CHARACTERISTICS. What’s this? Undocumented feature? Don’t think so, just careless coding and misunderstanding of standards and whole kernel. Another good example of that Kerio team don’t know anything about NDIS development, it’s that fact that they’re just don’t know what to hook. Kerio Firewall hooks in NDIS_PROTOCOL_CHARACTERISTICS:

OpenAdapterCompleteHandler
CloseAdapterCompleteHandler


And what does it hook in NDIS_OPEN_BLOCK:

SendHandler
SendPacketsHandler


Not too much? Right. It can be using for bypass his NDIS “protection” and deliver a packet to TCP/IP stack. You even can push “Block all” button and still watch in a local sniffer for incoming packets. Bah, I don’t like to see packets in a sniffer, when I’m pretending to be fully-protected as Kerio Firewall pretending to be.
From the other side, Outpost Firewall, who likes to hook much more in NDIS_PROTOCOL_BLOCK:

OpenAdapterCompleteHandler
SendCompleteHandler
TransferDataCompleteHandler
RequestCompleteHandler
ReceiveHandler
StatusHandler
ReceivePacketHandler
BindAdapterHandler
UnbindAdapterHandler

And in NDIS_OPEN_BLOCK:
Outpost 4.0:

SendCompleteHandler
TransferDataCompleteHandler
ReceiveHandler
ReceivePacketHandler
StatusHandler

Outpost 3.x:

SendHandler
TransferDataHandler
SendCompleteHandler
TransferDataCompleteHandler
ReceiveHandler
RequestCompleteHandler
ReceivePacketHandler
SendPacketsHandler
StatusHandler

It’s very interesting his intermediate code between handler caller and firewall:

call    ImCode        ; E8 XX XX XX XX
<some specific data>


For Outpost 3.x:

pop        eax        ; 58
push        [eax]        ; FF 30        Pushing the real handler
pushad                ; 60
push        [eax+4]        ; FF 70 04
push        [esp+28h]    ; FF 74 24 28    Pushing return address
jmp        [eax+8]        ; FF 60 08


For Outpost 4.0:

pop        eax        ; 58
add        eax, 3        ; 83 C0 03    Missing three zero bytes after call
push        [eax]        ; FF 30        Pushing the real handler
pushad                ; 60
push        [eax+4]        ; FF 70 04
push        [esp+28h]    ; FF 74 24 28    Pushing return address
jmp        [eax+8]        ; FF 60 08


As can you see, it’s not a problem to unhook all this stuff and immediately own the system. If you get bored of this intermediate asm codes, which are using to get to normal C code, I can present you something interesting from Tiny Firewall team, it’s pretending to be really secure and showing us a lot of hooks:

NdisOpenAdapter
NdisCloseAdapter
NdisInitializeWrapper
NdisTerminateWrapper
NdisMRegisterMiniport
NdisIMRegisterLayeredMiniport
NdisRegisterProtocol
NdisMSetAttributesEx
NdisRegisterMac
NdisIMAssociateMiniport
NdisClOpenAddressFamily
NdisCmRegisterAddressFamily
NdisMCmRegisterAddressFamily
NdisMCoSendComplete


Wow, looks great, and also great is that, that they’re trying to do a splicing-hooks over the functions by setting jmp to their handler. I don’t like splices, know why? It’s don’t because it’s hard to implement or you can find some instruction, which can’t be spliced (theoretically it can be, but in the real life, in the real functions’ prologues, I don’t think so) – the main reason it’s unsafe. Rootkit developers are using that because it’s the simplest way to get control over something, but don’t try to use it in security applications, it’s like using terrorist methods against terrorists. Also, need to say that I didn’t find any thread-safe or multiprocessor-safe code. Failure again. When your’re splice something, you need to be sure that no one thread and no one CPU run this code.
Tiny Firewall allocates memory for each hooking handler and copying this C-function with prologue and epilogue:

push        ebp                    ; 55
mov        ebp, esp                ; 8B EC
sub        esp, XXh                ; 83 EC XX
mov        byte ptr [ebp-1], XXh            ; C6 45 FF XX
mov        dword ptr [ebp-8], HookedHandler    ; C7 45 F8 XX XX XX XX
<...>
push        RealHandler
call        [ebp-8]
mov        esp, ebp
pop        ebp
ret        XXh


so it’s pretty easy to get the real handler by offset 0xD from the start of new handler. For all this handlers, Tiny is copying the same previous code.
Hooked in NDIS_PROTOCOL_BLOCK:

SendCompleteHandler
StatusHandler


Hooked in NDIS_OPEN_BLOCK:

TransferDataHandler
SendCompleteHandler
TransferDataCompleteHandler
ReceiveHandler
ReceivePacketHandler
StatusHandler


Need to say, that firewalls become clever and they’re trying to restore their hook, if they will be hooked by someone else. For example, Outpost firewall is detecting this and monitoring his hooks, but just safety of pointers. Probably they didn’t think that there could be splicing tricks? Outpost team don’t know it, white hats  Sygate Firewall can restore his hooks too, but it’s restoring just NDIS_OPEN_BLOCK.SendHandler and NDIS_OPEN_BLOCK.SendPacketsHandler. It’s strange, because they’re hooking a lot of handlers in NDIS_PROTOCOL_BLOCK:

OpenAdapterCompleteHandler
CloseAdapterCompleteHandler
TransferDataCompleteHandler
ReceiveHandler
StatusHandler


and NDIS_OPEN_BLOCK hooks:

SendHandler
TransferDataHandler
TransferDataCompleteHandler
ReceiveHandler
ReceivePacketHandler
SendPacketsHandler
StatusHandler


Just several firewalls are using Intermediate NDIS driver for protection on a NDIS level. It’s a clever solution. For example, Look’n’Stop and Outpost 2008 firewalls use IM NDIS drivers. Good improvement since last year, Outpost. But now it’s easier to bypass firewall just because now there is no hooks, no tricks and no any undocumented features used. Now you can smash down all IM NDIS firewalls just bypassing them. Don’t need to disturb firewall handlers by incoming or outgoing packets, you just don’t send packets to them. Anyway, using IM NDIS driver it’s a good, well-known, documented (not so much, but still…) and the one right way to protect the system against outside attacks.

As you might see, techniques are similar from one firewall to other, and ideas even can be stolen and nobody will say that you have stolen an idea. Good way to look under the cover and take something new in your product. Don’t need to think, don’t need to generate ideas, just reversing, debugging and being interested in it. The second main level in firewall building – it’s TDI, Transport Data Interface which can provide more high-level access to a transport protocol stacks in the kernel. Afd.sys, which can be interpreted as winsock, communicating with Windows TCP/IP stack (tcpip.sys) via tdi.sys (TDI layer, which I was talking about). So, there are several ways and places where to set hook and monitor your applications, communicating with network, and the best place where to set your protection – is right on tcpip.sys devices, which are interpreting as an upper-level protocols in stack:

DeviceIp
DeviceTcp
DeviceUdp
DeviceIPMULTICAST
DeviceRawIp

Yep, you even can spoof somebody via /Device/RawIp. The best way (and documented way, it’s important) to prevent applications an access to the network, it’s attach to those devices and monitor them. Almost all firewalls do this, because it’s a great way to notify user about strange application, which is going to communicate with network.

For example, Look’n’Stop attaches his devices to tcpip.sys devices:

DevicePcaTcpFilter -> DeviceTcp
DevicePcaUdpFilter -> DeviceUdp
DevicePcaRawIpFilter -> DeviceRawIp


Where is /Device/Ip? Not enough, we need to be sure, that all types of connections will be monitored, or they just pass through this pseudo-protection.
You can see that devices in your WinObj tool:

DeviceComodoRawIpFilter
DeviceComodoUdpFilter
DeviceComodoTcpFilter
DeviceComodoIpFilter

I hope you guessed, it’s Comodo Firewall is attaching devices to the same-named tcpip.sys devices.

Outpost Firewall, Kerio Firewall, Jetico Firewall, Norton Internet Security is just attaching noname devices to Tcp, Udp, Ip, RawIp, nothing interesting. People, who know main ideas of device-stacks organizing should know that it’s pretty easy to throw away this attaches and a firewall won’t get any notifies ever. You just need to find a pointer of tcpip.sys’s DRIVER_OBJECT, walk through the DeviceObject list and make null all DEVICE_OBJECT.AttachedDevice fields. Pretty easy? Sure, but very effective against firewalls, protection of which is placing just near here. Another failure of lame firewalls and big advertisement.
Besides of attaching technique, there is another one interesting technique, which is more complicated, but more effective against malware – it’s a MajorTable hooking. Everybody knows, when usermode (or driver, whatever) wants to communicate with a driver, it’s notifying to I/O manager that it wants to communicate with a driver. I/O manager makes an IRP, and (key moment) calls one of the handlers DRIVER_OBJECT.MajorTable[IRP_MJ_XXX]. The same here, in tcpip.sys, some firewalls just hooks an IRP_MJ_XXX handlers and monitoring all calls, passing through allowed requests and denying forbidden. Not so easy to find a real handler, huh? I think almost everybody thinks that it’s impossible. The main idea of finding some hooked handler in that it must be called and then it will be found. By hooking Int 0x01, setting TF and tracing the call of firewall’s handler, we can find a real handler when firewall will call it. Easy. MajorTable-hooking techniques loved by such firewalls as ZoneAlarm Firewall, it is hooking:

IRP_MJ_CREATE
IRP_MJ_CLOSE
IRP_MJ_DEVICE_CONTROL
IRP_MJ_INTERNAL_DEVICE_CONTROL
IRP_MJ_CLEANUP

another failure of partial-hooking in that tcpip.sys has just two IRP-handlers – TCPDispatch() and TCPDispatchInternalDeviceControl(), the first one is filling all MajorTable and it’s easy to take him from another handler. TCPDispatchInternalDeviceControl() you can find by using another method (such as previous said tracing method or by using disassembler). Sygate Firewall loves to hook that handlers:

IRP_MJ_CREATE
IRP_MJ_CLOSE
IRP_MJ_DEVICE_CONTROL
IRP_MJ_INTERNAL_DEVICE_CONTROL


PortsLock Firewall, hooks all of MajorTable handlers. Great idea, don’t give neither TCPDispatch(), nor TCPDispatchInternalDeviceControl() to enemies  Tiny Firewall is hooking next handlers:

IRP_MJ_CREATE
IRP_MJ_CLOSE
IRP_MJ_DEVICE_CONTROL
IRP_MJ_INTERNAL_DEVICE_CONTROL
IRP_MJ_CLEANUP



It’s not serious to have just this type of protection in a firewall, don’t you think so? I think products like PortsLock Firewall, Norton Internet Security (wtf, really Internet Security?), Comodo Firewall and others has a wrong name ‘firewall’. Just some nice-looking with a pretty GUI protection system.

Malware is becoming more aggressive, there are tons of rootkits registering every day, more sophisticated, more advanced, standing on lowest level than firewalls now and every time on a step forward. They’re trying to affect other processes and hide themselves in it. So, it’s a good idea, like a wolf in a sheep’s skin. I’m talking about injection, OpenProcess()/WriteProcessMemory()/CreateRemoteThread() and a good shellcode or a self-mapped module is a good perspective to communicate with outside world, it works good, it’s easy to write, so need to be protected against this. System Services Table is providing access to kernel functions, which is calling via _KiSystemService, which are using by usermode and drivers (Zw-functions). Firewalls successfully hooks functions, that providing access to opening processes, writing stuff into the process’s memory, creating threads, processes, files, editing files etc for preventing this actions and supporting the system in a good health. Firewalls love to do this, for example, ZoneAlarm Firewall is hooking this system services:

ZwConnectPort
ZwCreateFile
ZwCreateKey
ZwCreatePort
ZwCreateProcess
ZwCreateProcessEx
ZwCreateSection
ZwCreateWaitablePort
ZwDeleteFile
ZwDeleteKey
ZwDeleteValueKey
ZwDuplicateObject
ZwLoadKey
ZwMapViewOfSection
ZwOpenFile
ZwOpenProcess
ZwOpenThread
ZwReplaceKey
ZwRequestWaitReplyPort
ZwRestoreKey
ZwSecureConnectPort
ZwSetInformationFile
ZwSetSystemInformation
ZwSetValueKey
ZwTerminateProcess


It’s watching for accessing to registry, processes, drivers, files, it’s preventing himself from shut downing. Outpost Firewall 4 is hooking much more services:

ZwAssignProcessToJobObject
ZwClose
ZwCreateFile
ZwCreateKey
ZwCreateProcess
ZwCreateProcessEx
ZwCreateSymbolicLinkObject
ZwCreateThread
ZwDeleteFile
ZwDeleteKey
ZwDeleteValueKey
ZwLoadDriver
ZwMakeTemporaryObject
ZwOpenFile
ZwOpenKey
ZwOpenProcess
ZwProtectVirtualMemory
ZwQueryDirectoryFile
ZwQueryKey
ZwQueryValueKey
ZwReplaceKey
ZwRestoreKey
ZwSaveKey
ZwSaveKeyEx
ZwSetInformationFile
ZwSetValueKey
ZwTerminateProcess
ZwTerminateThread
ZwUnloadDriver
ZwWriteVirtualMemory


But actually it just uses half of them. It doesn’t care about drivers – you can load any if you want, but it hooks ZwLoadDriver. More hooks – the better? Aha, the better for vulnerability seekers. Not everybody knows what quality of that code, which will run when I call ZwOpenKey. Will my system fall to BSoD? Another example of hooking, Kerio Firewall:

ZwClose
ZwCreateFile
ZwCreateKey
ZwCreateProcess
ZwCreateProcessEx
ZwCreateThread
ZwDeleteFile
ZwDeleteKey
ZwDeleteValueKey
ZwLoadDriver
ZwMapViewOfSection
ZwOpenFile
ZwOpenKey
ZwResumeThread
ZwSetInformationFile
ZwSetValueKey
ZwTerminateProcess
ZwWriteFile


Can’t see hooks of ZwOpenProcess/ZwWriteVirtualMemory. With Kerio you can inject whatever you want in every process, including allowed processes. Going down, and Sygate shows us, that it is hooking less than others:

ZwTerminateProcess
ZwMapViewOfSection
ZwAllocateVirtualMemory
ZwCreateThread
ZwProtectVirtualMemory
ZwWriteVirtualMemory


They think they protect the system by hooking ZwWriteVirtualMemory, nice try. That is a bug: you could open process, and change some thread’s context. Almost
the same do Jetico:

ZwConnectPort
ZwCreatePort
ZwCreateThread
ZwTerminateProcess
ZwWriteVirtualMemory

Not so interesting.The most interesting do Tiny Firewall, all his hooks:

ZwCreateKey
ZwCreateSection
ZwOpenKey
ZwSetInformationProcess
ZwTerminateProcess


You can say that it’s simple to inject something by ZwWriteVirtualMemory? Right, but user will be noticed on this malicious action. It’s a little stupid trick – to have a protection in user mode, Tiny Firewall is loading to each process his DLL UmxSbxExw.dll and hooks many functions by setting jmp in the start of functions:

kernel32.dll:
CreateProcessA
CreateProcessW
CreateRemoteThread
DebugActiveProcess
FreeLibrary
GetProcAddress
LoadLibraryExW
OpenThread
TerminateProcess
TerminateThread
WriteProcessMemory

user32.dll:
BroadcastSystemMessage
BroadcastSystemMessageA
BroadcastSystemMessageExA
BroadcastSystemMessageExW
BroadcastSystemMessageW
EndTask
ExitWindowsEx
OpenClipboard
PostMessageA
PostMessageW
PostThreadMessageA
PostThreadMessageW
SendDlgItemMessageA
SendDlgItemMessageW
SendMessageA
SendMessageCallbackA
SendMessageCallbackW
SendMessageTimeoutA
SendMessageTimeoutW
SendMessageW
SendNotifyMessageA
SendNotifyMessageW
SetUserObjectSecurity
SetWindowsHookA
SetWindowsHookExA
SetWindowsHookExW
SetWindowsHookW

advapi32.dll:
AbortSystemShutdownW
AdjustTokenPrivileges
ChangeServiceConfig2A
ChangeServiceConfig2W
ChangeServiceConfigA
ChangeServiceConfigW
ControlService
CreateProcessAsUserA
CreateProcessAsUserW
CreateProcessWithLogonW
CreateServiceA
CreateServiceW
DeleteService
EnumDependentServicesA
EnumDependentServicesW
EnumServicesStatusA
EnumServicesStatusExA
EnumServicesStatusExW
EnumServicesStatusW
InitiateSystemShutdownExW
InitiateSystemShutdownW
OpenSCManagerA
OpenSCManagerW
OpenServiceA
OpenServiceW
QueryServiceConfig2A
QueryServiceConfig2W
QueryServiceConfigA
QueryServiceConfigW
QueryServiceStatus
QueryServiceStatusEx
SetFileSecurityW
SetKernelObjectSecurity
SetNamedSecurityInfoW
SetSecurityInfo
SetServiceObjectSecurity
StartServiceA
StartServiceW


Wow, Tiny is a hooking monster. You can see hook on kernel32.dll! WriteProcessMemory which is all their protection against inject. Tiny Firewall team thinks that it’s a cool protection, which can be dropped down even by some non-stable application. It’s not hard to unload that DLL from the process, restore all function entries and enjoy life. Btw, Outpost likes this too – it is loading his wl_hook.dll to every process which should protect user against malicious software. That’s a huge list of hooks:

kernel32.dll:
CreateProcessA
CreateProcessW
CreateRemoteThread
DebugActiveProcess
WinExec

ntdll.dll:
LdrLoadDll
LdrUnloadDll
NtCreateThread
NtResumeProcess
NtResumeThread
NtSetContextThread
NtSetValueKey
NtSuspendProcess
NtSuspendThread
NtTerminateProcess
NtWriteVirtualMemory
ZwCreateThread
ZwResumeProcess
ZwResumeThread
ZwSetContextThread
ZwSetValueKey
ZwSuspendProcess
ZwSuspendThread
ZwTerminateProcess
ZwWriteVirtualMemory

user32.dll:
CallNextHookEx
ChangeDisplaySettingsExA
ChangeDisplaySettingsExW
DdeConnect
DdeConnectList
DdeInitializeA
DdeInitializeW
EndTask
ExitWindowsEx
FindWindowExA
FindWindowExW
PostMessageA
PostMessageW
SendInput
SendMessageA
SendMessageCallbackA
SendMessageCallbackW
SendMessageTimeoutA
SendMessageTimeoutW
SendMessageW
SendNotifyMessageA
SendNotifyMessageW
SetForegroundWindow
SetWindowPos
SetWindowsHookExA
SetWindowsHookExW


It’s not a protection, it’s some unnecessary code. Yes, it can protect against some rare malware, but nothing more.

Some firewalls is pretending to be something more than just firewalls, they include some interesting features like spyware or rootkit detection. And, yeah, it works, and it makes an impression. For the first several minutes before meeting with debug. Some firewalls are trying to monitor loading modules by setting routine via PsSetLoadImageNotiryRoutine() – Jetico Firewall, Look’n’Stop Firewall, Tiny Firewall, ZoneAlarm Firewall, Outpost Firewall do this. For example, Outpost is monitoring for dnsapi.dll load and when it’s loading, it’s notifying to user that some application is trying to use DNS services. It can happened, when you will call gethostbyname(), dnsapi.dll is loading automatically. Not cool. Rename dnsapi.dll to xxx.dll, load it, find a pointer of DnsQuery_A, and use it for resolving, Outpost will shut up. It’s a bad way to make protection here.

Almost in the each of firewall you can find a lot of unused, useless stuff. Sometimes it helps to understand some part of code or giving an example of function naming or you can find there even a debug information (oh lucky!). Look’n’Stop Firewall team don’t make the difference between release and debug, maybe that’s why this stuff left here:

push    offset asc_187DC ; "f://dev//lns//2.05.cur//tdisys//w32api.c"
push    offset aKegetcurren_23 ; "KeGetCurrentIrql() == PASSIVE_LEVEL"
call    ds:RtlAssert


asserts are useful in debug builds, but not in the release version! Tiny Firewall has a lot of strange formatted-strings logs:

.text:00011608 aNbh0x08xMac0x0 db 9,'nbh:0x%08X mac:0x%08X mah:0x%08X pbc:0x%08X',0Dh,0Ah
.text:00011608 ; DATA XREF: HookedNdisOpenAdapter+273 o
.text:00011608 db 9,'med:"%s"',0Dh,0Ah
.text:00011608 db 9,'drv:"%s"',0Dh,0Ah
.text:00011608 db 9,'dev:"%s"',0Dh,0Ah
.text:00011608 db 9,'ada:"%s"',0
.text:00011661 align 4


I think no one wants to see BSoDs because of this strange logging. ZoneAlarm likes logs too:

.text:0001A610 aUPacketSProtoS db '%u Packet %s: Proto: %s Flags: 0x%08lx Src: %2u.%2u.%2u.%2u '
.text:0001A610 ; DATA XREF: sub_1A693+119 o
.text:0001A610 db 'Dest: %2u.%2u.%2u.%2u ',0


And especially it likes logs in release version, sure.

.text:00025A84 aSFragTLxHLxPfl db '%s frag: t=%lx h=%lx pflg=%lx subp=%lx sip=%d.%d.%d.%d dip=%'
.text:00025A84 ; DATA XREF: sub_25BAA+2D1 o
.text:00025A84 db 'd.%d.%d.%d id=%x f=%s%s%s off=%hu act=%lx',0Ah,0


I love ZoneAlarm, it gives me some function names:

.text:00050250 aVsdatantVstdic db 'VSDATANT:vsTdiClientRequestReceivePreProc(): FO=%p SE=%p RE#'
.text:00050250 ; DATA XREF: sub_502A6+D3 o
.text:00050250 db '=%d IRP=%p : TIMEOUT(%u)',0Ah,0


Kerio Firewall team can’t build his driver without paths inside:

.rdata:00433704 aCProjectsNetsecuritytoolsFire db 'C:/Projects/netsecuritytools/Firewall SDK/Build.Release/4.3.'
.rdata:00433704 db 'x/bin/Release/fwdrv.pdb',0


And also they like logs:

.data:00434020 aFwdrvApicopyas db 'FWDRV: ApiCopyAssociatedEndpoint: Local: %u.%u.%u.%u:%u Remo'
.data:00434020 ; DATA XREF: sub_401150+3B4 o
.data:00434020 db 'te:%u.%u.%u.%u:%u, SpeedIn: %u, SpeedOut: %u, PID: 0x%04X, A'
.data:00434020 db 'pp: [%s], Service: [%s]',0


And it’s really huge amount of logs like that:

.data:0043B1D4 aSPagedCodeCa_7 db '%s(): Paged code called on IRQL %d',0


What I wanted to say: doesn’t matter, how much you love logging, you need to move away this trash-logs and trash-code in release version. Less code – less bugs. Probably the next your BSoD will be right in that bad-tested banding debug code.

The first opening of this year became an OnlineArmor Firewall. "Online Armor has a very good chance of waltzing in and stealing top honors as the Scot’s Newsletter Best Software Firewall of 2008" Yeah, right  The first tests under DriverVerifier gave me a BSoD. Really interesting, it has fell down under the standard checking tool. So inside you can find IRP_MJ_DEVICE_CONTROL handler, which is handling IOCTLs all with METHOD_NEITHER. Guys, do you know about ProbeForRead()/ProbeForWrite()? They even don’t check pointers on NULL, it’s even fun, the best protection of all Windows users have a huge issues. Guess what it can be? Some portions of Hex-rayed code is following:

int __stdcall DispatchDeviceControl(int DeviceObject, PIRP Irp)
{
  struct _IRP::$::$::$::$A02EC6A2CE86544F716F4825015773AC::_IO_STACK_LOCATION *Stack; // eax@1
  unsigned int Status; // edi@1
  PIRP _Irp; // esi@1
  void *InBuffer; // ecx@2
  int InBufferSize; // edi@2
  PVOID OutBuffer; // edx@2
  int OutBufferSize; // ebx@2
  int Length; // eax@3
  int ReturnLength; // [sp+8h] [bp-4h]@1

  ReturnLength = 0;
  _Irp = Irp;
  Stack = Irp->Tail.Overlay.CurrentStackLocation;
  Status = 0xC00000BBu;
  if ( *(_BYTE *)Stack == 14 )
  {
    InBuffer = (void *)*((_DWORD *)Stack + 4);
    InBufferSize = *((_DWORD *)Stack + 2);
    OutBuffer = Irp->UserBuffer;
    OutBufferSize = *((_DWORD *)Stack + 1);
    Irp = (PIRP)*((_DWORD *)Stack + 3);
    Status = HandleRequest((int)Irp, InBuffer, InBufferSize, OutBuffer, OutBufferSize, &ReturnLength);
  }
  Length = ReturnLength;
  _Irp->IoStatus.Status = Status;
  _Irp->IoStatus.Information = Length;
  IofCompleteRequest(_Irp, 0);
  return Status;
}

int __stdcall HandleRequest(int Ioctl, void *InBuffer, int InBufferSize, void *OutBuffer, int OutBufferSize, int *ReturnLength)
{
  …
  if ( Ioctl == 0x830020EB )
  {
    sub_1484A((int)OutBuffer);
    *v6 = 28;
    return 0;
  }


What is so interesting inside sub_1484A()? Look here:

int __stdcall sub_1484A(int a1)
{
  int result; // eax@3
  CPPEH_RECORD ms_exc; // [sp+Ch] [bp-18h]@1

  ms_exc.disabled = 0;
  if ( dword_16168 )
  {
    memcpy((void *)a1, (const void *)dword_161A8, 0x1Cu);
  }
  else
  {
    result = 0;
    memset((void *)a1, 0, 0x1Cu);
  }
  return result;
}


Cool, there is not any trouble to write some shit in the kernel space, we can make a DoS or even a code execution. I just don’t want to dig deeper, hope that will be done by one of my colleagues ;)

Seems like every firewall can be bypassed and I say it’s true, there is no total protection against something. Rootkits, trojans, worms and other malicious software become more stealthed and sophisticated and it’s harder to find them. I don’t want to give any advice on which firewall to use, just be sure, that you use a firewall that has more functionality.


MaD, reverse engineer and researcher 
嵌入式软件学习:创建标准的工程文件 立即下载

相关推荐

图书管理系统:图书编目+借还书+超期罚款,Python+SQLite 可跑源码

面向课程设计的图书管理系统。用 Python 标准库 + SQLite 实现图书编目、读者管理、借还书与超期罚款计算,支持库存校验、借阅上限和借阅历史查询,零第三方依赖即可离线跑通,含样例数据和冒烟测试。MIT。作者 blog.youkuaiyun.com/mtl1994

ISAM错误信息

在 Access 或Sql Server中收到“Could not find installable ISAM”(找不到可安装的 ISAM)错误信息或者丢失某些文件类 解决方法:1.注册表编辑器使用不当可能导致严重问题,可能需要重新安装操作系统。Microsoft 不能保证您可以解决因注册表编辑器使用不当而导致的问题。使用注册表编辑器需要您自担风险。要解决此问题,您可以尝试手动注册此文

平凡酿就非凡 2151

科技中介服务机构如何利用平台实现服务流程的全流程闭环与智能支持.docx

科技中介服务机构如何利用平台实现服务流程的全流程闭环与智能支持

LLC谐振变换器恒压恒流双竞争闭环控制simulink仿真(附说明文档)

内容概要:本文详细介绍了LLC谐振变换器在恒压恒流双竞争闭环控制下的Simulink仿真设计,并附有说明文档。该仿真系统基于LLC谐振变换器的工作特性,构建了恒压(CV)与恒流(CC)双闭环竞争控制策略,通过智能逻辑切换实现输出电压与电流的精确调节,特别适用于电池充电等需要分阶段恒流恒压控制的应用场景。研究涵盖系统建模、控制环路设计、关键参数整定及仿真结果分析,全面展示了变换器在不同负载条件下的输出稳定性与动态响应性能,充分验证了所提出控制策略的有效性与可靠性; 适合人群:具备电力电子、自动控制等相关专业知识背景,熟悉Simulink仿真工具,从事开关电源、新能源发电、电动汽车充电系统等电源产品研发的工程师及高校研究生; 使用场景及目标:① 深入掌握LLC谐振变换器在恒压恒流模式下的控制原理与实现机制;② 学习并实践双闭环竞争控制策略在仿真环境中的建模方法与模式切换逻辑设计技巧;③ 为高效率、高性能DC-DC变换器的研发与优化提供可靠的仿真参考和技术支撑; 阅读建议:建议结合提供的Simulink模型文件与说明文档进行同步学习,重点关注控制环路的结构设计、PI调节器参数的整定过程以及恒压/恒流模式间切换逻辑的实现细节,可通过调整输入电压、负载等参数进行仿真验证,以深化对LLC变换器动态行为与控制性能的理解。

产业园区运营负责人在推动技术转移时,如何高效对接企业与科研机构?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

三相维也纳Vienna整流器电流过零畸变消除仿真模型【三种消除方法】(Simulink仿真实现)

内容概要:本文针对三相维也纳(Vienna)整流器在运行过程中存在的交流输入电流过零畸变问题,提出并实现了三种有效的消除方法,并基于Simulink平台构建了完整的仿真模型进行验证。首先深入分析了电流过零畸变的成因,主要包括控制延迟、功率器件的非理想开关特性以及调制策略在零电流切换时刻引发的不连续性。随后,系统阐述了三种核心抑制策略:一是改进电流环控制算法,引入前馈补偿机制以提升动态响应速度,减小因控制滞后导致的畸变;二是优化空间矢量脉宽调制(SVPWM)策略,通过对冗余小矢量作用时间的精确分配,实现中点电位平衡与谐波抑制的协同控制;三是采用死区时间补偿与非线性校正相结合的方法,有效抵消功率器件开关延迟、反向恢复等非线性因素带来的波形失真。仿真结果表明,所提出的复合控制策略能显著改善输入电流波形质量,大幅降低总谐波畸变率(THD),有效提升系统功率因数、电能质量和运行稳定性。该研究为高功率密度、高效率的三电平功率因数校正(PFC)整流器的设计与优化提供了可复现的仿真方案和理论依据。; 适合人群:具备电力电子与电力传动领域扎实的理论基础,熟练掌握Simulink/Matlab仿真工具,从事新能源发电、电动汽车充电、航空航天电源、工业变流器等方向的硕士/博士研究生、研发工程师及科研人员;尤其适合正在开展Vienna整流器拓扑结构、先进调制策略或高性能PFC控制技术相关课题研究与产品开发的专业技术人员。; 使用场景及目标:①深入理解三相Vienna整流器中电流过零畸变的物理机理与数学建模方法;②掌握基于SVPWM的中点电位平衡控制与谐波抑制的协同优化策略;③为设计高效率、低谐波的中大功率PFC整流器提供一套完整的、经过验证的仿真解决方案与参数设计思路,服务于科研项目攻关与工程产品原型开发。; 阅读建议:建议读者结合文中详述的三种消除方法,动手搭建或修改相应的Simulink仿真模型,通过对比不同控制策略下的电流波形、THD分析及中点电位波动情况,深入理解各方法的优劣与适用条件。在实践过程中,应重点关注控制参数(如PI调节器增益、前馈系数)的整定对系统稳定性、动态响应和抗干扰能力的影响。同时,可参考文档中提供的Mathcad计算书与双闭环设计案例,深化对整流器系统级设计与参数匹配的理解,实现理论与实践的深度融合。

科技中介服务机构在开展技术交易撮合时,如何提升对接效率和成功率?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

高校技术转移办公室人员如何快速识别优质专利并推动其转化?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

产业园区在推动企业技术需求对接时,如何实现精准匹配与资源聚合?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

高校技术转移办公室人员如何高效完成技术需求挖掘与转化对接?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

三相充电桩维也纳PFC+三电平LLC谐振变换器三电平PSIM仿真设计(Simulink仿真实现)

内容概要:本文详细阐述了三相充电桩中维也纳功率因数校正(PFC)电路与三电平LLC谐振变换器的PSIM仿真设计,并基于Simulink平台实现了系统建模与闭环控制策略的仿真验证。重点探讨了维也纳PFC与全桥LLC谐振变换器的协同工作机理,涵盖变频控制与移相控制相结合的混合控制策略设计与优化。文档提供了完整的仿真模型构建流程,包括主电路参数设计、控制环路搭建、系统动态响应分析及稳定性验证,尤其关注在不同负载条件下的效率表现与电能质量改善能力,旨在为新能源汽车充电设施与高效电力电子变换器的研发提供一套可复现、可扩展的技术方案。; 适合人群:具备电力电子、自动控制或电气工程等相关专业背景,从事新能源汽车充电技术、电力变换器拓扑研究、高效电源系统开发的科研人员、工程师及高校研究生。; 使用场景及目标:① 深入理解三相维也纳PFC与三电平LLC谐振变换器的工作原理及其联合控制方法;② 掌握基于Simulink的电力电子系统建模、仿真与闭环调试技术;③ 为高性能充电桩系统的研发、优化与工程化实现提供理论依据和仿真支撑。; 阅读建议:建议读者结合电力电子变换器基础理论,循序渐进地学习文档内容,重点关注控制策略的设计逻辑与参数整定方法,并动手实践仿真模型的搭建与调试,以深化对系统动态特性与控制性能的理解。

基于KKT条件的综合能源系统园区(IESP)双层优化模型,采用价格灵敏度方法,模拟综合能源服务提供商在电力市场中的战略套利行为研究(Matlab代码实现)

内容概要:本文围绕基于KKT条件的综合能源系统园区(IESP)双层优化模型展开研究,重点采用价格灵敏度方法模拟综合能源服务提供商在电力市场中的战略套利行为,并通过Matlab代码实现模型求解。研究构建了上层为市场策略优化、下层为系统运行优化的双层架构,利用KKT条件将下层问题转化为约束条件,结合价格灵敏度分析揭示了市场主体在电价波动中的响应机制与盈利模式。文中详细阐述了模型的数学推导、求解流程及仿真结果,验证了该方法在提升综合能源系统经济性和市场竞争力方面的有效性。; 适合人群:具备一定电力系统、优化理论和博弈论基础知识,从事能源互联网、综合能源系统、电力市场等相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①研究综合能源系统在电力市场环境下的优化运行与商业模式;②掌握双层优化模型的建模与求解方法,特别是基于KKT条件的转化技巧;③理解价格灵敏度在市场策略分析中的应用,模拟服务提供商的战略决策行为。; 阅读建议:此资源侧重于理论建模与数值仿真,建议读者结合Matlab代码深入理解算法实现细节,重点关注KKT条件的处理方式与价格灵敏度的计算逻辑,并尝试复现仿真结果以加深对双层优化机制的理解。

禁止系统自动更新-Windows Update Blocker-v1.8 .exe

禁止系统自动更新_Windows Update Blocker_v1.8 .exe

全桥LLC谐振(变频+移相混合控制)变换器闭环仿真模型(Simulink仿真实现)

内容概要:本文详细介绍了全桥LLC谐振变换器在变频控制(PFM)与移相控制相结合的混合控制策略下的闭环仿真模型构建过程,基于Simulink平台实现。该变换器通过融合两种控制方式的优势,实现了高效、稳定的电压调节与软开关特性,适用于中高功率DC-DC转换应用场景。文档系统阐述了系统建模、控制环路设计(包括电压外环与电流内环)、谐振腔关键参数计算、PWM信号生成及闭环反馈机制的实现方法,并通过仿真验证了在不同负载条件下输出电压的稳定性、动态响应性能以及零电压开关(ZVS)的实现效果。同时,文中探讨了该模型与PFC、CLLC、DAB等其他电力电子系统的协同仿真潜力,凸显其在现代电力电子系统设计与研究中的重要价值。; 适合人群:具备扎实的电力电子技术理论基础,熟悉Simulink/Matlab仿真环境,从事开关电源、新能源变换器、电力电子系统设计及相关领域研发工作的工程师与高校研究生。; 使用场景及目标:①用于高校教学与科研项目中,帮助学生深入理解LLC谐振变换器的工作原理、谐振特性及混合控制策略的实现逻辑;②为工业界全桥LLC电源产品的开发提供高保真的仿真原型与设计参考,加速产品迭代;③支持研究人员对变频-移相混合控制下的系统效率优化、动态响应提升、软开关范围拓展等关键技术问题进行深入探究。; 阅读建议:建议读者结合所提供的Simulink仿真模型文件进行实操学习,重点关注控制环路中PI参数的整定过程与谐振元件(如谐振电感、励磁电感、谐振电容)设计之间的强耦合关系,并通过主动调整输入电压、负载大小等工况条件,观察系统的启动过程、稳态性能和抗干扰能力,从而深刻掌握LLC变换器的非线性动态行为与控制规律。

大模型就业课(零基础可学)

面向零基础/小白/在职人群的大模型就业课,课程都是生产项目,学完直接找工作,工作直接复用技术栈。

高校技术转移办公室如何提升成果转化服务能力?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

上一篇: 用SSH隧道直接浏览网页
下一篇: hotpatch的参考文档和一些加载驱动或者xx的方法
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值