Tuesday, April 18, 2006

[itsdifferent] Understanding SQL Injection

A technique often employed by malicious users for gaining illegal access to remote machines, through the web applications' vulnerability, is SQL injection. The basic idea behind this technique is to run the SQL query, something not intended by the programmer. SQL injection relies heavily on logical operations such as AND, OR, UNION, etc. If this technique is used properly, a malicious user can gain complete access to a web server. If the application is creating SQL strings naively on the fly (dynamic queries) and then running them, it can create some real surprises as we shall see later on.

How does SQL injection work?
Vulnerability occurs as a result of faulty validation of data provided by the user in web applications. It may be possible that the programmer is a newcomer and does not understand such attacks. However, in many cases I have seen that most of the time it is the programmers who are too lazy to consider and apply proper security checks. A majority of programmers believe that the client or end-user will always give correct input to the application. They just check for some minor validations like empty string or null values, etc. but never think of the fact that a user could insert a specially crafted query which reveals all the important information on your machines.

 

The outsourcing boom saw the entry of many new companies with less experienced programmers. As such, these kinds of attacks also increased. If we take a simple example of a login page, then generally a programmer's uses this pseudo code (assume that the database server is MS-SQL Server). See code 1 below:

 

query="select * from userinfo where username='"&strUser&"' and password='"&strPass&"'"
strCheck=GetQueryResult(query)
if strCheck="" then
bool loginflg=False
else
bool loginflg=true
end if


This query works fine, without any problems, if a user enters the correct characters. But suppose a malicious user enters the following:

username=test
password=' or 1=1--


Now the above query will become:


query="select * from userinfo where username='test' and password='' or 1=1--'" 

(-- Symbol denotes the comment in SQL Server. Hence in the MS-SQL Server everything after the -- is ignored.)


So this query actually becomes something like this:


select * from userinfo where username='test' and password='' or 1=1

We can break this query into two portions, e.g.:

p=>username='test' and password=''
q=>1=1

So we can write it as pVq.


From Boolean algebra we know that in V(OR) operation the result will be true if any of the value is true. As in the above code the value of q is always true, since 1 is always equal to 1, hence the value of this entire expression(pVq) is always returned as TRUE. So the query becomes (I am using p, q for ease of reading)


query="select * from userinfo where pVq"


Now, as discussed above, the pVq is always true and hence the query will select all the records in the current table. But generally a programmer takes one record for login and hence the username becomes the username of the first record.


Consider the following table:

No.    username    password
1.       test              test
2.       temp            temp


In this table if the above query is executed, then the username becomes test. Hence on executing the above malformed query a malicious user can bypass authentication mechanisms of the web application. This is only one thing among several endless options that an intruder can use. By using specially crafted query a user can retrieve the entire database schema of your application or the user can upload/download any file or even gather any other information such as credit card numbers stored in the database, delete the user, add a new user, etc.

 

Different types of attacks
1. SELECT UNION:
Union operation permits combining two results. By using this option a user can retrieve any sensitive information from the database. In case of the above query we mentioned, suppose a user enters the following in the username and password fields:

username=test
password=' or 1=1 union select top 1 TABLE_NAME from INFORMATION_SCHEMA.TABLES--

On execution of this query the database engine will give an error, something like:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07' 

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'userinfo' to a column of data type int. /testpage.aspx, line 25.


Now, from the above mentioned error it is clear that the table name is userinfo. After determining the table name, the user needs to find the column name in the table. So the user can enter the following values:


username=test
password=' or 1=1 union select top 1 COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='userinfo'-

The output will now be:
Microsoft OLE DB Provider for ODBC Drivers error 80040e07' 

Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'login_id' to a column of data type int. /testpage.aspx, line 25.

The above error message shows that the first field or column in userinfo is login_id. To get the next column name the user will type as:


username=test
password=' or 1=1 union select top 1 COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='userinfo' where COLUMN_NAME not in('login_id')-

Then the output may be as follows:
Microsoft OLE DB Provider for ODBC Drivers error 
'80040e07' Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value 'login_name' to a column of data type int. /testpage.aspx, line 25.

In this manner, a user can gain information about the tables, username, passwords, etc.

2. SELECT INSERT:
With the insert key word, a user can easily add new records into the database. Given that we know the partial structure of the members table, we can try adding a new record to the table. If this works, we'll simply be able to login directly with our newly inserted credentials. Look at the following query:


SELECT email, passwd, login_id, full_name
FROM members
WHERE email = 'test@test.com';
INSERT INTO members ('email','passwd','login_id','full_name') 
VALUES ('test@test.com','hello','test','test');--'; 

