Monday, October 24, 2016

Maltrail and Sysv Integration

For those that are on systems without systemd, I've finally got a startup script that appears to work with maltrail.  Follow the instructions for initial setup using systemd in this blog first.  Here's the init script:

#!/bin/sh
# Start/stop/restart maltrail:

. /lib/lsb/init-functions

maltrail_start() {
  cd /opt/maltrail
  /usr/bin/screen -dm /usr/bin/sudo -u maltrail /usr/bin/python /opt/maltrail/server.py &
  /usr/bin/screen -dm /usr/bin/python /opt/maltrail/sensor.py &
}

maltrail_stop() {
  echo "Stopping maltrail..."
  pid=`ps -ef | grep -i 'SCREEN -dm /usr/bin/sudo -u maltrail /usr/bin/[p]ython /opt/maltrail/server.py' | awk '{ print $2 }'`
  echo $pid
  kill $pid
  sleep 2
  pid=`ps -ef | grep -i 'SCREEN -dm /usr/bin/[p]ython /opt/maltrail/sensor.py' | awk '{ print $2 }'`
  echo $pid
  kill $pid
  sleep 2
  echo "Server killed."
}

maltrail_restart() {
  maltrail_stop
  sleep 5
  maltrail_start
}

case "$1" in
'start')
 maltrail_start
  ;;
'stop')
  maltrail_stop
  ;;
'restart')
  maltrail_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac

put this script in /etc/init.d/ then execute:

sudo update-rc.d maltrail defaults

You should be able to see that maltrail is started after rebooting.

Friday, September 16, 2016

Bro and Elasticsearch Integration

First, fix dots in ES 2.4:

Fix dots in field names

Next install Bro ElasticSearch plugin:

Bro ElasticSearch Plugin

with a couple caveats of  you'll need to cd to bro-2.4.1/aux/plugins/elasticsearch before the ./configure && make && make install, and the default plugin dir to install in is bro-install-dir/lib/bro/plugins/.


The below script to use for mappings will set all strings to not analyzed, and ip source and destinations to field type of IP:
curl -XPUT "http://localhost:9200/_template/bro_template" -d'
{
  "template": "bro-*",
    "order": 1,
    "mappings": {
      "_default_": {
      "dynamic_templates": [
        {
          "strings": { 
            "match_mapping_type": "string",
            "mapping": {
              "type": "string",
              "index": "not_analyzed"
                }
              }
            }
          ]
        },
        "bro_ts": {
          "properties": {
            "ts": {
              "type": "date",
              "format": "epoch_millis"
            }
          }
        },  
        "bro_orig_h": {
            "properties": {
            "id.orig_h": {
              "type": "ip"
            }
          }
        },
        "bro_resp_h": {
            "properties": {
              "id.resp_h": {
                "type": "ip"
              }
            }
        },
        "bro_assigned_ip": {
            "properties": {
              "assigned_ip": {
                "type": "ip"
              }
            }
        }
    }
}'

Thursday, September 8, 2016

Maltrail Setup and Systemd Integration

Having run this app for a while now I figured this was long overdue...tested on Ubuntu 14-16:


git clone https://github.com/stamparm/maltrail.git

sudo mv maltrail /opt/

add to /etc/passwd:
maltrail:x:10000:10000::/opt/maltrail:/bin/false

add to /etc/group:
maltrail:x:10000:maltrail

edit your /opt/maltrail/maltrail.conf (interface, creds, etc...)

sudo chown -R maltrail:maltrail /opt/maltrail

create the two files below:

/lib/systemd/system/maltrail-server.service:

[Unit]
Description=Maltrail server

[Service]
User=maltrail
Group=maltrail
WorkingDirectory=/opt/maltrail
ExecStart=/usr/bin/nohup /usr/bin/python /opt/maltrail/server.py & disowm


[Install]
WantedBy=multi-user.target


/lib/systemd/system/maltrail-sensor.service:

[Unit]
Description=Maltrail sensor

[Service]
WorkingDirectory=/opt/maltrail
ExecStart=/usr/bin/python /opt/maltrail/sensor.py


