Security researchers have outlined steps to hide malware from most, if not all, anti-virus products and to defeat a series of possible countermeasures.
The twin research pieces, conducted separately, showed that AV could be relatively easily bypassed by following the published works.
Andrew King from GreyHat Research presented general instructions on how to execute an undetected malicious payload -- in this case a Meterpreter-Reverse Tcp payload -- in memory on a target system so that it would not be detected by most, if not all, AV products.
During his research, King slipped malware under the nose of all AV programs in an extensive list on VirusTotal. He said the malware would also bypass AV programs not listed on the site.
King conducted the research as part of his thesis, driven by his distaste for AV signature matching.
“When I looked at offensive security tools, it seemed like a lot of the evasion tactics could be taken apart pretty easily from a defender's perspective,” King told SC Magazine.
“I'm against signature matching in general, so I went for something that essentially completely removes the ability to write a static signature.”
He said each component in the process was "relatively logically straightforward”.
“The more difficult part was building in a high degree of random so that a definition for encoding and decoding stubs themselves would be near impossible to craft.”
He said an automated unpacking system or a plug-in for TitanMist may help “but harvesting the original binary in a usable form would be substantially more difficult than using an off-the-shelf packer”.
One approach detailed by King involved rewriting memory just before execution then rewriting it again to its original state when execution completed.
He said reverting the code back made the technique “a little different from just using metasploit built-ins” because it constantly modified memory during execution.
King added an encoded library that manipulated the custom payload which meant it remained completely undetected. That created a “very painful reverse engineering” requirement for AV and made scanning for memory signatures difficult.
He said the process would scale for full malicious binaries.
Readers can follow King's three-part instructions on writing self-modifying code
Another approach by German security researcher -- using the handle 0dem -- created a signature-free 'dummy' application template that contained a malicious payload which was unleashed after an AV scan.
The researcher published more specific instructions in a paper dubbed Embedding the Payload.
"This is quite enough for an attacker to gain control over the target system and has a huge impact for the security of a system," 0dem said.
"We can be inside every targeted machine depending on anti-virus for security!"
In 0dem's research, harmless dummy functions were mapped to memory and then called within a main function.
The dummy functions were then overwritten with the malicious payload which hid within the application's non-executable library -- a section rarely scanned by AV programs.
Once the loading process of the library finished, execution was passed back to the main function where it called the now overridden dummy-function that held the custom payload.
Copyright © SC Magazine, Australia
Processing registration... Please wait.
This process can take up to a minute to complete.
A confirmation email has been sent to your email address - SUPPLIED GOES EMAIL HERE. Please click on the link in the email to verify your email address. You need to verify your email before you can start posting.
If you do not receive your confirmation email within the next few minutes, it may be because the email has been captured by a junk mail filter. Please ensure you add the domain @itnews.com.au to your white-listed senders.