No SQL! no injection? A talk on the state of NoSQL security



Similar documents
NO SQL! NO INJECTION?

Protecting the Cloud from Inside

NoSQL, But Even Less Security Bryan Sullivan, Senior Security Researcher, Adobe Secure Software Engineering Team

What about MongoDB? can req.body.input 0; var date = new Date(); do {curdate = new Date();} while(curdate-date<10000)

Project 2: Web Security Pitfalls

Hack-proof Your Drupal App. Key Habits of Secure Drupal Coding

REDCap General Security Overview

DIPLOMA IN WEBDEVELOPMENT

Advanced Web Technology 10) XSS, CSRF and SQL Injection 2

SQL Injection. By Artem Kazanstev, ITSO and Alex Beutel, Student

Security Awareness For Website Administrators. State of Illinois Central Management Services Security and Compliance Solutions

Attacking MongoDB. Firstov Mihail

CSCC09F Programming on the Web. Mongo DB

Cyber Security Challenge Australia 2014

Hacking the WordpressEcosystem

NoSQL replacement for SQLite (for Beatstream) Antti-Jussi Kovalainen Seminar OHJ-1860: NoSQL databases

Web applications. Web security: web basics. HTTP requests. URLs. GET request. Myrto Arapinis School of Informatics University of Edinburgh

Hack Proof Your Webapps

CSE598i - Web 2.0 Security OWASP Top 10: The Ten Most Critical Web Application Security Vulnerabilities

SQL Injection for newbie

Why NoSQL? Your database options in the new non- relational world IBM Cloudant 1

SQL Injection. The ability to inject SQL commands into the database engine through an existing application

A SQL Injection : Internal Investigation of Injection, Detection and Prevention of SQL Injection Attacks

Serious Threat. Targets for Attack. Characterization of Attack. SQL Injection 4/9/2010 COMP On August 17, 2009, the United States Justice

Advanced Web Security, Lab

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

Current Data Security Issues of NoSQL Databases

How To Fix A Web Application Security Vulnerability

Nikolay Zaynelov Annual LUG-БГ Meeting nikolay.zaynelov.com

Hacking de aplicaciones Web

SQL Injection Vulnerabilities in Desktop Applications

Server-Side JavaScript Injection Bryan Sullivan, Senior Security Researcher, Adobe Secure Software Engineering Team July 2011

Database Management System Choices. Introduction To Database Systems CSE 373 Spring 2013

Enterprise Application Security Workshop Series

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

EC-Council CAST CENTER FOR ADVANCED SECURITY TRAINING. CAST 619 Advanced SQLi Attacks and Countermeasures. Make The Difference CAST.

SQL Injection Attack Lab

SQL Injection. Slides thanks to Prof. Shmatikov at UT Austin

Integrating Moodle with an external tool

CTF Web Security Training. Engin Kirda

Secure Coding. Code development practice Mitigates basic vulnerabilities. Made by security experts, for non-security experts

ASP.NET MVC Secure Coding 4-Day hands on Course. Course Syllabus

Criteria for web application security check. Version

Is Drupal secure? A high-level perspective on web vulnerabilities, Drupal s solutions, and how to maintain site security

How To Let A Lecturer Know If Someone Is At A Lecture Or If They Are At A Guesthouse

Finding Your Way in Testing Jungle. A Learning Approach to Web Security Testing.

Databases for text storage

Web Application Guidelines

SQL Injection Attack Lab Using Collabtive

Introducing DocumentDB

NoSQL Database Systems and their Security Challenges

EECS 398 Project 2: Classic Web Vulnerabilities

Cracking the Perimeter via Web Application Hacking. Zach Grace, CISSP, CEH January 17, Mega Conference

Testing Web Applications for SQL Injection Sam Shober

Hack-proof Your Drupal App. Key Habits of Secure Drupal Coding

pset 7: C$50 Finance Zamyla Chan

SECURING APACHE : THE BASICS - III

The Top Web Application Attacks: Are you vulnerable?

Defending against XSS,CSRF, and Clickjacking David Bishop

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

MongoDB. Or how I learned to stop worrying and love the database. Mathias Stearn. N*SQL Berlin October 22th, gen

State of The Art: Automated Black Box Web Application Vulnerability Testing. Jason Bau, Elie Bursztein, Divij Gupta, John Mitchell

Understanding Sql Injection

PHP and MongoDB Web Development Beginners Guide by Rubayeet Islam

Intrusion detection for web applications

CS 558 Internet Systems and Technologies

SQL INJECTION ATTACKS By Zelinski Radu, Technical University of Moldova

Perl & NoSQL Focus on MongoDB. Jean-Marie Gouarné jmgdoc@cpan.org

Web Application Report

SQL Injection January 23, 2013

ICTN Enterprise Database Security Issues and Solutions

REDCap Technical Overview

Securing Your Web Application against security vulnerabilities. Ong Khai Wei, IT Specialist, Development Tools (Rational) IBM Software Group

VIDEO intypedia007en LESSON 7: WEB APPLICATION SECURITY - INTRODUCTION TO SQL INJECTION TECHNIQUES. AUTHOR: Chema Alonso

Programming Autodesk PLM 360 Using REST. Doug Redmond Software Engineer, Autodesk

Bayesian Classification for SQL Injection Detection

SERVER-SIDE JAVASCRIPT INJECTION ATTACKING AND DEFENDING NOSQL AND NODE.JS BRYAN SULLIVAN SENIOR SECURITY RESEARCHER, ADOBE SYSTEMS

