Saturday, September 08, 2007

HITB Aftermath: Why you don't know you are having virus in your pocket?

This is something interesting happened during HITB Conference 2007, all of us brought our own USB thumb drive to ease the file transfer process. After the conference is over, Dhillon told us that his USB thumb drive contains virus and ask us to look into ours, interestingly here's what I have in my thumb drive -

shell>cat autorun.inf
[AutoRun]
open=.\MSOCache\90000804-6000-11D3-8CFE-0150048383C9\KB915865.exe
shellexecute=.\MSOCache\90000804-6000-11D3-8CFE-0150048383C9\KB915865.exe
shell\AutoOpen\command=.\MSOCache\90000804-6000-11D3-8CFE-0150048383C9\KB915865.exe
shell=AutoOpen

shell>file \ MSOCache/90000804-6000-11D3-8CFE-0150048383C9/kb915865.exe
MSOCache/90000804-6000-11D3-8CFE-0150048383C9/kb915865.exe: MS-DOS executable PE for MS Windows (GUI) Intel 80386 32-bit

Other crews may also have similar files in their USB thumb drive, therefore if any of you have borrowed USB thumb drive from us, good luck! As most of us are using either linux or osX, we don't even know the malicious files reside in our usb thumb drive.

Thanks to F-Secure sticker, I especially like the quote -

Real Men don't use antivirus.

Good luck to all Windows users in the conference.

Enjoy ;]

The root cause of this - thanks to the rented PC from whatever hardware provider ..... you should pay our monetary losssss

The Good Phisher

Yes, I'm talking about good phisher who kicks his/her own asssss -

For security reasons, you are advised to keep your winning information confidential till your claims are processed and your money remitted to you in whatever manner you deem it fit to claim your prize. This is part of our precautionary measure to avoid double claiming and unwarranted abuse of this program by some unscrupulous elements and most importantly for your own security Please be warned

Sometimes I just love spammers/phishers for no reason .....

Cheers ;]

Friday, August 31, 2007

Ubuntu: Huawei E220 for the sake of Celcom 3G

For certain purpose, I get to play with celcom 3G using Huawei E220 modem. Interestingly they are many people getting this device working under linux, but it seems people may have it working for them but not for the others, and here's mine.

shell>wget \
http://www.kanoistika.sk/bobovsky/archiv/umts/huaweiAktBbo-i386.out

shell>sudo chown root huaweiAktBbo-i386.out

shell>sudo chmod +s huaweiAktBbo-i386.out

shell>./huaweiAktBbo-i386.out

After you have done this, you can now configure wvdial, here's my humble configuration for impatient celcom 3G users, just edit your /etc/wvdial.conf.

[Dialer celcom]
Phone = *99***1#
Modem = /dev/ttyUSB0
Username = username
Password = password
ISDN = 0
New PPPD = yes
Baud = 460800
Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem

After you have configured it, just run this will do -

shell>wvdial celcom

Done. Thanks to all the helpful links in internet that give me idea of how to get this working on Ubuntu 7.04.

Cheers ;]

Tuesday, August 28, 2007

Ubuntu: Enlightenment 17

Due to the new job engagement, I haven't been posting much. I have just finished my first week working in the new company, the new job is totally different than my previous job since I need to do the requirements study for different network environments as well as some involvement of technical tasks. The job is quite challenging in certain perspective and hopefully I can take it.

I have been toying with enlightenment DR17, just like fluxbox there's no so called "stable release" and it is still in pre-alpha stage, if you know about enlightenment, DR17 is completely rewrite comparing to DR16 and the developers are now building all the applications using its own "e" libraries to facilitate and speed up the process. You can find more information about enlightenment here.

I have checked out E17 when trying the elive liveCD here, and it makes me always thinking that enlightenment is more to hobbyist window manager with slick graphic and animation supports. People who know me well should already know I always prefer something simple but highly usable and that's fluxbox.

Now I have Ubuntu linux installed on my new laptop(HP Compaq nx6320), I can get E17 installed using the package management system. I just need to add this three lines in my /etc/apt/sources.list -

deb http://edevelop.org/pkg-e/ubuntu feisty e17 deb-src http://edevelop.org/pkg-e/ubuntu feisty e17 deb http://e17.dunnewind.net/ubuntu feisty e17

Then I just update package repo -

shell>sudo apt-get update

shell>sudo apt-get install enlightenment enlightenment-dev \
e17-devel-extras entrance enlightenment-theme-night-bling

After this is done, I just need to logout from current session, and I can change the session from gnome to enlightenment in the login manager.

As there's no enlightenment user manual, I have to use "trial and error" method to configure it. You have to use left mouse click to launch the main menu and right mouse click to launch favourite menu where you can store quick launch application that you use daily.

Under the main menu, there's Configuration, click on it and it will expand horizontally and you can find the Configuration Panel where you will be able to configure most of the thing(everything?) for enlightenment.


I have a lot of keybindings when using fluxbox, therefore it is important feature for me. Enlightenment also provides the ease of use keybindings configuration. However the keybindings only support the control of the window and certain system commands, you can't do keybinding for application launching, maybe there's a way but I don't figure it out yet.


One of the important feature in Enlightenment is the modules, though it is not near perfect but with that you no longer requires gkrellm or conky, I just loaded few modules I find useful especially the virtual desktop, battery and so forth.


Wallpaper and theme configuration can be found under Configuration, and I just change to my preferred wallpaper(animated) and the theme too. Here are the two screenshots of my current desktop.



Here's the challenge, can you find the differences between two screenshots(wallpaper only) above? ;P

Yet I'm not finishing my post, there are two main functions which are built in that making me love about enlightenment, the window list and run command, with them you can just do application launching and switching in the blink of an eye. Just try out alt+tab and alt+esc and you will find that make your days.

As for now, though in pre-alpha version but I don't consider it in pre-alpha quality, and I have changed my mind that enlightenment is no longer hobbyist desktop shell but very fast and usable especially for people who don't rely much on mouse. Of course the graphics and animations without sacrifying the speed are the big plus too.

Kudos to Enlightenment developers!!!!!

Enjoy ;]

HP Compaq nx6320: Ubuntu Linux

Just start working in the company and I got this laptop in the first day, after few days of using ultimate OS that produced by M$, I can't resist anymore due to low productivities, therefore ..... good bye M$.

Finally Ubuntu kicks into my life in for production work because .....

1. I'm lazy to configure anything manually

2. I need something that can create high productivities

3. I have no time

4. It works almost out of the box except suspend to memory which not my serious concern anyway

5. Mel aka Spoonfork burnt me the Ubuntu installation CD

For Ubuntu users, the laptop model is HP Compaq nx6320 and its weight around 2.8kg +. If you don't mind the weight and love big laptop with clear screen, this is definitely your choice, especially the battery can last 3++ hours or I should say around 4 hours.

Maybe next time I should try FreeBSD, OpenBSD or Gentoo but currently I'm quited pleased with the outcome and I'm on the road.

Enjoy ;]

Thursday, August 23, 2007

Anti Anti-Spamming

Now you have detection to figure out the spam email, and now you have a way to avoid spammer to crawl your email, and now the spammer use your way to reach your mail box .....

