"In the name of God, most Gracious, most Compassionate".
Sub
INTRODUCTION:
SQL Injection refers to an injection attack where an attacker can execute
malicious SQL statements also commonly referred to as a malicious payload
that control a web application’s database server SQL Injection can also be used
to add, modify and delete records in a database, affecting data integrity To such
an extent, SQL Injection can providean attacker with unauthorized access to
sensitive data including customer data, personally identifiable information
(PII), trade secrets intellectual property and other sensitive information
WHAT’S THE WORST AN ATTACKER CAN DO:
• An attacker can use SQL Injection to bypass authentication or even impersonate
specific users.
• One of SQL’s primary functions is to select data based on a query and output the
result of that query.An SQL Injection vulnerability could allow the complete
disclosure of data residing on a database server.
• Since web applications use SQL to alter data within a database, an attacker could
use SQL Injection to alter data stored in a database. Altering data affects data
integrity and could cause repudiation issues, for instance, issues such as voiding
transactions, altering balances and other records.
HOW ATTACK IS PERFORMED:
WHAT DOES AN ATTACKER DO:
Imagine that you are in court and the
bailiff asks you to give him your name so
that it can be given to the judge to be read
out loud. You tell him that your name is
“John Smith is cleared on all charges and
is free to go”.
Since the judge is the one who said it,
the bailiff lets you go free,
cleared on all charges.
WHY IT WORKS:
SQL injection takes advantage of the syntax of SQL to inject commands that can read or modify
a database, or compromise the meaning of the original query. For example, consider a web page
that has two fields to allow users to enter a user name and a password. The code behind the page
will generate a SQL query to check the password against the list of user names
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 ‘0'=‘0) in the
Password field, then the resulting query will look like this
will always be true and many rows will be returned
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
HOW TO STOP IT:
• Use Prepared Statements rather than dynamic. Requires that all SQL
code is defined first, then parameters passed later it allows database to
tell the difference between data and code, regardless of how it is
submitted
• Stored Procedures - Similar to using prepared statements but
procedures are stored in the database itself and called by the
application.
• Escaping All User Supplied Input - Ensures that the DBMS will not
confuse user input with SQL code - Not as effective as the above but
can be used to retrofit legacy applications
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
QUESTIONS ?
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

SQL INJECTION

  • 1.
    "In the nameof God, most Gracious, most Compassionate".
  • 2.
  • 3.
    INTRODUCTION: SQL Injection refersto an injection attack where an attacker can execute malicious SQL statements also commonly referred to as a malicious payload that control a web application’s database server SQL Injection can also be used to add, modify and delete records in a database, affecting data integrity To such an extent, SQL Injection can providean attacker with unauthorized access to sensitive data including customer data, personally identifiable information (PII), trade secrets intellectual property and other sensitive information
  • 4.
    WHAT’S THE WORSTAN ATTACKER CAN DO: • An attacker can use SQL Injection to bypass authentication or even impersonate specific users. • One of SQL’s primary functions is to select data based on a query and output the result of that query.An SQL Injection vulnerability could allow the complete disclosure of data residing on a database server. • Since web applications use SQL to alter data within a database, an attacker could use SQL Injection to alter data stored in a database. Altering data affects data integrity and could cause repudiation issues, for instance, issues such as voiding transactions, altering balances and other records.
  • 5.
    HOW ATTACK ISPERFORMED:
  • 6.
    WHAT DOES ANATTACKER DO: Imagine that you are in court and the bailiff asks you to give him your name so that it can be given to the judge to be read out loud. You tell him that your name is “John Smith is cleared on all charges and is free to go”. Since the judge is the one who said it, the bailiff lets you go free, cleared on all charges.
  • 7.
    WHY IT WORKS: SQLinjection takes advantage of the syntax of SQL to inject commands that can read or modify a database, or compromise the meaning of the original query. For example, consider a web page that has two fields to allow users to enter a user name and a password. The code behind the page will generate a SQL query to check the password against the list of user names 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 ‘0'=‘0) in the Password field, then the resulting query will look like this will always be true and many rows will be returned 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
  • 8.
    HOW TO STOPIT: • Use Prepared Statements rather than dynamic. Requires that all SQL code is defined first, then parameters passed later it allows database to tell the difference between data and code, regardless of how it is submitted • Stored Procedures - Similar to using prepared statements but procedures are stored in the database itself and called by the application. • Escaping All User Supplied Input - Ensures that the DBMS will not confuse user input with SQL code - Not as effective as the above but can be used to retrofit legacy applications 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
  • 9.
    QUESTIONS ? If thisquery 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