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

Malware with pure UTF-16 characters in the filename can bypass detection #5

Open
SouhailHammou opened this issue Feb 19, 2018 · 1 comment

Comments

@SouhailHammou
Copy link

Files with names containing pure UTF-16 characters can bypass detection. The user-mode service will fail to open the file for scanning after the conversion is done to ANSI, because characters that cannot be converted from Unicode are replaced with '?'.

// Convert unicode string to ansi string for ring 3 process.
ntStatus = RtlUnicodeStringToAnsiString(&AnsiString, (PCUNICODE_STRING)FilePath, TRUE);
if(!NT_SUCCESS(ntStatus)){
DbgPrint("[-] Error :: ArmaditoGuard!SendScanOrder :: RtlUnicodeStringToAnsiString() routine failed !! \n");
__leave;
}
// Fill the SCAN_MESSAGE_CONTEXT struct.
RtlCopyMemory(&(scanMessage->FileName), AnsiString.Buffer, AnsiString.Length);

Below is an image demonstrating the bug. In the first case, the filename is in Arabic and in the second, the filename's first letter is the greek M (U+039C).

image
A fix would require a re-implementation of the parts of the service dealing with filenames to make them support Unicode.

@fdechelle
Copy link
Member

@SouhailHammou Thank you for reporting the issue and for suggesting a fix.
Another possible fix would be that the driver sends to the user-mode service a HANDLE instead of the file name.

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

2 participants