From: "Harris Ramirez"

To: me

Seen my profile yet? Jennies friend. check me out @ triple w dot gotgameyes dot com xoxo Kira.

If you are interested, feel free to try the link, I'm sured you won't be dissapointed.

Don't get heart attack!!!!!

Cheers ;]

Sunday, August 19, 2007

Malaysia: National Cyber Security

There are two interesting posts from security.org.my regarding our National Cyber Security, I'm sured the guy who maintains the site has critical view about Malaysia Cyber Security but truly correct in his sense.

Lets start the fun by reading this -

- Part 1

- Part 2

Sometimes we have to learn to accept critique especially when we are wrong, consciousness is a need.

Peace ;]

Saturday, August 18, 2007

Media Files Meta Info Identification

Lately I have setup a home pc for my parents and I have to install windows for them even I myself advocate open source, that's the platform my brother knows how to work with and he can help my parents in case there's technical problem as I'm about to move to new place.

I have installed Firefox browser, OpenOffice and Vlc media player for them. Since my parents prefer to watch movies, I have found a Open Source application that can help them to identify the media files and download the correct codec. You can find the application here -

http://mediainfo.sourceforge.net/en

Mediainfo is small application but very neat although it can't support all codecs yet, you can just load the media file and it will try to identify what kind of containers and media formats are embedded in the file and extract the useful meta information for you. Here's the basic look of it when I load the Joker.avi file -


You can change to tree view to read more details information(I prefer this) -


Of course the most useful feature for end user should be the "mouse click" where you can fetch the correct codecs to solve the problem of playing media file.

I already told you I advocate Open Source Softwares!

Enjoy ;]

Friday, August 17, 2007

The Best Friend

If you are hired to design and deploy the whole security infrastructure, who you prefer to refer or consult?

The answer is pretty straightforward - System & Network Administrator

If you are living with your alter ego and ignore the role of them, you are definitely the wrong person for the job. In order to roll out the whole security infrastructure plan and execute them correctly, we must be humble and study the existing structure in all aspects from them, you may say some of companies(usually Multi National Company) have very well written documentation but that's all from the hard works of them as well.

Most of the people who work in information security field only concentrating on developing their tech skill set, however sometimes we really need to learn how to build effective relationship and communication with people we are working with.

Cheers ;]

Tuesday, August 14, 2007

Gmail Verification

Login to my google mail account today, and I read this(replace my email to my email @ gmail.com) -
Delivered-To: my email @ gmail.com
Received: by 10.143.3.9 with SMTP id f9cs301689wfi;
Sun, 12 Aug 2007 23:42:07 -0700 (PDT)
Received: by 10.140.201.1 with SMTP id y1mr2421909rvf.1186987296602;
Sun, 12 Aug 2007 23:41:36 -0700 (PDT)
Received: by 10.141.40.8 with HTTP; Sun, 12 Aug 2007 23:41:36 -0700 (PDT)
Message-ID:
Date: Mon, 13 Aug 2007 08:41:36 +0200
From: "Gmail Team"
Subject: Gmail Account Alert ( Verify Your Account Details)
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_2617_8076328.1186987296570"

------=_Part_2617_8076328.1186987296570
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

G MAI L BETA


* VERIFY YOUR FREE G MAI L ACCOUNT NOW !!! *
*
Dear ****G ma il Account Owner,*
This message is from Gmail messaging center to all Gmail free account
owners and premium account owners. We are currently upgrading our data base
and e-mail account center. We are deleting all unused Gmail account to
create more space for new accounts.

*To prevent your account from closing you will have to update it below
so that we will know that it's a present used account.*

* CONFIRM YOUR IDENTITY BELOW

- Gma il! ID : ..........
- Password : ...........
- Date of Birth : ......
- Country or Territory : ...........

Enter the letter from the Security Image :
........ 859304
*
** **
** * * * ** Warning!!! Account owner that refuses to update his or her
account within Seven days of receiving this warning will lose his or her
account permanently. *
**
***Thank you for using Gmail* *! *
*Warning Code:VX2G99AAJ*
Thanks,
The Gmail Team
G MAI L BETA
Interesting isn't it? Look at the puzzling gmail word. I think I need to update this or else my email will be deactivated -
Warning!!!   Account owner that refuses to update his or her
account within Seven days of receiving this warning will lose his or her
account permanently.
Thanks to mail.service291@googlemail.com for sending this notification.

Cheers ;]

Monday, August 13, 2007

Defensive Security: Beyond NSM

I was with the Offensive Security Cloud in the VNSEC Conference, this is the first security conference ever in Vietnam and overall it is good with some of the familiar faces we have seen in HITB. I don't plan to write anything about the security conference as you can find the event write up here. Overall I enjoy the Vietnam trip and may pay for second visit.

I had spent a lot of times studying Defcon presentation slides, and I have feeling of this -

- You will never be the expert in certain subject, unless you don't see "Time" as a factor. Every single subject requires deep interest and continuous efforts to reach "expert" level.

- There are too many vectors that leads to successful attacks, we can't just count on bugs in the software itself, and even if you are, and assuming you are hiring pentester to hunt for the bugs in the software, he or she can find bug A, but he or she may miss bug B(different skill level or just miss it, code auditing is not easy task especially in complex software). Other problem such as human errors, this is not only happening for the social engineering and carelessness part that leads to information leaking, misconfiguration of network assets that leads to compromise should be counted because you are hiring wrong people to do the job.

- Attack and exploit based tools are geared towards automation now to speed up the process of hacking and vulnerabilities discovery. Cracking is possible now with better hardware(fast processors and chunks and chunks of memories), imagine the cyber crime activities that supported and backup by evil organizations.

- Application based exploitation becomes more and more popular. The exploitation techniques that discovered by attackers getting more and more unpredictable and advance. When I say application, it is no longer server side applications(eg. network services) but user side applications too such as browser, flash player and so forth.

- New technology is not always good, look at Voip, NAC, Web 2.0 and IPv6. Don't believe in "HYPE"! Learning from past experience is a need when building new technology but this is not the case.

For the moment it is pretty hard to form a well-defined defence because things are getting more complicated. But I would love to point out few open source applications which can be utilized to form my idea.

Application Level Protection & Monitoring - Why, because front end application is easy target and not well protected, and most of the hackers always go for the easiest route. Currently we hardly see much development on application level protection and monitoring yet, but that doesn't mean they doesn't exist -

- http://en.opensuse.org/Apparmor

- http://www.modsecurity.org/

Network Assets Profiling - Whatever connected to the network must be profiled and stored in the centralized location, of course this can be done almost passively with something like PADS, but I'm looking at something more advanced, such as -

- http://www.ocsinventory-ng.org/

Network Security Metrics - There's no complete standard for this yet as I don't think network security reaches mature stage yet. But really, we can't avoid this anymore if we are talking about Critical Network Security Infrastructure. Of course I don't see any complete tool for this but look at this -

- http://www.ossim.net/

Logs ..... - I'm not talking about tree but record. Record must be in Human Readable Form, realtime, understandable and provides advance mining functions. I think OSSEC has done a good job -

- http://www.ossec.net/

To counter fast pace emerging threats, I would love to see defensive systems to be built with the ideas below -