[Install]
WantedBy=multi-user.target


then run:
sudo systemctl enable maltrail-server
sudo systemctl enable maltrail-sensor


lastly run:
sudo systemctl start maltrail-server
sudo systemctl start maltrail-sensor


updating:
sudo systemctl stop maltrail-server
sudo systemctl stop maltrail-sensor
cd /opt/maltrail
sudo cp maltrail.conf maltrail.conf.mine
sudo rm maltrail.conf
sudo git pull

copy local changes from maltrail.conf.mine to the new maltrail.conf

sudo chown -R maltrail:maltrail /opt/maltrail
sudo systemctl start maltrail-server

sudo systemctl start maltrail-sensor

Thursday, August 18, 2016

The Sad State of Foxit Reader

The tl;dr is:  Foxit Reader, tracks your usage and sends it to their servers (in China!!), installs a service that you can’t uninstall without uninstalling Foxit Reader, and is not proxy aware.  There is currently no way to disable any of the cloud based functionality, or user tracking.  Long version below:

After installation, you can see the Foxit Reader Service installed (left), but no option to uninstall the service (right), whereas previous versions you could:


If you disable the service as shown above, Foxit will give you the below prompt EVERY TIME you open a pdf or start the application:








Foxit Reader sending your IP and MAC address to Foxit's servers

Logging data sent to Foxit's servers

 The below shows a list of User Agent's found in the FoxitConnectedPDFService.exe memory:




Lastly, the Detected field shows the protections Foxit has put in place on the exe:



Wednesday, June 29, 2016

Boleto Malspam Leads to Symmi

Boleto Malspam Leads to Symmi

It starts with an email

The pdf button goes to a servint.net link, which in turn goes to dropbox.com

We're left with BOLETO-29-06-2016.PDF.zip, which extracts to BOLETO-29-06-2016.jar.  Decompiling the jar file we see several interesting bits


the key and most of the crypto routine were pulled from avajava.com tutorials.  After decrypting the files we're left with two 64 bit files, and two 32 bit files

c4cb4fdf6369dd1342d2666171866ce5 is apparently calc.exe (?), the rest are packed with VMProtect.  VT Links:

https://www.virustotal.com/en/file/2db1aa1eed26fd3805c121ed42af2a35f93af22932462f4919b190b1cf5464dc/analysis/

Friday, February 5, 2016

A Concise List of Windows 10 Network Activity on Boot

So this is just a list of what sysmon sees on boot.  This is Windows 10 Pro with all the security settings set to as much strict as allowed.  This was a fresh install, updated, no applications installed, with no user interaction.  Interesting that Procmon running on Windows 10 doesn't show any of this activity.  CSV is below...read from bottom up.

