Компьютерный форум NoWa.cc Здесь может быть Ваша реклама
Правила Форума
редакция от 22.06.2020
Портал .::2BakSa.WS::.
Вернуться   Компьютерный форум NoWa.cc > Компьютеры и Интернет > Интернет партизаны > Статьи

Уважаемые пользователи nowa.cc и 2baksa.ws. У нас сложилось тяжёлое финансовое положение. Мы работаем для вас вот уже более 15 лет и сейчас вынуждены просить о помощи. Окажите посильную поддержку проектам. Мы очень надеемся на вас. Реквизиты для переводов ниже.
Webmoney Webmoney WMZ: 826074280762 Webmoney WME: 804621616710
Кошелёк для вашей помощи YooMoney 4100117770549562
YooMoney Спасибо за поддержку!
Ответ
 
Опции темы Опции просмотра Language
Старый 23.03.2011, 10:33   #1
Постоялец
 
Аватар для DCRM
 
Пол:Мужской
Регистрация: 03.11.2005
Адрес: Annuit Cœptis
Сообщений: 302
Репутация: 424
Lightbulb [C] Rootkit - Hooking NtQuerySystemInformation to hide processes (Source + Binary)

This is my first tutorial and I assume you have some C / C++ knowledge. The driver is coded in C and the Driver Loader is coded in C++. In this tutorial we are going to replace the Kernel Function NtQuerySystemInformation.

An Very Short Introduction To Drivers
There are a few differences between user-mode programs (consoles and Win32 applications) and drivers.

A driver can't be started as an normal .EXE file. NT drivers are compiled to .SYS binaries, which need to be loaded as drivers before they can be ran.

Drivers run in kernel mode, they are given an higher privelege level. With a driver, you can do pretty much anything you want to to the computer the driver is running on. There are no limitations, since drivers are given SYSTEM priveleges.

Errors in kernel mode and user mode are handled very differently. The Blue Screen of Death is actually a very useful thing. When a problem in the driver occurs, Windows stops execution of all programs and drivers, and brings down the system in a controlled manner. If not for this, extensive system corruption could be caused by a faulty driver that keeps running after encountering a fatal error. Make sure that when you're writing drivers you are very careful with your code, and it's best to use a debugger and run it in a VM.

You can read more about driver development here.

Windows Driver Development Kit (DDK)

You will need the latest version of Windows Driver Development Kit, which contains the DDK in order to create drivers. The DDK contains many useful headers and libraries, as well as the binaries we're going to be using to build our driver. In this tutorial I'm using version 3790.1830. You will have to download the .ISO file and burn it to a CD disc or extract all files in it to your harddisk using WinRAR. It is possible to use DDK with Visual Studio, but it's not recommended. The console and Notepad will do just fine.

Once you finish installing, there should be a directory on your drive such as C:\WINDDK\3790.1830 (It depends on where you choose to install it and the numbers are the DDK version). Open C:\WINDDK\3790.1830 with Windows Explorer, if you installed the samples there should be a src directory (If you didn't then just create one). Inside, create a folder for your created drivers (Call it MyDrivers, or whatver you want). Don't use any spaces in your folder names, you will get errors if you have. In that folder, make a new one for your first driver that we are going to create now. Name it MyDriver. In that folder, you need to create 4 files:

Make sure that when you create these two files you do not give them an extension.

Makefile (Which essentially redirects to the Makefile provided in the DDK)
Код:
!INCLUDE $(NTMAKEENV)\makefile.def
Sources
Код:
TARGETNAME=MyDriver
TARGETTYPE=DRIVER
TARGETPATH=Bin
INCLUDES=..\..\Includes
SOURCES=Main.c
The TARGETNAME variable controls what your driver will be named. Remember that this name may be embedded in the binary itself, so using a TARGETNAME of MY_EVIL_ROOTKIT_IS_GONNA_GET_YOU is not a good idea.

Better names for the driver are those that look like legitimate device drivers.
Examples include MSDIRECTX, MSVID_H424, IDE_HD41, SOUNDMGR, and H323FON.

The TARGETPATH variable controls where the files go when they are compiled. Usually your driver files will be placed underneath the current directory in the objchk_xxx/i386 subdirectory.

The TARGETTYPE variable controls the kind of file you are compiling. To create a driver, we use the type DRIVER.

On the SOURCES line, a list of .c files is expected.

Before continuing, I would like you to known that DbgPrint("Hello World!\n"); prints an message to a debugger which is running on the system. You can download DbgView here. DbgPrint is very useful when testing.

The drivers DriverEntry is just like WinMain in a Win32 Application, or DllMain in a DLL.

Main.c


ZwQuerySystemInformation.c

Compiling is very simple. Go to Start / Programs / Development Kits / Windows DDK / Build Evironments / OS NAME / Checked Build Environment (This may change depending on your DDK version). This will open a command prompt. Type cd "...\src\MyDrivers\MyDriver" to navigate to the drivers path. Now type build or make to compile the driver. The .SYS file should be in C:\WINDDK\3790.1830\src\MyDrivers\MyDriver\i386\ (Depending on OS and DDK version and installation path).

How do I test the compiled driver?
Download Driver Loader [DLoad] or download my silent Driver Loader Application.

Can hidden processes and SSDT hooks be detected?
Yes, Tuluka can search for hooked Kernel Functions and restore them.

Where can I read more about rootkits and hooks?
You can read more about rootkits, hooks and how the process hiding function works here. I'd recommend you to read it.

Do you know an good book about rootkits?
Rootkits - Subverting the Windows Kernel is a very good book about rootkits, written by Greg Hoglund.

Can I create drivers in Visual Studio?
Yes, you can. You will need the latest version of DDKBuild.bat.

I'm using a 64 bit machine and I can't compile the driver with Windows Driver Development Kit (DDK), what shall I do?
DDK can't compile drivers with inline Assemby on 64 bit machines. Is is possible to disable the Memory Write Protection for the SSDT in another way. Google is your friend,

Downlod the Driver Loader and the Driver here. (Binary Files and Source Included)

If you want to test it, copy the driver to C:\Windows\system32\drivers\MyDriver.sys and run the Driver Loader with the parameter ...\Driver Controller.exe -Install. Open Windows Task Manager, can you see the process winlogon.exe? No, you can't. It's hidden. When you are done, run the Driver Controller again with the parameter ... -Uninstall. The Driver File is only 3KB, the loader is 28KB. I have tested it on Windows 7 32 bit but it should work on Windows XP and Windows Vista too. (Both 32 and 64 versions). Unlucky... the driver is detected as an rootkit by a few antivirus softwares.

(c) woodo
__________________
This world is very interesting, it feels free, but this freedom must be hacked. (с)
DCRM вне форума
 
Ответить с цитированием Вверх
Эти 3 пользователя(ей) сказали cпасибо за это полезное сообщение:
Здесь может быть Ваша реклама
Здесь может быть Ваша реклама


Реклама: Рекомендуем гипермаркет KNS - самый дешевый компьютер - Подарок каждому покупателю!купить билет в москвариумnr230a-sбарнхаус под ключ проекты и ценыбаннерный короб


Ответ


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Rootkit Unhooker Lamazz Безопасность 2 13.10.2011 00:51
Logic Express 7.2 Universal Binary yakuzaa Mac Os X 15 01.09.2009 19:03
Processes (windows task manager) jaago Архив 5 16.06.2005 00:16

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.

Быстрый переход


Текущее время: 19:50. Часовой пояс GMT +3.


Copyright ©2004 - 2024 2BakSa.WS

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc. Перевод: zCarot
Время генерации страницы 0.13108 секунды с 11 запросами