SlideShare ist ein Scribd-Unternehmen logo
1 von 15
SQL Injection Attacks

          Tyler Fetters
          Stacy Watts
            3.13.2013
CS586 – Introduction to Databases
    Portland State University
Today‟s Topics
     What is a SQL Injection Attack
     Security in SQL
       How to lock down a dbms
       Best Practices
       Common Mistakes
     SQL Injection Attack Example
     Questions




2
SQL Injection Attack - Definition

     SQL injection consists of the possibility the
     user has to inject fragments of SQL queries in
     Web application input fields.

     If these fields or the resulting SQL query to be
     sent to the database are not properly
     validated, then it might be possible for the
     attacker to access unauthorized data, reverse
     engineer the database structure, or even to
     insert/delete data [1]
3
Security in SQL – dbms Lock Down
     Keep your PostgreSQL version up-to-date
     Network design should include firewalls
     Track user Input
     Analyze the correctness of SQL statements
     Additional security
       SQL Randomization
         Appending random numbers to all statements, and rejecting
          any not containing such numbers
       Black Box testing your solution prior to release
     Third party software options for testing and
     locking
         Examples: SQLMap, V1p3R, Candid

4
Best Practices




5
Security in SQL – Best Practices
     Parameterize all Queries
         Example From Week 7 – Guest Lecture




     Stored Procedures and Permissions
       All code can be implemented using stored procedures
        on the DB
       Use the account with the lowest permissions needed for
        the task
       In PostgreSQL there are the following privileges:
         SELECT (read), INSERT (append), UPDATE
         (write), DELETE, RULE, REFERENCES (foreign key), and
         TRIGGER.
6      Eg. GRANT SELECT ON accounts TO external;
Security in SQL – Best Practices
     Input Validation Checks
       Implement code that ensures correct inputs are
       given.
         Some examples:
             A name input should not contain an “=“ with it
             A zip code should only contain numbers


     Avoid printing error codes directly
       Use Try and Catch Mechanisms
         Within the Catch Provide meaningful error messages to the
          user


7
Security in SQL – Best Practices
     Encrypt Secure Data
       Passwords should be encrypted or hashed not
       stored as text




       What about CC info? Or SSN?


     Data Segregation
       Store secure data in a separate database from non-
       secure data
        Not accessible from outside of the network
8
        Example Bank Teller
Security in SQL – Best Practices
     Keep your database Schema hidden
       Avoid using select *
.
       Use the table and attribute aliases
       Avoid obvious nomenclature and schema
         i.e. User (first_name, last_name, user_name, password)


     Log and Audit you dbms
       Verify users and permissions
         Require high security passwords and passwords be
          updated
       Remove any non-essential/not approved tables
       Helps to find potential threat attempts and prevent
       future attacks
9
Common Mistakes




10
Security in SQL – Common Mistakes
      Turning off the default security configuration
          The idea might be to make input easier for the user by
           allowing any input
          Not a good idea. Know what might happen by turning off a
           security measure before doing so.
      Security through Obscurity
          As long as the machine is connected to the internet and
           responsive, attacks are possible
          “In operational environments, it has been noted that
           applications experience an average of 71 attempts an hour.”
           [3]
      Accessing Tables Directly
          If the information is for viewing, use a view, don‟t expose the
11
           table
Security in SQL – Common Mistakes
      Obvious nomenclature and schema
          Once access is gained even if the schema is protected it might
           be possible to guess User (Name, Password) as a relation.
          Even without, possible to damage with drop table.
      Not checking logs, or performing audits
          No assumptions about data integrity
      User Permissions pitfalls
          Setting user permission tiers too high
          Setting global user permissions for ease of administration
          The user the application uses to connect to the database
           should never be the owner of the objects created in the
           database
      Storing sensitive data without encryption
          Eg: social security number, current location, credit card
           information
12
SQL Injection Attack Example
      Go to the following url and complete the survey
        http://sqlinjection.70sites.com/
      Now we will Run a SQL injection attack


      SQL Injection Attack
        $lastn = stripslashes($lastn);
          Used to remove built in security of “” on „ or “
          Might be done for names like O‟Brian




13
Questions




