Saturday, March 31, 2012

Busting an Attacker: article 201202

Last week I received a phone call from "Microsoft Support" informing me that my computer was infected and was sending out "viruses".  Knowing this was a scam I thought I would have a little fun with it.  So I ran into my office, started recording the call, brought up an isolated virtual machine and played along!

I strung this attacker on for about 90 minutes. Needless to say when I broke the news to him that I was on to his game he was not happy.

I am sure most of you are aware cyber crime is a multibillion dollar business.  This was not just one or two guys calling just me.  This was a from call-center.  The entire time I could hear several others talking in the background exploiting individuals.

I wish I could have done more with this but the call obviously caught me off guard.  Next I am going to attempt some forensics on the virtual machine to see what changes they made.

Below is a subtitled recording of the call to make it easier to understand.  I snipped out about 2 minutes of conversation and tried to make it entertaining to watch.  If you wish, please feel free to use this video for security awareness demonstrations.

If you have any questions or wish to discuss you may email me.



 If you would like a HI-DEF version right click on this link and select save as:


http://holepokersecurity.com/ohsg/BustedVisherHiDef.wmv

Friday, February 17, 2012

My Errata for C Programming in easy steps 3rd edition: article 201201


C Programming in easy steps 3rd edition
Author: Mike McGrath
Published by Easy Steps Limited


I think this book’s format is a great way for a beginner to wade into C programming however, even on its third edition there are several typos both in the verbiage and examples. I saw this as a challenge because it forced me to really investigate and understand the code in the examples.  Others may see this as a frustration and deter them from using the book.  Because I like the book so much, especially its lack of “fluff” and it’s great format I promote it to others, with the caveat that there are many typos.   I have yet to find errata on the web so I thought I would help my friends and peers out by listing errors and corrections out myself and maybe Easy Steps will throw another book my way (like maybe Java 4th edition, or SQL or both…)

So here I go:

Page 33 in step 2 of the example last line of the code snippet
Reads: double decimal = 0.123459;
Should Read: double decimal = 0.1234569;

Page 48 in step 2 of the example (there should be a space between DEBUG and 1
Reads: #define DEBUG1
Should Read: #define DEGUG 1

Page 65 the entire example is off.   The author is trying to get from x= 10 to y = 5 using XOR to flip bits to have x=5 and y=10; however, coding and running the example as presented ends with x=15 and y=5.  The typo is found in step 3 the last line in the comment section:
Reads: /*1111 ^ 1010 = 0101 (decimal 5)*/
Should Read (based on XOR, the numbers provided, and how the code is written): /*1010 ^ 0101 = 1111 (decimal 15)*/
So this is a combo of a typo and inaccurate coding.
The output in the image should have the second line of x= and y= as such
Reads: x=5 y=10
Should Read: x=15 y=5

Page 75 in step 2 the line of code has misplaced left curly bracket
Reads: int num = 2 ; char letter = ‘b’;  }
Should Read: int num = 2 ; char letter = ‘b’; 

Page 76 in Step 2 the line of code has a misplaced left curly bracket
Reads: int I, j; }
Should Read: int I, j; 

Page 141 in step there is a period where a comma should be
Reads: file_ptr = fopen( “data.txt” . “w”) ;
Should Read:  file_ptr = fopen( “data.txt” , “w”) ;

Page 144 in step 1 there in an include file string.h complete missing; it is needed call strcpy
Reads:  #include
Should Read:  #include
                           #include


That is all I came across, at least that I notated as I read the book.  Of course there could be more in the books verbiage and appendix etc… I did complete every example given in the book and they worked, eventually, so I believe I have caught all of those.  I hope this helps and I hope a 4th edition is printed with corrections because I really do believe it is a great beginner’s book.

.




Wednesday, December 28, 2011

BASH WHILE Loop: article 201107

Loop every 1 minute for 7 hours, provide a date stamp, listen for syslog traffic with TCPDUMP, put the output to screen.  This was to have a check running in a Putty screen so I could keep a manual check on syslog not feeding my appliance.

#!/bin/bash

COUNTER=0
while [ $COUNTER -lt 421 ]; do
           date
           tcpdump -i eth0 port 514 -c 3
           let COUNTER=COUNTER+1
           sleep 58
           clear
           sleep 1
done

.

Sunday, December 11, 2011

Breakdown of C Format Parameters: article 201106

Study notes from Hacking: The Art of Exploitation and C Programming in Easy Steps. This is a table of format parameters in the C programming language

















 


.

Sunday, December 4, 2011

Notes on Memory Segmentation: article 201105

Notes taken from "Hacking: The Art of Exploitation, 2nd ed."  Author Jon Erickson; Publisher No Starch Press.

Take aways: Compiled programs on x86 systems memory is divided into 5 segements each with specific purposes.  The segments are: text, data, bss, heap, and stack.

Fortunately my career is also my hobby; information security.  Forgiving all of the tired cliches, it is true; to really understand "your enemy" you must learn how they work.  It is also my opinion that to protect information you must too learn how the systems it resides on, and through, work as well. 

In my free time I have been educating myself on Assembly, C, Python, application security, and malware analysis. I have been at it for over a year now and due to the slow pace and lack of daily application of my studies I find myself having to re-review some mateirials as I progress.  My current focus is the fantastic book "Hacking: The Art of Explotation".  It is a great step through of showing the reader what C programming is, how to attack a poorly written program, and finally how to attack a network.

I decided to write some notes from my readings out here to provide myself with a reference and hopefully help provide information and understanding to others. 

NOTES ON MEMORY SEGMENTATION

A compiled program's memory is divided into 5 segments: text, data, bss, heap and stack. Of course each segment has their own purpose.

TEXT SEGMENT:
Sometimes called the code segment.  This location holds the assembled machine language instructions of the program.  WRITE permissions are disabled in the TEXT segment.  The segment is not used to store any variables, only code.  The TEXT segment has a fixed size.

DATA SEGMENT:
Houses initialized global and static variables.  This segment is writable but does have a fixed size.

BSS SEGMENT:
Houses uninitialized variables.  This segment is writable but it too has a fixed size.

HEAP SEGMENT:
A segment of memory programmers can directly control. Blocks of memory in this segment can be allocated and used by the programmer.  This segment's size can grow larger and smaller as needed.  The HEAP memory grows DOWN towards HIGHER memory addresses.

STACK SEGMENT:
This segment is also writeable and is used as a "scratch pad" to store local function variables and context during function calls.  The segment's size also can grow larger and smaller as needed. As the STACK segment expands it grows UP towards LOWER memory addresses.





.


Tuesday, June 28, 2011

Incident Repsonse; When To Call the Posse: article 201104

A security incident as defined in NIST SP800-61 rev 1 is a violation or imminent threat of violation of computer security policies, acceptable use policies, or standard security practices. That being the case then triggered web filters, IDS/IPS alerts, AV alerts, failed login attempts etc all combined can easily add up to hundreds if not thousands, possibly millions of "incidents" a day within an organization.

Thinking that any and all incidents require implementation of an organization's Incident Response Team is impractical. So when does one call in the posse? Unfortunately the answer is not black and white because it varies from organization to organization. However below are what I believe to be very good guidelines on when to make that call.

I asked Lenny Zelster via twitter if he had an answer and he was kind enough to provide very good info on his blog. By the time Lenny Zelster posted I had already performed further research on my own and fell upon one of the same sources as he did, NIST SP800-61. I will be using it as reference below; but I want to expound a little further on what NIST provided as well what US-CERT.gov and CERT.org have to say.

Down to it. It is up to an organization to determine the best use of their resources and with that determine when an incident warrants implementing a formal incident response. In the private sector one may be thinking more in the terms of what QUANTIFIES ($$$$) a formal incident response over what QUALIFIES as needing a formal incident response; and that is fine as this may very well be step one in the categorization process.







Looking at what the US Government Does





Even a government entity understands that priorities must be set on when to call in the posse. NIST itself suggests that minor incidents should be handled by basic staff instead of a formal response team.





I am a fan of ratings and categories because they provide fairly firm boundaries. I say firm because in the real world there is much gray. Ratings and categories help one determine what is not so important, what is important, and what is very freaking important!






First categories to create are IMPACT or EFFECT ratings. Many groups I have worked with in the past use Low Medium High. NIST breaks it down a bit more as shown in the table below taken from their SP800-61 guide page 3-15.






Once EFFECT ratings have been established an organization should assign CRITICALITY ratings which are typically based on system or processes affected. For example if malware hits one system, is not spreading, and has been quarantined by the AV program this may not warrant a formal incident response, if it is on a user's workstation; however, if it is on a payroll server then formalizing incident response may very well be implemented. This NIST pub provides another nice table as an example on page 3-16.








NIST goes even further and utilizes the values it provides to determine an overall severity score




Overall Severity/Effect Score = Round ((Current Effect Rating * 2.5) + (Projected Effect Rating * 2.5) + (System Criticality Rating * 5))


The rating can then be compared to an incident impact rating chart also found on page 3-16







So based on the final score one will hopefully have the an idea of whether or not to call in the posse!






A little more from the US Government:





This does not directly pertain the implementation of the Incident Response Team but I think it does add even more value to the fact that not all incidents are equal and thus the need for incident prioritization. The Federal Incident Reporting Guidelines from US-Cert provides the table below for federal reporting time frames. Notice that some of incidents are reported on only a monthly basis.







So I hope this helps somebody out there get a grasp on incident response and prioritization, else as Lenny Zelster mentions in his blog "start panicking about every IDS or anti-virus alert, and you’ll not only develop hypertension, but will also waste the time of your staff."



Many thanks to Lenny Zelster, NIST, and CERT.

.

Sunday, May 8, 2011

Honeynet Forensics Challenge 7 winner: article 201103

I am excited and honored to have tied for third place. Many thanks to Honeynet for offering these challenges!

Forensic Challenge 7 – “Forensic Analysis of a Compromised System” - And the winners are...
Sat, 05/07/2011 - 15:09 — angelo.dellaera
Folks, Guillame and Hugo have judged all submissions and results have been posted on the challenge web site. The winners are:

1. Dev Anand
2. Fernando Quintero & Camilo Zapata
3. (3 submissions) Matt Erasmus, Joseph Kahlich and Kevin Mau

Congratulations to the winners!

With challenge 7 completed, we are getting ready to launch challenge 8 on May 9th. This challenge has been prepared by Guido Landi and Angelo Dell'Aera from the Sysenter Chapter and it deals with
malware reverse engineering. We hope to see you participating!

Angelo Dell'Aera
The Honeynet Project

Original post found at: http://www.honeynet.org/node/667 .