Powered by Blogger.

Bài Mới ...

How to steal Facebook Authentication cookies

Written By Unknown on Monday, January 6, 2014 | 1:00 AM

How to hack a facebook account – or, basically how to hijack php sessions. Yes – this is old news – yes its a common vulnerability – but you get a better idea for what it is and how it works when things are explained in detail (with screenshots!).
Before we begin, however, I want to re-emphasize that it is VERY EASY to protect yourself against this sort of attack. Facebook supports HTTPS, so when you browse facebook (or twitter for that matter) or if you have it bookmarked – please make sure you’re using HTTPS:// rather than HTTP:// in the URL at the very least, if not using a VPN solution for further encryption. Also, if the ‘victim’ logs out of facebook, the attackers session becomes invalid – so it’s a good practice to actually log out of facebook and log back in again rather than using the ‘remember me’ checkbox.
Facebook like many sites operates using authentication cookies. Their auth cookies contain a variety of information, but for our purposes this is irrelevant. Here is a sanitized cookie for reference:
Cookie: datr=1276721606-b7f94f977295759399293c5b0767618dc02111ede159a827030fc; lsd=Xesut; lxe=greg.evans%40****************; c_user=100001230367821; lo=wl9fcGXMhPfoT4bAhKFP3Q; lxs=1; sct=1276721745; xs=a615cfe596448194d6e2a8d062a90e4e
You can see the ‘lxe’ field is the login. We haven’t done any further research into what the various other fields mean, but using facebook without any kind of security you’re both leaking the email address used for your login and the session cookie.
First thing you’ll want to do is fire up your favorite packet capture application. For this example we’ve used Wireshark:

Next, set the filter in the top left to ” http.cookie contains “datr” “. This should show you only packets captured which contain the cookie we’re looking for. You can see that in this screenshot we’ve already captured a cookie.

Once you’ve found a suitable cookie, you can copy it into the buffer by right clicking on the cookie line, and clicking Copy -> Bytes (Printable Text Only)

Next you’ll want to open up firefox. You’ll need both greasemonkey and the cookieinjector script.
Simply browse to facebook – make sure you are not logged in:

Hit ALT-C to bring up the cookie injector dialog box:

Then paste in the cookie!

Hit refresh and – VIOLA! you’re now logged in as your victim! Now this doesn’t give you access to their credentials, this is about the equivalent to walking up to their workstation while they’re away from their desk and using facebook.

Neat huh? Pretty easy too. I smiled big when we demo’ed the attack in our lab – its old, sure, but being successful is always a good feeling!

NOWASP 1 - How to Install Mutillidae on Fedora / Windows

Written By Unknown on Sunday, January 5, 2014 | 8:25 PM

{ How to Install Mutillidae on Fedora}
Bài thực hành sẽ cài đặt NOWASP trên Windows 7

Section 0. Background Information
  • What Mutillidae?
    • OWASP Mutillidae II is a free, open source, deliberately vulnerable web-application providing a target for web-security enthusiast.
    • With dozens of vulns and hints to help the user; this is an easy-to-use web hacking environment designed for labs, security enthusiast, classrooms, CTF, and vulnerability assessment tool targets. Mutillidae has been used in graduate security courses, corporate web sec training courses, and as an "assess the assessor" target for vulnerability assessment software.
  • Pre-Requisite Lab
    • Fedora: Lesson 1: Installing Fedora 
      • Note: Only required if you don't already have a Fedora instance.
  • Lab Notes
    • In this lab we will do the following:
      1. Install Apache Webserver
      2. Install Mysql Server
      3. Install PHP
      4. Install and Configure Mutillidae
    • Lưu ý - Bài thực hành trong lớp học sẽ cài đặt NOWASP trên Windows 7 (máy thật) / hoặc máy ảo Windows XP / 2K3