Type,Date,Time,Domain\User,Computer,Process proto dst ip
Information,2/5/2016,12:02:16 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,12:02:14 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,12:01:57 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,12:01:45 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,12:01:42 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,12:01:38 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,12:01:35 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,12:01:33 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,12:01:30 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 191.232.139.170
Information,2/5/2016,12:01:04 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 191.232.139.170
Information,2/5/2016,12:00:53 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,12:00:50 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,12:00:38 PM,\SYSTEM,DESKTOP-GTO9KN6,System udp 134.170.179.87
Information,2/5/2016,12:00:37 PM,\SYSTEM,DESKTOP-GTO9KN6,System udp 131.253.61.66
Information,2/5/2016,12:00:36 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 134.170.179.87
Information,2/5/2016,12:00:35 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 131.253.61.66
Information,2/5/2016,12:00:31 PM,\SYSTEM,DESKTOP-GTO9KN6,System udp 239.255.255.250
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe udp 127.0.0.1
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe udp 239.255.255.250
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,System udp 64.4.54.253
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,System udp 131.253.40.84
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 23.196.87.75
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.231.200.101
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.231.255.140
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 131.253.40.84
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 131.253.40.84
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.231.200.101
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 23.196.87.75
Information,2/5/2016,12:00:30 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.231.255.140
Information,2/5/2016,12:00:29 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\CompatTelRunner.exe tcp 64.4.54.253
Information,2/5/2016,12:00:28 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 107.20.234.199
Information,2/5/2016,12:00:14 PM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,11:59:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 64.129.104.158
Information,2/5/2016,11:59:25 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:59:24 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:59:24 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:59:24 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:59:23 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:59:23 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:59:23 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:59:22 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 65.55.113.11
Information,2/5/2016,11:59:22 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:59:19 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 64.129.104.165
Information,2/5/2016,11:59:17 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\backgroundTaskHost.exe tcp 65.52.108.252
Information,2/5/2016,11:59:16 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\backgroundTaskHost.exe tcp 65.52.108.103
Information,2/5/2016,11:59:13 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 64.129.104.158
Information,2/5/2016,11:58:57 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,11:58:56 AM,\SYSTEM,DESKTOP-GTO9KN6,System udp 111.221.29.222
Information,2/5/2016,11:58:54 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 111.221.29.222
Information,2/5/2016,11:58:52 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 64.4.54.36
Information,2/5/2016,11:58:50 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 64.4.54.36
Information,2/5/2016,11:58:50 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 64.4.54.36
Information,2/5/2016,11:58:29 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\BackgroundTransferHost.exe tcp 172.226.137.132
Information,2/5/2016,11:58:29 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\BackgroundTransferHost.exe tcp 172.226.137.132
Information,2/5/2016,11:58:29 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\BackgroundTransferHost.exe tcp 64.129.104.150
Information,2/5/2016,11:58:28 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\BackgroundTransferHost.exe tcp 64.129.104.150
Information,2/5/2016,11:58:28 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\BackgroundTransferHost.exe tcp 172.226.113.163
Information,2/5/2016,11:58:28 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\BackgroundTransferHost.exe tcp 172.225.172.125
Information,2/5/2016,11:58:28 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\BackgroundTransferHost.exe tcp 172.226.113.163
Information,2/5/2016,11:58:23 AM,\SYSTEM,DESKTOP-GTO9KN6,System udp 198.41.215.184
Information,2/5/2016,11:58:23 AM,\SYSTEM,DESKTOP-GTO9KN6,System udp 65.52.108.252
Information,2/5/2016,11:58:22 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\backgroundTaskHost.exe tcp 198.41.215.184
Information,2/5/2016,11:58:22 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\backgroundTaskHost.exe tcp 72.21.91.8
Information,2/5/2016,11:58:21 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\backgroundTaskHost.exe tcp 65.52.108.252
Information,2/5/2016,11:58:20 AM,\SYSTEM,DESKTOP-GTO9KN6,System udp 72.21.91.8
Information,2/5/2016,11:58:20 AM,\SYSTEM,DESKTOP-GTO9KN6,System udp 65.52.108.103
Information,2/5/2016,11:58:19 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\backgroundTaskHost.exe tcp 72.21.91.8
Information,2/5/2016,11:58:18 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\backgroundTaskHost.exe tcp 65.52.108.103
Information,2/5/2016,11:58:12 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe tcp 204.79.197.200
Information,2/5/2016,11:58:11 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\SppExtComObj.Exe tcp 10.0.5.34
Information,2/5/2016,11:58:11 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\SppExtComObj.Exe tcp 10.0.5.34
Information,2/5/2016,11:57:56 AM,\SYSTEM,DESKTOP-GTO9KN6,System udp 65.55.113.11
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe udp e000:fc:0:0:0:0:0:0
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe udp ff02:0:0:0:0:0:1:3
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 65.55.113.11
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe tcp 172.225.172.182
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe udp 10.10.0.25
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe udp a0a:19:0:0:0:0:0:0
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,C:\Windows\System32\svchost.exe udp ff02:0:0:0:0:0:1:2
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,System udp 10.0.2.15
Information,2/5/2016,11:57:55 AM,\SYSTEM,DESKTOP-GTO9KN6,System udp 10.0.2.255


