-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WinAFL can not fuzzy Windows service. #392
Comments
For fuzzing Windows services, you most likely want to use "Attach" functionality, see https://github.com/googleprojectzero/winafl#attaching-to-a-running-process |
Yes, I am use attach by add option -A, But it seems no function. below is my command. afl-fuzz.exe -D D:\WinAFL\DynamoRIO-Git\dynamorio\build\bin64\ -A SampleService.exe -i D:\WinAFL\Test\testin -o D:\WinAFL\Test\testout -t 200000 -- -coverage_module SampleService.exe -target_module SampleService.exe -target_method fuzz -fuzz_iterations 10 -nargs 2 -- SampleService.exe @@ fuzz function never run. |
i have a question, As I know,In order to get coverage, the process must exit.so how winafl attach model work.Thanks! |
The process does not need to exit in order to get coverage. WinAFL collects coverage when the target_method exits, not the process. |
I have simple service and try to run fuzzy function but fuzzy never run. Below is my service code.
#include <Windows.h>
#include <tchar.h>
#define MY_DEBUG_TAG "SampleService"
#include "log.h"
SERVICE_STATUS g_ServiceStatus = {0};
SERVICE_STATUS_HANDLE g_StatusHandle = NULL;
HANDLE g_ServiceStopEvent = INVALID_HANDLE_VALUE;
VOID WINAPI ServiceMain (DWORD argc, LPTSTR *argv);
VOID WINAPI ServiceCtrlHandler (DWORD);
DWORD WINAPI ServiceWorkerThread (LPVOID lpParam);
#define SERVICE_NAME _T("SampleService")
DWORD g_BytesTransferred = 0;
VOID CALLBACK FileIOCompletionRoutine(
__in DWORD dwErrorCode,
__in DWORD dwNumberOfBytesTransfered,
__in LPOVERLAPPED lpOverlapped)
{
g_BytesTransferred = dwNumberOfBytesTransfered;
}
void __declspec(noinline) fuzz(LPCWSTR data) {
int const BUFFERSIZE = 1024;
DWORD dwBytesRead = 0;
char ReadBuffer[BUFFERSIZE] = { 0 };
OVERLAPPED ol = { 0 };
}
int _tmain (int argc, TCHAR *argv[])
{
debug_print("Main: Entry");
}
VOID WINAPI ServiceMain (DWORD argc, LPTSTR *argv)
{
DWORD Status = E_FAIL;
}
VOID WINAPI ServiceCtrlHandler (DWORD CtrlCode)
{
debug_print("ServiceCtrlHandler: Entry");
}
DWORD WINAPI ServiceWorkerThread (LPVOID lpParam)
{
debug_print("ServiceWorkerThread: Entry");
}
It can run fuzzy on command
afl-fuzz.exe -D D:\WinAFL\DynamoRIO-Git\dynamorio\build\bin64\ -i D:\WinAFL\Test\testin -o D:\WinAFL\Test\testout -t 200000 -- -coverage_module SampleService.exe -target_module SampleService.exe -target_method fuzz -fuzz_iterations 10 -nargs 2 -- SampleService.exe @@
But can not run on command and it will stock "OverlappedConnectNamedPipe", "OverlappedConnectNamedPipe" is my log.
afl-fuzz.exe -D D:\WinAFL\DynamoRIO-Git\dynamorio\build\bin64\ -A SampleService.exe -i D:\WinAFL\Test\testin -o D:\WinAFL\Test\testout -t 200000 -- -coverage_module SampleService.exe -target_module SampleService.exe -target_method fuzz -fuzz_iterations 10 -nargs 2 -- SampleService.exe @@
WinAFL 1.16b by [email protected]
Based on AFL 2.43b by [email protected]
[+] You have 4 CPU cores with average utilization of 11%.
[+] Try parallel jobs - see afl_docs\parallel_fuzzing.txt.
[] Checking CPU core loadout...
[+] Found a free CPU core, binding to #0.
[+] Process affinity is set to 1.
[] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[] Deleting old session data...
[+] Output dir cleanup successful.
[] Scanning 'D:\WinAFL\Test\testin'...
[+] No auto-generated dictionary tokens to reuse.
[] Creating hard links for all input files...
[] Attempting dry run with 'id_000000'...
[*] OverlappedConnectNamedPipe GetLastError=997
Please help me, There have any wrong let service can not run fuzzy.
The text was updated successfully, but these errors were encountered: