Tuesday, April 5, 2011

SQL injection from wikipedia






SQL injection

From Wikipedia, the free encyclopedia
Jump to: navigation, search
SQL injection is a code injection technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another. SQL injection attacks are also known as SQL insertion attacks.[1]

Contents

[hide]

[edit] Forms of the vulnerability

[edit] Incorrectly filtered escape characters

This form of SQL injection occurs when user input is not filtered for escape characters and is then passed into an SQL statement. This results in the potential manipulation of the statements performed on the database by the end-user of the application.
The following line of code illustrates this vulnerability:
statement = "SELECT * FROM `users` WHERE `name` = '" + userName + "';"
This SQL code is designed to pull up the records of the specified username from its table of users. However, if the "userName" variable is crafted in a specific way by a malicious user, the SQL statement may do more than the code author intended. For example, setting the "userName" variable as
' or '1'='1
Or using comments to even block the rest of the query (there are three types of sql comments):[2]
' or '1'='1' -- '
' or '1'='1' ({ '
' or '1'='1' /* '
renders this SQL statement by the parent language:
SELECT * FROM `users` WHERE `name` = '' OR '1'='1';
If this code were to be used in an authentication procedure then this example could be used to force the selection of a valid username because the evaluation of '1'='1' is always true.
The following value of "userName" in the statement below would cause the deletion of the "users" table as well as the selection of all data from the "userinfo" table (in essence revealing the information of every user), using an API that allows multiple statements:
a';DROP TABLE `users`; SELECT * FROM `userinfo` WHERE 't' = 't
This input renders the final SQL statement as follows:
SELECT * FROM `users` WHERE `name` = 'a';DROP TABLE `users`; SELECT * FROM `userinfo` WHERE 't' = 't';
While most SQL server implementations allow multiple statements to be executed with one call in this way, some SQL APIs such as PHP's mysql_query(); function do not allow this for security reasons. This prevents attackers from injecting entirely separate queries, but doesn't stop them from modifying queries.

[edit] Incorrect type handling

This form of SQL injection occurs when a user supplied field is not strongly typed or is not checked for type constraints. This could take place when a numeric field is to be used in a SQL statement, but the programmer makes no checks to validate that the user supplied input is numeric. For example:
statement := "SELECT * FROM `userinfo` WHERE `id` = " + a_variable + ";"
It is clear from this statement that the author intended a_variable to be a number correlating to the "id" field. However, if it is in fact a string then the end-user may manipulate the statement as they choose, thereby bypassing the need for escape characters. For example, setting a_variable to
1;DROP TABLE `users`
will drop (delete) the "users" table from the database, since the SQL would be rendered as follows:
SELECT * FROM `userinfo` WHERE `id`=1;DROP TABLE `users`;

[edit] Blind SQL injection

Blind SQL Injection is used when a web application is vulnerable to an SQL injection but the results of the injection are not visible to the attacker. The page with the vulnerability may not be one that displays data but will display differently depending on the results of a logical statement injected into the legitimate SQL statement called for that page. This type of attack can become time-intensive because a new statement must be crafted for each bit recovered. There are several tools that can automate these attacks once the location of the vulnerability and the target information has been established.[3]

[edit] Conditional responses

One type of blind SQL injection forces the database to evaluate a logical statement on an ordinary application screen.
SELECT `booktitle` FROM `booklist` WHERE `bookId` = 'OOk14cd' AND '1'='1';
will result in a normal page while
SELECT `booktitle` FROM `booklist` WHERE `bookId` = 'OOk14cd' AND '1'='2';
will likely give a different result if the page is vulnerable to a SQL injection. An injection like this may suggest to the attacker that a blind SQL injection is possible, leaving the attacker to devise statements that evaluate to true or false depending on the contents of another column or table outside of the SELECT statement's column list.[4]

[edit] Conditional errors

This type of blind SQL injection causes an SQL error by forcing the database to evaluate a statement that causes an error if the WHERE statement is true. For example,
SELECT 1/0 FROM `users` WHERE `username`='Ralph';
the division by zero will only be evaluated and result in an error if user Ralph exists.

