Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

I received a pretty blatantly spammy email to my Gmail account. I'm not really sure how it made it through the spam filters, since it has all of the telltale signs. The FROM field is spoofed as upsservices@ups.com, but the headers reveal the sender's IP as 178.90.188.166... which points back to an ISP in Kazakhstan.

Anyway, attached to the email is a supposed HTML file. My first hunch was that it was probably one of the following:

  1. A nasty executable file masquerading as a simple HTML file, or
  2. An actual HTML file meant to be opened in a browser in a phishing attack

(edit: Or one of the others mentioned by @Adnan)

My guess is that it really is an HTML file, since Gmail claims the attachment is only 1K in size.

I know I should probably just mark this as spam and get on with my life, but my curiosity is getting the best of me... I really want to know what's in that attachment. Is there a safe way to go about downloading it to a sandboxed location and inspecting the contents? I'm at the beginning of a career shift into the security field, and I would love to pick apart this real world example of something potentially nasty and see how it ticks.

I'm thinking a LiveCD or a VM would be a safe environment... I would prefer to do it in a clean, un-networked environment, but in any case, I'll still be logging into my Gmail account to download the thing.

Any suggestions?

Update:

I was probably over thinking this. I ended up making sure a downloaded file wouldn't automatically execute or open in a browser, then inspected the source code. It is indeed an HTML file that runs some shady Javascript. They're doing some clever stuff in the code, including masking a destination document.location redirect as hex code. Converting it to ascii reveals the destination as a php script on a .ru domain (I won't share it because I want to be a good Internet Citizen). I can't make sense of the code's true goal... it's not exceptionally complicated, but it's pretty muddled and convoluted, presumably to take advantage of browser bugs (it claims to be "Internet Explorer compatible only").

Anyway, I wasn't originally planning on running the suspicious file... I mostly wanted to see the source code. Now I'm tempted to set up a little something like @Adnan recommends and give it a go.

share|improve this question
    
Hi, is there a place where to send such suspicious file (html) for review, without actually trying to open it myself. Or can I download it as .zip without opening? –  Buscar웃 Feb 3 at 21:22

6 Answers 6

up vote 14 down vote accepted

3. HTML page with JavaScript code attempting exploit a vulnerability in your browser.

4. HTML page with an embedded Java applet attempting to exploit a vulnerability the JVM

5. HTML page with an embedded Flash file attempting to exploit a vulnerability Flash Player

6. The email itself, before you open the attachment could try to exploit a vulnerability in your email client

There might be other possibilities.

For this purpose, I have the following setup:

  • Virtual Machine using VirtualBox. No network access.

  • I have a snapshot saved for the VM after a fresh OS install.

  • I also take two snapshots with What Changed? and TrackWinstall.

  • I copy files only in the direction Host -> VM, using a free ISO creator.

  • I create the .iso file and mount it. Then I can have all the fun I want on the VM itself.

  • I usually run the malware and study memory usage, CPU load, listening ports, networking attempts.

  • I check the changes to the OS using What Changed? and TrackWinstall.

  • Finally I restore to the fresh snapshot.

The reason I have the whole setup is because I like to run the malware and see what it's trying to do.

Update:

I was talking to colleague who performs malware analysis as a hobby and he told me about his setup, it might be different that what you might want for an occasional .html attachment check.

  • Old PC with a fresh OS install.

  • After installing the needed tools he takes a full-disk image using Clonezilla Live.

  • What Changed for snapshots comparisons.

  • The PC is connected to the Internet through a separate network.

  • Whenever he finishes working on a sample, he reboots with Clonezilla and restores the full-disk image.

share|improve this answer
1  
I like the point you make... it was short-sighted of me to suggest there were only two possibilities. I happened to mention the first ones that came to mind, so thanks for listing some others. I have some questions about your approach. Wouldn't creating the ISO and mounting it in the VM require you to download the suspicious file on the host in order to create the ISO (since the VM isn't networked)? –  sonofamitch Mar 20 '13 at 16:10
    
