SlideShare una empresa de Scribd logo
1 de 48
Descargar para leer sin conexión
DEF CON 2010

               Kuon Ding, Wayne Huang
Agenda
 What is NoSQL
 Types of NoSQL
 Who uses NoSQL?
 NoSQL Architecture
 Security Issues
 Prevention and Detection !?
What is NoSQL
    No SQL technologies do
  not support SQL
    No SQL technologies are
  not vulnerable to threats
  such as SQL injection
What is NoSQL
  One of the most
  commonly accepted
  definitions--Not only
  a SQL
What is NoSQL
  The storage itself is a
  “none-relational
  DBMS”
    Semi-structured
    Schema-less
Types of NoSQL
1. Key-value based
2. Column-based
3. Document-based
4. Graph-based
5. Object-based
6. …
Types of NoSQL
What’s challenging for security
   researchers:
  NoSQL is resembled by its
   diversity
  Within the same family of
   NoSQL, implementations (of the
   client library) differ widely
Why NoSQL
1.  Performance

2.  Scalability
Who’d use NoSQL?
(What’s the impact?)
1.  Cloud computing
   Saas vendors
2.  SNS providers
3.  Portal websites
 Use a mixture of databases
NoSQL Architecture
Web Application     Web Services


          Client Library



          Data Storage
NoSQL Architecture
Web Application       Web Services
                  a



          Client Library



          Data Storage
The Client Library
  No Standards such as ODBC,
   JDBC, ADO, PDO
  H w is it implemented?
  What interfaces does it
   support?
  Query interface?
Why a SQL-like interface?
  Easier for developers
  SQL statements can be
  reused during migration
  from RDBMS to NoSQL
NoSQL Architecture
Web Application       Web Services
                  a



          Client Library



          Data Storage
NoSQL Architecture


     Client Library
NoSQL Architecture




                                                   Old vectors
SQL       ODBC JDBC ADO PDO
                   Client Library
           QL-like impl impl  impl implimpl
key-value




                                                  New vectors
           None-QL impl impl impl impl  impl
          QL-like impl impl impl  impl impl
  column None-QL impl impl impl impl impl
                                           impl
          QL-like impl  impl impl impl impl
document None-QL impl impl impl impl impl
NoSQL Architecture
SQL




                                                     Old vectors
          ODBC JDBC ADO PDO
                    Client Library
            QL-like impl impl impl  impl impl
    graph   None-QL impl impl impl impl impl impl
            QL-like impl impl  impl impl
                                       impl
key-value




                                                    New vectors
            None-QL impl impl impl impl impl
          QL-like impl impl impl  impl impl
  column None-QL impl impl impl impl impl
                                           impl
          QL-like impl  impl impl impl impl
document None-QL impl impl impl impl impl
NoSQL Architecture
SQL




                                                    Old vectors
          ODBC JDBC ADO PDO
            QL-like impl impl impl impl impl
   object           Client Library
            None-QL impl impl impl  impl impl
          QL-like impl impl impl   impl impl
    graph None-QL impl impl impl impl impl
                                            impl
          QL-like impl impl   impl impl impl
key-value None-QL impl impl impl impl




                                                   New vectors
                                         impl
          QL-like impl impl impl   impl impl
  column None-QL impl impl impl impl impl
                                            impl
          QL-like impl   impl impl impl impl
document None-QL impl impl impl impl impl
A Blessing?
In the past:
 Notion of RDBMS matured
 Notion of SQL matured
 SQL implementation standards
   matured ODBC, JDBC, etc
NoSQL Architecture
SQL




                                                    Old vectors
          ODBC JDBC ADO PDO
            QL-like impl impl impl impl impl
   object           Client Library
            None-QL impl impl impl  impl impl
          QL-like impl impl impl   impl impl
    graph None-QL impl impl impl impl impl
                                            impl
          QL-like impl impl   impl impl impl
key-value None-QL impl impl impl impl




                                                   New vectors
                                         impl
          QL-like impl impl impl   impl impl
  column None-QL impl impl impl impl impl
                                            impl
          QL-like impl   impl impl impl impl
document None-QL impl impl impl impl impl
NoSQL Vulnerabilities
 1.  Connection Pollution
 2.  JSON Injection
 3.  View Injection
 4.  Key Bruteforcing
Connection Pollution
Using CouchDB as example
    RESTful
    Cross- Database/ Pool Access
    CouchDB’s Global and DB Handler

    Easier: Handlers are all RESTful
  Ex:
    NoSQL.connect(http://couchDB/_restart”)
Connection Pollution
Using CouchDB as example
    RESTful
    Cross- Database/ Pool Access
    CouchDB’s Global and DB Handler

    Harder: Even when an injection vector exist, crossing DB
     is difficult
      Traditional SQL: ConnectSQL injectionJump DB or table
  Ex:
    NoSQL.connect(“http://”.$Pool.”/DC18/”)
    NoSQL.connect(“http://POOL/”.$Database)
Document-Based Issues:
JSON Injection (CouchDB)
DATA Manipulation!!
   DRY Don’t Repeat Yourself -- leverage
     existing JSON implementations
   If we really need to implement our own
     JSON parser 
   Troublemaker is the String type
     •  Try to use the Collection type such as
         hash and map
   When handing tainted strings, must
     escapeJSON() / unescapeJSON()
Document-based Issue:
View Injection (CouchDB)
Application Manipulation!!
   CouchDB is scriptable--use SpiderMonkey
    as the scripting engine
     These javascripts are called “Views”

   Predefined Views and Temporary Views
     Views are to do map reduce
     Retrieve arbitrary data, modify return
       values to manipulate control flow, etc
Key-Value Based Problem
Key bruteforcing
     It’s schema-free  No schema guessing required
     How to speedup attacks?
         Depends on the implementation of client library &
            architecture
         CHALLENGE Can we make context-sensitive
            attack?

   http://IP/app/action?key=1aD33rSq
   Ex:
     $value = NoSQL.Get($key)
Key-Value Based Security
Key bruteforcing Prevention
  (application-level)
   How data is modeled
   Key Size
   Key Space
   Unpredictable key generation
    algorithm
   Challenge-based (eg. Captchas)
NoSQL vs. WAS
1.  For traditional scanning, how to
     handle unknown error messages?
2.  For blind injections,
  If xQL exist, how to perform logic
   -based blind injections?
  Time-based differential attacks? Based
    on statistical analysis?
NoSQL vs. WAS
3.  Different types of attack payload
   Languages (data and programming)
      JSON injections (data)
      View injections (programming)
   Schema-less
     Attack surface is redefined
     Data is modeled not by SQL but by the
       application
     Much more sensitive to the entry point
4.  Different attack concepts(ex bruteforcing key?)
NoSQL vs. WAS / pentesting
Selecting the payload requires understanding of
    the underlying DB
How to blindly identify URLs involving NoSQL?

  The SQL support will be a subset of
    SQL-92/95
  Features (ex: Unions) that will impact
    parallelization will be removed
NoSQL vs. SCA
1.  Checks by data flow, less problems
2.  Diversity is a big problem
   Unsupported Client Library
3.  In general, a lot easier than WAS
NoSQL vs. WAF
1.  Key bruteforcing is not injection attack
      Block by access threshold


2.  URL integrity check (ex: add token)
     Transparency to the backend
    Ex:
    http://IP/app/action?key=1aD33rSq[HMAC($key)]
3.  Definition of attack payloads
     What is a data (ex JSON) injection?
     What is a view (ex javascript) injection?
Conclusion
  Threat analysis must be conducted under a
    NoSQL mindset
  Modeling of data is done by the application
    logic and not the SQL statements or DB
    schema
   Threat very sensitive to entry point
  Threat types are different
   Key bruteforcing
  Impacts existing security technologies
Comments please!!
We are considering implementing
  static and blackbox scanners for
  NoSQL technologies

Please give us some comments!
NoSQL, no SQL injections?

Más contenido relacionado

La actualidad más candente

Distributed Virtual Transaction Directory Server
Distributed Virtual Transaction Directory ServerDistributed Virtual Transaction Directory Server
Distributed Virtual Transaction Directory Server
LDAPCon
 

La actualidad más candente (20)

CQRS Evolved - CQRS + Akka.NET
CQRS Evolved - CQRS + Akka.NETCQRS Evolved - CQRS + Akka.NET
CQRS Evolved - CQRS + Akka.NET
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017
 
Drupal commerce performance profiling and tunning using loadstorm experiments...
Drupal commerce performance profiling and tunning using loadstorm experiments...Drupal commerce performance profiling and tunning using loadstorm experiments...
Drupal commerce performance profiling and tunning using loadstorm experiments...
 
Altitude SF 2017: Security at the edge
Altitude SF 2017: Security at the edgeAltitude SF 2017: Security at the edge
Altitude SF 2017: Security at the edge
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
 
Elm - Could this be the Future of Web Dev?
Elm - Could this be the Future of Web Dev?Elm - Could this be the Future of Web Dev?
Elm - Could this be the Future of Web Dev?
 
Python & Cassandra - Best Friends
Python & Cassandra - Best FriendsPython & Cassandra - Best Friends
Python & Cassandra - Best Friends
 
Asynchronous programming in ASP.NET
Asynchronous programming in ASP.NETAsynchronous programming in ASP.NET
Asynchronous programming in ASP.NET
 
CQRS
CQRSCQRS
CQRS
 
Scaling with mongo db (with notes)
Scaling with mongo db (with notes)Scaling with mongo db (with notes)
Scaling with mongo db (with notes)
 
Distributed Virtual Transaction Directory Server
Distributed Virtual Transaction Directory ServerDistributed Virtual Transaction Directory Server
Distributed Virtual Transaction Directory Server
 
Data encoding and Metadata for Streams
Data encoding and Metadata for StreamsData encoding and Metadata for Streams
Data encoding and Metadata for Streams
 
Spark Streaming @ Scale (Clicktale)
Spark Streaming @ Scale (Clicktale)Spark Streaming @ Scale (Clicktale)
Spark Streaming @ Scale (Clicktale)
 
RedisConf18 - Writing modular & encapsulated Redis code
RedisConf18 - Writing modular & encapsulated Redis codeRedisConf18 - Writing modular & encapsulated Redis code
RedisConf18 - Writing modular & encapsulated Redis code
 
WebLogic Scripting Tool Overview
WebLogic Scripting Tool OverviewWebLogic Scripting Tool Overview
WebLogic Scripting Tool Overview
 
High Performance Java EE with JCache and CDI
High Performance Java EE with JCache and CDIHigh Performance Java EE with JCache and CDI
High Performance Java EE with JCache and CDI
 
Scale and Throughput @ Clicktale with Akka
Scale and Throughput @ Clicktale with AkkaScale and Throughput @ Clicktale with Akka
Scale and Throughput @ Clicktale with Akka
 
Running MongoDB in the Cloud
Running MongoDB in the CloudRunning MongoDB in the Cloud
Running MongoDB in the Cloud
 
Keeping your Kubernetes Cluster Secure
Keeping your Kubernetes Cluster SecureKeeping your Kubernetes Cluster Secure
Keeping your Kubernetes Cluster Secure
 
Cloud Architecture & Distributed Systems Trivia
Cloud Architecture & Distributed Systems TriviaCloud Architecture & Distributed Systems Trivia
Cloud Architecture & Distributed Systems Trivia
 

Destacado

Hadoop REST API Security with Apache Knox Gateway
Hadoop REST API Security with Apache Knox GatewayHadoop REST API Security with Apache Knox Gateway
Hadoop REST API Security with Apache Knox Gateway
DataWorks Summit
 
An Introduction to Accumulo
An Introduction to AccumuloAn Introduction to Accumulo
An Introduction to Accumulo
Donald Miner
 
Authentication(pswrd,token,certificate,biometric)
Authentication(pswrd,token,certificate,biometric)Authentication(pswrd,token,certificate,biometric)
Authentication(pswrd,token,certificate,biometric)
Ali Raw
 

Destacado (20)

NoSQL Injections in Node.js - The case of MongoDB
NoSQL Injections in Node.js - The case of MongoDBNoSQL Injections in Node.js - The case of MongoDB
NoSQL Injections in Node.js - The case of MongoDB
 
SQL or NoSQL, that is the question!
SQL or NoSQL, that is the question!SQL or NoSQL, that is the question!
SQL or NoSQL, that is the question!
 
Hadoop REST API Security with Apache Knox Gateway
Hadoop REST API Security with Apache Knox GatewayHadoop REST API Security with Apache Knox Gateway
Hadoop REST API Security with Apache Knox Gateway
 
hacking with node.JS
hacking with node.JShacking with node.JS
hacking with node.JS
 
Security Challenges in Node.js
Security Challenges in Node.jsSecurity Challenges in Node.js
Security Challenges in Node.js
 
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injectionStHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
StHack 2013 - Florian "@agixid" Gaultier No SQL injection but NoSQL injection
 
Securing Hadoop's REST APIs with Apache Knox Gateway Hadoop Summit June 6th, ...
Securing Hadoop's REST APIs with Apache Knox Gateway Hadoop Summit June 6th, ...Securing Hadoop's REST APIs with Apache Knox Gateway Hadoop Summit June 6th, ...
Securing Hadoop's REST APIs with Apache Knox Gateway Hadoop Summit June 6th, ...
 
Discover Enterprise Security Features in Hortonworks Data Platform 2.1: Apach...
Discover Enterprise Security Features in Hortonworks Data Platform 2.1: Apach...Discover Enterprise Security Features in Hortonworks Data Platform 2.1: Apach...
Discover Enterprise Security Features in Hortonworks Data Platform 2.1: Apach...
 
Web Application Security 101 - 06 Authentication
Web Application Security 101 - 06 AuthenticationWeb Application Security 101 - 06 Authentication
Web Application Security 101 - 06 Authentication
 
Pentesting with Metasploit
Pentesting with MetasploitPentesting with Metasploit
Pentesting with Metasploit
 
Hadoop Security: Overview
Hadoop Security: OverviewHadoop Security: Overview
Hadoop Security: Overview
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introduction
 
Hadoop Security Today & Tomorrow with Apache Knox
Hadoop Security Today & Tomorrow with Apache KnoxHadoop Security Today & Tomorrow with Apache Knox
Hadoop Security Today & Tomorrow with Apache Knox
 
Physical Penetration Testing - RootedCON 2015
Physical Penetration Testing - RootedCON 2015Physical Penetration Testing - RootedCON 2015
Physical Penetration Testing - RootedCON 2015
 
Oracle Database 12c Attack Vectors
Oracle Database 12c Attack VectorsOracle Database 12c Attack Vectors
Oracle Database 12c Attack Vectors
 
An Introduction to Accumulo
An Introduction to AccumuloAn Introduction to Accumulo
An Introduction to Accumulo
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Hdp security overview
Hdp security overview Hdp security overview
Hdp security overview
 
NoSQL databases, the CAP theorem, and the theory of relativity
NoSQL databases, the CAP theorem, and the theory of relativityNoSQL databases, the CAP theorem, and the theory of relativity
NoSQL databases, the CAP theorem, and the theory of relativity
 
Authentication(pswrd,token,certificate,biometric)
Authentication(pswrd,token,certificate,biometric)Authentication(pswrd,token,certificate,biometric)
Authentication(pswrd,token,certificate,biometric)
 

Similar a NoSQL, no SQL injections?

Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»
e-Legion
 
ExceptionTail.com - MongoDB and RabbitMQ in action
ExceptionTail.com - MongoDB and RabbitMQ in actionExceptionTail.com - MongoDB and RabbitMQ in action
ExceptionTail.com - MongoDB and RabbitMQ in action
Sorin Oboroceanu
 
SQL Data Service Overview
SQL Data Service OverviewSQL Data Service Overview
SQL Data Service Overview
Eric Nelson
 

Similar a NoSQL, no SQL injections? (20)

NoSQL for you
NoSQL for youNoSQL for you
NoSQL for you
 
Scala in a wild enterprise
Scala in a wild enterpriseScala in a wild enterprise
Scala in a wild enterprise
 
SFScon18 - Stefano Pampaloni - The SQL revenge
SFScon18 - Stefano Pampaloni - The SQL revengeSFScon18 - Stefano Pampaloni - The SQL revenge
SFScon18 - Stefano Pampaloni - The SQL revenge
 
Sql vs NoSQL-Presentation
 Sql vs NoSQL-Presentation Sql vs NoSQL-Presentation
Sql vs NoSQL-Presentation
 
KSQL Deep Dive - The Open Source Streaming Engine for Apache Kafka
KSQL Deep Dive - The Open Source Streaming Engine for Apache KafkaKSQL Deep Dive - The Open Source Streaming Engine for Apache Kafka
KSQL Deep Dive - The Open Source Streaming Engine for Apache Kafka
 
Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»
 
NoSQL – Beyond the Key-Value Store
NoSQL – Beyond the Key-Value StoreNoSQL – Beyond the Key-Value Store
NoSQL – Beyond the Key-Value Store
 
Methods of NoSQL database systems benchmarking
Methods of NoSQL database systems benchmarkingMethods of NoSQL database systems benchmarking
Methods of NoSQL database systems benchmarking
 
C# Advanced L06-SQL Server+LINQ to SQL
C# Advanced L06-SQL Server+LINQ to SQLC# Advanced L06-SQL Server+LINQ to SQL
C# Advanced L06-SQL Server+LINQ to SQL
 
Survey of High Performance NoSQL Systems
Survey of High Performance NoSQL SystemsSurvey of High Performance NoSQL Systems
Survey of High Performance NoSQL Systems
 
Big Data Day LA 2016/ NoSQL track - Spark And Couchbase: Augmenting The Opera...
Big Data Day LA 2016/ NoSQL track - Spark And Couchbase: Augmenting The Opera...Big Data Day LA 2016/ NoSQL track - Spark And Couchbase: Augmenting The Opera...
Big Data Day LA 2016/ NoSQL track - Spark And Couchbase: Augmenting The Opera...
 
Spark and Couchbase– Augmenting the Operational Database with Spark
Spark and Couchbase– Augmenting the Operational Database with SparkSpark and Couchbase– Augmenting the Operational Database with Spark
Spark and Couchbase– Augmenting the Operational Database with Spark
 
ExceptionTail.com - MongoDB and RabbitMQ in action
ExceptionTail.com - MongoDB and RabbitMQ in actionExceptionTail.com - MongoDB and RabbitMQ in action
ExceptionTail.com - MongoDB and RabbitMQ in action
 
Ideas for Step7 Tools.pptx
Ideas for Step7 Tools.pptxIdeas for Step7 Tools.pptx
Ideas for Step7 Tools.pptx
 
SQL Data Service Overview
SQL Data Service OverviewSQL Data Service Overview
SQL Data Service Overview
 
Kafka Streams vs. KSQL for Stream Processing on top of Apache Kafka
Kafka Streams vs. KSQL for Stream Processing on top of Apache KafkaKafka Streams vs. KSQL for Stream Processing on top of Apache Kafka
Kafka Streams vs. KSQL for Stream Processing on top of Apache Kafka
 
Kai Waehner - KSQL – The Open Source SQL Streaming Engine for Apache Kafka - ...
Kai Waehner - KSQL – The Open Source SQL Streaming Engine for Apache Kafka - ...Kai Waehner - KSQL – The Open Source SQL Streaming Engine for Apache Kafka - ...
Kai Waehner - KSQL – The Open Source SQL Streaming Engine for Apache Kafka - ...
 
Kai Waehner - KSQL – The Open Source SQL Streaming Engine for Apache Kafka - ...
Kai Waehner - KSQL – The Open Source SQL Streaming Engine for Apache Kafka - ...Kai Waehner - KSQL – The Open Source SQL Streaming Engine for Apache Kafka - ...
Kai Waehner - KSQL – The Open Source SQL Streaming Engine for Apache Kafka - ...
 
java database connectivity for java programming
java database connectivity for java programmingjava database connectivity for java programming
java database connectivity for java programming
 
KSQL Intro
KSQL IntroKSQL Intro
KSQL Intro
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

NoSQL, no SQL injections?

  • 1. DEF CON 2010 Kuon Ding, Wayne Huang
  • 2. Agenda  What is NoSQL  Types of NoSQL  Who uses NoSQL?  NoSQL Architecture  Security Issues  Prevention and Detection !?
  • 3. What is NoSQL  No SQL technologies do not support SQL  No SQL technologies are not vulnerable to threats such as SQL injection
  • 4. What is NoSQL  One of the most commonly accepted definitions--Not only a SQL
  • 5. What is NoSQL  The storage itself is a “none-relational DBMS”  Semi-structured  Schema-less
  • 6. Types of NoSQL 1. Key-value based 2. Column-based 3. Document-based 4. Graph-based 5. Object-based 6. …
  • 7. Types of NoSQL What’s challenging for security researchers:   NoSQL is resembled by its diversity   Within the same family of NoSQL, implementations (of the client library) differ widely
  • 8.
  • 10. Who’d use NoSQL? (What’s the impact?) 1.  Cloud computing  Saas vendors 2.  SNS providers 3.  Portal websites  Use a mixture of databases
  • 11.
  • 12. NoSQL Architecture Web Application Web Services Client Library Data Storage
  • 13. NoSQL Architecture Web Application Web Services a Client Library Data Storage
  • 14. The Client Library   No Standards such as ODBC, JDBC, ADO, PDO   H w is it implemented?   What interfaces does it support?  Query interface?
  • 15.
  • 16. Why a SQL-like interface?   Easier for developers   SQL statements can be reused during migration from RDBMS to NoSQL
  • 17. NoSQL Architecture Web Application Web Services a Client Library Data Storage
  • 18. NoSQL Architecture Client Library
  • 19. NoSQL Architecture Old vectors SQL ODBC JDBC ADO PDO Client Library QL-like impl impl impl implimpl key-value New vectors None-QL impl impl impl impl impl QL-like impl impl impl impl impl column None-QL impl impl impl impl impl impl QL-like impl impl impl impl impl document None-QL impl impl impl impl impl
  • 20. NoSQL Architecture SQL Old vectors ODBC JDBC ADO PDO Client Library QL-like impl impl impl impl impl graph None-QL impl impl impl impl impl impl QL-like impl impl impl impl impl key-value New vectors None-QL impl impl impl impl impl QL-like impl impl impl impl impl column None-QL impl impl impl impl impl impl QL-like impl impl impl impl impl document None-QL impl impl impl impl impl
  • 21. NoSQL Architecture SQL Old vectors ODBC JDBC ADO PDO QL-like impl impl impl impl impl object Client Library None-QL impl impl impl impl impl QL-like impl impl impl impl impl graph None-QL impl impl impl impl impl impl QL-like impl impl impl impl impl key-value None-QL impl impl impl impl New vectors impl QL-like impl impl impl impl impl column None-QL impl impl impl impl impl impl QL-like impl impl impl impl impl document None-QL impl impl impl impl impl
  • 22. A Blessing? In the past:  Notion of RDBMS matured  Notion of SQL matured  SQL implementation standards matured ODBC, JDBC, etc
  • 23.
  • 24.
  • 25.
  • 26. NoSQL Architecture SQL Old vectors ODBC JDBC ADO PDO QL-like impl impl impl impl impl object Client Library None-QL impl impl impl impl impl QL-like impl impl impl impl impl graph None-QL impl impl impl impl impl impl QL-like impl impl impl impl impl key-value None-QL impl impl impl impl New vectors impl QL-like impl impl impl impl impl column None-QL impl impl impl impl impl impl QL-like impl impl impl impl impl document None-QL impl impl impl impl impl
  • 27.
  • 28. NoSQL Vulnerabilities 1.  Connection Pollution 2.  JSON Injection 3.  View Injection 4.  Key Bruteforcing
  • 29. Connection Pollution Using CouchDB as example   RESTful   Cross- Database/ Pool Access   CouchDB’s Global and DB Handler   Easier: Handlers are all RESTful Ex:   NoSQL.connect(http://couchDB/_restart”)
  • 30.
  • 31.
  • 32.
  • 33. Connection Pollution Using CouchDB as example   RESTful   Cross- Database/ Pool Access   CouchDB’s Global and DB Handler   Harder: Even when an injection vector exist, crossing DB is difficult   Traditional SQL: ConnectSQL injectionJump DB or table Ex:   NoSQL.connect(“http://”.$Pool.”/DC18/”)   NoSQL.connect(“http://POOL/”.$Database)
  • 34. Document-Based Issues: JSON Injection (CouchDB) DATA Manipulation!!  DRY Don’t Repeat Yourself -- leverage existing JSON implementations  If we really need to implement our own JSON parser  Troublemaker is the String type •  Try to use the Collection type such as hash and map  When handing tainted strings, must escapeJSON() / unescapeJSON()
  • 35. Document-based Issue: View Injection (CouchDB) Application Manipulation!!  CouchDB is scriptable--use SpiderMonkey as the scripting engine  These javascripts are called “Views”  Predefined Views and Temporary Views  Views are to do map reduce  Retrieve arbitrary data, modify return values to manipulate control flow, etc
  • 36.
  • 37.
  • 38. Key-Value Based Problem Key bruteforcing   It’s schema-free  No schema guessing required   How to speedup attacks?   Depends on the implementation of client library & architecture   CHALLENGE Can we make context-sensitive attack? http://IP/app/action?key=1aD33rSq Ex:   $value = NoSQL.Get($key)
  • 39. Key-Value Based Security Key bruteforcing Prevention (application-level)  How data is modeled  Key Size  Key Space  Unpredictable key generation algorithm  Challenge-based (eg. Captchas)
  • 40.
  • 41. NoSQL vs. WAS 1.  For traditional scanning, how to handle unknown error messages? 2.  For blind injections,  If xQL exist, how to perform logic -based blind injections?  Time-based differential attacks? Based on statistical analysis?
  • 42. NoSQL vs. WAS 3.  Different types of attack payload  Languages (data and programming)   JSON injections (data)   View injections (programming)  Schema-less  Attack surface is redefined  Data is modeled not by SQL but by the application  Much more sensitive to the entry point 4.  Different attack concepts(ex bruteforcing key?)
  • 43. NoSQL vs. WAS / pentesting Selecting the payload requires understanding of the underlying DB How to blindly identify URLs involving NoSQL?   The SQL support will be a subset of SQL-92/95   Features (ex: Unions) that will impact parallelization will be removed
  • 44. NoSQL vs. SCA 1.  Checks by data flow, less problems 2.  Diversity is a big problem  Unsupported Client Library 3.  In general, a lot easier than WAS
  • 45. NoSQL vs. WAF 1.  Key bruteforcing is not injection attack   Block by access threshold 2.  URL integrity check (ex: add token)   Transparency to the backend Ex: http://IP/app/action?key=1aD33rSq[HMAC($key)] 3.  Definition of attack payloads   What is a data (ex JSON) injection?   What is a view (ex javascript) injection?
  • 46. Conclusion   Threat analysis must be conducted under a NoSQL mindset   Modeling of data is done by the application logic and not the SQL statements or DB schema   Threat very sensitive to entry point   Threat types are different   Key bruteforcing   Impacts existing security technologies
  • 47. Comments please!! We are considering implementing static and blackbox scanners for NoSQL technologies Please give us some comments!