Section 1. Configure Fedora14 Virtual Machine Settings
  1. Open Your VMware Player
    • Instructions:
      1. On Your Host Computer, Go To
      2. Start --> All Program --> VMWare --> VMWare Player
  2. Edit BackTrack Virtual Machine Settings
    • Instructions:
      1. Highlight fedora14
      2. Click Edit virtual machine settings
  3. Edit Network Adapter
    • Instructions:
      1. Highlight Network Adapter
      2. Select Bridged
      3. DO NOT Click on the OK Button.

  4. Edit Network Adapter
    • Instructions:
      1. Click the Options Tab
      2. Virtual machine name: Fedora14 - Mutillidae
      3. Click the OK Button

Section 2. Login to Fedora14 - Mutillidae
  1. Start Fedora14 VM Instance
    • Instructions:
      1. Start Up VMWare Player
      2. Select Fedora14 - Mutillidae
      3. Play virtual machine
  2. Login to Fedora14 - Mutillidae
    • Instructions:
      1. Login: student
      2. Password: <whatever you set it to>.

Section 3. Open Console Terminal and Retrieve IP Address
  1. Start a Terminal Console
    • Instructions:
      1. Applications --> Terminal
  2. Switch user to root
    • Instructions:
      1. su - root
      2. <Whatever you set the root password to>
  3. Get IP Address
    • Instructions:
      1. ifconfig -a
    • Notes (FYI):
      • As indicated below, my IP address is 192.168.1.112.
      • Please record your IP address.

Section 4. Disable SELinux
  1. Open the SELinux config file with gedit
    • Instructions:
      1. gedit /etc/selinux/config &
    • Notes (FYI):
      • The "&" is used to open gedit in the background.
      • If you are the Linux Guru feel free to use the VI editor instead.
  2. Delete targeted
    • Instructions:
      1. Arrow down to the last line --> SELINUXTYPE=targeted
      2. Highlight the word "targeted" and press the delete button
  3. Replace targeted with disabled
    • Instructions:
      1. Replace targeted with the word "disabled"
        •  SELINUXTYPE=disabled
      2. Click Save
      3. Click the "X" to Close
  4. Open the SELINUX config file with gedit
    • Instructions:
      1. setenforce 0
      2. sestatus
    • Notes (FYI):
      • setenforce - is used to modify the mode SELinux is running in.
      • Generally, I do not support disabling SELinux.  However, we are going to turn this server into a vulnerable machine by later installing Mutillidae.

Section 5. Disable Firewall
  1. Disable the Firewall
    • Instructions:
      1. service iptables stop
      2. chkconfig iptables off
    • Notes (FYI):
      • Again, I do not support disabling the firewall.  However, we are going to turn this server into a vulnerable machine by later installing Mutillidae.

Section 6. Install Apache httpd Server
  1. Download httpd
    • Instructions:
      1. yum install httpd.i686
      2. y
  2. Start Apache
    • Instructions:
      1. service httpd start
        • This starts up the Apache Listening Daemon
      2. ps -eaf | grep httpd
        • Check to make sure Apache is running.
      3. chkconfig --level 2345 httpd on
        • Create Start up script for run levels 2, 3, 4 and 5.
Section 7. Install mysql and mysql-server
  1. Install mysql
    • Instructions:
      1. yum install mysql.i686
      2. Is this okay [y/N]: y
  2. Install mysql-server
    • Instructions:
      1. yum install mysql-server
      2. Is this okay [y/N]: y
  3. Start Up mysqld
    • Instructions:
      1. service mysqld start
  4. Start Up mysqld
    • Instructions:
      1. chkconfig --level 2345 mysqld on
        • Creates the start up scripts for run level 2, 3, 4 and 5.
      2. mysqladmin -u root password samurai
        • Sets the mysql root password to "samurai"
  5. Login to mysql
    • Instructions:
      1. mysql -uroot -p
      2. samurai
      3. show databases;
      4. quit
  6. Allow Remote Access to MySQL
    • Note(FYI):
      • Allowing remote access is not part of the Mutillidae installation.
      • This step just provides an additional vulnerability used in following labs.
    • Instructions:
      1. echo "use mysql; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'samurai' WITH GRANT OPTION;" | mysql -uroot -psamurai
