Skip to content

Commit

Permalink
[plugin imports] Removed QueryPerformanceCounter as an anti-debug API…
Browse files Browse the repository at this point in the history
…, as it generates too many false positives.

[plugin overlay & plugin resources] Fixed a null deref when the Yara scan fails.
  • Loading branch information
JusticeRage committed Dec 6, 2018
1 parent c93d974 commit 5736e44
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions bin/attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
mapping = {
# Plugin Imports
"Code injection capabilities": [("Defense Evasion", "Process Injection")],
"Code injection capabilities (process hollowing)": [("Defense Evasion", "Process Injection")],
"Code injection capabilities (process hollowing)": [("Defense Evasion", "Process Injection"),
("Defense Evasion", "Process Hollowing")],
"Manipulates other processes": [("Discovery", "Process Discovery"),
("Defense Evasion", "Process Injection")],
"Code injection capabilities (PowerLoader)": [("Defense Evasion", "Extra Window Memory Injection"),
Expand Down Expand Up @@ -187,4 +188,4 @@ def main():


if __name__ == "__main__":
main()
main()
3 changes: 1 addition & 2 deletions plugins/plugin_imports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ enum REQUIREMENT { AT_LEAST_ONE = 1, AT_LEAST_TWO = 2, AT_LEAST_THREE = 3 };
std::string anti_debug =
"FindWindow(A|W)|(Zw|Nt)QuerySystemInformation|DbgBreakPoint|DbgPrint|"
"CheckRemoteDebuggerPresent|CreateToolhelp32Snapshot|Toolhelp32ReadProcessMemory|"
"OutputDebugString|SwitchToThread|NtQueryInformationProcess|" // Standard anti-debug API calls
"QueryPerformanceCounter"; // Techniques based on timing. GetTickCount ignored (too many false positives)
"OutputDebugString|SwitchToThread|NtQueryInformationProcess"; // Standard anti-debug API calls

std::string vanilla_injection = "(Nt)?VirtualAlloc.*|(Nt)?WriteProcessMemory|CreateRemoteThread(Ex)?|(Nt)?OpenProcess";

Expand Down
2 changes: 1 addition & 1 deletion plugins/plugin_overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class OverlayPlugin : public IPlugin
return res;
}
yara::const_matches matches = y.scan_bytes(*overlay_bytes);
if (!matches->empty())
if (matches && !matches->empty())
{
for (size_t i = 0; i < matches->size(); ++i)
{
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin_resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ class ResourcesPlugin : public IPlugin
{
// In some packed executables, resources still keep their original file size, which causes
// them to become bigger than the file itself. Disregard those cases when they happen
// because they make the resource to filesize rario bigger than 1.
// because they make the resource to filesize ratio bigger than 1.
// These cases will be reported by the packer detection plugin.
if (it->get_size() < pe.get_filesize()) {
size += it->get_size();
}
yara::const_matches matches = y.scan_bytes(*it->get_raw_data());
if (!matches->empty())
if (matches && !matches->empty())
{
for (size_t i = 0 ; i < matches->size() ; ++i)
{
Expand Down

0 comments on commit 5736e44

Please sign in to comment.