- Network intelligence collection, such as baselining of network assets and network traffics. This is the important lead to identify abnormal and malicious activities abruptly.

- Full automation is bullshit, human intelligence must present. The system must require certain level of automation and certain level of examination as well. Why automation, automation can increase time effectiveness and productivities on behalf of analyzt. Why we need to examine it? Because we won't be any good as the expert in the subject when dealing in certain type of the attacks(usually unknown or new to the analyzt especially when they have never encountered it before). Therefore we need other sources to learn about it. For example snort has the reference for its signature rules.

- Relation to the whole organization, and follow up actions, I don't know how to describe this in proper way yet but it is something I have in mind for my new employer which has to do with reporting, classification and priority.

- Supporting Audit Trails, Incident Response and Forensics Operation.

Of course I can't consider this as proactive methodology but I'm now looking at how it can be applied to critical network infrastructure. Richard has very interesting thought in this one.

We can never hopeless!

Peace ;]

Thursday, August 09, 2007

HeX liveCD: Mirror mirror on the Net

Dr. J has again setup the download mirror for HeX liveCD 1.0 Beta 2. I have forgotten to mention that we have included metasploit for this release as well. Here you can find two US mirrors download -

- Mirror 1
- Mirror 1 MD5

- Mirror 2
- Mirror 2 MD5

Thanks to Dr.J for his kindly offer! Please report if you have any problem with the mirrors.

Enjoy!

Monday, August 06, 2007

HeX liveCD 1.0 Beta 2

Chl4gs_ has integrated BSD installer to HeX liveCD so now we are making it to 1.0 Beta 2, we haven't added any other changes yet except the BSD installer so we encourage everyone to test it extensively. Here's the really simple how-to -

Boot up the LiveCD and "su" to root and type "installer" or "sudo installer" to start the installation. cpdup might take 10-30 minutes depending on you CDROM drive speed.

The only problem is BSD installer ncurses looks a bit weired under X. We still have no solution/workaround to that. However that shouldn't affect the installation process.

You can find the download link below, I will put it up at rawpacket site later.

- HeX liveCD 1.0 Beta 2 ISO Image

- MD5 Checksum

- SHA256 Checksum

Enjoy ;]

Wednesday, August 01, 2007

Books

Why do you read books? Some people read books because it is their hobby, some read entertaining books such as novel or science fiction, some prefer philosophy or politic related books, as there are way many too books out there, everyone just choose the topic of their interest.

Before I started my computing journey(pre age 23), I read a lot of books that related to economy and pyschology which is enlightening, I learned how to manage EQ, relationship and partnership management and the trend of macro economy.

But now, most of my times are spent on computing books, technical papers, mailing lists and RSS feeds to keep myself cutting edge about the evolution of technology. Working in InfoSec field requires continuous strength to improve myself. I think reading books may speed up the learning process of certain topics or subjects that I'm not familiar with as I'm learning from the experts in the field.

Anyway here are the books I will buy -

- Computer Networks: Internet Protocols in Action

- Snort Intrusion Detection and Prevention Toolkit

-
Security Metrics: Replacing Fear, Uncertainty, and Doubt

- Virtual Honeypots: From Botnet Tracking to Intrusion Detection

More books to come but all of these are what I need for the moment.
Enjoy ;]

Ourmon: Detecting P2P Activities In LAN

One of the beautiful thing about ourmon is it does generate network errors graphs, and usually we know p2p uses non-privilege dynamic ports(>1024) for both file uploads and downloads, and when one of the host running p2p client stop running, other p2p clients in external networks(internet) will still probe to it hardly and that will generate noticeable burst, hence if you see lots of triggers on port unreachable flow, that maybe some kind of ongoing p2p traffics.


However ourmon monitor placement is important, I suggest it should be deployed between Local Area Networks and the Firewall that protecting the network.

Cheers ;]

Tuesday, July 31, 2007

Best for Last .....

Today is a busy day as I'm packing everything and finally moving out from the Penang Island. I'm glad to meet my former colleague who just back from US, and playing games with my friends. I can't consider it as relaxing day for me as I'm rushing here and there to finish all the stuffs possible. I will be heading to Kuala Lumpur tomorrow and taking flight to this event -

http://conf.vnsecurity.net/

Guess what, with this post I'm hitting 35 in a month which means more than a blog post in a day. Insane!!!!!

Peace ;]

HeX liveCD: CD Label

Our HeX liveCD great graphic designer - Vickson has sent me the CD label that he has just redesigned and asking my opinion about it. This is almost the final version of the CD label for HeX liveCD version 1.0 after some discussion and modification ongoing between me and some of team members, I would like to put it up here and sharing with everyone. To protect his artworks, I have told him to register under Creative Common License.For better view, click on the picture to zoom in, let us know what do you think about it?

Awesome works, Vickson!

Enjoy (;])

Sunday, July 29, 2007

Bro: It's not just NIDS

Thanks to Bro team which has published the workshop materials online so that we can learn more about Bro internal. While I have been using Bro in Operational Network, I haven't actually learned about Bro Scripting Language. Therefore I think those materials will be ice-breaker for me because it really makes thing clear and I plan to finish all the exercises to further sharpen my skills in operating Bro.

http://www.bro-ids.org/bro-workshop-2007/agenda.html


There are few things I have noted in the materials provided, in the slide 6 of Bro Overview -

Much of the system is policy-neutral
- i.e. no presumption of "good" or "bad"

This is exactly similar to NSM concept where we don't assume any alert events provided by IDS as intrusion or extrusion without further confirmation and verification with the subsystem given.

From the slide 4 of Bro Conclusion and Outlook -

The Bro Cluster
- A set of PCs running Bro jointly analyze large network streams
- A central manager system

And 5th slide -

Multi-Core Support
- Going to turn Bro into multi-threaded application
- Will fully exploit the multi-core potential of modern CPUs

I would love to see all of them integrated to Bro in near future as it will benefit us with both low or high end hardwares.

Again from the slide 4 of Bro Conclusion and Outlook -

New Functionality
- Time Machine Interface
- Netflow Analyzer

I have written the setup of time machine here previously and time machine will soon be integrated with Bro to provide full content data via its indexing system. If you want to learn more about it, check out its main site -

http://www.net.t-labs.tu-berlin.de/research/tm/

With Netflow Analyzer added that is plus point as most of the companies having Cisco router deployed in their network, or you can use fprobe if running *nixes network appliance.

Think again about the approach, is Bro a Network Intrusion Detection System?

Again I have to emphasize, NSM analyzt is da future!

Peace ;]

Friday, July 27, 2007

Malaysia Honeynet Community

Me and Mel have discussed about running non-profit honeynet group to research on internet threats and attacks trend for a while, and finally Mel launched the website about the group after long delay. We are currently running low level honeypots to capture malwares and plan to deploy high level honeynet once we have found the sponsors because more costs intact in order to operate them.

We welcome any contributors, here's our list -

http://my-honeynet.org/index.php?/archives/Contributions-to-the-Malaysia-Honeynet-Project.html

Current members in the group -

http://my-honeynet.org/index.php?/archives/Malaysia-Honeynet-Project-Members.html


And that includes raWPacket team members too.