14
References
      [1] http://en.wikipedia.org/wiki/SQL_injection_attack
      [2] http://wiki.postgresql.org/wiki/Sql_injection
      [3]http://blog.imperva.com/2011/09/sql-injection-by-the-numbers.html
      [4]http://savepoint.blog.br/o-minimo-que-voce-deveria-aprender-para-se-defender-de-ataques-de-injecao-
        de-sql-no-postgresql/

      [5]http://wiki.postgresql.org/wiki/9.1%E7%AC%AC%E4%B8%89%E5%8D%81%E4%B8%80%E7%AB%A0
      [6]https://www.simple-talk.com/sql/learn-sql-server/sql-injection-
       defense-in-depth/
      [7]http://www.postgresql.org/docs/7.2/static/privileges.html
      [8]http://msdn.microsoft.com/en-us/library/ff648339.aspx# paght000002
        _additionalconsiderations
      [9]https://www.simple-talk.com/sql/learn-sql-server/sql-injection-
       defense-in-depth/
      [10]http://www.php.net/manual/en/exception.getmessage.php
      [11]https://www.simple-talk.com/sql/learn-sql-server/sql-injection-defense-in-
        depth/
      [12]http://weblogs.sqlteam.com/jamesw/archive/2011/10/03/a-list-of-sql-best-
15     practices.aspx

Weitere Àhnliche Inhalte

Was ist angesagt?

SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya MorimotoSQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya MorimotoPichaya Morimoto
 
Web Security: SQL Injection
Web Security: SQL InjectionWeb Security: SQL Injection
Web Security: SQL InjectionVortana Say
 
SQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationSQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationRapid Purple
 
seminar report on Sql injection
seminar report on Sql injectionseminar report on Sql injection
seminar report on Sql injectionJawhar Ali
 
SQL Injection
SQL InjectionSQL Injection
SQL InjectionAbhinav Nair
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySandip Chaudhari
 
A Brief Introduction in SQL Injection
A Brief Introduction in SQL InjectionA Brief Introduction in SQL Injection
A Brief Introduction in SQL InjectionSina Manavi
 
Advanced SQL Injection: Attacks
Advanced SQL Injection: Attacks Advanced SQL Injection: Attacks
Advanced SQL Injection: Attacks Nuno Loureiro
 
Advanced SQL Injection
Advanced SQL InjectionAdvanced SQL Injection
Advanced SQL Injectionamiable_indian
 
SQL Injection Tutorial
SQL Injection TutorialSQL Injection Tutorial
SQL Injection TutorialMagno Logan
 
Advanced Sql Injection ENG
Advanced Sql Injection ENGAdvanced Sql Injection ENG
Advanced Sql Injection ENGDmitry Evteev
 
How to identify and prevent SQL injection
How to identify and prevent SQL injection  How to identify and prevent SQL injection
How to identify and prevent SQL injection Eguardian Global Services
 
D:\Technical\Ppt\Sql Injection
D:\Technical\Ppt\Sql InjectionD:\Technical\Ppt\Sql Injection
D:\Technical\Ppt\Sql Injectionavishkarm
 
What is advanced SQL Injection? Infographic
What is advanced SQL Injection? InfographicWhat is advanced SQL Injection? Infographic
What is advanced SQL Injection? InfographicJW CyberNerd
 

Was ist angesagt? (20)

SQL Injection
SQL Injection SQL Injection
SQL Injection
 
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya MorimotoSQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
 
Web Security: SQL Injection
Web Security: SQL InjectionWeb Security: SQL Injection
Web Security: SQL Injection
 
SQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationSQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint Presentation
 
seminar report on Sql injection
seminar report on Sql injectionseminar report on Sql injection
seminar report on Sql injection
 
Sql injection
Sql injectionSql injection
Sql injection
 
SQL Injection
SQL InjectionSQL Injection
SQL Injection
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and Security
 
A Brief Introduction in SQL Injection
A Brief Introduction in SQL InjectionA Brief Introduction in SQL Injection
A Brief Introduction in SQL Injection
 
SQL Injection
SQL InjectionSQL Injection
SQL Injection
 
Advanced SQL Injection: Attacks
Advanced SQL Injection: Attacks Advanced SQL Injection: Attacks
Advanced SQL Injection: Attacks
 
Advanced SQL Injection
Advanced SQL InjectionAdvanced SQL Injection
Advanced SQL Injection
 
SQL Injection Tutorial
SQL Injection TutorialSQL Injection Tutorial
SQL Injection Tutorial
 
Sql injection
Sql injectionSql injection
Sql injection
 