Based on the implementation and database permissions, this query may work and one can login with the user name "test" and password "test". On the other hand, this approach may fail, supposing that there is a different table which contains the access rights to the user and other stuff or may be the web application user doesn't have insert permission for the user table.

3. SELECT UPDATE:
As discussed above, sometimes the select insert option may fail depending on various conditions. In such a scenario, using the "Forgot Password" button seems a nice way to get into the system. See code 2.

 

SELECT email, passwd, login_id, full_name
FROM members
WHERE email = 'test@test.com';
UPDATE members
SET email = 'malicious_user_mail@mail.com'
WHERE email = 'test@test.com';


These are the general techniques used. However, based on the combination of various SQL keywords – say "LIKE", "CREATE", "DROP", "WHERE", etc. – one can unleash a variety of attacks.

Built-in Stored Procedure
Another technique in the case of SQL Server is using SQL Server's stored procedure. A default installation of SQL Server contains many stored procedures which a malicious user can easily misuse. One of these is:

xp_cmdshell
Microsoft's SQL Server supports a stored procedure xp_cmdshell that permits what amounts to arbitrary command execution and if this is permitted to the web user, complete compromise of the web server is possible.


If xp_cmdshell is enabled, then a malicious user can run any arbitrary command on the web server. Although access to xp_cmdshell is usually limited to administrative accounts, it's also possible to grant it to lesser users. Not to mention many SQL Server installations run with default user "sa" and blank password!!

How to save web applications from SQL injection attacks?
You can now understand that SQL injection attacks work on many sites easily. There are many programmers who never validate the data properly. If you are a web application developer, then you need to secure your application from such attacks. Following are the proposed solutions by which you can avoid such attacks:
1. Data sanitization: We should remove unwanted characters, say ', ", ;, or -- from the user input. Allowing these characters may enable SQL injection attacks on your website. However, there are times when you may have to allow certain special characters, say ' as in the name O'Reilly.
2. Limit database permissions: We also need to make sure that we give only necessary permission to the user. Allowing unrestricted access to the user may cause trouble as we discussed above, a malicious user can use built-in stored procedures to perform the attacks.
3. Use stored procedures: If possible, use properly formatted stored procedure instead of dynamic queries in your web applications. It will reduce the chance of such attacks.
4. Use quote function: We can use built-in functions like magic_quote in case of PHP to properly format inputs from a user. This will also prevent attacks.

 

Regards,
Deven Goratela
देवेन गोरातेला



Note: This Group is not a Job Searching Group, so please co-operate and dont transfer any kind of job related material across this Group.AnyOne doing so can be banned from the Group
Thanx , Group Co-Ordinators




YAHOO! GROUPS LINKS




[itsdifferent] Open Source Dot Net - The three Musketeers

There are at least three Open Source implementation of Microsoft’s Dot Net platform – Mono, DotGNU and Rotor. Though there are a few other implementations happening at some remote corners of the World Wide Web, these projects are insignificant at least at this point of time.

 

In this article we will review each of these projects and figure out where all of them stand as far as quintessential developers go.

 

All the Open Source projects are miles behind the original Dot Net platform. Hence, this makes it unattractive for a developer working on cutting edge Dot Net platform to switch over to one of these projects for developing applications. However, each of them is developing a niche for themselves.

 

Mono
By far the most controversial and promising of all Open Source Dot Net projects, Mono was originally conceived by Miguel De Icaza of Ximian. Last year the company was acquired by Novell, as a part of one of the many high profile acquisitions which Novell made, as the company reinvented itself as an Open Source/Linux player.

 

It is a well-known secret that the Mono project has support from Microsoft. In fact Miguel de Icaza has gone on record on the fact that he draws a lot of inspiration from the way Microsoft has approached solving the various business issues.

 

Mono project is currently having a version number 1.1.8.

 

Mono is officially an Open Source implementation of Common Language Infrastructure (CLI) of the European Computer Manufactures Association, better known to most as ECMA. The Dot Net standards are actually an ECMA standard.

 

To the best of our belief, Mono does not have a single line of code of Microsoft .Net platform. It is a complete rewrite and is targeting every platform from Linux to Windows.

 

What do you get in Mono?

l  A Common Language Runtime (CLR) that is compatible with the ECMA standard;

l  A C# compiler;

l  A set of class libraries which includes implementations of ADO.net, ASP.net, Winforms, 
      GTk#, Gtk toolkit; and

l  Ancillary tools such as a disassembler, debugger, IDE, etc.

 

The current version is more or less compatible with Microsoft Dot Net framework 1.1. This means that any code that compiles on Microsoft Dot Net will actually run on Mono.

 

Work is in progress at Novell, and several developers are writing code across the globe and even in India.

 

Some of the implementations where work is on include:
 1. C# 2.1 implementation;
 2. AMD64 JIT port;
 3. Visual Basic compiler;
 4. Improved IO-Layer and Internationalization framework;
 5. Gtk# improvement and GUI designer;
 6. Mono Debugger;
 7. Windows.Forms support;
 8. JIT performance work;
 9. Integration of patches that were too big to make it into the 1.0 release;
10. Code Access Security Framework;
11. Continued bug fixing of major and critical bugs;
12. Support for Java and Basic;
13. New XML classes;
14. An OpenGL class called Tao Framework;
15. Cocao support Mac’s OSX; and
16. Web Services enhancements.

 

The final goal of Mono project according to Miguel is to extend the technology beyond the current Microsoft Dot Net framework. The plans, at least on paper, is to create a free platform that is both operating system and language independent.

 

Though there are many exciting new features added to the Mono platform, that adds value to the overall appeal of the platform, it still is largely unstable, especially when you try porting huge C# or VB.net applications from Windows to Linux.

 

But among all available cross platform options, Mono is the most attractive. Unlike others that are supported by a bunch of Open Source developers, Mono has the backing of resurgent corporate giant Novell, which in turn has funding from IBM.

 

DotGNU

DotGNU is getting ready to make a big splash though the current release is version 0.1. However, the project is said to be picking up steam and there may be more action in store in the coming days. It is of interest to many hardcore Open Source developers, since it is in accordance with the GNU project. DotGNU has several projects under its umbrella.

 

DotGNU Portable.NET is a project under the DotGNU meta-project. Its goal is to build a suite of free software tools to build and execute Common Language Infrastructure (CLI) applications. The initial target platform is GNU/Linux, but it has been known to work under Windows, NetBSD, FreeBSD, Solaris, and MacOS X, among others. It also runs on a variety of CPU's including x86, PPC, ARM, Sparc, s390, Alpha, ia-64, and PARISC.

 

DotGNU Portable.NET is focused on compatibility with the ECMA specifications for CLI and extensions as defined by the .NET Framework SDK.

 

Infrastructure

DotGNU Portable.NET contains a runtime engine, C# compiler, and a host of useful development tools, all written in C. This package is generally referred to as "pnet".

 

The C# system library was split off from the main source distribution during the early phases of development to create the "pnetlib" package. It contains implementations of the major C# class libraries, including "mscorlib.dll", "System.dll", "System.Xml.dll", "System.Drawing.dll", "System.Windows.Forms.dll", etc.

 

Treecc is an aspect-oriented programming tool that was written to assist in the development of DotGNU Portable.NET's compiler, "cscc". It complements flex and bison by providing support for abstract syntax tree creation and manipulation Treecc performs most of the housekeeping within the core of the compiler, allowing the programmer to concentrate on the specifics of language implementation.

 

PNetMark is a benchmarking tool for Common Language Runtime (CLR) environments. It is loosely based on the techniques used by CaffeineMark to benchmark Java.

 

The regression test suite for the C# compiler is distributed via CVS as the module "cscctest".

 

Since version 0.4.4 of DotGNU Portable.NET, the cscc compiler has had support for compiling C programs. The companion libc implementation for the C compiler is called "pnetC". The code is based on glibc.

 

The C Sharp Compiler Collection (cscc compiler) is designed so that it can compile to either IL or JVM bytecode. Adding other output formats would be quite easy. There is still some work to be done in assembling JVM bytecode, but most of the support code is in place.

 

The Win form classes are almost done, with a few loose ends to be tied up. Web forms (ASP.net) is still in primitive stages.

 

We found the installation of the Protable.Net a little tedious compared to Mono. There are too many bugs still as there is a lot to be fixed.

 

If you are moving from Windows to Linux attempting Dot Net adventures, then Portable.Net may be an adventure of sorts.

 

Rotor

From the Microsoft web site “Released on 27 March 2002, Rotor provides a free, Shared Source implementation of Microsoft’s Common Language Runtime platform, including source code for C# and Jscript compilers, as well as for the Common Language Infrastructure (CLI) platform itself. It also contains source code for a variety of useful developer tools, including a Common Intermediate Language (CIL) assembler, a disassembler, a debugger, a profiler, and an assembly linker. The Rotor code can be used, modified and re-distributed, for non-commercial experimentation, as a basis for courseware or lab projects, or as a guide for those developing their own commercial ECMA implementations. (The specifications, already ratified as international standards by the European Computer Manufacturers Association (ECMA Standards 242, 334 and 335), are undergoing ISO Fast Track processing.)”

 

Rotor is also there for hobbyists as well as university and commercial researchers. Academic users will be able to integrate it into courses and labs, since Rotor can be used as a foundation for other applications and tools. Additionally, since Rotor can run side-by-side with the commercial .NET Framework SDK, you can easily test the same bit of code on both.

 

Rotor is in a way an attempt by Microsoft to appease the Open Source community.

 

The current targets are Windows and FreeBSD, but ports to other platforms are possible. Rotor relies on a Platform Adaptation Layer (PAL), which is similar to Apache's Portable Runtime (APR) in that it provides an abstraction layer between the runtime and the operating system. In theory, porting Rotor should involve nothing more than porting the PAL.

 

Rotor is fairly stable, and there cannot be many complaints about the documentation. However, it lacks the features, and in many ways this looks like a muted application, with no definite road map to the future. Rotor is strictly for academic purposes.

 

Regards,
Deven Goratela
देवेन गोरातेला



Note: This Group is not a Job Searching Group, so please co-operate and dont transfer any kind of job related material across this Group.AnyOne doing so can be banned from the Group
Thanx , Group Co-Ordinators




YAHOO! GROUPS LINKS




Sunday, April 09, 2006

[itsdifferent] Youngest Web Designer


 
At the age of 1½, ooooops!!!!!
This is a real proud of India, the youngest web designer of the world Ajay Puri is an Indian.
    Ajay started using computer since age of one & a half years.  Ajay can use with ease Microsoft products like Word 2000 , Excel 2000 , PowerPoint 2000 ,  Outlook Express , Internet Explorer , FrontPage 2000 , Access Database .  Ajay can create  web site with all hyper links, thumb nails, background music, fram! es , DHTML , Forms etc using FrontPage 2000 . Ajay can insert pictures
  

--
Regards.
Yours Intimately,
U Know.
"Life is challenge, Meet it"


Note: This Group is not a Job Searching Group, so please co-operate and dont transfer any kind of job related material across this Group.AnyOne doing so can be banned from the Group
Thanx , Group Co-Ordinators




YAHOO! GROUPS LINKS




[itsdifferent] New Yahoo mail BETA review

Hi all,


I used new Yahoo mail which is in BETA and i thought i should share this with you people.


http://www.tarakash.com/tech/2006/04/yahoo-mail-beta.html





Thanks,

Ravi Kamdar






"Talk n' Cafe"




My Blog | Know Me




Tring Tring | SMS: (+91) 94264 02423

Thursday, April 06, 2006

[itsdifferent] Microsoft Makes Virtual Server Free, Releases Linux Plug-ins

http://rcpmag.com/news/article.aspx?editorialsid=7317

--
=======================================================================
Each work has to pass through these stages- RIDICULE, OPPOSITION, and then ACCEPTANCE


Note: This Group is not a Job Searching Group, so please co-operate and dont transfer any kind of job related material across this Group.AnyOne doing so can be banned from the Group
Thanx , Group Co-Ordinators




YAHOO! GROUPS LINKS




Monday, April 03, 2006

[itsdifferent] Romance with Google

Hi All Differents!!

Now romance with Google Romance
http://www.google.com/romance/

Regards,
Rajesh Khatri




           
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com





Note: This Group is not a Job Searching Group, so please co-operate and dont transfer any kind of job related material across this Group.AnyOne doing so can be banned from the Group
Thanx , Group Co-Ordinators




YAHOO! GROUPS LINKS




Wednesday, March 29, 2006

[itsdifferent] FW: The Rise of India ----India Rising..........Too Good.....

Dear All,

Just go through both link of abcnews official website.

no doubt long one, first one is of 7:15 minutes & second one is of 6:25 seconds.

But this is captured from abc news episode, which was specially on India Rising.

 

After listening & watching both videos I am sure that the proud towards India will become 10 times more in your heart.

 

Just just just gr8!. And the biggest thing is it was already published in abc News channel in US.

 

Thanks to Fenil Shah for contributing this kind of good links & news.

 

Jai Hind,

chirag

 

"First they ignore you. Then they laugh at you.

Then they fight you. Then you win."

                                                - Mohandas Gandhi

 

-----Original Message-----
From:]
Sent:
Wednesday, March 29, 2006 7:53 PM
To:
Subject: The Rise of India ----India Rising..........Too Good.....

 

Hi All,

 

India rising....Videos..............

 

Part 1:

 

 

Part 2:

 

 

 



Note: This Group is not a Job Searching Group, so please co-operate and dont transfer any kind of job related material across this Group.AnyOne doing so can be banned from the Group
Thanx , Group Co-Ordinators




SPONSORED LINKS
Computer software spy Automotive computer software Medical computer software
Computer telephony software Computer software online training Computer monitoring software


YAHOO! GROUPS LINKS