SlideShare a Scribd company logo
NoSQL, But Even Less Security
      Bryan Sullivan, Senior Security Researcher, Adobe Secure Software Engineering Team




© 2011 Adobe Systems Incorporated. All Rights Reserved.
Agenda




             Eventual Consistency
             REST APIs and CSRF
             NoSQL Injection
             SSJS Injection



© 2011 Adobe Systems Incorporated. All Rights Reserved.
NoSQL databases




© 2011 Adobe Systems Incorporated. All Rights Reserved.
Eric Brewer’s CAP Theorem



       Choose any two:

                                                                        Availability




                                                                                        Partition
                                                          Consistency
                                                                                       Tolerance




© 2011 Adobe Systems Incorporated. All Rights Reserved.
Eventual consistency in social networking




© 2011 Adobe Systems Incorporated. All Rights Reserved.
Writes don’t propagate immediately




© 2011 Adobe Systems Incorporated. All Rights Reserved.
Reading stale data




© 2011 Adobe Systems Incorporated. All Rights Reserved.
Reading stale data – a more serious case




© 2011 Adobe Systems Incorporated. All Rights Reserved.
Agenda




             Eventual Consistency
             REST APIs and CSRF
             NoSQL Injection
             SSJS Injection



© 2011 Adobe Systems Incorporated. All Rights Reserved.
Authentication is unsupported or discouraged

       From the MongoDB documentation
                 “One valid way to run the Mongo database is in a trusted environment,
                  with no security and authentication”
                 This “is the default option and is recommended”


       From the Cassandra Wiki
                 “The default AllowAllAuthenticator approach is essentially pass-through”


       From CouchDB: The Definitive Guide
             The “Admin Party”: Everyone can do everything by default


        Riak
                  No authentication or authorization support
© 2011 Adobe Systems Incorporated. All Rights Reserved.
Port scanning


       If an attacker finds an open port, he’s already won…

                Database                                          Default Port
           MongoDB                                        27017
                                                          28017
                                                          27080
           CouchDB                                        5984
           Hbase                                          9000
           Cassandra                                      9160
           Neo4j                                          7474
           Riak                                           8098


© 2011 Adobe Systems Incorporated. All Rights Reserved.
Port Scanning Demo



© 2011 Adobe Systems Incorporated. All Rights Reserved.
Port scanning


       If an attacker finds an open port, he’s already won…

                Database                                          Default Port
           MongoDB                                        27017
                                                          28017
                                                          27080
           CouchDB                                        5984
           Hbase                                          9000
           Cassandra                                      9160
           Neo4j                                          7474
           Riak                                           8098


© 2011 Adobe Systems Incorporated. All Rights Reserved.
REST document API examples (CouchDB)


           Retrieve a document                            Update a document
      GET /mydb/doc_id HTTP/1.0                           PUT /mydb/doc_id HTTP/1.0
                                                          {
                                                            "album" : "Brothers",
                                                            "artist" : "The Black Keys"
                                                          }


           Create a document                              Delete a document
      POST /mydb/ HTTP/1.0                                DELETE /mydb/doc_id?
        {                                                  rev=12345 HTTP/1.0
          "album" : "Brothers",
          "artist" : "Black Keys"
        }


© 2011 Adobe Systems Incorporated. All Rights Reserved.
Cross-Site Request Forgery (CSRF) firewall bypass




© 2011 Adobe Systems Incorporated. All Rights Reserved.
REST document API examples (CouchDB)


           Retrieve a document                            Update a document
      GET /mydb/doc_id HTTP/1.0                           PUT /mydb/doc_id HTTP/1.0
                                                          {
                                                            "album" : "Brothers",
                                                            "artist" : "The Black Keys"
                                                          }


           Create a document                              Delete a document
      POST /mydb/ HTTP/1.0                                DELETE /mydb/doc_id?
        {                                                  rev=12345 HTTP/1.0
          "album" : "Brothers",
          "artist" : "Black Keys"
        }


© 2011 Adobe Systems Incorporated. All Rights Reserved.
Traditional GET-based CSRF




           <img src="http://nosql:5984/_all_dbs"/>


       Easy to make a potential victim request this URL
       But it doesn’t do the attacker any good
       He needs to get the data back out to himself



© 2011 Adobe Systems Incorporated. All Rights Reserved.
RIA GET-based CSRF


  <script>
                var xhr = new XMLHttpRequest();
                xhr.open('get', 'http://nosql:5984/_all_dbs');
                xhr.send();
  </script>


       Just as easy to make a potential victim request this URL
       Same-origin policy won’t allow this (usually)
       Same issue for PUT and DELETE

