Finding evil in Flash files
Adobe Flash is present on nearly every PC, thus, malware authors have been increasingly targeting it over the last years, following the principle of return on investment, i.e. they will focus on popular technologies to exploit as that will eventually mean a larger base of compromised machines. The rich ActionScript features that are available in Flash also led to these files being commonly abused in multi-stage web-based attacks, using them as a vehicle to perform heap-spraying, JIT spraying and other badness.
Just recently FireEye discovered a new Zero-Day targeting Internet Explorer that used a well-known flash exploitation technique to achieve arbitrary memory access and bypass Windows’ ASLR and DEP protections. In trying to find SWF samples from this attack across our entire collection we realized that, while we produce very rich information for most commonly abused file types (behavioural reports, Androguard Android static information, RTF maliciousness signals, etc.), we did not have any file characterization tool specifically focusing on SWF files. Remember that VirusTotal is not only a multi-antivirus, it also runs many other tools on files.
We have built a very simple tool which we call swfknife in order to extract certain interesting properties from flash files. In addition to this, the tool also produces a feature hash that can be used in VirusTotal Intelligence in order to search for similar SWF files and cluster these together, just as you can do right now with PEs, MS Office files, RTFs and PDFs.
The new data will give you a quick overview of the flash file, pinpointing interesting features such as:
- The use of ActionScript2/ActionScript3.
- Whether the file fingerprints the OS executing it.
- The use of the loadBytes function in order to load other SWF files or custom code at runtime.
- Whether the file has been encrypted/obfuscated with common SWF packing tools.
- Whether the file contains long strings of hex characters, very often revealing encoded malicious code that gets decoded with hexToBin and loaded at runtime.
- Indicators revealing that the file is performing heap spraying.
- Whether it contains code identifying the environment executing it, e.g. the flash player and version.
- Whether it uses the ExternalInterface class to communicate with the external host of the Flash plugin, such as the web browser, commonly used in multi-stage attacks where the browser gets redirected, injected with an iframe or some other badness.
- The presence of iframe injecting code, or iframe tag references.
- The use of the fscommand function to save or execute other files.
- Whether the file embeds other file types such as Portable Executables, RARs or ZIPs.
https://www.virustotal.com/en/file/00db30d185678bacc8f3fa12f6a642ca923d93219a9447b448e0e1e1c97b2c69/analysis/ (Recent CVE-2014-1776 example)
https://www.virustotal.com/en/file/ac49aa73ed37aacf4a1a1e2c00824cb4f7372ede2dc210e2f706390b6bebf936/analysis/ (Example highlighting iframe extractions)