Monday, July 20, 2015

Kali Linux Tutorial: Finding Exploits Using the Searchsploit Tool

What is Vulnerability Exploit?


Words like "exploit" and "vulnerability" are tightly bound together. Often, a script/program will exploit a specific vulnerability. Since most vulnerabilities are exploited by script kiddies, the vulnerability is often known by the name of the most popular script that exploits it. In any case, there are broad-spectrum vulnerability scanners/assessment tools that will scan a system and look for common vulnerabilities. These are often used in order to toughen up a computer system.

In computer security, the term vulnerability is applied to a weakness in a system that allows an attacker to violate the integrity of that system. Vulnerabilities may result from weak passwords, software bugs, a computer virus or a script code injection, and a SQL injection.

Introduction


When we are looking for ways to hack a system, we need a specific exploit to take advantage of a certain vulnerability in the operating system, service, or application.

Remember, exploitation is very specific, there is no one silver bullet that will allow you to exploit all systems. You need to find an exploit that will specifically take advantage of a vulnerability in the system that you are attacking. That is where the Exploit Database can be so incredibly useful.

EDB is a project of Offensive Security, the same folks who developed BackTrack and Kali Linux, which includes exploits categorized by platform, type, language, port, etc. to help you find the exploit that will work in your particular circumstance. Then, if you feel it will work on your target, you can simply copy and paste it into Kali for your attack.



Step 1: Fire Up Kali & Open a Browser


Let's start by firing up Kali and opening a browser, such as Iceweasel, the default browser in Kali (EDB can be reached from any browser, in any operating system). If we use the default browser in Kali, we can see that there is a built-in shortcut to the "Exploit-DB" in the browser shortcut bar, as seen below.


kali-tutorial-find-exploits-searchsploit- picateshackz.com



When we click on it, it takes us to the Exploit Database, as seen below.


kali-tutorial-find-exploits-searchsploit- picateshackz.com



If you are not using Iceweasel and its built-in shortcut, you can navigate to Exploit-DB by typing www.exploit-db.comin the URL bar.

Step 2: Search the Exploit Database


If we look at the top menu bar in the Exploit Database website, second from the right is a menu item called "Search". When we click on it, it enables us to search the database of exploits and returns a search function screen similar to the screenshot below.


kali-tutorial-find-exploits-searchsploit- picateshackz.com


Let's use this search function to find some recent Windows exploits (we are always looking for new Windows exploits, aren't we?). In the search function window, we can enter any of the following information;

  • Description
  • Free Text Search
  • Author
  • Platform (this is the operating system)
  • Type
  • Language
  • Port
  • OSVDB (the Open Source Vulnerability Database)
  • CVE (Common Vulnerability and Exploits)

The last two fields can be used if you are specifically looking for an exploit that takes advantage of a known, numbered vulnerability in either of those databases.

In the Platform field, enter "Windows", in the Type field, enter "remote", and in the Free Text Search box, enter "Office". When we do so, the Exploit Database returns a list and a link to all of the exploits that meet those criteria. Of course, you can put in whatever criteria you are searching for. I am only using these as an example.

kali-tutorial-find-exploits-searchsploit- picateshackz.com


Step 3: Open an Exploit


From the search results page, we can click on any of the two pages of search results and it will take us to the particular exploit. I clicked on the very first exploit in the list "Internet Explorer TextRange Use-After Free (MS14_012)". When I do so, I am brought to a screen that displays the exploit code like that below. I have circled the description in the code of the exploit.


kali-tutorial-find-exploits-searchsploit- picateshackz.com


This exploit works against Internet Explorer that was built between August 2013 and March 2014. If you want to use it, you can simply copy and paste this text file and put it into the exploit directory in Metasploit (if you are using an up-to-date version of Metasploit, it is already included). This is a good example of how specific an exploit can be.
Step 4: Open Up Searchsploit

Kali, having also been developed by Offensive Security, has built into it a local database of exploits based on the same Exploit Database. We can access it by going to Applications -> Kali Linux -> Exploitation Tools -> Exploit Database and clicking on searchsploit as shown below.

kali-tutorial-find-exploits-searchsploit- picateshackz.com


It will open a screen like that below that details the basic syntax on how to use searchsploit. Note that it explains that you must use lowercase search terms and that it searches a CSV (comma separated values) file from left to right, so search term order matters.

kali-tutorial-find-exploits-searchsploit- picateshackz.com


Step 5: Search the Exploit Database with Searchsploit


Now that we have opened a terminal for searchsploit, we can now use this tool to search our local copy of the Exploit Database. As you might expect, our local copy of the exploit database is much faster to search, but does NOT have all the updates that the online database does. Despite this, unless we looking for the very latest exploits, the local database works fast and is effective.

One other note on its use. As the information is organized in CSV files, searches locally often will yield results slightly differently than the online database. In the screenshot below, I searched for "Windows" and "Office" and only received a single result, unlike what I received when I used the online database.

kali-tutorial-find-exploits-searchsploit- picateshackz.com