Advanced Sql Injection ENG
Advanced Sql Injection ENGAdvanced Sql Injection ENG
Advanced Sql Injection ENG
 
How to identify and prevent SQL injection
How to identify and prevent SQL injection  How to identify and prevent SQL injection
How to identify and prevent SQL injection
 
D:\Technical\Ppt\Sql Injection
D:\Technical\Ppt\Sql InjectionD:\Technical\Ppt\Sql Injection
D:\Technical\Ppt\Sql Injection
 
What is advanced SQL Injection? Infographic
What is advanced SQL Injection? InfographicWhat is advanced SQL Injection? Infographic
What is advanced SQL Injection? Infographic
 
SQL Injection Defense in Python
SQL Injection Defense in PythonSQL Injection Defense in Python
SQL Injection Defense in Python
 
Sql injection
Sql injectionSql injection
Sql injection
 

Andere mochten auch

Entropy and denial of service attacks
Entropy and denial of service attacksEntropy and denial of service attacks
Entropy and denial of service attackschris zlatis
 
Sql Injection Attacks Siddhesh
Sql Injection Attacks SiddheshSql Injection Attacks Siddhesh
Sql Injection Attacks SiddheshSiddhesh Bhobe
 
SQL INJECTION
SQL INJECTIONSQL INJECTION
SQL INJECTIONAnoop T
 
Sql injection
Sql injectionSql injection
Sql injectionZidh
 
Sql Injection attacks and prevention
Sql Injection attacks and preventionSql Injection attacks and prevention
Sql Injection attacks and preventionhelloanand
 
SQLMAP Tool Usage - A Heads Up
SQLMAP Tool Usage - A  Heads UpSQLMAP Tool Usage - A  Heads Up
SQLMAP Tool Usage - A Heads UpMindfire Solutions
 
Advanced SQL injection to operating system full control (short version)
Advanced SQL injection to operating system full control (short version)Advanced SQL injection to operating system full control (short version)
Advanced SQL injection to operating system full control (short version)Bernardo Damele A. G.
 
Threat modeling librarian freedom conference
Threat modeling   librarian freedom conferenceThreat modeling   librarian freedom conference
Threat modeling librarian freedom conferenceevacide
 
03. sql and other injection module v17
03. sql and other injection module v1703. sql and other injection module v17
03. sql and other injection module v17Eoin Keary
 
Introduction to SQL Injection
Introduction to SQL InjectionIntroduction to SQL Injection
Introduction to SQL Injectionjpubal
 
Time-Based Blind SQL Injection
Time-Based Blind SQL InjectionTime-Based Blind SQL Injection
Time-Based Blind SQL Injectionmatt_presson
 
Protecting Web Services from DDOS Attack
Protecting Web Services from DDOS AttackProtecting Web Services from DDOS Attack
Protecting Web Services from DDOS AttackPonraj
 
Prevention of SQL Injection Attacks having XML Database
Prevention of SQL Injection Attacks having XML DatabasePrevention of SQL Injection Attacks having XML Database
Prevention of SQL Injection Attacks having XML DatabaseIOSR Journals
 
Devouring Security XML Attack surface and Defences
Devouring Security XML Attack surface and DefencesDevouring Security XML Attack surface and Defences
Devouring Security XML Attack surface and Defencesgmaran23
 
Sql injection with sqlmap
Sql injection with sqlmapSql injection with sqlmap
Sql injection with sqlmapHerman Duarte
 

Andere mochten auch (19)

Entropy and denial of service attacks
Entropy and denial of service attacksEntropy and denial of service attacks
Entropy and denial of service attacks
 
Website attack n defacement n its control measures
Website attack n defacement n its control measures Website attack n defacement n its control measures
Website attack n defacement n its control measures
 
DDOS ATTACKS
DDOS ATTACKSDDOS ATTACKS
DDOS ATTACKS
 
Sql Injection Attacks Siddhesh
Sql Injection Attacks SiddheshSql Injection Attacks Siddhesh
Sql Injection Attacks Siddhesh
 
SQL INJECTION
SQL INJECTIONSQL INJECTION
SQL INJECTION
 
Sql injection
Sql injectionSql injection
Sql injection
 
Sql Injection attacks and prevention
Sql Injection attacks and preventionSql Injection attacks and prevention
Sql Injection attacks and prevention
 