Security Basics - Lessons From a Paranoid. Stuart Larsen Yahoo! Paranoids - Pentest

Still Aren't Doing. Frank Kim

Development. Resilient Software. Secure and. Mark S. Merkow Lakshmikanth Raghavan. CRC Press. Taylor& Francis Croup. Taylor St Francis Group,

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

Braindumps.C questions

A Review of Web Application Security for Preventing Cyber Crimes

Rational AppScan & Ounce Products

NoSQL web apps. w/ MongoDB, Node.js, AngularJS. Dr. Gerd Jungbluth, NoSQL UG Cologne,

CS 161 Computer Security

Webapps Vulnerability Report

Improving Web Vulnerability Scanning. Daniel Zulla

DNS REBINDING DENIS BARANOV, POSITIVE TECHNOLOGIES

Web application security

Hack Yourself First. Troy troyhunt.com

Web Service Facade for PHP5. Andreas Meyer, Sebastian Böttner, Stefan Marr

(WAPT) Web Application Penetration Testing

APPLICATION SECURITY: FROM WEB TO MOBILE. DIFFERENT VECTORS AND NEW ATTACK

Transcription:

No SQL! no injection? A talk on the state of NoSQL security IBM Cyber Security Center of Excellence Aviv Ron Alexandra Shulman-Peleg Anton Puzanov

Aviv Ron Security Researcher for IBM Cyber Security Center of Excellence at Beer Sheva @aviv_ron Focus on Application Security in the cloud Ongoing research on new and emerging application vulnerabilities for IBM AppScan, Application Security Testing Joined IBM at 2014, prior with Intel for 9 years dressed up as a security researcher when I m not a security researcher 2

3

Who doesn t know Little Bobby Tables http://xkcd.com/327/ 4

Fast forward to 2015 5

Not only SQL According to http://db-engines.com 6

Applications of NoSQL BIG DATA REAL TIME WEB PERFORMANCE Images are under Creative Commons license and are attributed to their creators FLEXIBILITY SCALABILITY 7

It s not that relational databases are bad We are just saying tables are not the solution for EVERYTHING 8

SO no sql, no worries? 9

Not really Introducing NoSQL Injections 10

A look at mongodb db.books.insert({ title: The Hobbit, author: J.R.R. Tolkien }) db.books.find({ title: The Hobbit, author: J.R.R. Tolkien }) array( title => The hobbit, author => J.R.R. Tolkien ); 11

Login Username: Password: username=tolkien&password=hobbit db->logins->find(array( username =>$_POST[ username ], password =>$_POST[ password ])); { username: tolkien, password: hobbit } 12

Login Username: Password: username[$ne]=1&password[$ne]=1 db->logins->find( array( username =>array( $ne => 1), password => array( $ne => 1)); { username: { $ne: 1 }, password: { $ne: 1 } } 13

PHP Parameter pollution db->logins->find( array( $where => function() { return this.price < 100 } )); 14

PHP Parameter pollution db->logins->find( array( $where => function() { return this.price < 100 } )); From PHP documentation: Please make sure that for all special query operators (starting with $) you use single quotes so that PHP doesn't try to replace "$exists" with the value of the variable $exists. 15

Not only in php let s take a look at JavaScript 16

Login Username: Password: username=tolkien&password=hobbit string query = { username: + post_username +, password: + post_password + } { username: tolkien, password: hobbit } 17

Login Username: Password: username=tolkien, $or: [ {}, { a : a&password= } ], $comment: hacked string query = { username: + post_username +, password: + post_password + } { username: tolkien, $or: [ {}, { a : a, password: } ], $comment: hacked } 18

NoSQL Javascript Injection 19

Mongodb map reduce $map = "function() { for (var i = 0; i < this.items.length; i++) { emit(this.name, this.items[i]. $param ); } }"; $reduce = "function(name, sum) { return Array.sum(sum); }"; $opt = "{ out: 'totals' }"; $db->execute("db.stores.mapreduce($map, $reduce, $opt);"); a 20

Attack on map reduce javascript a);}},function(kv) { return 1; }, { out: 'x' });db.injection.insert({success:1});return 1;db.stores.mapReduce(function() { { emit(1,1 21

Attack on map reduce javascript a);}},function(kv) { return 1; }, { out: 'x' });db.injection.insert({success:1});return 1;db.stores.mapReduce(function() { { emit(1,1 db.stores.mapreduce(function() { for (var i = 0; i < this.items.length; i++) { emit(this.name, this.items[i].a); } },function(kv) { return 1; }, { out: 'x' }); db.injection.insert({success:1}); return 1;db.stores.mapReduce(function() { { emit(1,1); } }, function(name, sum) { return Array.sum(sum); }, { out: 'totals' });" 22

Now let s Have some REST 23

CSRF attack on NoSQL REST API 24

CSRF attack on NoSQL REST API 25

Beware of third party API s 26

Defending against risks 27

Defenses Injections Sanitize all user input do not assemble JSON from strings If possible disable Javascript execution on DB else be careful when inserting user input to javascript Beware of $ operators in PHP CSRF Check your HTTP API framework for CSRF protection (NO JSONP, use of random token) General Use automatic tools for application security testing that cover NoSQL vulnerabilities such as IBM AppScan Use of role based access control and the principal of least privilege NoSQL databases suffer from the same security issues their relational siblings do 28

Thank you for attending! 29