[edit] Time delays

Time delays are a type of blind SQL injection that cause the SQL engine to execute a long running query or a time delay statement depending on the logic injected. The attacker can then measure the time the page takes to load to determine if the injected statement is true.

[edit] Mitigation

[edit] Parameterized statements

With most development platforms, parameterized statements can be used that work with parameters (sometimes called placeholders or bind variables) instead of embedding user input in the statement. In many cases, the SQL statement is fixed, and each parameter is a scalar, not a table. The user input is then assigned (bound) to a parameter. This is an example using Java and the JDBC API:
PreparedStatement prep = conn.prepareStatement("SELECT * FROM `users` WHERE USERNAME=? AND PASSWORD=?");
prep.setString(1, username);
prep.setString(2, password);
prep.executeQuery();

[edit] Enforcement at the database level

The H2 Database Engine supports the ability to enforce query parameterization.[5] However, one drawback is that query by example may not be possible or practical because it is difficult to implement query by example using parameterized queries.

[edit] Enforcement at the coding level

Using object-relational mapping libraries avoids the need to write SQL code. The ORM library in effect will generate parameterized SQL statements from object-oriented code.

[edit] Escaping

A straightforward, though error-prone, way to prevent injections is to escape characters that have a special meaning in SQL. The manual for an SQL DBMS explains which characters have a special meaning, which allows creating a comprehensive blacklist of characters that need translation. For instance, every occurrence of a single quote (') in a parameter must be replaced by two single quotes ('') to form a valid SQL string literal. In PHP, for example, it is usual to escape parameters using the function mysql_real_escape_string(); before sending the SQL query:
$query = sprintf("SELECT * FROM `Users` WHERE UserName='%s' AND Password='%s'",
mysql_real_escape_string($Username),
mysql_real_escape_string($Password));
mysql_query($query);
Routinely passing escaped strings to SQL is error prone because it is easy to forget to escape a given string. Creating a transparent layer to secure the input can reduce this error-proneness, if not entirely eliminate it. [6]

Google secrets - Some Cool Google Dorks





div dir="ltr" style="text-align: left;" trbidi="on">
Method 1


?ww.google.com
put this string in google search:
"parent directory " /appz/ -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
"parent directory " DVDRip -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
"parent directory "Xvid -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
"parent directory " Gamez -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
"parent directory " MP3 -xxx -ht
ml -htm -php -shtml -opendivx -md5 -md5sums
"parent directory " Name of Singer or album -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
Notice that i am only changing the word after the parent directory, change it to what you want and you will get a lot of stuff.
voila!

Method 2

?ww.google.com
put this string in google search:
?intitle:index.of? mp3
You only need add the name of the song/artist/singer.

Example: ?intitle:index.of? mp3 jackson

Google secrets - Some Cool Google Dorks





div dir="ltr" style="text-align: left;" trbidi="on">
Method 1


?ww.google.com
put this string in google search:
"parent directory " /appz/ -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
"parent directory " DVDRip -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
"parent directory "Xvid -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
"parent directory " Gamez -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
"parent directory " MP3 -xxx -ht
ml -htm -php -shtml -opendivx -md5 -md5sums
"parent directory " Name of Singer or album -xxx -html -htm -php -shtml -opendivx -md5 -md5sums
Notice that i am only changing the word after the parent directory, change it to what you want and you will get a lot of stuff.
voila!

Method 2

?ww.google.com
put this string in google search:
?intitle:index.of? mp3
You only need add the name of the song/artist/singer.

Example: ?intitle:index.of? mp3 jackson

Google search tips for hacking





Google search tips for hacking
Google search engine can be used to hack into remote servers or gather confidential or sensitive information which are not visible through common searches.

Google is the world’s most popular and powerful search engine. It has the ability to accept pre-defined commands as inputs which then produces unbelievable results.

Google’s Advanced Search Query Syntax

Discussed below are various Google’s special commands and I shall be explaining each command in brief and will show how it can be used for getting confidential data.

[ intitle: ]

The “intitle:” syntax helps Google restrict the search results to pages containing that word in the title.

intitle: login password


will return links to those pages that has the word "login" in their title, and the word "password" anywhere in the page.

Similarly, if one has to query for more than one word in the page title then in that case “allintitle:” can be used instead of “intitle” to get the list of pages containing all those words in its title.

intitle: login intitle: password


is same as

allintitle: login password


[ inurl: ]

The “inurl:” syntax restricts the search results to those URLs containing the search keyword. For example: “inurl: passwd” (without quotes) will return only links to those pages that have "passwd" in the URL.

Similarly, if one has to query for more than one word in an URL then in that case “allinurl:” can be used instead of “inurl” to get the list of URLs containing all those search keywords in it.

allinurl: etc/passwd


will look for the URLs containing “etc” and “passwd”. The slash (“/”) between the words will be ignored by Google.

[ site: ]

The “site:” syntax restricts Google to query for certain keywords in a particular site or domain.

exploits site:hackingspirits.com


will look for the keyword “exploits” in those pages present in all the links of the domain “hackingspirits.com”. There should not be any space between “site:” and the “domain name”.

[ filetype: ]

This “filetype:” syntax restricts Google search for files on internet with particular extensions (i.e. doc, pdf or ppt etc).

filetype:doc site:gov confidential


will look for files with “.doc” extension in all government domains with “.gov” extension and containing the word “confidential” either in the pages or in the “.doc” file. i.e. the result will contain the links to all confidential word document files on the government sites.


[ link: ]

“link:” syntax will list down webpages that have links to the specified webpage.

link:www.expertsforge.com


will list webpages that have links pointing to the SecurityFocus homepage. Note there can be no space between the "link:" and the web page url.


[ related: ]

The “related:” will list web pages that are "similar" to a specified
web page.

related:www.expertsforge.com


will list web pages that are similar to the Securityfocus homepage. Note there can be no space between the "related:" and the web page url.


[ cache: ]

The query “cache:” will show the version of the web page that Google
has in its cache.

cache:www.hackingspirits.com


will show Google's cache of the Google homepage. Note there can be no space between the "cache:" and the web page url.

If you include other words in the query, Google will highlight those words within the cached document.

cache:www.hackingspirits.com guest


will show the cached content with the word "guest" highlighted.

[ intext: ]

The “intext:” syntax searches for words in a particular website. It ignores links or URLs and page titles.

intext:exploits


will return only links to those web pages that has the search keyword "exploits" in its webpage.


[ phonebook: ]

phonebook” searches for U.S. street address and phone number information.

phonebook:Lisa+CA


will list down all names of person having “Lisa” in their names and located in “California (CA)”. This can be used as a great tool for hackers incase someone want to do dig personal information for social engineering.

Google Hacks

Well, the Google’s query syntaxes discussed above can really help people to precise their search and get what they are exactly looking for.

Now Google being so intelligent search engine, hackers don’t mind exploiting its ability to dig much confidential and secret information from the net which they are not supposed to know. Now I shall discuss those techniques in details how hackers dig information from the net using Google and how that information can be used to break into remote servers.

Index Of

Using “Index of ” syntax to find sites enabled with Index browsing

A webserver with Index browsing enabled means anyone can browse the webserver directories like ordinary local directories. The use of “index of” syntax to get a list links to webserver which has got directory browsing enabled will be discussd below. This becomes an easy source for information gathering for a hacker. Imagine if the get hold of password files or others sensitive files which are not normally visible to the internet. Below given are few examples using which one can get access to many sensitive information much easily.

Index of /admin
Index of /passwd
Index of /password
Index of /mail

"Index of /" +passwd
"Index of /" +password.txt
"Index of /" +.htaccess

"Index of /secret"
"Index of /confidential"
"Index of /root"
"Index of /cgi-bin"
"Index of /credit-card"
"Index of /logs"
"Index of /config"


Looking for vulnerable sites or servers using “inurl:” or “allinurl:”

a. Using “allinurl:winnt/system32/” (without quotes) will list down all the links to the server which gives access to restricted directories like “system32” through web. If you are lucky enough then you might get access to the cmd.exe in the “system32” directory. Once you have the access to “cmd.exe” and is able to execute it.


b. Using “allinurl:wwwboard/passwd.txt”(without quotes) in the Google search will list down all the links to the server which are vulnerable to “WWWBoard Password vulnerability”. To know more about this vulnerability you can have a look at the following link:

http://www.securiteam.com/exploits/2BUQ4S0SAW.html

c. Using “inurl:.bash_history” (without quotes) will list down all the links to the server which gives access to “.bash_history” file through web. This is a command history file. This file includes the list of command executed by the administrator, and sometimes includes sensitive information such as password typed in by the administrator. If this file is compromised and if contains the encrypted unix (or *nix) password then it can be easily cracked using “John The Ripper”.

d. Using “inurl:config.txt” (without quotes) will list down all the links to the servers which gives access to “config.txt” file through web. This file contains sensitive information, including the hash value of the administrative password and database authentication credentials.

For Example: Ingenium Learning Management System is a Web-based application for Windows based systems developed by Click2learn, Inc. Ingenium Learning Management System versions 5.1 and 6.1 stores sensitive information insecurely in the config.txt file. For more information refer the following
links: http://www.securiteam.com/securitynews/6M00H2K5PG.html

Other similar search using “inurl:” or “allinurl:” combined with other syntax


inurl:admin filetype:txt
inurl:admin filetype:db
inurl:admin filetype:cfg
inurl:mysql filetype:cfg
inurl:passwd filetype:txt
inurl:iisadmin
inurl:auth_user_file.txt
inurl:orders.txt
inurl:"wwwroot/*."
inurl:adpassword.txt
inurl:webeditor.php
inurl:file_upload.php

inurl:gov filetype:xls "restricted"
index of ftp +.mdb allinurl:/cgi-bin/ +mailto


Looking for vulnerable sites or servers using “intitle:” or “allintitle:”

a. Using [allintitle: "index of /root”] (without brackets) will list down the links to the web server which gives access to restricted directories like “root” through web. This directory sometimes contains sensitive information which can be easily retrieved through simple web requests.

b. Using [allintitle: "index of /admin”] (without brackets) will list down the links to the websites which has got index browsing enabled for restricted directories like “admin” through web. Most of the web application sometimes uses names like “admin” to store admin credentials in it. This directory sometimes contains sensitive information which can be easily retrieved through simple web requests.

Other similar search using “intitle:” or “allintitle:” combined with other syntax

intitle:"Index of" .sh_history
intitle:"Index of" .bash_history
intitle:"index of" passwd
intitle:"index of" people.lst
intitle:"index of" pwd.db
intitle:"index of" etc/shadow
intitle:"index of" spwd
intitle:"index of" master.passwd
intitle:"index of" htpasswd
intitle:"index of" members OR accounts
intitle:"index of" user_carts OR user_cart

allintitle: sensitive filetype:doc
allintitle: restricted filetype :mail
allintitle: restricted filetype:doc site:gov



Other interesting Search Queries

· To search for sites vulnerable to Cross-Sites Scripting (XSS) attacks:

allinurl:/scripts/cart32.exe
allinurl:/CuteNews/show_archives.php
allinurl:/phpinfo.php



· To search for sites vulnerable to SQL Injection attacks:

allinurl:/privmsg.php
allinurl:/privmsg.php

Hacking PHP 4.4 sites in 20 seconds





Hacking PHP 4.4 sites in 20 seconds



Now here is  a real hacking tutorial in which I am going to hack a real website,and that too in less than 20 seconds.and I am not kidding. Actually sites with PHP Hacking PHP 4.4 sites in 20 seconds - rdhacker.blogspot.com 4.4 have a SQL injection vulnerability in them which makes their Admin control panel easily accessible,and I mean in one big shot,you will be admin of that site.
Remember,this tutorial is applicable on PHP4.4 machines with Apache running in parallel with them.Also,since I will be hacking REAL websites,I will not be displaying their URL’s or else I will be gunned down (by law of course :P).It will be partial in nature,that is I WILL not be teaching each and everything to you,I assume you know basics of SQL injection/PHP injection/Google searching,and if you don't then read these articles first -
    Google Search Tips for Hacking
    Google Secrets – Some Cool Google Dorks
    Basics of SQL Injection
    SQL injection by example
    Simple Nmap Scanning

In the mean time,here is how you can start -
Step 1 – Search for them
Yep,make a Google dork to find sites running Apache and PHP 4.4 . Its quite easy.
Step 2 – Scan them
Start by scanning them using Nmap,Do and intense scan and find the open ports. If you find port 2000 open,then you have almost got it. most websites running PHP4.4 have this port for admin login.
Now just login using port 2000 ie -
http://www.website.com:2000
and you will be comfortably login into admin page like this -
You will login with port 2000 into website - rdhacker.blogspot.com
Step 3 – Hack them
Now in the fields,you have to type -
username – admin
password – a’ or 1=1 or ‘b
domain - a’ or 1=1 or ‘b
Inject the fields qith these values - rdhacker.blogspot.com
and press go,you will login into admin
and you have hacked into admin - rdhacker.blospot.com
voila..you have hacked into admin. Actually sites based on PHP 4.4 have the vulnerability in them that they are vulnerable to SQL injection.It will literally take 20 seconds.
I hope that was informative :P go learn something.

Cheers

Download SQL Injection tool - SQL injection automated software SQLMAP
Sqlmap is an open source command-line automatic SQL injection tool and its goal is to detect and take advantage of SQL injection vulnerabilities in web applications. Once it detects one or more SQL...
Sqlmap is an open source command-line automatic SQL injection tool and its goal is to detect and take advantage of SQL injection vulnerabilities in web SQL Injection applications. Once it detects one or more SQL injections on the target host, the user can choose among a variety of options to perform an extensive back-end database management system fingerprint, retrieve DBMS session user and database, enumerate users, password hashes, privileges, databases, dump entire or user’s specified DBMS tables/columns, run his own SQL statement, read or write either text or binary files on the file system, execute arbitrary commands on the operating system, establish an out-of-band stateful connection between the attacker box and the database server via Metasploit payload stager, database stored procedure buffer overflow exploitation or SMB relay attack and more.Enthusiastics can experiment with its opotions and pwn many of the servers around,or can test their skills to secure their servers..but remember,SQL map is a tool,its might help you to find and apply vulnerabilities and injections,but in the end,you really must have a good knowledge of SQL some real pwning out there..
You Can download sqlmap 0.7 here:

    Linux Source: sqlmap-0.7.tar.gz
    Windows Portable: sqlmap-0.7_exe.zip

Thanks for your readership. Be a Pro,Visit Prohack. RD

Monday, April 4, 2011

iPhone Application Development Training





iPhone Application Development Training
Learning Objectives
The objective of this program is to give attendees a course in iPhone
Programming. It will introduce the Framework,Programming languages
and other relevant APIs to the audience and will help them understand
the concepts and techniques behind the iPhone Application development.
It is expected that after the course the attendee will be able to work
independently on iPhone application development and will be able to
migrate from conventional technologies to Cocoa and iPhone related
technologies effectively.
Target Audience
Developers who are already working on other platforms and want to
develop for iPhone and iPod touch.
Prerequisites
 Understanding of C programming language.
 Understanding of Object Oriented Programming.
 Any experience in Mobile development will be and added
advantage.
Course Duration
5 Days (Online training Sessions with Hands On).
Contents
 Introduction to iPhone SDK
 A Hello World using Xcode
 Objective C – Complete details from Objects to Categories,
Exceptions
 and Protocols
 Essential Cocoa Touch classes
 iPhone Software Architecture
 Interface Builder
 UIView and UIView Controller
 UITabbarController
 UINavigationController
SpymekTech Solutions Pvt. Ltd.
iPhone_Contents_V1.1
 UITableView and UITableViewController
 Controls – Buttons, UIToolbar, Switch, Slider, TextField , TextView
 Advance Controls – Pickers
 SQLite database
 Core Data
 Property Lists
 XML

No objection letter written





14 January 2011
To Whom It May Concern
RE:  No Objection Letter for _____________
Dear Sir/Madam:
This letter is to confirm that Mr. __________ is employed with us since 05 January 2010 on a full time basis as a web Developer Engineer. His annual salary is NRs 286,000/year (In words: Two hundred Eighty six thousand only) per annum.
Mr. Kurmi has expressed interest on studying Master degree in computer science at ________________, USA and  our organization has no objection regarding Mr._________’s study in USA.
Please feel free to contact us if you or your organization should require further information.
Sincerely,
____________________

 No objection letter written for the university, no objection letter written by the working company for the futher study of the workers.






Recommendation Letter for an Engineering Student


Director,
Avanti Engineering College,
Ramantha pur,
Hyderabad.
Respected Sir,
This is to recommend Miss. Swetha Agarwal, who wishes to seek admission in B.Tech in your college for 2010-2014 batch. I would like to let you know that Miss. Swetha was my student at the intermediate level in Narayana Junior College for the academic year 2008-2010. During her studies in our college, she has been found exceptionally good, with an excellent conduct. I am proud to say that she has secured state 42nd rank in intermediate and State 25 rank in the recent EAMCET examination conducted. I think she can groom well in your college as the learning environment would be impeccable.
So I would like to recommend Miss. Swetha for the study of engineering course in your college. Here are attached document in support of her candidature. Kindly consider her admission in to your college.
Thanking you,
Yours faithfully,
K. Jayasimha,
Principal cum Regional head,
Narayana colleges,
Hyderabad division.

How to write recommendation letters, recommendation letter, recomendation leters, recommendation post for students and workers, recomending for the post

Sunday, April 3, 2011

Apologizing letter by the advertiser to the customer




Dear Rupak,

Due to a technical issue, Chitika reports from Monday, March 28 through Thursday, March 31 are missing data. We are currently working to restore this data to your reports.
We have identified and fixed the cause of this issue, and reports for Friday, April 1 will be accurate going forward.
We apologize for any inconvenience this may have caused. The missing data will be added to your reports as soon as possible, and we will send an update as soon as this is complete. If you have any questions, please contact customer support.
Best Regards,
Chitika

Letter of apologizing to the customer, how to send customer a letter saying about the technical problems

A letter from the Clixsense, how marketing is done for the online earning site





Hello rupak,

Every Friday we will send you an email like this with your ClixSense stats. We will also include any new updates we may have or any news we feel you should know about.

Since we released the new ClixSense on March 10th many of you have been actively recruiting others and more than 50,000 people joined us since the relauch of our site. We had more than 2 Million account logins, we paid more than $25,000 in Clicks and paid over $6,000 in click commissions. We also had more than 47 Million total hits to our site. Incredible numbers and this is just the beginning.

Below you will find your ClixSense stats.


Your account balance:$0.0180
Your affiliate link:http://www.clixsense.com/?2838441
Your active referrals:
Lifetime affiliate earnings:

Please remember that if you fail to login to your account at least once every 90 days that it can be closed for inactivity.

We ask all of you to please do your part and promote your affiliate URL. The more people you refer, the more money you can make. Also, please remember that you must request your payout now in order to be paid. On the My Account page next to your balance a Cashout link will be shown as long as you have a minimum balance of $10.00. Withdrawals are processed every Monday (except Checks, they are processed monthly).

If you have any questions please contact us through our helpdesk available on the web site. Do not reply to this email as this address is not monitored.

Thank you
The ClixSense Team

Letter for the online marketing, how to send customers letter of online marketing,
letters to customer,