Pentest Tools

Published on May 2nd, 2018 📆 | 7422 Views ⚑

0

SpookFlare v2.0 released: Meterpreter loader generator with multiple features for bypassing client-side & network-side countermeasures


https://www.ispeech.org/text.to.speech
SpookFlare has a different perspective to bypass security measures and it gives you the opportunity to bypass the endpoint countermeasures at the client-side detection and network-side detection. SpookFlare is a loader generator for Meterpreter Reverse HTTP and HTTPS stages. SpookFlare has custom encrypter with string obfuscation and run-time code compilation features so you can bypass the countermeasures of the target systems like a boss until they “learn” the technique and behavior of SpookFlare payloads.

  • Obfuscation
    In software development, obfuscation is the deliberate act of creating the source or machine code that is difficult for humans to understand. SpookFlare uses the obfuscation for the string names. Therefore, it will be difficult to develop a signature in a certain “string(s)”. Actually writing a signature for certain string is a behavior done by many malware-analysts or security product developers. When a malware analyst analyzes the sample or by dynamic analysis systems then, once it is determined to be a malware, a proper signature of the file is extracted and added to the signatures database of the AV or Endpoint Security product. The signature of the file will change if you change any byte in a file. If you change the correct bytes, you can bypass the signature-based detections. SpookFlare uses the string obfuscation. Therefore, each generated payload will be unique as possible.
  • Runtime Code Compiling
    Even though the application is built using obfuscation, the code must be completely changed after a point and this point is when your payloads are detected as malicious because string-based obfuscation can achieve success in a certain extent. For example, if the string-based obfuscation is used in your payload also the OpenProcess, VirtualAlloc etc. system calls are used in your payload, there is a possibility of your payload detect by security products. That system calls are suspicious because so many malware uses that system calls. To escape from these and other situations, SpookFlare compiles the actual code during runtime. Thus, the definition of suspicious defines like system calls is hidden. Like the system calls, the actual code hiding is explained under the ongoing heading.The .NET Framework includes a mechanism called the Code Document Object Model (CodeDOM) that enables developers of programs that emit source code to generate source code in multiple programming languages at runtime, based on a single model that represents the code to render. Sometimes developers need it, and .NET Framework makes it possible. For example, the following C # code compiles the C # code assigned to the “code” variable during execution and runs it.
    SpookFlare payloads use the runtime code compiling and execution. Each generated SpookFlare payloads contains own loader code and when executed, it gives the loader code to the compiler.

[adsense size='1' ]

  • Source Code Encryption
    So far we have learned that we can use the string-based obfuscation and compile the code at runtime. However, when doing all of this we need to hide code the actual loader. Because the loader code being moved will have a disadvantage against signature-based fixes when the loader code defined clear-text. So SpookFlare encrypts the original loader’s code using the RijnDaelManaged class and when executed it decrypts the loader code after then it gives the code to the compiler. It acts like crypts and finally, it executes the compiled code.
  • Patched Meterpreter Stage Support
    I inspired this section from @Arno0x0x and wanted to improve it. We usually use Meterpreter Staged Payloads, as you know, these payloads download their cores (stage) over the network and run in the target system memory. Security countermeasures may not only be in the end-user system but also at the network level, remember the IDS/IPS etc. Although the security countermeasures in end-user systems are bypassed, security countermeasures at network level can jeopardize an entire operation.So, how can they detect the malicious files at the right network level? The answer is signature-based detection. For this situation, you can use an encoder for Meterpreter’s core (stage) and you can bypass the network-level countermeasures. It can be the first conceivable idea and makes sense. If you use an encoder, you need to add a stub to decode it and creation of a signature decoder is easier for malware analysts. We need something different and more difficult to analyze or detect. SpookFlare can handle this better without any encoder.How do malware analysts write signatures for a binary? By creating unique patterns and creating these patterns for the head of the file. I mean, malware analysts are creating signatures for the header part of the file. Thus, they can prevent false-positives and detect malicious files more easily. So here is the solution or SpookFlare offer; if we add random bytes at the beginning of the application we can bypass network-based countermeasures and for this solution, we need to patch Metasploit.

Download

git clone https://github.com/hlldz/SpookFlare.git

Usage

 ___ ___  ___   ___  _  __  ___ _      _   ___ ___
/ __| _ \/ _ \ / _ \| |/ / | __| |    /_\ | _ \ __|
\__ \  _/ (_) | (_) | ' <  | _|| |__ / _ \|   / _|
|___/_|  \___/ \___/|_|\_\ |_| |____/_/ \_\_|_\___|

Version    : 1.0
Author     : Halil Dalabasmaz
WWW        : artofpwn.com
Twitter    : @hlldz
Github     : @hlldz
Licence    : Apache License 2.0
Note       : Stay in shadows!

-------------------------------------------------------

[*] You can use "help" command for access help section.

spookflare > help

list     : List payloads
generate : Generate payloads
exit     : Exit from program

[!] Important: Use x86 listener for x86 payloads and x64 listener for x64 payloads otherwise the process will crash!

spookflare > list

SpookFlare can generate following payloads.

[*]  Meterpreter Loader (.EXE) with Custom Encrypter and Custom Stub:

    - Meterpreter Reverse HTTP x86/x64
    - Meterpreter Reverse HTTPS x86/x64

Demo





Note

[adsense size='1' ]

I developed the SpookFlare and technique for use in penetration tests, red team engagements and it is purely educational. Please use with responsibility.

Copyright (C) 2017 hlldz 

Source: https://github.com/hlldz



Comments are closed.