And matching IP to name for a unique list:
107.20.234.199    version.hybrid.api.here.com
111.221.29.222    tsfe.trafficshaping.dsp.mp.microsoft.com
131.253.40.84    platform.maps.glbdns2.microsoft.com
131.253.61.66    login.live.com.nsatc.net
134.170.179.87    device.auth.xboxlive.com
172.225.172.125    store-images.microsoft.com
172.225.172.182    go.microsoft.com.edgekey.net
172.226.113.163    store-images.s-microsoft.com
172.226.137.132    sci1-1.am.microsoft.com
172.231.200.101    t0.ssl.ak.dynamic.tiles.virtualearth.net
172.231.255.140    t0.ssl.ak.tiles.virtualearth.net
191.232.139.170    tsfe.trafficshaping.dsp.mp.microsoft.com
198.41.215.184    ocsp.msocsp.com
204.79.197.200    tse4.mm.bing.net
23.196.87.75    ssl2.tiles.virtualearth.net.edgekey.net
64.129.104.150    static.btrd.net
64.129.104.158    ctldl.windowsupdate.nsatc.net
64.129.104.165    ctldl.windowsupdate.nsatc.net
64.4.54.253        settings-win.data.microsoft.com
64.4.54.36        licensing.mp.microsoft.com
65.52.108.103    arc.msn.com
65.52.108.252    rpt.msn.com
65.55.113.11    dmd.metaservices.microsoft.com
72.21.91.8        cdn.optimizely.com 

Friday, November 20, 2015

A comparison of OS phone homes

Not much to say here really...so I'll let the pictures do the talking.  Each OS was turned on...that was it....no interaction for a few days at all.  Each OS was a basic install....no other applications were installed.

Ubuntu
 
El Capitan

Windows 10

Wednesday, August 19, 2015

Binnavi install on Windows

Great app...I couldn't find anywhere that talked about what you need to make it so here goes:

Apache Ant
Apache Maven 
Java JDK 
PostgreSQL 