SQLMAP Tool Usage - A Heads Up
SQLMAP Tool Usage - A  Heads UpSQLMAP Tool Usage - A  Heads Up
SQLMAP Tool Usage - A Heads Up
 
Advanced SQL injection to operating system full control (short version)
Advanced SQL injection to operating system full control (short version)Advanced SQL injection to operating system full control (short version)
Advanced SQL injection to operating system full control (short version)
 
Threat modeling librarian freedom conference
Threat modeling   librarian freedom conferenceThreat modeling   librarian freedom conference
Threat modeling librarian freedom conference
 
03. sql and other injection module v17
03. sql and other injection module v1703. sql and other injection module v17
03. sql and other injection module v17
 
SQL injection
SQL injectionSQL injection
SQL injection
 
Introduction to SQL Injection
Introduction to SQL InjectionIntroduction to SQL Injection
Introduction to SQL Injection
 
Sql injection
Sql injectionSql injection
Sql injection
 
Time-Based Blind SQL Injection
Time-Based Blind SQL InjectionTime-Based Blind SQL Injection
Time-Based Blind SQL Injection
 
Protecting Web Services from DDOS Attack
Protecting Web Services from DDOS AttackProtecting Web Services from DDOS Attack
Protecting Web Services from DDOS Attack
 
Prevention of SQL Injection Attacks having XML Database
Prevention of SQL Injection Attacks having XML DatabasePrevention of SQL Injection Attacks having XML Database
Prevention of SQL Injection Attacks having XML Database
 
Devouring Security XML Attack surface and Defences
Devouring Security XML Attack surface and DefencesDevouring Security XML Attack surface and Defences
Devouring Security XML Attack surface and Defences
 
Sql injection with sqlmap
Sql injection with sqlmapSql injection with sqlmap
Sql injection with sqlmap
 

Ähnlich wie SQL Injection Attacks cs586

Hardening Database Server
Hardening Database ServerHardening Database Server
Hardening Database ServerFahri Firdausillah
 
SQLSecurity.ppt
SQLSecurity.pptSQLSecurity.ppt
SQLSecurity.pptCNSHacking
 
SQLSecurity.ppt
SQLSecurity.pptSQLSecurity.ppt
SQLSecurity.pptLokeshK66
 
Sql injections (Basic bypass authentication)
Sql injections (Basic bypass authentication)Sql injections (Basic bypass authentication)
Sql injections (Basic bypass authentication)Ravindra Singh Rathore
 
Modern Data Security for the Enterprises – SQL Server & Azure SQL Database
Modern Data Security for the Enterprises – SQL Server & Azure SQL DatabaseModern Data Security for the Enterprises – SQL Server & Azure SQL Database
Modern Data Security for the Enterprises – SQL Server & Azure SQL DatabaseWinWire Technologies Inc
 
Code injection and green sql
Code injection and green sqlCode injection and green sql
Code injection and green sqlKaustav Sengupta
 
Security For Application Development
Security For Application DevelopmentSecurity For Application Development
Security For Application Development6502programmer
 
Sql server security in an insecure world
Sql server security in an insecure worldSql server security in an insecure world
Sql server security in an insecure worldGianluca Sartori
 
Database Systems Security
Database Systems SecurityDatabase Systems Security
Database Systems Securityamiable_indian
 
SQL Injection and Clickjacking Attack in Web security
SQL Injection and Clickjacking Attack in Web securitySQL Injection and Clickjacking Attack in Web security
SQL Injection and Clickjacking Attack in Web securityMoutasm Tamimi
 
ASP.NET Web Security
ASP.NET Web SecurityASP.NET Web Security
ASP.NET Web SecuritySharePointRadi
 
Secure Software Engineering
Secure Software EngineeringSecure Software Engineering
Secure Software EngineeringRohitha Liyanagama
 
Web security
Web securityWeb security
Web securitydogangcr
 
Understanding and preventing sql injection attacks
Understanding and preventing sql injection attacksUnderstanding and preventing sql injection attacks
Understanding and preventing sql injection attacksKevin Kline
 
Owasp Top 10 2017
Owasp Top 10 2017Owasp Top 10 2017
Owasp Top 10 2017SamsonMuoki
 
Securing you SQL Server - Denver, RMTT
Securing you SQL Server - Denver, RMTTSecuring you SQL Server - Denver, RMTT
Securing you SQL Server - Denver, RMTTGabriel Villa
 

