Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -u netlog.orig/cuckoomon.c netlog/cuckoomon.c
- --- netlog.orig/cuckoomon.c 2013-05-19 16:12:20.032282296 +0200
- +++ netlog/cuckoomon.c 2013-05-19 16:20:29.765159792 +0200
- @@ -76,6 +76,9 @@
- HOOK(kernel32, RemoveDirectoryA),
- HOOK(kernel32, RemoveDirectoryW),
- + HOOK(kernel32, GetFileAttributesA),
- + HOOK(kernel32, GetFileAttributesExA),
- +
- // lowest variant of MoveFile()
- HOOK(kernel32, MoveFileWithProgressW),
- Wspólne podkatalogi: netlog.orig/distorm3.2-package i netlog/distorm3.2-package
- Wspólne podkatalogi: netlog.orig/.git i netlog/.git
- diff -u netlog.orig/hook_file.c netlog/hook_file.c
- --- netlog.orig/hook_file.c 2013-05-19 16:12:20.036282246 +0200
- +++ netlog/hook_file.c 2013-05-19 16:23:16.373076907 +0200
- @@ -20,6 +20,7 @@
- #include <ctype.h>
- #include <windows.h>
- #include <shlwapi.h>
- +#include <string.h>
- #include "hooking.h"
- #include "ntapi.h"
- #include "log.h"
- @@ -494,3 +495,39 @@
- LOQ("u", "FileName", lpFileName);
- return ret;
- }
- +
- +/* Hardened */
- +HOOKDEF(DWORD, WINAPI, GetFileAttributesA,
- + __in LPCTSTR lpFileName
- +) {
- + BOOL ret;
- + if (strstr(lpFileName, "VBox") != NULL) {
- + ret = INVALID_FILE_ATTRIBUTES;
- + LOQ("s", "Hardening", "Faked GetFileAttributesA return");
- + }
- + else {
- + ret = Old_GetFileAttributesA(lpFileName);
- + }
- + LOQ("s", "GetFileAttributesA", lpFileName);
- + return ret;
- +}
- +
- +/* Hardened */
- +HOOKDEF(DWORD, WINAPI, GetFileAttributesExA,
- + __in LPCTSTR lpFileName,
- + __in GET_FILEEX_INFO_LEVELS fInfoLevelId,
- + __out LPVOID lpFileInformation
- +) {
- + BOOL ret;
- + if (strstr(lpFileName, "VBox") != NULL) {
- + ret = 0;
- + LOQ("s", "Hardening", "Faked GetFileAttributesExA return");
- + }
- + else {
- + ret = Old_GetFileAttributesExA(lpFileName, fInfoLevelId,
- + lpFileInformation);
- + }
- + LOQ("s", "GetFileAttributesExA", lpFileName);
- + return ret;
- +}
- +
- diff -u netlog.orig/hook_reg.c netlog/hook_reg.c
- --- netlog.orig/hook_reg.c 2013-05-19 16:12:20.037282233 +0200
- +++ netlog/hook_reg.c 2013-05-19 16:26:16.268827900 +0200
- @@ -18,12 +18,14 @@
- #include <stdio.h>
- #include <windows.h>
- +#include <string.h>
- #include "hooking.h"
- #include "ntapi.h"
- #include "log.h"
- static IS_SUCCESS_LONGREG();
- +/* Hardened */
- HOOKDEF(LONG, WINAPI, RegOpenKeyExA,
- __in HKEY hKey,
- __in_opt LPCTSTR lpSubKey,
- @@ -31,8 +33,19 @@
- __in REGSAM samDesired,
- __out PHKEY phkResult
- ) {
- - LONG ret = Old_RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired,
- - phkResult);
- + LONG ret;
- + if (strstr(lpSubKey, "VirtualBox") != NULL) {
- + ret = 1;
- + LOQ("s", "Hardening", "Faked RegOpenKeyExA return");
- + }
- + else if (strstr(lpSubKey, "ControlSet") != NULL) {
- + ret = 1;
- + LOQ("s", "Hardening", "Faked RegOpenKeyExA return");
- + }
- + else {
- + ret = Old_RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired,
- + phkResult);
- + }
- LOQ("psP", "Registry", hKey, "SubKey", lpSubKey, "Handle", phkResult);
- return ret;
- }
- @@ -241,6 +254,7 @@
- return ret;
- }
- +/* Hardened */
- HOOKDEF(LONG, WINAPI, RegQueryValueExA,
- __in HKEY hKey,
- __in_opt LPCTSTR lpValueName,
- @@ -250,8 +264,25 @@
- __inout_opt LPDWORD lpcbData
- ) {
- ENSURE_DWORD(lpType);
- - LONG ret = Old_RegQueryValueExA(hKey, lpValueName, lpReserved, lpType,
- - lpData, lpcbData);
- + LONG ret;
- + /* HARDWARE\\Description\\System "SystemBiosVersion" */
- + if (strstr(lpValueName, "SystemBiosVersion") != NULL) {
- + ret = ERROR_SUCCESS;
- + LOQ("s", "Hardening", "Faked RegQueryValueExA return");
- + }
- + /* HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0 "Identifier" */
- + else if (strstr(lpValueName, "Identifier") != NULL) {
- + ret = ERROR_SUCCESS;
- + LOQ("s", "Hardening", "Faked RegQueryValueExA return");
- + }
- + else if (strstr(lpValueName, "ProductId") != NULL) {
- + ret = ERROR_SUCCESS;
- + LOQ("s", "Hardening", "Faked RegQueryValueExA return");
- + }
- + else {
- + ret = Old_RegQueryValueExA(hKey, lpValueName, lpReserved, lpType,
- + lpData, lpcbData);
- + }
- if(ret == ERROR_SUCCESS && lpType != NULL && lpData != NULL &&
- lpcbData != NULL) {
- LOQ("psr", "Handle", hKey, "ValueName", lpValueName,
- diff -u netlog.orig/hooks.h netlog/hooks.h
- --- netlog.orig/hooks.h 2013-05-19 16:12:20.038282221 +0200
- +++ netlog/hooks.h 2013-05-19 16:27:07.082192646 +0200
- @@ -212,6 +212,16 @@
- __in LPWSTR lpFileName
- );
- +extern HOOKDEF(DWORD, WINAPI, GetFileAttributesA,
- + __in LPCTSTR lpFileName
- +);
- +
- +extern HOOKDEF(DWORD, WINAPI, GetFileAttributesExA,
- + __in LPCTSTR lpFileName,
- + __in GET_FILEEX_INFO_LEVELS fInfoLevelId,
- + __out LPVOID lpFileInformation
- +);
- +
- //
- // Registry Hooks
- //
- diff -u netlog.orig/Makefile netlog/Makefile
- --- netlog.orig/Makefile 2013-05-19 16:12:20.032282296 +0200
- +++ netlog/Makefile 2013-05-19 16:18:27.015694372 +0200
- @@ -1,5 +1,5 @@
- MAKEFLAGS = -j8
- -CC = gcc
- +CC = i686-pc-mingw32-gcc
- CFLAGS = -Wall -std=c99 -s -O2
- DLL = -shared
- DIRS = -Idistorm3.2-package/include
- Wspólne podkatalogi: netlog.orig/tests i netlog/tests
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement