{"id":30,"date":"2011-07-01T11:00:24","date_gmt":"2011-07-01T11:00:24","guid":{"rendered":"https:\/\/sqlserverlearner.azurewebsites.net\/2011\/07\/01\/sql-injection\/"},"modified":"2011-07-01T11:00:24","modified_gmt":"2011-07-01T11:00:24","slug":"sql-injection","status":"publish","type":"post","link":"https:\/\/sqlserverlearner.com\/2011\/07\/01\/sql-injection\/","title":{"rendered":"SQL injection"},"content":{"rendered":"
SQL injection<\/strong> SQL Injection Attack is abbreviated as SQLIA<\/strong><\/p>\n Basic example of SQL Injection attack:<\/strong><\/p>\n Lets consider the following query:<\/p>\n [php]var sql = "SELECT * FROM EMPLOYEE WHERE NAME =’"+EmployeeName+"’";[\/php]<\/p>\n EmployeeName is fetched from the users input from the web page.<\/p>\n Now if the user enters “Jhon”, then the query would run great and the details of “Jhon” would be displayed.<\/p>\n But consider user entering the following as input: This would result in the following query:<\/p>\n [php]var sql = "SELECT * FROM EMPLOYEE WHERE NAME =” or ‘1’=’1’";[\/php]<\/p>\n This means the user will be able to tweek the SQL query.<\/p>\n Using such means users can by pass user authentication on the websites. Hence the developers must be careful in order to avoid such Injection attacks.<\/p>\n Now if we pass this as employee name?? This results in the query being built into: The SQL Query that would be executed will be: Here ; says that the first query is completed, and the — says to ignore the remaining part of the query.<\/p>\n So three queries are executed here: The following charecters must be checked in the user input and if they are present they have to be rejected:<\/p>\n Downloads: References: SQL injection SQL injection is technique that exploits a security vulnerability using sql code. This happens when the input given by the user is not correctly checked for the vurnerable SQL code and is there by sent to the instance of SQL Server for parsing and execution. This process works by terminating the text and…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[102,103,104,105],"class_list":["post-30","post","type-post","status-publish","format-standard","hentry","category-sql-security","tag-sql-injection-attacks","tag-sql-insertion-attacks","tag-sql-security","tag-types-of-sql-injection-attacks"],"_links":{"self":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/comments?post=30"}],"version-history":[{"count":0,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/30\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/media?parent=30"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/categories?post=30"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/tags?post=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\nSQL injection is technique that exploits a security vulnerability using sql code.
\nThis happens when the input given by the user is not correctly checked for the vurnerable SQL code and is there by sent to the instance of SQL Server for parsing and execution. This process works by terminating the text and by appending a new command.<\/p>\n
\n[php]’ or ‘1’=’1[\/php]<\/p>\n
\n[php]Jhon’; drop table EMPLOYEE–[\/php]<\/p>\n
\n[php]var sql = "SELECT * FROM EMPLOYEE WHERE NAME =’Jhon’; drop table EMPLOYEE–‘";[\/php]<\/p>\n
\n[sql]SELECT * FROM EMPLOYEE WHERE NAME =’Jhon’; drop table EMPLOYEE–‘[\/sql]<\/p>\n
\n[sql]
\nSELECT * FROM EMPLOYEE WHERE NAME =’Jhon’
\ndrop table EMPLOYEE
\n–‘[\/sql]<\/p>\n\n
\n
\nMicrosoft – Source Code Analyzer for SQL Injection<\/a><\/p>\n
\nwiki<\/a>
\nMSDN – SQL Injection<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"