Skip to main content

IMP Scanner

The project is comprised of 3 modules:


  1. The embedding Module which is written in Ruby
  2. The Execution/ exploiting stage
  3. The IMP Scanner, to scan for Images with Malicious Programs (IMP)
For the embedding the following are the stages:

  1. Generate malicious program (malp.exe) using msfpayload from metasploit
  2. encode the generated program (malp.exe) using msfencode from metasploit
  3. obfuscate malp.exe using UPX or any other suitable packer like Themida to make sure it is not detected by antivirus.
  4. embed malip.exe into selected stegoimage (stegoimg.jpg) using F5 algorithm (for transform domain steganography) or Jsteg (for spatial domain steganography). the size of the image should be more than double the size of malp.exe to be safe and to ensure no distortion occurs.

Deploy the image to the target machine. Many possible ways of doing this including keydrops with manipulated autorun.inf file to extract malp from stego or passive propagation via FTP shared folder and then later activation/triggering.

Scanning tool was developed using Python. The IDE was PyDev in Eclipse Helios (for C and C++ by default) after adding on the needed files from the Eclipse Marketplace. GUI design was done using QtDesigner which saved the files as .ui extensioned files. QtDesigner came with PyQt4. To convert the .ui files to .py, use the pyuic4 command to do this.

For the scanning procedure:

  1. Opt to scan either an entire directory or a single image
  2. steganography algorithms to be targeted are JSteg and F5
  3. Opt for quick scan or slow scan (in-depth)
Quick Scan:
  1. Load list of images into QListWidgetItem and create a list object for them also
  2. Check the EXIF headers of the images for markers regarding the steganography algorithm used. In some cases, the developer may add their name to the first few bytes of the stegoimage as a signature of sorts.
  3. Run the Chi-Square attack on the images one by one to see if it has had data embedded into it using steganography. Eliminate the ones without the steganography markers/artefacts from the QListWidgetItem.
  4. If the stegoimage is found to have used JSteg from EXIF header analysis, use the Jsteg tool to extract the data from the image since no password is used. If it's F5, the best option would be to run a dictionary attack on the image using the F5 tool and common default passwords.
  5. submit the image hash to Virustotal as well as the hash for the extracted program/tool. Get the results and display.
  6. display results of the scan and allow the user to see individual details for each scanned image.
Slow Scan:
  1. Run the stages of quick scan
  2. Submit each image to cuckoo sandbox
  3. run/execute all image viewing programs in the sandbox to try and see if any activity occurs besides simple opening of the file. this is to check if any of the programs can be exploited into extracting the malicious program from the image.
  4. do the same tests for any extracted data from the images.
  5. Display results and allow printing of report of all the findings.


Comments

Popular posts from this blog

Part 4 - Static and Dynamic analysis of a Remote Access Trojan

Now we delve into the world of Malware analysis, This can be either Basic static, basic dynamic, advanced static or advanced dynamic malware analysis. By static we just mean we do not execute the malicious program but simply analyse it by looking at the headers, the linked libraries it calls, its resources, etc. When it is advanced, this would mean breaking it down and analysing it with tools such as IDA Pro. Dynamic means we run it in a safe environment and see what it does. Basic tools include Regshot which simply takes a snapshot of the registry before and after the malware was executed. It then returns only the changes made in between those two points in time. Advanced would involve the use of a sandbox that monitors all the calls the malware makes as well as the connection attempts it tries to make to outside terminals or C&C servers. The video below illustrates Basic Static and Dynamic malware analysis.

Password Cracking: RainbowCrack table generation, sorting and usage

I had to do this demo after one of my students asked for my assistance regarding how to use this tool. Usually, I just assign different tools to them individually depending on the aspect of penetration testing we are covering (session hijacking, vulnerability scanning, etc) and then tell them to submit a report and a video demo of how the tool is used. Anyway, after a brief one-to-one discussion I realized the student had actually done the research on how rainbow tables operate (above and beyond the material in the lecture slides) so I figured that if he was here asking for assistance, he genuinely needed it. The tool is available at the RainbowCrack site.  A detailed description of this nifty tool can also be found here . So, firstly I had to generate the rainbow tables. The command line syntax is: rtgen hash_algorithm charset plaintext_len_min plaintext_len_max table_index chain_len chain_num part_index where: hash_algorithm  Rainbow table is hash algorithm sp...

Forensics: Recovery of Files Ep 2 - Data Rescue PC3

This is the second episode in the Recovery of Files series.  Episode 1  has a little more background on the whole aspect of file recovery. The video below shows a demo of how to recover lost/deleted files using the proprietary tool commonly known as  Data Rescue PC3 . As in episode 1, in the video, we format the USB drive, add stuff to it, and then format it again in order to recover the deleted files. Again, just like in episode 1, you will also note that not only the files we lost upon formatting are the ones that are recovered, but this will also include the files from previous drive formats too.