htp's People
htp's Issues
Implement interlock var access
The return_stack unordered_map can be dangerous with multiple threads:
e.g:
void CreateFileWHook(HTPContext* ctx)
{
}
void CreateFileWPostHook(HTPContext* ctx)
{
}
void NtCreateFileHook(HTPContext* ctx)
{
}
void NtCreateFilePostHook(HTPContext* ctx)
{
}
VOID MyThreadFunction(VOID)
{
Sleep(1);
HANDLE hFile = CreateFile("roux.bmp",
GENERIC_WRITE,
0,
NULL,
CREATE_NEW,
FILE_ATTRIBUTE_NORMAL,
NULL);
Sleep(1);
printf("[%d] Bye bye\n", GetCurrentThreadId());
}
/*
....
*/
int main(int argc, char** argv)
{
HTPHandle handle;
HTPInit(&handle);
SetupInlineHook(&handle, "kernel32.dll", "CreateFileW", CreateFileWHook, CreateFileWPostHook);
SetupInlineHook(&handle, "ntdll.dll", "NtCreateFile", NtCreateFileHook, NtCreateFilePostHook);
std::queue<HANDLE> thqueue;
for (int i = 0; i < 0x2000; i++) {
DWORD dwThreadId;
HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)MyThreadFunction, NULL, 0, &dwThreadId);
if (hThread != NULL) {
thqueue.push(hThread);
}
}
while (!thqueue.empty()) {
WaitForSingleObject(thqueue.front(), INFINITE);
thqueue.pop();
}
printf("GOOD!\n");
}
Setup Appveyor
Having a CI would would help
edge cases
Problème de reconstruction des instructions lors du setup d'un hook:
Exemple 1 (BRANCH):
test rcx, rcx
jz XXXX
Exemple 2 (RIP relatif):
mov REG, QWORD PTR [rip+0x4241]
Type confusion in RemoveInlineHookInternal leads to memory corruption
The following cast is made in RemoveInlineHookInternal
:
Line 357 in 38b9a9c
However, the trampoline in question can be of two types, either HTPTrampoline
or HTPReturnTrampoline
.
These two types have different memory layouts so the following line might copy garbage when the removed trampoline is of type HTPReturnTrampoline
:
Line 365 in 38b9a9c
Implement a more evolved dissassembler component
Currently we are using Zydis as a disassembler. Having a dedicated decoder module wrapping Zydis API could cleanup a lot of code.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.