Of course if you are interested in the project(researches, contributions, sponsorships), feel free to email us, you can either contact me or Mel.

mel at hackinthebox dot org

geek00l at gmail dot com

We hope this can be the long term R & D with the supports of various parties, and the outcome value is definitely worthwhile.

Cheers ;]

Thursday, July 26, 2007

Bro-NIDS: Pairing with Ourmon

Beside Snort, Bro-NIDS is another one of the most powerful open source NIDS that developed by Vern Paxson and his team with community supports.

I figure out the lacking part of Bro, the detail explanation of analysis flow definitely. So what's the problem with that? Let's take a look at its logs -

shell>ls -la logs
-rw-r--r-- 1 bro wheel 196714 Jul 26 12:17 alarm.hostname.07-07-23_00.00.01
-rw-r--r-- 1 bro wheel 406878 Jul 23 17:33 alarm.hostname.07-07-23_00.00.01-07-07-23
-rw-r--r-- 1 bro wheel 142239 Jul 24 21:39 alarm.hostname.07-07-23_00.00.01-07-07-24
-rw-r--r-- 1 bro wheel 585678 Jul 25 22:39 alarm.hostname.07-07-23_00.00.01-07-07-25
-rw-r--r-- 1 bro wheel 258391385 Jul 23 00:00 conn.hostname.07-07-18_15.25.41-07-07-22
-rw-r--r-- 1 bro wheel 130996 Jul 23 00:00 conn.hostname.07-07-18_15.25.41-07-07-23
-rw-r--r-- 1 bro wheel 35500032 Jul 26 12:17 conn.hostname.07-07-23
-rw-r--r-- 1 bro wheel 100144755 Jul 24 00:00 conn.hostname.07-07-23_00.00.01-07-07-23
-rw-r--r-- 1 bro wheel 76778138 Jul 25 00:00 conn.hostname.07-07-23_00.00.01-07-07-24
-rw-r--r-- 1 bro wheel 83297924 Jul 26 00:00 conn.hostname.07-07-23_00.00.01-07-07-25
-rw-r--r-- 1 bro wheel 856239 Jul 23 00:00 ftp.hostname.07-07-18_15.25.41-07-07-22
-rw-r--r-- 1 bro wheel 603 Jul 23 00:00 ftp.hostname.07-07-18_15.25.41-07-07-23
-rw-r--r-- 1 bro wheel 765952 Jul 26 12:17 ftp.hostname.07-07-23
-rw-r--r-- 1 bro wheel 2371772 Jul 24 00:00 ftp.hostname.07-07-23_00.00.01-07-07-23
-rw-r--r-- 1 bro wheel 2529580 Jul 25 00:00 ftp.hostname.07-07-23_00.00.01-07-07-24
-rw-r--r-- 1 bro wheel 1646301 Jul 26 00:00 ftp.hostname.07-07-23_00.00.01-07-07-25
-rw-r--r-- 1 bro wheel 179461957 Jul 23 00:00 http.hostname.07-07-18_15.25.41-07-07-22
-rw-r--r-- 1 bro wheel 47554 Jul 23 00:00 http.hostname.07-07-18_15.25.41-07-07-23
-rw-r--r-- 1 bro wheel 77824 Jul 26 11:49 http.hostname.07-07-23_00.00.01
-rw-r--r-- 1 bro wheel 642726 Jul 24 00:00 http.hostname.07-07-23_00.00.01-07-07-23
-rw-r--r-- 1 bro wheel 627456 Jul 25 00:00 http.hostname.07-07-23_00.00.01-07-07-24
-rw-r--r-- 1 bro wheel 202697 Jul 26 00:00 http.hostname.07-07-23_00.00.01-07-07-25
Output truncated .....

Ouch! There are so many logs here and how should I start? Just like sguil where you must speak mysql pretty well to perform better analysis, you must speak shell scripting enough to perform smooth analysis flow on Bro logs. The power of Bro lies in it's protocol anomaly detection and therefore having different protocols logging in different files(prefix with its protocol) do make things clear. However you can't consider its logs as alert and indicator of malicious event(different approach comparing with snort) even though alarm, notice and weird logs do give some clues about suspected network event. Another problem should be when the file grows larger in a day, it is pretty hard to crawl the file to check on malicious event. For example look at one of the file -

shell>du -h \
conn.hostname.07-07-18_15.25.41-07-07-19_00.00.00

510M conn.hostname.07-07-18_15.25.41-07-07-19_00.00.00

It could be deep pain if you want to read them, don't you? Therefore it becomes unclear when one first learn about Bro and want to proceed to examine the logs but don't know where to start. Here I will give you some insight of how I perform analysis using Bro but I need another powerful tool to assist me, I vote ourmon!

Bro only generates network statistical data in its daily report therefore we don't have real time view of current network statistic, therefore ourmon plays the main role for you to access to the network statistical data via its well crafted graph. But where's our flow data to understand each connection? Bro does store connections flow data, all its connections flow stored in the file with the prefix of conn.*. The only data we don't have is full content(pcap), you can either use tcpdump, daemonlogger or Bro alone to do the job for you however I would like to ignore this part for the moment because generally you can have idea of each connections because most of the widely used and popular protocols such as http, smtp and so forth are decoded and stored in its corresponding file such as http.*, smtp.* and so forth, other protocols that are not decoded(provided no decoder for it) still can be seen in conn.* to understand its nature. Here's the example when you find unconfirmed or suspected malicious activity in certain time frame via notice log -

notice.sguard.07-07-23_00.00.01-07-07-25_00.00.00:t=1185314110.984062 no=ProtocolFound na=NOTICE_FILE sa=1.2.3.4 sp=33071/tcp da=10.0.0.1 dp=443/tcp num=14 msg=1.2.3.4/33071\ >\ 10.0.0.1/https\ FlashCom\ (via\ HTTP)\ on\ port\ 443/tcp sub=FlashCom\ (via\ HTTP) tag=@2113

Interesting connection from 1.2.3.4 to 10.0.0.1, you have the tag number @2113 for this connection flow, now we can grep the flow from connections log -

shell>egrep '@2113' \
conn.sguard.07-07-23_00.00.01-07-07-25_00.00.00 | cf

Jul 25 05:55:05 122.708121 1.2.3.4 10.0.0.1 https 33071 443 tcp 13384 12298 RSTR L %332 @2113 HTTP

You may see I pipe to cf, cf is small utility to translate unix epoch time format to human readable form, therefore it's more easy for you to read and correlate the event based on time frame. The format of connections flow should be read in this way -

| Start | Duration | Local IP | Remote IP | Service | Local PORT | Remote PORT | Protocol | Orig Bytes Sent | Res Bytes Sent | State | Flags | Tag |

The only part which is not clear is the connection state - RSTR, you can check out here -

RSTR Established, responder aborted.

While L means connection is initiated locally.

There are two tags, %332 and @2113, so now we know about the connection flows which is http, we should search the tag %332 in http log -

shell>egrep '%332' \
http.hostname.07-07-23_00.00.01-07-07-25_00.00.00
1185314105.742038 %332 (200 "OK" [10])
1185314107.122409 %332 POST /idle/315397832/2 (200 "OK" [67] ic.flashcom.peopleim.userplane.com:443)
1185314107.750136 %332 POST /send/315397832/4 (200 "OK" [1260] ic.flashcom.peopleim.userplane.com:443)
Output truncated .....