@sonofamitch, oh, sorry I didn't explain that. For that I'll refer you to AJ's answer. But I'll update my answer to further explain why I have that setup. –  Adnan Mar 20 '13 at 17:21
2  
@Adnan, I think it is worth pointing out that malware can detect whether it is in a VM, even if it can't break out of the VM, it may still be able to alter its behavior to mask its true purpose. A less likely feature, but still possible. –  George Bailey Mar 20 '13 at 18:44
    
@GeorgeBailey, important note. Thanks for the addition. –  Adnan Mar 20 '13 at 18:48

In Gmail, click on the button with the little triangle on the bar above the message, on the right. In the menu that pops up, select "Show Original". Now gmail shows you the raw message with all the headers, in another browser window. The attachment is in the message body, MIME-encoded into harmless text. You can cut and paste the MIME material and decode it with some MIME utilities (e.g. munpack on Linux or Cygwin).

share|improve this answer
    
I love this answer! It didn't cross my mind that the actual attachment would be encoded as part of the email header, but it makes total sense. I tested it out by copy and pasting the encoded portion of the header into a text file, then using openssl base64 on OSX to decode it. This seems much less risky for the simple reason that it won't run automatically like downloading from the browser might. I'll file away this method for future use. Thanks! –  sonofamitch Mar 21 '13 at 15:53
    
+1 This is exactly the answer to the OPs original question. Any mail app that lets you see the raw ASCII of the message is safe to look at the message and any attachments, whether it's an on-line (GMail) or a standalone app (Outlook etc). From there you can cut-n-paste to wherever you want for further investigation. –  Jan Doggen Mar 21 '13 at 16:22
    
But, you don't love this answer enough to give it a green checkmark. * Pout *! :) :) –  Kaz Mar 22 '13 at 23:12

A liveCD running on a system with no hard drive, set in a DMZ network with no access to anything else would be my answer. That way there's nothing the malware could write to, and no way it could attempt to infect any other systems. The problem with a VM is that is that malware could attempt to compromise the host machine. Even if it isn't capable of infecting using some sort of hypervisor attack (pretty unlikely), it could simply use the network to attempt to crack the host machine.

share|improve this answer

The simplest approach would be to use direct HTTP access to save the file and open it in Notepad to examine the contents. The file can't magically run itself if you treat it directly as data and you should be able to examine the contents. The key is to make sure you do not access it with anything which could automatically run something for you.

To be a little more thorough, you could use a VM to actually let it go and see what it does, but for simple checking, treating it as a data file and accessing it with data analysis tools should be safe.

If you've already opened the e-mail and just not the attachment, then you could simply save the attachment. If you are nervous about actually opening the e-mail, something like Lynx could probably be used.

share|improve this answer
    
I have already opened the email, but not the attachment. Are you suggesting that I'm safe to download the attachment, assuming nothing automatically runs it once downloaded? I'm on a Mac, using Chrome... if that makes a difference. I don't think I have any settings to run anything automatically on download. –  sonofamitch Mar 20 '13 at 16:24
    
@sonofamitch - Yes, a data file can not do anything without being run. The trick is there are lots of things that can automatically run a file. Downloading it as a file and then opening it with a basic text editor or hex editor should prevent it from being able to execute anything though. –  AJ Henderson Mar 20 '13 at 16:26

Get a laptop. The laptop contains no hard disk. Use a boot cd that lets you boot from usb port. Insert a 2GB usbstick with the Tor Tails OS. Boot from the usb stick. Log into your email account, save the attachment to a "virtual" ram disk. Then log out from your e-mail account. Then run or analyze your attachment. Draw your conclusions. Shutdown the laptop and voila. No trace, no damage. QED.

share|improve this answer

The easiest way would be to foward the mail to an online scanning service.

You can submit files to virustotal by forwarding the email to scan@virustotal.com You will have to change the subject field to "SCAN". When it is done, you should receive a mail with the results. Email submissions is not prioritized, so it might take some time for the results to come back.

For more information, you can visit virustotal

And of course, you should not forward sensitive information.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.