{"id":864,"date":"2020-12-20T11:57:11","date_gmt":"2020-12-20T11:57:11","guid":{"rendered":"http:\/\/nitk.acm.org\/blog\/?p=864"},"modified":"2020-12-20T11:57:11","modified_gmt":"2020-12-20T11:57:11","slug":"is-your-data-really-safe","status":"publish","type":"post","link":"https:\/\/nitk.acm.org\/blog\/2020\/12\/20\/is-your-data-really-safe\/","title":{"rendered":"Is Your Data Really Safe?"},"content":{"rendered":"\n<p>Do you really believe your data is safe?<br>Here is an example of a severe security breach that will make you think otherwise:<\/p>\n\n\n\n<p>\u201cApril 15th 2016, <strong>11.5 million<\/strong> documents were leaked that had details about financial and attorney\u2013client information for more than <strong>214,488 offshore entities<\/strong>. The Panama Paper leak named <strong>12<\/strong> current or former world leaders; <strong>128 <\/strong>other public officials and politicians; and hundreds of celebrities, businessmen, and other wealthy individuals of over <strong>200 countries<\/strong>.\u201d<\/p>\n\n\n\n<p>This is simply a small example out of thousands of security compromised situations. Still believe your credit and debit card details are safe? What about your personal details like your passport number?<\/p>\n\n\n\n<p>SQL Injection is seen to be once again listed as the top OWASP (Open Web Application Security Project) vulnerability.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SQL Injection<\/h2>\n\n\n\n<p>SQL injection is an attack technique used by hackers to steal data from organizations by targeting web-based applications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Exactly Is It Implemented?<\/h2>\n\n\n\n<p>Hackers take advantage of improper coding styles or insufficient database privileges assigned to users who access this database.<br>SQL injection arises because user input fields &#8211; if not checked correctly at the application &#8211; allow SQL statements to pass through and directly alter or retrieve information from the database.<\/p>\n\n\n\n<p>This allows attackers to tamper with or even <strong>delete existing data<\/strong>, <strong>spoof identity<\/strong>, change administrative rights and in some cases <strong>void transactions<\/strong> and<strong> change balances<\/strong>.<br>In short, someone could steal your identity, all your money in a day and you could pretty much become nonexistent in the world!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Different Types of SQL Injections<\/strong><br><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Blind SQL Injection<\/strong><\/h3>\n\n\n\n<p>A Blind SQL injection attack doesn\u2019t reveal data directly from the database being targeted. The attacker makes different SQL queries that ask the database <strong>TRUE<\/strong> or <strong>FALSE <\/strong>questions. Then they analyze differences in responses between <strong>TRUE<\/strong> and <strong>FALSE<\/strong> statements.<br><br>Blind SQL Injections are often used to build the database schema and get all the data in the database. This is done using brute force techniques and requires many requests but may be automated by attackers using SQL Injection tools.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Union-Based SQL Injection<\/strong><\/h3>\n\n\n\n<p>It is the most popular type of SQL injection. This type of attack uses the<strong> UNION<\/strong> statement to obtain data from the database. The <strong>UNION <\/strong>keyword lets you execute one or more additional <strong>SELECT<\/strong> queries and append the results to the original query.<br><br>In order to implement this attack, some amount of information such as number of columns of the table, data types etc. have to be known beforehand.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Error-Based SQL Injection<\/strong><\/h3>\n\n\n\n<p>An error-based SQL injection is the simplest type. In this attack, we cause an application to show an error to extract the database. Normally, you ask a question to the database, and it responds with an error including the data you asked for.<\/p>\n\n\n\n<p>Let&#8217;s look at a very simple SQL Injection technique.<br>Consider logging in to a site.<\/p>\n\n\n\n<p>The query for doing so would look like this:<br><strong>SELECT * FROM User WHERE username = uname AND password = pass<\/strong><\/p>\n\n\n\n<p>Where &#8216;uname&#8217; is the variable that stores the input you type in the username field, and &#8216;pass&#8217; is the variable that stores the password you type in the password field. The query looks pretty good and will definitely work, but the truth is that it\u2019s ridiculously insecure.<\/p>\n\n\n\n<p>Consider in the username and password field you type in the following:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-regular\"><table class=\"has-subtle-pale-pink-background-color has-background\"><tbody><tr><td><strong>Username<\/strong><\/td><td><em>JakePeralta<\/em><\/td><\/tr><tr><td><strong>Password<\/strong><\/td><td><em>\u2018\u2019  OR  1=1<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>So now, the query ends up looking like this:<br><strong>SELECT * FROM User WHERE username = \u2018JakePeralta\u2019 AND <\/strong><br><strong>password = \u2018\u2019 OR 1=1<\/strong><\/p>\n\n\n\n<p>The statement <strong>1=1<\/strong> is always <strong>TRUE<\/strong>. Since there is a \u2018<strong>OR<\/strong>\u2019 statement, it doesn\u2019t matter if the username or password given is wrong and logging in with wrong credentials ends up as a success.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Not to worry though, sites nowadays are highly resistive to such an attack and have taken major precautions to prevent a variety of different SQL Injection attacks.<\/p>\n\n\n\n<p>Prevention measures include form validation, restricting access and simply writing better code. SQL Injections are seen to be one of the most classic attacks used by attackers to gain sensitive information. <br>Though nowadays all websites are built keeping in mind a variety of threats, highly complex SQL injections can still pose a danger to the security of any website.<\/p>\n\n\n\n<p style=\"font-size:17px\"><strong><em>&#8211; An article by Meghna Kashyap, 3rd Year Information Technology<\/em><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this era of Information Technology where &#8216;Data is the King&#8217;, how secure is your data?<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[25,10],"tags":[232,229,234,228,230,231,235,236,227,233],"class_list":["post-864","post","type-post","status-publish","format-standard","hentry","category-sanganitra","category-tech","tag-blind-sql-injection","tag-data","tag-error-based-sql-injection","tag-injection","tag-leak","tag-owasp","tag-password","tag-secure","tag-sql","tag-union-based-sql-injection"],"_links":{"self":[{"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/posts\/864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/comments?post=864"}],"version-history":[{"count":6,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/posts\/864\/revisions"}],"predecessor-version":[{"id":870,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/posts\/864\/revisions\/870"}],"wp:attachment":[{"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/media?parent=864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/categories?post=864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/tags?post=864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}