Here you go, you are now having full understanding of the network connections(all those http requests with same tag number), this is kind of batch analysis to identify network events. I don't explain how I make use of ourmon here or maybe I will make it for future post. Ourmon generates the graph by plotting such as TCP flags ratio, network errors, irc stats and some other graphs that you can correlate with the data provided by Bro to fully understand your network and readily countering any network threats.

Below I demonstrate some of the tips I use before I examine Bro logs, it's good catch if we want to read the separate kind of logs in timely manner, for example I want to check out the alarm log only, I just execute -

shell>ls -lac alarm*
-rw-r--r-- 1 bro wheel 0 Jul 23 00:00 alarm.hostname.07-07-18_15.25.41
-rw-r--r-- 1 bro wheel 3999 Jul 19 00:00 alarm.hostname.07-07-18_15.25.41-07-07-18_15.25.50
-rw-r--r-- 1 bro wheel 4515 Jul 20 00:00 alarm.hostname.07-07-18_15.25.41-07-07-19_00.00.00
-rw-r--r-- 1 bro wheel 4525 Jul 21 00:00 alarm.hostname.07-07-18_15.25.41-07-07-20_00.00.00
-rw-r--r-- 1 bro wheel 1551 Jul 22 00:00 alarm.hostname.07-07-18_15.25.41-07-07-21_00.00.00
-rw-r--r-- 1 bro wheel 1363 Jul 23 00:00 alarm.hostname.07-07-18_15.25.41-07-07-22_00.00.00
-rw-r--r-- 1 bro wheel 0 Jul 23 00:00 alarm.hostname.07-07-18_15.25.41-07-07-23_00.00.00
-rw-r--r-- 1 bro wheel 206776 Jul 26 13:50 alarm.hostname.07-07-23_00.00.01
-rw-r--r-- 1 bro wheel 406878 Jul 24 00:00 alarm.hostname.07-07-23_00.00.01-07-07-23_00.00.04
-rw-r--r-- 1 bro wheel 142239 Jul 25 00:00 alarm.hostname.07-07-23_00.00.01-07-07-24_00.00.00
-rw-r--r-- 1 bro wheel 585678 Jul 26 00:00 alarm.hostname.07-07-23_00.00.01-07-07-25_00.00.00


I use ls with -c switch so that I can sort them by file creation time, that way making us easy to check out any daily log we want by date especially searching for connections tag. In the alarm log, you may see the time stamp of every network event started with t=, that render cf tool unable to convert the time stamp from unix epoch time to human readable form correctly -

shell>head -2 alarm.hostname.07-07-23_00.00.01

t=1185379996.560573 no=ProtocolViolation na=NOTICE_ALARM_ALWAYS sa=1.2.3.4 sp=33762/tcp da=2.3.4.5 dp=25/tcp msg=1.2.3.4/33762\ >\ 2.3.4.5/smtp\ analyzer\ SMTP\ disabled\ due\ to\ protocol\ violation sub=reply\ code\ out\ of\ range tag=@4363
t=1185380009.544433 no=PortScan na=NOTICE_ALARM_ALWAYS sa=1.2.3.4 da=2.3.4.5 dp=443/tcp msg=64.86.142.65\ has\ scanned\ 50\ ports\ of\ 10.14.42.154 tag=@4364


You can use sed to remedy this issue -

shell>sed 's/^t=//g' alarm.hostname.07-07-23_00.00.01 | cf

Just discard t= and parse it to cf. Bingo! Piping to less command is also great because you can perform certain function such as search by regular expression, easy log navigation and so forth(vi style functions).

Both Bro and Ourmon provide you great context for most of anomaly network events, I have spent my time to figure out the better way to utilize them and hopefully this help anyone who uses them because I did face difficulty when first dealing with Bro that it seems to require more man power to examine them. One more tip, remember to turn on dynamic protocol detection(DPD) when dealing with stealthy attackers.

Some of you may wonder why not examining the application protocol log(http.*, ftp.*) and instead of digging the connections log first, the answer is pretty simple, if you examine the connections log and found no data transfers(Orig Bytes Sent | Res Bytes Sent), it's pointless to look at the application protocol log and may indicate some kind of network probing or scanning activities. However this doesn't apply to every condition and sometimes you need to tinker of how to perform analysis effectively. I draw the simple diagram for better illustration -


I use color depth to indicate the understanding level of the network event. You may see the color in the entity becomes lighter and lighter from left to right when you have better understanding of network event through out the structural analysis process.

What's the lacking in Bro? Clearly enough that it really needs better way to organize and manage its logs and perhaps OSSEC can fill the gaps with additional log parser. Using this mechanism with the deployment of Snort NIDS, I'm pretty confirmed that you can identify known and unknown(0 days) network attacks.

Enjoy (;])

Monday, July 23, 2007

High Quality Spam, please .....

As usual I login to my webmail after I woke up in the morning, checking the email and there's one with zip attachment, sounds malicious that it may contain executable file? Here's how the email looks like, I discard the sender part as it can be any originator -


I like the Note message, it looks so harmless. Anyway I just unzip it and it appears to be a pdf file -

shell>file 2685.pdf
2685.pdf: PDF document, version 1.2

shell>hexdump -C 2685.pdf
255044462d312e32 200d0a312030206f |%PDF-1.2 ..1 0 o|
626a0d0a3c3c0d0a 2f54797065202f43 |bj..<<../Type /C|
6174616c6f670d0a 2f50616765732033 |atalog../Pages 3|
203020520d0a2f50 6167654d6f646520 | 0 R../PageMode |
2f5573654e6f6e65 0d0a2f506167654c |/UseNone../PageL|

Output truncated .....

Therefore I use xpdf to open the file and here's how it looks like .....


You can click on the image to zoom in, but the image quality is so bad until you can't really read, I know you spammer want it to be small size(68K) only but please deliver with better quality image so that I can read or else how I gonna invest?

I don't see much of small gif file from spamming activities lately, maybe the trend is changing again .....

Enjoy ;]

Saturday, July 21, 2007

400th Post: The New Milestone

This 400th blog post means a lot to me because I have never thought of myself able to blog that much continuously but I really make it. On the other hand, today it's my last half day(Saturday) working in Exabytes Network and I'm officially resigned starting from 1200 21/07/2007. Without me noticing, I have already worked in this company for 2 years, time really flies .....

Thanks to Mr. Chan who has given me opportunity to join the company, I greatly thanks to everyone who has been working closely with me especially Andy, Jackie, Albert and Guan who has been very supportive(sorry to disclose your name and don't get mad if your name is not listed :P). At the same time, I also greet the whole technical team which dedicated a lot of times and efforts in maintaining the server farms, you guys are just awesome!

I have been involved in many network security operations such as incident response, vulnerability assessment, network forensics and so forth. This is greatly improving my technical knowledge to face new challenge in my next career.

It is undoubtedly that I have mix feeling because I have to leave Pulau Penang and moving to somewhere soon, I must say I love this island very much, great people and delicious foods here. Hopefully the new place won't be disappointing me.

Seriously I don't know what to say, I'm rarely expressing my real feeling in this technical blog, anyway -

good bye to all my friends here and good luck to ya all!!!!! My memory is larger than RAM so I will carry them with me no matter where I go .....

Peace ;]