Section 8. Install PHP
  1. Install PHP
    • Instructions:
      1. yum install php.i686
      2. Is this okay [y/N]: y
  2. Install php-mysql
    • Instructions:
      1. yum install php-mysql
      2. Is this okay [y/N]: y
  3. Install php-pear
    • Instructions:
      1. yum install php-pear php-pear-DB
      2. Is this okay [y/N]: y
  4. Install php-mbstring
    • Instructions:
      1. yum install php-mbstring
      2. Is this okay [y/N]: y
  5. Open php.ini
    • Instructions:
      1. gedit /etc/php.ini &
    • Notes (FYI):
      • The "&" is used to open gedit in the background.
      • If you are the Linux Guru feel free to use the VI editor instead.
  6. Search php.ini
    • Instructions:
      1. Search --> Find...
      2. Search for: ; extension
      3. Click the Find Button
  7. Add Extension
    • Instructions:
      1. Below the '; extension_dir = "./"' add the following line
        • extension=mysql.so
      2. Click Save
      3. Click "X" to Close
  8. Restart Apache
    • Instructions:
      1. service httpd restart
Section 9. Install wget
  1. Install wget
    • Instructions:
      1. yum install wget
      2. Is this okay [y/N]: y
Section 10. Install Mutillidae
  1. Open Firefox
    • Instructions:
      1. firefox "http://sourceforge.net/projects/mutillidae/files/latest/download?source=dlp" &
  2. Save File
    • Instructions:
      1. Click radio button Save File
      2. Click the OK button
  3. Browse for other folders
    • Instructions:
      1. Click on "Browse for other folders"
      2. Continue to next step
  4. Navigate to /var/www/html
    • Instructions:
      1. Navigate to /var/www/html
      2. Click the Save Button
  5. Un-Zip Mutillidae
    • Instructions:
      1. cd /var/www/html
      2. ls -lrta
      3. unzip LATEST-mutillidae-2.5.11.zip
  6. Un-Zip Mutillidae
    • Instructions:
      1. cd mutillidae/classes/
      2. ls -lrta
      3. gedit MySQLHandler.php &
  7. Unzip Package
    • Instructions:
      1. Arrow down to line 39 ---> static public $mMySQLDatabasePassword = "";
        • Place the word samurai in between the quotes after the "=" sign.
        • From: static public $mMySQLDatabasePassword = "";
        • To: static public $mMySQLDatabasePassword = "samurai";
      2. Click the Save Button
      3. Click X to Close
  8. Change Ownership
    • Note(FYI):
      • This step is not necessary.
      • This step is to supplement additional SQL Union attacks.
    • Instructions:
      1. cd /var/www/html
      2. chown apache:mysql mutillidae
      3. chmod 770 mutillidae
      4. ls -ld mutillidae
  9. Start Firefox
    • Instructions:
      1. Click on the Firefox icon
     
  10. Setup/Reset the DB
    • Instructions:
      1. http://localhost/mutillidae
      2. Click on setup/reset the DB
  11. Setting up the database...  
    • Instructions:
      1. Click the OK Button
  12. Welcome to Mutillidae  
    • Note(FYI):
      1. If you see the below screen, then congratualations on setting up Mutillidae on a Fedora server.
Section 11. Proof of Lab
  1. Proof of Lab
    • Instructions:
      1. echo "use nowasp; show tables;" | mysql -uroot -psamurai
      2. date
      3. echo "Your Name"
        • Replace the string "Your Name" with your actual name.
        • e.g., echo "John Gray"
    • Proof of Lab Instructions:
      1. Do a PrtScn
      2. Paste into a word document
      3. Upload to website www.antoanthongtin.edu.vn

An Toàn Thông Tin

Bài Viết Hay

Onsite Lab / Penetration

 
Đăng Kí Học Trực Tuyến : Chương Trình Đào Tạo Security365 | Ethical Haking | SiSSP
Copyright © 2013. An toan thong tin - All Rights Reserved
Web Master @ Nguyen Tran Tuong Vinh
Tech Support @ Bang Tran Ngoc