© 2011 Adobe Systems Incorporated. All Rights Reserved.
POST-based CSRF


  <form method=post action='http://nosql:5984/db'>
               <input type='hidden' name='{"data"}' value='' />
  </form>
  <script>
               // auto-submit the form
  </script>


       Ok by the same-origin policy!



© 2011 Adobe Systems Incorporated. All Rights Reserved.
REST-CSRF Demo



© 2011 Adobe Systems Incorporated. All Rights Reserved.
POST is all an attacker needs



                                                          Insert arbitrary data


                                        Insert arbitrary script data


                   Execute any REST command from
                           inside the firewall

© 2011 Adobe Systems Incorporated. All Rights Reserved.
Agenda




             Eventual Consistency
             REST APIs and CSRF
             NoSQL Injection
             SSJS Injection



© 2011 Adobe Systems Incorporated. All Rights Reserved.
NoSQL injection


       Most developers believe they don’t have to worry
        about things like this


  “…with MongoDB we are not building queries from
   strings, so traditional SQL injection attacks are not a
   problem.”
                                                          -MongoDB Developer FAQ


       They’re mostly correct

© 2011 Adobe Systems Incorporated. All Rights Reserved.
MongoDB and PHP


       MongoDB expects input in JSON array format
        find( { 'artist' : 'The Black Keys' } )


       In PHP, you do this with associative arrays
        $collection->find(array('artist' => 'The Black Keys'));


       This makes injection attacks difficult
       Like parameterized queries for SQL



© 2011 Adobe Systems Incorporated. All Rights Reserved.
MongoDB and PHP


       You also use associative arrays for query criteria
        find( { 'album_year' : { '$gte' : 2011} } )
        find( { 'artist' : { '$ne' : 'Lady Gaga' } } )


       But PHP will automatically create associative arrays
        from querystring inputs with square brackets
        page.php?param[foo]=bar
        param == array('foo' => 'bar');




© 2011 Adobe Systems Incorporated. All Rights Reserved.
NoSQL Injection Demo