P/S: Stop being geek, you fool ;-)

HeX liveCD: Ntop

We have included Ntop in our liveCD and here's the simple how to use it to perform offline processing on pcap data, it's another useful to generate network statistic besides tshark and tcpdstat. I always use honeynet-scan18.pcap as example as it is publically available here. Credit to honeypot team for making the trace available.

shell>sudo ntop -u analyzt -M -n \ -f ./honeynet-scan18.pcap -m 172.16.1.0/24 \ -O ntop-output/ -w 192.168.0.50:3000 -W 0 -g -c -a -q

shell>sockstat -4 | grep ntop
analyzt ntop 3054 12 tcp4 *:3000 *:*

Now we have access to port 3000, just point our browser to it -

http://192.168.0.50:3000

Major Protocols Distribution

Application Protocols Distribution

Per Host Information

The down side about ntop is that it will purge the old data therefore you only view the latest data displayed, if anyone of you(experience Ntop user) know how to disable it, please share it with me because I would prefer to use it to process the pcap offline.

Enjoy (;])

Blogmania

I just realized that I have turned planet.foss.org.my to geek00l.blogspot.com except that the white background doesn't turn into black. Thanks to my blogmania!!!!! Kindly checkout the screenshots .....



It's temporarily renamed to planet geek00l .....

Cheers ;]

HeX liveCD: Chaosreader

I have included chaosreader in the HeXtra so that you can use with HeX liveCD, you can use chaosreader to parse the pcap data and it will generate the html report to ease the process of analysis thus you can quickly learn about all the network activities. Just follow the screenshot below -


Once the process is done, you will find index.html and all the files extracted in the rp-chaosreader directory, just open index.html using your internet browser and you will come to the screen below -


You can even download the compressed file(tar.gz) from the session or examine the raw data -


If you would like to have high level understanding of the network data, chaosreader is definitely a good choice.

Enjoy ;]

Malaysia: HITB SEC CONF 2007


Hack In The Box Security Conference is around the corner, if you are interested in attending one of the most interesting security conference on earth and meeting the hackers around the world, feel free to check it out here -

http://conference.hitb.org/hitbsecconf2007kl/


Enjoy ;]

Fl0p - Passive L7 Flow Fingerprinter

Checking back my old posts and I just figured out I have this post in my saved draft and never be posted online. It's all about identifying the flow by fingerprinting the application bytes in packets exchange of the connection stream. Thanks to Michal Zalewski who writes this tool called Fl0p, from the description -

fl0p is a passive L7 flow fingerprinter that examines TCP/UDP/ICMP packet sequences, can peek into cryptographic tunnels, can tell human beings and robots apart, and performs a couple of other infosec-related tricks.

If you are on FreeBSD, you can just install it via package/port system, but for gentoo users, you will have to install via source -

shell>wget http://lcamtuf.coredump.cx/soft/fl0p-devel.tgz

shell>tar xvzf fl0p-devel.tgz

shell>cd fl0p

shell>make

./Build all
Your system type is: FreeBSD

Please help with p0f 2:
http://lcamtuf.coredump.cx/p0f-help/

GNU make not found; failing back to regular (BSD?) make.
gcc -g -ggdb -Wall -DUSE_BPF=\"net/bpf.h\" -I/usr/include/pcap -I/usr/local/include/pcap -I/usr/local/include -o fl0p fl0p.c crc32.c -lpcap
strip fl0p 2>/dev/null || true

Running fl0p -

shell>./fl0p -h

Usage: ./fl0p [ -f file ] [ -i device ] [ -s file ] [ -o file ]
[ -u user ] [ -e ms ] [ -T ms ] [ -FUKrqvpdtl ] [ 'filter rule' ]
-f file - read fingerprints from file
-i device - listen on this device
-s file - read packets from tcpdump snapshot
-o file - write to this logfile (implies -t)
-u user - chroot and setuid to this user
-e ms - pcap capture timeout in milliseconds (1)
-q ms - packet timing threshold in milliseconds (400)
-F - disable fuzzy matching on all signatures
-U - display fingerprints for unidentified streams
-K - do not display known signatures (implies -U)
-r - resolve host names (not recommended)
-q - be quiet - no banner
-v - enable support for 802.1Q VLAN frames
-p - switch card to promiscuous mode
-d - daemon mode (fork into background)
-t - add timestamps to every entry
-l - output concise 1-line output

'Filter rule' is an optional pcap-style BPF expression (man tcpdump).

To automatically generate signatures for certain traffics, I decided to run the commands below -

shell>./fl0p -i sk0 -o /nsm/fl0p-logs/smtp-gather -t -l -U -d 'port 25'

shell>./fl0p -i sk0 -o /nsm/fl0p-logs/http-gather -t -l -U -d 'port 80'

shell>./fl0p -i sk0 -o /nsm/fl0p-logs/ssh-gather -t -l -U -d 'port 22'

I'm currently having a lot of signatures collected but having no time to examine about them yet, guess I need some spare time for that.

Argus: Development Testing

I think many of you have heard about argus from my previous blog post. Here's how I maintained my argus installation in my testing environment on FreeBSD platform.

Installing argus server -

shell>wget ftp://qosient.com/dev/argus-3.0/argus-3.0.0.tar.gz

shell>tar xvzf argus-3.0.0.tar.gz

shell>cd argus-3.0.0

shell>./configure --prefix=/usr/local/stow/argus3

shell>make && make install

shell>mv /usr/local/stow/argus3/bin/argusbug /usr/local/stow/argus3/

Installing argus client -

shell>wget ftp://qosient.com/dev/argus-3.0/argus-clients-3.0.0.rc.45.tar.gz

shell>tar xvzf argus-clients-3.0.0.rc.45.tar.gz

shell>cd argus-clients-3.0.0.rc.45

shell>./configure --prefix=/usr/local/stow/argusc-3rc45

shell>make && make install

I have mentioned about the usage of stow previously, you can easily handle source installation with it.

shell>cd /usr/local/stow

shell>stow argus3

shell>stow argusc-3rc45

If there's new version of argus released, you can just unstow and remove all the argus file from /usr/local/stow, then install the new version using the same steps above and you are done. If you want to try out argus 3, just download HeXtra here and load it to HeX liveCD will do.

Friday, July 20, 2007

I'm reading .....

Phrack is alive -

http://www.phrack.org/issues.html?issue=64


Faster PF implementation -

http://www.openbsd.org/papers/cuug2007/

RFC - Real Time Streaming Protocol

http://www.ietf.org/rfc/rfc2326.txt

Fast Flux Service Network

http://www.honeynet.org/papers/ff/index.html

Network Forensics

Link 1

Link 2

I plan to relearn DNS protocol because I found it interesting and may pick up RFC and reread again if I have time. Anyway I'm still reading .....

Enjoy ;]

What is reality?

I have heard many people told me that they have Firewall and IPS in place therefore they don't need monitoring, but can't you think logically what is reality? The simple fact -