Exploit Database is an excellent repository for exploits and other hacks that we might need, including new Google hacks, white papers on security and hacking, denial of service (DOS) attacks, and shellcode that you can use out the box or tailor for your unique attack.

Sunday, July 19, 2015

Linux Security

SECURITY 


Things to be considered before configuring apache server.


1.Hiding Apache version and OS information:



Apache displays its version and the name of the operating system in errors. A hacker can use this information to launch an attack. so server administration must hide the server signature. This can be with following command
vim /etc/httpd/conf/httpd.conf

>Go to the above directory


ServerSignature Off

>Off the default signature


service httpd restart

>restart the server to take effect the changes



2.Disable Directory Listing



If /var/www/ don’t have the index file then webserver shows the document root directory

This feature could be turn off for a specific directory through “options directive” available in the Apache configuration file.

Options -Indexes



3.Restricting Access to files outside the root directory



Configure the file like given below:

Options None
AllowOverride None
Order deny,allow
Deny from all

This will not allow user to access outside the web root directory



HOW TO INSERT RESTRICTION. 



To view the current iptables configuration
iptables -L


How to block all connections from a specific IP Address.


iptables -A INPUT -s (ip address) -j DROP
e.g.: iptables -A INPUT -s 192.168.1.22 -j DROP


How to block all of the IP Addresses in the 192.168.1.1/24 network range.


Standard method: iptables -A INPUT -s 192.168.1.1/24 -j DROP
OR
Netmask method: iptables -A INPUT -s 192.168.1.1/255.255.255.0 -j DROP



How to block SSH connections from any IP address.


iptables -A INPUT -p tcp --dport ssh -j DROP

How to block SSH connections from a specific IP Address.


iptables -A INPUT -p tcp --dport ssh -s 10.10.10.10 -j DROP
For tcp protocol use -p tcp
& for udp protocol use -p udp


The changes that you make to your iptables rules will be scrapped the next time that the iptables service gets restarted unless you execute a command to save the changes


For Ubuntu:
sudo /sbin/iptables-save


Red Hat / CentOS:
/sbin/service iptables save
Or
/etc/init.d/iptables save


To clear all the currently configured rules:
iptables -F

Linux sever Management

This summary is not available. Please click here to view the post.

Linux Network Management

This summary is not available. Please click here to view the post.

System Management

SYSTEM COMMANDS


uname -a
Display linux system information 


uname -r
Display kernel release information


last reboot
Show system reboot history


date
Show current date and time


cal
Show current month calendar4


whoami
Who you are logged in as 


finger user
Display information about user


cat /proc/cpuinfo
Show cpu info


cat /proc/meminfo 
Show memory information

 
man command
Show manual for command


df
Check filesytem storage

 
du
Check subdirectories

 
df -h            
Shows file size which is user readable


du --max-depth=1 -h  
Check subdirectories by one level down

 
whereis app
Show possible location of app


which app
Show which app will be run by default
 

free      
To check ram & swap partition  usuage


free -g
To see usuage in gigabytes


dd if=/dev/zero of=/swapfile bs=1024 count=1024
dd to create a storage file
if=/dev/zero : Read from /dev/zero file.  /dev/zero is a special file in that provides as many null characters to build storage file called /swapfile.
of=/swapfile : Read from /dev/zero write storage file to /swapfile.
bs=1024 : Read and write 1024 BYTES bytes at a time.
count=1024 : Copy only 1024 BLOCKS input blocks.


mkswap /swapfile 
To setup a linux swap area in a file.


swapon /swapfile
Enable the swap file.


swapoff /swapfile
Disable the swap file.
Determine the size of the new swap file in megabytes and multiply by 1024 to determine the number of blocks. For example, the block size of a 64 MB swap file is 65536. 


lvextend -l +100  /logical/volume00
Extend the logical volume 00 from blank space i.e. 0mb to volume 00 with 100 mb...


ctrl+alt+f1    
GUI (Graphical mode) to text mode i.e. CLI(Command Line Interface)


ctrl+alt+f7    
Text to graphic mode

Types Of Boot Loader
grub  grand unified boot loader
lilo linux bootloader

 
kcontrol &      
Configure the kde enviroment


gnome-control-center      
Configure the gnome enviroment

 
switchdesk kde  
Set the default startup to kde


switchdesk gnome  
Set the default startup to gnome


up2date-config      
Configure the red hat for update

mount /dev/sda1  /tmpdir         mount the sda1 file in tmpdir directory
mount /dev/sda0 /tmpdir          mount the sda0 file in tmpdir directory
unmount  /tmpdir/boot              unmount boot directory
unmount /tmpdir                       unmunt tmpdir directory
 

sync
Sync the changed or changes take effect

 
top    
Will show the running process list
 

gnome-system-monitor  
Show the graphical mode of running process

 
uptime    
Show how long the system is running from last boot  and
load average of first no show the the total load in last one minute 
load average of second no show the the total load in last five minute
load average of third no show the the total load in last fifteen minute

Evil Twin attack

Evil Twin Attack is attack is frequently carried upon wireless access points with malicious intentions. This attack happens when...