© 2011 Adobe Systems Incorporated. All Rights Reserved.
$where queries


       The $where clause lets you specify script to filter results

        find( { '$where' : 'function() { return artist == "Weezer"; }}' )


        find ( '$where' : 'function() {
                var len = artist.length;
                for (int i=2; i<len; i++) {
                  if (len % I == 0) return false;
                }
                return true; }')



© 2011 Adobe Systems Incorporated. All Rights Reserved.
NoSQL Injection Demo #2



© 2011 Adobe Systems Incorporated. All Rights Reserved.
Agenda




             Eventual Consistency
             REST APIs and CSRF
             NoSQL Injection
             SSJS Injection



© 2011 Adobe Systems Incorporated. All Rights Reserved.
Browser war fallout


    Browser wars have given us incredibly fast and powerful JS engines




                           V8                             WebKit   SpiderMonkey
                                                           Nitro       Rhino


    Used for a lot more than just browsers
    Like NoSQL database engines…

© 2011 Adobe Systems Incorporated. All Rights Reserved.
Server-side JavaScript injection vs. XSS


       Client-side JavaScript injection
        (aka XSS) is #2 on OWASP Top Ten


       Use it to steal authentication cookies
       Impersonate victim
       Create inline phishing sites
       Self-replicating webworms ie Samy


       It’s really bad.
       But server-side is much worse.

© 2011 Adobe Systems Incorporated. All Rights Reserved.
Server-Side Javascript Injection (SSJI)



© 2011 Adobe Systems Incorporated. All Rights Reserved.
SSJI red flags


       $where clauses
             Built with user input
             Injected from querystring manipulation


       eval() clauses


       Map/Reduce


       Stored views/design docs
             More CSRF possibilities here


© 2011 Adobe Systems Incorporated. All Rights Reserved.
Wrapping Up



© 2011 Adobe Systems Incorporated. All Rights Reserved.
Conclusions


  1.           Always use authentication/authorization.
                    Firewalls alone are not sufficient
                    Sometimes you may have to write your own auth code
                    This is unfortunate but better than the alternative


  2.           Be extremely careful with server-side script.
                    Validate, validate, validate
                    Escape input too



© 2011 Adobe Systems Incorporated. All Rights Reserved.
Read my blog: http://blogs.adobe.com/asset
  Email me: brsulliv




© 2011 Adobe Systems Incorporated. All Rights Reserved.
© 2011 Adobe Systems Incorporated. All Rights Reserved.

More Related Content

PDF
深入了解Redis
PDF
Making the case for write-optimized database algorithms / Mark Callaghan (Fac...
PPT
Redis深入浅出
PPTX
Scylla Summit 2018: In-Memory Scylla - When Fast Storage is Not Fast Enough
ODP
Exploiting Your File System to Build Robust & Efficient Workflows
PDF
Алексей Лесовский "Тюнинг Linux для баз данных. "
KEY
High Performance Weibo QCon Beijing 2011
PDF
Setting up mongodb sharded cluster in 30 minutes
深入了解Redis
Making the case for write-optimized database algorithms / Mark Callaghan (Fac...
Redis深入浅出
Scylla Summit 2018: In-Memory Scylla - When Fast Storage is Not Fast Enough
Exploiting Your File System to Build Robust & Efficient Workflows
Алексей Лесовский "Тюнинг Linux для баз данных. "
High Performance Weibo QCon Beijing 2011
Setting up mongodb sharded cluster in 30 minutes

What's hot (20)

PPT
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
PPTX
Introduction to Redis
PPTX
Understanding and tuning WiredTiger, the new high performance database engine...
KEY
微博cache设计谈
PDF
Development to Production with Sharded MongoDB Clusters
PDF
MyRocks introduction and production deployment
PPTX
Performance analysis with_ceph
PPTX
Ужимай и властвуй алгоритмы компрессии в базах данных / Петр Зайцев (Percona)
PDF
Scaling MongoDB in the cloud with Microsoft Azure
PDF
SUSE Storage: Sizing and Performance (Ceph)
PPTX
Build an affordable Cloud Stroage
PDF
Ceph Day Beijing - Our journey to high performance large scale Ceph cluster a...
PPTX
Hadoop Meetup Jan 2019 - Mounting Remote Stores in HDFS
PPTX
Webinar Back to Basics 3 - Introduzione ai Replica Set
PPTX
Ceph - High Performance Without High Costs
PDF
Scaling Cassandra for Big Data
PDF
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
PDF
MyRocks Deep Dive
PDF
Glauber Costa on OSv as NoSQL platform
PPTX
DevOps for ETL processing at scale with MongoDB, Solr, AWS and Chef
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
Introduction to Redis
Understanding and tuning WiredTiger, the new high performance database engine...
微博cache设计谈
Development to Production with Sharded MongoDB Clusters
MyRocks introduction and production deployment
Performance analysis with_ceph
Ужимай и властвуй алгоритмы компрессии в базах данных / Петр Зайцев (Percona)
Scaling MongoDB in the cloud with Microsoft Azure
SUSE Storage: Sizing and Performance (Ceph)
Build an affordable Cloud Stroage
Ceph Day Beijing - Our journey to high performance large scale Ceph cluster a...
Hadoop Meetup Jan 2019 - Mounting Remote Stores in HDFS
Webinar Back to Basics 3 - Introduzione ai Replica Set
Ceph - High Performance Without High Costs
Scaling Cassandra for Big Data
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
MyRocks Deep Dive
Glauber Costa on OSv as NoSQL platform
DevOps for ETL processing at scale with MongoDB, Solr, AWS and Chef
Ad

Viewers also liked (6)

PDF
MongoDB 在盛大大数据量下的应用
PDF
NoSQL误用和常见陷阱分析
PDF
Webinar - Approaching 1 billion documents with MongoDB
KEY
Living with SQL and NoSQL at craigslist, a Pragmatic Approach
PDF
Midas - on-the-fly schema migration tool for MongoDB.
PPTX
Lessons Learned Migrating 2+ Billion Documents at Craigslist
MongoDB 在盛大大数据量下的应用
NoSQL误用和常见陷阱分析
Webinar - Approaching 1 billion documents with MongoDB
Living with SQL and NoSQL at craigslist, a Pragmatic Approach
Midas - on-the-fly schema migration tool for MongoDB.
Lessons Learned Migrating 2+ Billion Documents at Craigslist
Ad

Similar to No sql but even less security (20)

KEY
CouchDB : More Couch
PDF
NoSQL, no security?
PDF
Couch Db
PDF
Using Spring with NoSQL databases (SpringOne China 2012)
PDF
NoSQL - No Security?
PDF
MongoDB: a gentle, friendly overview
PPTX
Couchbase at the academic bisilim, Turkey
KEY
Scotch On The Rocks 2011
PDF
Couchdb
PPTX
An Introduction to Big Data, NoSQL and MongoDB
PDF
Chris Lea - What does NoSQL Mean for You
PPTX
NoSQL with Mongodb
PDF
Post-relational databases: What's wrong with web development?
PPT
Getting Started with MongoDB at Oracle Open World 2012
KEY
CouchDB introduction
PPTX
Nosql Now 2012: MongoDB Use Cases
PPTX
Drop acid
PPTX
Why Organizations are Looking at Alternative Database Technologies – Introduc...
KEY
NOSQL, CouchDB, and the Cloud
PDF
Post-relational databases: What's wrong with web development? v3
CouchDB : More Couch
NoSQL, no security?
Couch Db
Using Spring with NoSQL databases (SpringOne China 2012)
NoSQL - No Security?
MongoDB: a gentle, friendly overview
Couchbase at the academic bisilim, Turkey
Scotch On The Rocks 2011
Couchdb
An Introduction to Big Data, NoSQL and MongoDB
Chris Lea - What does NoSQL Mean for You
NoSQL with Mongodb
Post-relational databases: What's wrong with web development?
Getting Started with MongoDB at Oracle Open World 2012
CouchDB introduction
Nosql Now 2012: MongoDB Use Cases
Drop acid
Why Organizations are Looking at Alternative Database Technologies – Introduc...
NOSQL, CouchDB, and the Cloud
Post-relational databases: What's wrong with web development? v3

More from iammutex (20)

PDF
Scaling Instagram
PPT
8 minute MongoDB tutorial slide
PPT
skip list
PDF
Thoughts on Transaction and Consistency Models
PPTX
Rethink db&tokudb调研测试报告
PDF
redis 适用场景与实现
PDF
Introduction to couchdb
PPTX
What every data programmer needs to know about disks
PDF
Ooredis
PDF
Ooredis
PDF
redis运维之道
PDF
Realtime hadoopsigmod2011
PDF
[译]No sql生态系统
PDF
Couchdb + Membase = Couchbase
PDF
Redis cluster
PDF
Redis cluster
PDF
Hadoop introduction berlin buzzwords 2011
PDF
Couchdb and me
PDF
10 Key MongoDB Performance Indicators
PDF
MongoDB开发应用实践
Scaling Instagram
8 minute MongoDB tutorial slide
skip list
Thoughts on Transaction and Consistency Models
Rethink db&tokudb调研测试报告
redis 适用场景与实现
Introduction to couchdb
What every data programmer needs to know about disks
Ooredis
Ooredis
redis运维之道
Realtime hadoopsigmod2011
[译]No sql生态系统
Couchdb + Membase = Couchbase
Redis cluster
Redis cluster
Hadoop introduction berlin buzzwords 2011
Couchdb and me
10 Key MongoDB Performance Indicators
MongoDB开发应用实践

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Modernizing your data center with Dell and AMD
PPT
Teaching material agriculture food technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Approach and Philosophy of On baking technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
20250228 LYD VKU AI Blended-Learning.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Modernizing your data center with Dell and AMD
Teaching material agriculture food technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
The AUB Centre for AI in Media Proposal.docx
Network Security Unit 5.pdf for BCA BBA.
Understanding_Digital_Forensics_Presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Big Data Technologies - Introduction.pptx
A Presentation on Artificial Intelligence
Building Integrated photovoltaic BIPV_UPV.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Approach and Philosophy of On baking technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Dropbox Q2 2025 Financial Results & Investor Presentation

No sql but even less security

  • 1. NoSQL, But Even Less Security Bryan Sullivan, Senior Security Researcher, Adobe Secure Software Engineering Team © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 2. Agenda Eventual Consistency REST APIs and CSRF NoSQL Injection SSJS Injection © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 3. NoSQL databases © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 4. Eric Brewer’s CAP Theorem Choose any two: Availability Partition Consistency Tolerance © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 5. Eventual consistency in social networking © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 6. Writes don’t propagate immediately © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 7. Reading stale data © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 8. Reading stale data – a more serious case © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 9. Agenda Eventual Consistency REST APIs and CSRF NoSQL Injection SSJS Injection © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 10. Authentication is unsupported or discouraged  From the MongoDB documentation  “One valid way to run the Mongo database is in a trusted environment, with no security and authentication”  This “is the default option and is recommended”  From the Cassandra Wiki  “The default AllowAllAuthenticator approach is essentially pass-through”  From CouchDB: The Definitive Guide  The “Admin Party”: Everyone can do everything by default  Riak  No authentication or authorization support © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 11. Port scanning  If an attacker finds an open port, he’s already won… Database Default Port MongoDB 27017 28017 27080 CouchDB 5984 Hbase 9000 Cassandra 9160 Neo4j 7474 Riak 8098 © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 12. Port Scanning Demo © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 13. Port scanning  If an attacker finds an open port, he’s already won… Database Default Port MongoDB 27017 28017 27080 CouchDB 5984 Hbase 9000 Cassandra 9160 Neo4j 7474 Riak 8098 © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 14. REST document API examples (CouchDB)  Retrieve a document  Update a document GET /mydb/doc_id HTTP/1.0 PUT /mydb/doc_id HTTP/1.0 { "album" : "Brothers", "artist" : "The Black Keys" }  Create a document  Delete a document POST /mydb/ HTTP/1.0 DELETE /mydb/doc_id? { rev=12345 HTTP/1.0 "album" : "Brothers", "artist" : "Black Keys" } © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 15. Cross-Site Request Forgery (CSRF) firewall bypass © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 16. REST document API examples (CouchDB)  Retrieve a document  Update a document GET /mydb/doc_id HTTP/1.0 PUT /mydb/doc_id HTTP/1.0 { "album" : "Brothers", "artist" : "The Black Keys" }  Create a document  Delete a document POST /mydb/ HTTP/1.0 DELETE /mydb/doc_id? { rev=12345 HTTP/1.0 "album" : "Brothers", "artist" : "Black Keys" } © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 17. Traditional GET-based CSRF <img src="http://nosql:5984/_all_dbs"/>  Easy to make a potential victim request this URL  But it doesn’t do the attacker any good  He needs to get the data back out to himself © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 18. RIA GET-based CSRF <script> var xhr = new XMLHttpRequest(); xhr.open('get', 'http://nosql:5984/_all_dbs'); xhr.send(); </script>  Just as easy to make a potential victim request this URL  Same-origin policy won’t allow this (usually)  Same issue for PUT and DELETE © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 19. POST-based CSRF <form method=post action='http://nosql:5984/db'> <input type='hidden' name='{"data"}' value='' /> </form> <script> // auto-submit the form </script>  Ok by the same-origin policy! © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 20. REST-CSRF Demo © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 21. POST is all an attacker needs Insert arbitrary data Insert arbitrary script data Execute any REST command from inside the firewall © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 22. Agenda Eventual Consistency REST APIs and CSRF NoSQL Injection SSJS Injection © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 23. NoSQL injection  Most developers believe they don’t have to worry about things like this “…with MongoDB we are not building queries from strings, so traditional SQL injection attacks are not a problem.” -MongoDB Developer FAQ  They’re mostly correct © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 24. MongoDB and PHP  MongoDB expects input in JSON array format find( { 'artist' : 'The Black Keys' } )  In PHP, you do this with associative arrays $collection->find(array('artist' => 'The Black Keys'));  This makes injection attacks difficult  Like parameterized queries for SQL © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 25. MongoDB and PHP  You also use associative arrays for query criteria find( { 'album_year' : { '$gte' : 2011} } ) find( { 'artist' : { '$ne' : 'Lady Gaga' } } )  But PHP will automatically create associative arrays from querystring inputs with square brackets page.php?param[foo]=bar param == array('foo' => 'bar'); © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 26. NoSQL Injection Demo © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 27. $where queries  The $where clause lets you specify script to filter results find( { '$where' : 'function() { return artist == "Weezer"; }}' ) find ( '$where' : 'function() { var len = artist.length; for (int i=2; i<len; i++) { if (len % I == 0) return false; } return true; }') © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 28. NoSQL Injection Demo #2 © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 29. Agenda Eventual Consistency REST APIs and CSRF NoSQL Injection SSJS Injection © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 30. Browser war fallout  Browser wars have given us incredibly fast and powerful JS engines V8 WebKit SpiderMonkey Nitro Rhino  Used for a lot more than just browsers  Like NoSQL database engines… © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 31. Server-side JavaScript injection vs. XSS  Client-side JavaScript injection (aka XSS) is #2 on OWASP Top Ten  Use it to steal authentication cookies  Impersonate victim  Create inline phishing sites  Self-replicating webworms ie Samy  It’s really bad.  But server-side is much worse. © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 32. Server-Side Javascript Injection (SSJI) © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 33. SSJI red flags  $where clauses  Built with user input  Injected from querystring manipulation  eval() clauses  Map/Reduce  Stored views/design docs  More CSRF possibilities here © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 34. Wrapping Up © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 35. Conclusions 1. Always use authentication/authorization.  Firewalls alone are not sufficient  Sometimes you may have to write your own auth code  This is unfortunate but better than the alternative 2. Be extremely careful with server-side script.  Validate, validate, validate  Escape input too © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 36. Read my blog: http://blogs.adobe.com/asset Email me: brsulliv © 2011 Adobe Systems Incorporated. All Rights Reserved.
  • 37. © 2011 Adobe Systems Incorporated. All Rights Reserved.