Humans > System created by Humans

So you want to argue again, or you are actually humiliating yourself! And if you ask me what's the best IDS again, I will beat your ass and say -

Humans

Don't get mad, this is reality .....

Peace (;])

Network Based Forensics?

Talking about Network Based Forensics, are you going to perform batch analysis on each files that you obtain via network data through network forensics mechanism?

Even if you able to examine each file transfers over network, can you really dig into the details of every single code? Remember malicious contents can be hidden inside picture file(stenography), simple backdoor can be injected into the normal application and so forth, and how do you able to examine every single binaries?

Do you have enough resources to perform this kind of operation?

How do you examine encrypted connections, any trail?

Therefore it still falls back to the NSM concept. I have seen expensive commercial system that can extract all the files and categorize them reliably, however I swear I don't want to examine those files one by one, it's too costly and exhaustive. I do agree those data can be stored as historical purpose but doing data mining on them requires better mechanism, and if you know Network Security Monitoring well, I think you will get what I mean as better mechanism.

NSM allows you to research on different area if you ask me, you can study on Network Statistical Analysis, Network Flow analysis, IDS log analysis or even data mining on raw network data(usually pcap). So you say you want to learn Network Based Forensics, then you should again rethink about NSM!!!!!

In fact, we don't need IDS analyzt but NSM analyzt.

Cheers ;]

KDE Applications List

I have been using a lot of KDE based(QT) applications while I'm still using Fluxbox as my window manager. I find them pretty stable and works out of the box and here's the list -

- Koffice

- Kivio

- Ktorrent

- Kopete

- Amarok

I don't know what else is good but they all work pretty well. If you have any QT based application that you think is great, just share it with me. Thanks!

Enjoy ;]

HeX liveCD: Using tshark

We have included Wireshark in our liveCD, therefore it is pretty straight forward if you want to generate network statistic using wireshark command line tool - tshark(or previously called tethereal), just checkout the screenshot below -


There you will have protocol hierarchy displayed, or you can also use tcpdstat as well to compliment the output.

Cheers ;]

Smart NTFS-3G

Again I need to use my large disk and I try to mount it once I have connected it, but this time it has minor issue -

shell>sudo ntfs-3g /dev/sdb1 ~/i-Mnt

$LogFile indicates unclean shutdown (0, 1)
Failed to mount '/dev/sdb1': Operation not supported
Mount is denied because NTFS is marked to be in use. Choose one action:

Choice 1: If you have Windows then disconnect the external devices by clicking on the 'Safely Remove Hardware' icon in the Windows taskbar then shutdown Windows cleanly.

Choice 2: If you don't have Windows then you can use the 'force' option for your own responsibility. For example type on the command line:

mount -t ntfs-3g /dev/sdb1 /home/geek00l/i-Mnt -o force

Or add the option to the relevant row in the /etc/fstab file:

/dev/sdb1 /home/geek00l/i-Mnt ntfs-3g defaults,force 0 0

Smart enough, remind me that I have just passed the disk to my friend and he has actually disconnected the disk uncleanly. Therefore I just need to follow the hint given -

shell>sudo mount -t ntfs-3g /dev/sdb1 ~/i-Mnt -o force
$LogFile indicates unclean shutdown (0, 1)
WARNING: Forced mount, reset $LogFile.
shell>cd ~/i-Mnt shell>ls -la
total 20
drwxrwxrwx 1 root root 4096 Jun 11 15:16 .
drwxr-xr-x 86 geek00l geek00l 12288 Jun 11 16:07 ..
drwxrwxrwx 1 root root 4096 Jun 11 15:40 System Volume Information

It's all working now!

Enjoy ;]

OpenBSD: Wireshark Port

Thanks to Nikns again for sending me this information and I think it would be great to share with everyone especially OpenBSD users who need Wireshark for life.

In 5th of July, new wireshark version 0.99.6 is released. Many of us, who uses OpenBSD has need to use wireshark. However, ethereal (now wireshark), has been removed from OpenBSD ports tree long ago due to the bad security record where many vulnerabilities have been discovered in dissectors code.

Nikns has created unofficial OpenBSD port for Wireshark where you can find here -

http://secure.lv/~nikns/stuff/ports/wireshark-0.99.6_4.1.tar

Some of details about the port -

From pkg/DESCR:
SECURITY MEASURES:
If run with root privileges, wireshark, tshark and dumpcap will drop privileges to unprivileged user "_wireshark" after opening live capture device or dump file.

So, like OpenBSD's tcpdump written previously here...

http://geek00l.blogspot.com/2007/04/tcpdump-privilege-dropping-passive-os.html

If run as root it drops privileges after opening capture device or dump file. This is why it is recommended to start it as root first. The disadvantage for this privilege dropping is that once privileges are dropped wireshark must be restarted to start now capture...

For me I think it's great to have Wireshark on OpenBSD not for the purpose of network sniffing/logging instead of using it for network analysis, therefore thanks to Nikns putting the effort in maintaining the unofficial port himself.

Enjoy ;]

Gentoo: Mounting Large Disk via USB

I got 2 Western Digital 500 Gigs hard drives that formatted as NTFS file system at hand but not able to mount it, I choose to recompile my kernel as I have been using 2.6.19 for a while and it's time to move to 2.6.20. I read thread from the forum that I have to disable this feature in kernel in order to get it mounted properly -

CONFIG_USB_EHCI_HCD=m

I choosed to compile it as module so that I may be able to enable it if I need it. Then once I have finished compiling my kernel and reboot, I mounted the hard drive to my external enclusure, connect it to the laptop via usb and switched on the power , I can view the information via dmesg -

Jun 21 11:14:42 trinity sdb: Write Protect is off
Jun 21 11:14:42 trinity sdb: Mode Sense: 23 00 00 00
Jun 21 11:14:42 trinity sdb: assuming drive cache: write through
Jun 21 11:14:42 trinity sdb:<7>usb-storage: queuecommand called
Jun 21 11:14:42 trinity usb-storage: *** thread awakened.
Jun 21 11:14:42 trinity usb-storage: Command READ_10 (10 bytes)
Jun 21 11:14:42 trinity usb-storage: 28 00 00 00 00 00 00 00 08 00
Jun 21 11:14:42 trinity usb-storage: Bulk Command S 0x43425355 T 0xd L 4096 F 12
8 Trg 0 LUN 0 CL 10
Jun 21 11:14:42 trinity usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
Jun 21 11:14:42 trinity usb-storage: Status code 0; transferred 31/31
Jun 21 11:14:42 trinity usb-storage: -- transfer complete
Jun 21 11:14:42 trinity usb-storage: Bulk command transfer result=0
Jun 21 11:14:42 trinity usb-storage: usb_stor_bulk_transfer_sglist: xfer 4096 by
tes, 1 entries
Jun 21 11:14:42 trinity usb-storage: Status code 0; transferred 4096/4096
Jun 21 11:14:42 trinity usb-storage: -- transfer complete
Jun 21 11:14:42 trinity usb-storage: Bulk data transfer result 0x0
Jun 21 11:14:42 trinity usb-storage: Attempting to get CSW...
Jun 21 11:14:42 trinity usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
Jun 21 11:14:42 trinity usb-storage: Status code 0; transferred 13/13
Jun 21 11:14:42 trinity usb-storage: -- transfer complete
Jun 21 11:14:42 trinity usb-storage: Bulk status result = 0
Jun 21 11:14:42 trinity usb-storage: Bulk Status S 0x53425355 T 0xd R 0 Stat 0x0
Jun 21 11:14:42 trinity usb-storage: scsi cmd done, result=0x0
Jun 21 11:14:42 trinity usb-storage: *** thread sleeping.
Jun 21 11:14:42 trinity sdb1
Jun 21 11:14:42 trinity sd 2:0:0:0: Attached scsi removable disk sdb
....truncated