Ähnlich wie SQL Injection Attacks cs586 (20)

Hardening Database Server
Hardening Database ServerHardening Database Server
Hardening Database Server
 
Sql security
Sql securitySql security
Sql security
 
SQLSecurity.ppt
SQLSecurity.pptSQLSecurity.ppt
SQLSecurity.ppt
 
SQLSecurity.ppt
SQLSecurity.pptSQLSecurity.ppt
SQLSecurity.ppt
 
Database security issues
Database security issuesDatabase security issues
Database security issues
 
Sql injections (Basic bypass authentication)
Sql injections (Basic bypass authentication)Sql injections (Basic bypass authentication)
Sql injections (Basic bypass authentication)
 
Modern Data Security for the Enterprises – SQL Server & Azure SQL Database
Modern Data Security for the Enterprises – SQL Server & Azure SQL DatabaseModern Data Security for the Enterprises – SQL Server & Azure SQL Database
Modern Data Security for the Enterprises – SQL Server & Azure SQL Database
 
Greensql2007
Greensql2007Greensql2007
Greensql2007
 
Code injection and green sql
Code injection and green sqlCode injection and green sql
Code injection and green sql
 
Security For Application Development
Security For Application DevelopmentSecurity For Application Development
Security For Application Development
 
SqlSa94
SqlSa94SqlSa94
SqlSa94
 
Sql server security in an insecure world
Sql server security in an insecure worldSql server security in an insecure world
Sql server security in an insecure world
 
Database Systems Security
Database Systems SecurityDatabase Systems Security
Database Systems Security
 
SQL Injection and Clickjacking Attack in Web security
SQL Injection and Clickjacking Attack in Web securitySQL Injection and Clickjacking Attack in Web security
SQL Injection and Clickjacking Attack in Web security
 
ASP.NET Web Security
ASP.NET Web SecurityASP.NET Web Security
ASP.NET Web Security
 
Secure Software Engineering
Secure Software EngineeringSecure Software Engineering
Secure Software Engineering
 
Web security
Web securityWeb security
Web security
 
Understanding and preventing sql injection attacks
Understanding and preventing sql injection attacksUnderstanding and preventing sql injection attacks
Understanding and preventing sql injection attacks
 
Owasp Top 10 2017
Owasp Top 10 2017Owasp Top 10 2017
Owasp Top 10 2017
 
Securing you SQL Server - Denver, RMTT
Securing you SQL Server - Denver, RMTTSecuring you SQL Server - Denver, RMTT
Securing you SQL Server - Denver, RMTT
 

KĂŒrzlich hochgeladen

Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vĂĄzquez
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 

KĂŒrzlich hochgeladen (20)

Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 

SQL Injection Attacks cs586

  • 1. SQL Injection Attacks Tyler Fetters Stacy Watts 3.13.2013 CS586 – Introduction to Databases Portland State University
  • 2. Today‟s Topics  What is a SQL Injection Attack  Security in SQL  How to lock down a dbms  Best Practices  Common Mistakes  SQL Injection Attack Example  Questions 2
  • 3. SQL Injection Attack - Definition  SQL injection consists of the possibility the user has to inject fragments of SQL queries in Web application input fields.  If these fields or the resulting SQL query to be sent to the database are not properly validated, then it might be possible for the attacker to access unauthorized data, reverse engineer the database structure, or even to insert/delete data [1] 3
  • 4. Security in SQL – dbms Lock Down  Keep your PostgreSQL version up-to-date  Network design should include firewalls  Track user Input  Analyze the correctness of SQL statements  Additional security  SQL Randomization  Appending random numbers to all statements, and rejecting any not containing such numbers  Black Box testing your solution prior to release  Third party software options for testing and locking  Examples: SQLMap, V1p3R, Candid 4
  • 6. Security in SQL – Best Practices  Parameterize all Queries  Example From Week 7 – Guest Lecture  Stored Procedures and Permissions  All code can be implemented using stored procedures on the DB  Use the account with the lowest permissions needed for the task  In PostgreSQL there are the following privileges:  SELECT (read), INSERT (append), UPDATE (write), DELETE, RULE, REFERENCES (foreign key), and TRIGGER. 6  Eg. GRANT SELECT ON accounts TO external;
  • 7. Security in SQL – Best Practices  Input Validation Checks  Implement code that ensures correct inputs are given.  Some examples:  A name input should not contain an “=“ with it  A zip code should only contain numbers  Avoid printing error codes directly  Use Try and Catch Mechanisms  Within the Catch Provide meaningful error messages to the user 7
  • 8. Security in SQL – Best Practices  Encrypt Secure Data  Passwords should be encrypted or hashed not stored as text  What about CC info? Or SSN?  Data Segregation  Store secure data in a separate database from non- secure data  Not accessible from outside of the network 8  Example Bank Teller
  • 9. Security in SQL – Best Practices  Keep your database Schema hidden  Avoid using select *