Install the JDK, create a new Windows Environment Variable called JAVA_HOME that should point to install directory (e.g. C:\Program Files\Java\jdk1.8.0_60).  Extract your apache-maven-*.*.*-bin.zip and apache-ant-*.*.*-bin.zip, put them somewhere (I put mine just in "c:\", and add both to your PATH (I renamed these and mine look like: C:\apache-maven\bin;C:\apache-ant\bin).

Install PostgreSQL, and with pgAdmin create a new user (I called mine binnavi), then create a new database (I called mine binnavi) with the owner being binnavi.

Get a command prompt/powershell and cd to binnavi-master then build:

mvn dependency:copy-dependencies
ant -f src/main/java/com/google/security/zynamics/build.xml build-binnavi-fat-jar
 

Then run and point to your PostgreSQL instance:
java -jar target/binnavi-all.jar




Done.

Sunday, August 16, 2015

Breaking Windows 10 with a Firewall

Breaking Windows 10 with a Firewall

My firewall of choice is Commodo since I can get pretty granular with it.  Settings below:


After running for a couple days with this configuration, these are some observations:

  • Clicking the Windows Start Button results in a spin wheel...takes several tries to get the menu to pop up
  • Said menu is completely blank
  •  Calculator no longer functions (for another post)
More to come...

Powershell executable search order

Powershell executable search order


Seems legit....just type "calc" in a shell...hope nobody places anything naughty there.

Saturday, August 15, 2015

Windows 10 Observations

Windows 10 Observations


I wonder why SearchUI.exe (Cortana) needs all those User Agents?

Friday, April 17, 2015

Bro IDS SMTP File Extraction

Bro-ids SMTP file extraction script, first attempt:
 
#define list of mime types to extension that we want
global ext_map: table[string] of string = {
        ["application/x-dosexec"] = "exe",
        ["application/zip"] = "zip",
        ["application/msword"] = "xls",
};

event file_new(f: fa_file)
        {

        # if this isn't SMTP, we don't want it
        if ( f$source != "SMTP" )
                return;
        #if it's not a mime type, or it's not in our list we don't want it
        if ( ! f?$mime_type || f$mime_type !in ext_map )
                return;

        local ext = "";

        if ( f?$mime_type )
                ext = ext_map[f$mime_type];

        local fname = fmt("%s-%s.%s", f$source, f$id, ext);
        Files::add_analyzer(f, Files::ANALYZER_EXTRACT, [$extract_filename=fname]);
}

Tuesday, December 4, 2012

Blackhole Exploit Kit Observations

Hey all,

Been doing a bit of research, and I've found some interesting correlations with the BEK.  First off, I'll be looking at three separate incidents:

Oct 22 2012 - Microsoft Support spoofed emails
Oct 23 2012 - LinkedIn spoofed emails
Dec 4 2012 - US Airways spoofed emails

The method of infection is pretty much the same and well documented...click the link, and your flash/reader/java versions are checked, then exploited.  After that, usually Zeus or Cridex is installed and your machine starts talking to their C&C servers.  It's this point that I'm looking at.  There are some variances, but the general flow seems to be:

Exploited java creates:
C:\Documents and Settings\username\wgsdgsdgdsgsd.exe

Internet Explorer creates:
C:\DOCUME~1\username\LOCALS~1\Temp\wpbt0.dll

wpbt0.dll creates (and starts) a secondary downloaded executable file
or
wgsdgsdgdsgsd.exe creates (and starts) a secondary downloaded executable file, usually a KB00random#s.exe
 
File C:\Documents and Settings\username\Application Data\94B3EB7A and Registry Key HKCU\Software\Microsoft\Windows NT\S94B3EB7A are created.  This entry is what I believe to be the list of banks and sites to steal your data and has some interesting bits:


File C:\Documents and Settings\jlay\Local Settings\Temporary Internet Files\Content.IE5\<random>\AjX0[1].txt is created.  This file I believe is encrypted and portions of it are sent to the C&C server:


I suspect this file contains information about your machine/user info/etc.  In two cases this file was close to 100kB, in the last case it was over 440kB!

For reboot survival, key HKCU\Software\Microsoft\Windows\CurrentVersion\Run\KB00729045.exe is created.

Lastly, wgsdgsdgdsgsd.exe and wpbt0.dll createa couple .bat files are created that attempt to delete a few files:
C:\Documents and Settings\username\Local Settings\Temp\exp3.tmp.bat
C:\Documents and Settings\username\Local Settings\Temp\exp1.tmp.bat 


Things I need to do:
Create a snort rule
Figure out how to decrypt the AjX0 files

Thanks.

Monday, November 19, 2012

The Sad State of the Modern OS

In today's lesson, we'll look at the following operating systems on an older Mac Mini (2 GHz, 2 gigs of RAM):


Our first contestant:  OS X Mountain Lion

Apple has decided that OS X Mountain Lion won't run on this device.  Technically game over, but for poops and giggles let's look at some nuggets from a device that it DOES run on:

Some of OS X's processes flat out refuse to use whatever proxy settings you've hard set in your Network settings, and will fail if you attempt to proxy transparently (Dictation).  Why is that?  I suspect it's because of this:

"When you use the keyboard dictation feature on your computer, the things you dictate will be recorded and sent to Apple to convert what you say into text. Your computer will also send Apple other information, such as your first name and nickname; and the names, nicknames, and relationship with you (for example, “my dad”) of your address book contacts."

The "such as" is especially exciting...I'm betting it's far more, and Apple doesn't want you to see it, hence proxy fail

In Lion, most of your jazz (contacts, notes, etc...) sync'd via iTunes to your iPhone and life was good.  In Mountain Lion, Apple has removed that and now you MUST use iCloud.  Have you LOOKED at the iCloud privacy statement?  Some tidbits below:

To provide such features or services, where available, Apple and its partners and licensors must collect, use, transmit, process and maintain your location data, including but not limited to the geographic location of your device and information related to your iCloud account (“Account”) and any devices registered thereunder, including but not limited to your Apple ID, device ID and name, and device type.

When you create an Apple ID, register your products, apply for commercial credit, purchase a product, download a software update, register for a class at an Apple Retail Store, or participate in an online survey, we may collect a variety of information, including your name, mailing address, phone number, email address, contact preferences, and credit card information.

When you share your content with family and friends using Apple products, send gift certificates and products, or invite others to join you on Apple forums, Apple may collect the information you provide about those people such as name, mailing address, email address, and phone number.

In the U.S., we may ask for your Social Security number (SSN) but only in limited circumstances such as when setting up a wireless account and activating your iPhone or when determining whether to extend commercial credit.
We also use personal information to help us develop, deliver, and improve our products, services, content, and advertising.

We also use personal information to help us develop, deliver, and improve our products, services, content, and advertising.

We may collect information such as occupation, language, zip code, area code, unique device identifier, location, and the time zone where an Apple product is used so that we can better understand customer behavior and improve our products, services, and advertising.

As is true of most websites, we gather some information automatically and store it in log files. This information includes Internet Protocol (IP) addresses, browser type and language, Internet service provider (ISP), referring and exit pages, operating system, date/time stamp, and clickstream data.

We use this information to understand and analyze trends, to administer the site, to learn about user behavior on the site, and to gather demographic information about our user base as a whole. Apple may use this information in our marketing and advertising services.


Yea pass thanks.  Apple is forcing you to use their service so they can sell your info...nice.  Fail..and done with OS X!

Next up, Ubuntu 12.10 Client!

One of the staples of Linux, is the fact that you can just about throw it on anything and it will work, and do it well.  Ubuntu 12.10 gives a fat "shove it" to that notion.  Ubuntu 12.10 on this same Mac Mini fails to work with the aging Intel 945GM graphic card (the ancient 1024x768 is the max res you'll get).  This "modern OS" was released just last month, yet can't see my card.  A fresh install with a 2009 Windows 7 cd, and Windows sees the card and gives me full res's right out the gate, not even with SP1.  WTH.  Couple this with the shameless (and insecure) bundling of desktop search with Amazon (link here) and this OS, is fail.

NEXT

Windows 8

Now I must admit, that Windows 8 is worse than I thought it would be :)  Taking a queue from Apple, certain process will happily disregard your proxy settings and go direct to the Net.  Again, why is that?  It's not to hide their in-app advertisements (link here), those are bad enough (this is my DESKTOP OPERATION SYSTEM, NOT MY PHONE).  I have yet to try and transparently proxy the traffic to see what it's doing.  And they there's the new Store...a shameless (and late) copy of Apple's Store.  Come to think of it, isn't the whole Metro UI about...5 years late if they wanted to be like Apple?  Fail.


And there it is!  So what's a tech person to do when the big three of OS's are going in directions that are technically questionable, clearly made for the masses, and seem hell bent on acquiring (and selling) my data?  It's a sad way. 

Friday, June 29, 2012

Tumblr Redirects

Tumblr Redirects
Recently I’ve been seeing spams as shown below:

Your inbox is full of surprises from a special someone. You should go check it out now. To receive this special gift, View Here

Sent from Yahoo! Mail on Android


The “view here” goes to links such as (one used the t.co url shortening service however before going to Tumblr):
kmghoshk.tumblr.com
wcmxztol.tumblr.com

These links contain the below obfuscated javascript:
var dnc='http'; var ghmr='://e'; function ertryu(wnz,hfy){return wnz+hfy} var ndnkkl=ertryu(dnc,ghmr);var qvst='card'; var fcv='love'; function ikgofp(gtq,ojh){return gtq+ojh} var pdgfvt=ikgofp(qvst,fcv);var ymm='wis'; var zko='h.co'; function hgypvh(ocu,cln){return ocu+cln} var ehillv=hgypvh(ymm,zko);var jah='m/?'; var wlo='6QBc'; var ehjh='kb'; function iatyan(rcw,dgi,ygk){return rcw+dgi+ygk} var hjgfam=iatyan(jah,wlo,ehjh); var kwzkgy=ndnkkl+pdgfvt+ehillv+hjgfam; document.location = kwzkgy

var uvw='http'; var unn='://e'; function xoimr(qmn,cey){return qmn+cey} var opbsj=xoimr(uvw,unn);var jvgt='card'; var smo='lov'; function dbog(tzp,nqh){return tzp+nqh} var rvoa=dbog(jvgt,smo);var foi='ersw'; var rth='ish'; function qzhlg(uwu,mrg){return uwu+mrg} var wtzdi=qzhlg(foi,rth);var hqzh='.com'; var vrly='/?C'; function shfq(fgk,yom){return fgk+yom} var vzby=shfq(hqzh,vrly);var dih='qdve'; var ibt='e'; function rdetyd(xep,itr){return xep+itr} var ybvpit=rdetyd(dih,ibt); var vaybau=opbsj+rvoa+wtzdi+vzby+ybvpit; document.location = vaybau

These decode to links pointing to:
hxxp://ecardlovewish.com/?6QBckb

Which in turn go to silly dating sites (iHookup, ScoreNextDoor, etc…)

Update 1:
The bad guys have added an additional method for this:
var bwl='htt'; var jwu='p://'; function relz(dgk,cpy){return dgk+cpy} var bgbr=relz(bwl,jwu);var daih='ecar'; var zpd='d3-'; function eettgr(xyl,too){return xyl+too} var sdiocl=eettgr(daih,zpd);var xand='love'; var max='r.co'; function sccfhz(krs,mre){return krs+mre} var abbghb=sccfhz(xand,max);var khd='m/?5'; var esd='Mzo'; var zcl='GyEy'; function frmy(jxx,sbe,onn){return jxx+sbe+onn} var qpyj=frmy(khd,esd,zcl); var otoa=bgbr+sdiocl+abbghb+qpyj; document.location = otoa

The below Snort sig should match both of these now:
alert tcp $EXTERNAL_NET $HTTP_PORTS -> $HOME_NET any (msg:"WEB-CLIENT Tumblr spam redirect"; flow:from_server; file_data; content:"='htt"; content:"://"; within: 15; metadata:policy security-ips drop, service http; classtype:bad-unknown; sid:10000014; reference:url,malwareandmore.blogspot.com/2012/06/tumblr-redirects.html; rev:2;)

Wednesday, December 21, 2011

Blackhole Toolkit drive-by download reversed

So..seeing those "Transaction system failure".  Included in the email is this great tidbit:

<html>
<h1>WAIT PLEASE</h1>
 <h3>Loading...</h3>
<script language="JavaScript" type="text/JavaScript" src="hxxp://bobosbouncytown.com/jscript.js"></script>
<script language="JavaScript" type="text/JavaScript" src="hxxp://dzevents-algerie.com/jscript.js"></script>
<script language="JavaScript" type="text/JavaScript" src="hxxp://sammy.dommel.be/gogleads.js"></script>
</html>
 

so let's wget one of these and see what we have:

document.location='http://curvechurch.com/main.php?page=4a4fd3141d846cdd';


let's wget THAT and see what we have:





























Yugh...obfuscated javascript...ick.  So let's fire up Malzilla and see what we can do.  I copied the above into the Decoder tab and hit debug.  I get an:
 
aa is not defined 



































Well that stinks.  But I DO get some good info from the Variable State window, so let's change the easy ones:

d="doc";
e='ev';
w=window;
g=fromCharCode';
if(w[d+"ument"])aa=([].unshift+'');
aa=aa.split('').pop();



Still the same "aa is not defined" error after clicking Debug...so lets nuke that if portion to show:
aa=([].unshift+'');































Now we're hot doggin!  Closing the Debug window will give us:
  





So let's see what that eval_temp file is...open up the temp file in note/wordpad, copy ALL of it, create a new Decoder tab in Malzilla and dump it in and Format Code:

































Note the rabbit link.  Now...there's a LOT of crap going on here...pdf/java/flash version checks to name a few.  But what caught my eye was down at the bottom area:





























Let's copy all those comma numbers, go to the Misc Decoders, paste um in.  Don't forget to add a comma at the very start of the string.  Click the Decode Dec(,) button:
Hey hey!  Look at that.  Let's wget THAT link and see what we get:


 
 

Vicheck and Virustotal don't show much...scary:
http://www.virustotal.com/file-scan/report.html?id=453b83d472e378cb306ae282ebeb51765545892637bd087aa2a916df1a3fb934-1324483480

https://www.vicheck.ca/md5query.php?hash=559ccdd2ae813251d28cf6ab15195fff