It is ntfs file system, therefore I mount it with ntfs-3g,

shell>sudo ntfs-3g /dev/sdb1 /mnt

shell>mount
/dev/sdb1 on /mnt type fuseblk (rw,nosuid,nodev,noatime,allow_other,blksize=4096)

I see this message in /var/log/messages -

Jun 21 11:26:49 trinity ntfs-3g[4715]: Mounted /dev/sdb1 (Read-Write, label "Sto
rage1", NTFS 3.1)

shell>df -h
/dev/sdb1 466G 101M 466G 1% /mnt

We all love big storage, don't you?

Cheers ;]

TCPdump: Understanding the Output

Tcpdump is definitely a TOOL for most of network engineers to debug or examine their network pcap data. However not many actually read it with full understanding, let's go back to basic and take a simple look at this tcpdump output -

2007-04-18 20:09:17.334010 IP 192.168.0.24.49971 > 210.171.226.46.21: P 49:54(5) ack 543 win 14
0x0000: 0016 b681 3b0e 000a e435 ea8e 0800 4500 ....;....5....E.
0x0010: 0039 9430 4000 4006 30f4 c0a8 0018 d2ab .9.0@.@.0.......
0x0020: e22e c333 0015 3ed0 d5bd 4304 5fb9 8018 ...3..>...C._...
0x0030: 000e 75c6 0000 0101 080a 0150 492e 6828 ..u........PI.h(
0x0040: 2f7c 5057 440d 0a /|PWD..

I have highlighted the hex number in the most left column, but how can we make use of them when examining the data? Here's the conversation I have with my friend and he said I should blog about it and I think that's not bad idea too since I haven't read anything about it online yet. Our conversation went like this -

(10:19:03) me: u need to make use of the left side hex number too
(10:19:11) me: 0x0000
(10:19:13) me: 0x0010
(10:19:15) me: 0x0020
(10:19:17) me: :)
(10:19:27) friend: and that represents for?
(10:19:38) me: it tells you exactly the start of the byte offset in that row
(10:19:49) me: 0x0000 = starts from 0 byte
(10:19:54) friend: ohhhhhhh
(10:19:58) me: 0x0010 = starts from 16 byte
(10:20:03) me: 16th byte
(10:20:06) me: hehe
(10:20:24) me: 0x0020 = starts from 32nd byte
(10:20:43) me: and that's for whole frame offset instead of per layer/header offset
(10:20:53) me: but it's good indication
(10:21:12) me: remember for all layer, it counts starting from 0 byte offset.
(10:21:20) me: i think i should blog about this
bla bla bla bla ...... truncated

This is definitely better than couting the byte manually especially useful when you have a large size packet, but keep in mind if you want to decode per layer/header, you will have to examine initial header length in IP header and offset/header length in TCP header which I highlighted in the output below -

2007-04-18 20:09:17.334010 IP 192.168.0.24.49971 > 210.171.226.46.21: P 49:54(5) ack 543 win 14
0x0000: 0016 b681 3b0e 000a e435 ea8e 0800 4500 ....;....5....E.
0x0010: 0039 9430 4000 4006 30f4 c0a8 0018 d2ab .9.0@.@.0.......
0x0020: e22e c333 0015 3ed0 d5bd 4304 5fb9 8018 ...3..>...C._...
0x0030: 000e 75c6 0000 0101 080a 0150 492e 6828 ..u........PI.h(
0x0040: 2f7c 5057 440d 0a /|PWD..

2 hex number = 1 byte, 5 x 4 = 20 bytes and here's your IP header -

2007-04-18 20:09:17.334010 IP 192.168.0.24.49971 > 210.171.226.46.21: P 49:54(5) ack 543 win 14
0x0000: 0016 b681 3b0e 000a e435 ea8e 0800 4500 ....;....5....E.
0x0010: 0039 9430 4000 4006 30f4 c0a8 0018 d2ab .9.0@.@.0.......
0x0020: e22e c333 0015 3ed0 d5bd 4304 5fb9 8018 ...3..>...C._...
0x0030: 000e 75c6 0000 0101 080a 0150 492e 6828 ..u........PI.h(
0x0040: 2f7c 5057 440d 0a /|PWD..

Following by the IP header should be your TCP header(Check the 9th byte offset and that's 06), just now you see I have highlighted 8 and that's the length of TCP header - 8 x 4 = 32 bytes

2007-04-18 20:09:17.334010 IP 192.168.0.24.49971 > 210.171.226.46.21: P 49:54(5) ack 543 win 14
0x0000: 0016 b681 3b0e 000a e435 ea8e 0800 4500 ....;....5....E.
0x0010: 0039 9430 4000 4006 30f4 c0a8 0018 d2ab .9.0@.@.0.......
0x0020: e22e c333 0015 3ed0 d5bd 4304 5fb9 8018 ...3..>...C._...
0x0030: 000e 75c6 0000 0101 080a 0150 492e 6828 ..u........PI.h(
0x0040: 2f7c 5057 440d 0a /|PWD..

You may notice I didn't highlight the ascii on the most right(3rd) column, because it is totally meaningless to examine the ascii data when reading the layer2, 3 and 4 header in most circumstances. What about the remaining 5 bytes - 5057 440d 0a?

2007-04-18 20:09:17.334010 IP 192.168.0.24.49971 > 210.171.226.46.21: P 49:54(5) ack 543 win 14
0x0000: 0016 b681 3b0e 000a e435 ea8e 0800 4500 ....;....5....E.
0x0010: 0039 9430 4000 4006 30f4 c0a8 0018 d2ab .9.0@.@.0.......
0x0020: e22e c333 0015 3ed0 d5bd 4304 5fb9 8018 ...3..>...C._...
0x0030: 000e 75c6 0000 0101 080a 0150 492e 6828 ..u........PI.h(
0x0040: 2f7c 5057 440d 0a /|PWD..

This is definitely FTP traffic(notice port 21 highlighted) for this case, and the reason why I highlight the ascii now is because it is the application data that you should examine, PWD is print working directory when you check the RFC here, 0d is carriage return and 0a is newline or usually be recognized as \r\n.

Hopefully here I have clear the myth of tcpdump output for some of newcomers who want to learn about reading tcpdump output, it's not so hard to decode them when you understand. I don't explain every single field in the header yet but maybe I will make it next time if I'm in mood. I know some of you prefer to use wireshark as it generates more human readable output by decoding every single field correctly but I would say it is meaningless if you generally have no idea about networking therefore it's always good to go back to basic.

Peace (;])