.  Use the table and attribute aliases  Avoid obvious nomenclature and schema  i.e. User (first_name, last_name, user_name, password)  Log and Audit you dbms  Verify users and permissions  Require high security passwords and passwords be updated  Remove any non-essential/not approved tables  Helps to find potential threat attempts and prevent future attacks 9
  • 11. Security in SQL – Common Mistakes  Turning off the default security configuration  The idea might be to make input easier for the user by allowing any input  Not a good idea. Know what might happen by turning off a security measure before doing so.  Security through Obscurity  As long as the machine is connected to the internet and responsive, attacks are possible  “In operational environments, it has been noted that applications experience an average of 71 attempts an hour.” [3]  Accessing Tables Directly  If the information is for viewing, use a view, don‟t expose the 11 table
  • 12. Security in SQL – Common Mistakes  Obvious nomenclature and schema  Once access is gained even if the schema is protected it might be possible to guess User (Name, Password) as a relation.  Even without, possible to damage with drop table.  Not checking logs, or performing audits  No assumptions about data integrity  User Permissions pitfalls  Setting user permission tiers too high  Setting global user permissions for ease of administration  The user the application uses to connect to the database should never be the owner of the objects created in the database  Storing sensitive data without encryption  Eg: social security number, current location, credit card information 12
  • 13. SQL Injection Attack Example  Go to the following url and complete the survey  http://sqlinjection.70sites.com/  Now we will Run a SQL injection attack  SQL Injection Attack  $lastn = stripslashes($lastn);  Used to remove built in security of “” on „ or “  Might be done for names like O‟Brian 13
  • 15. References  [1] http://en.wikipedia.org/wiki/SQL_injection_attack  [2] http://wiki.postgresql.org/wiki/Sql_injection  [3]http://blog.imperva.com/2011/09/sql-injection-by-the-numbers.html  [4]http://savepoint.blog.br/o-minimo-que-voce-deveria-aprender-para-se-defender-de-ataques-de-injecao- de-sql-no-postgresql/  [5]http://wiki.postgresql.org/wiki/9.1%E7%AC%AC%E4%B8%89%E5%8D%81%E4%B8%80%E7%AB%A0  [6]https://www.simple-talk.com/sql/learn-sql-server/sql-injection- defense-in-depth/  [7]http://www.postgresql.org/docs/7.2/static/privileges.html  [8]http://msdn.microsoft.com/en-us/library/ff648339.aspx# paght000002 _additionalconsiderations  [9]https://www.simple-talk.com/sql/learn-sql-server/sql-injection- defense-in-depth/  [10]http://www.php.net/manual/en/exception.getmessage.php  [11]https://www.simple-talk.com/sql/learn-sql-server/sql-injection-defense-in- depth/  [12]http://weblogs.sqlteam.com/jamesw/archive/2011/10/03/a-list-of-sql-best- 15 practices.aspx

Hinweis der Redaktion

  1. Tyler
  2. Tyler
  3. Stacy
  4. Stacy
  5. Tyler
  6. https://www.simple-talk.com/sql/learn-sql-server/sql-injection-defense-in-depth/http://www.postgresql.org/docs/7.2/static/privileges.htmlhttp://msdn.microsoft.com/en-us/library/ff648339.aspx#paght000002_additionalconsiderationsTyler
  7. https://www.simple-talk.com/sql/learn-sql-server/sql-injection-defense-in-depth/http://www.php.net/manual/en/exception.getmessage.phpTyler
  8. https://www.simple-talk.com/sql/learn-sql-server/sql-injection-defense-in-depth/Tyler
  9. http://weblogs.sqlteam.com/jamesw/archive/2011/10/03/a-list-of-sql-best-practices.aspxTyler
  10. Stacy
  11. Stacy
  12. Stacy
  13. Last Name = Fake" OR "a" = "a