Skip to content

brantburnett/N1QlInjection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Overview

SQL Injection is a well known security concern when working with SQL servers. Since Couchbase has added N1QL to the NoSQL environment, how does SQL injection translate to N1QL injection? This simple test application can be used to demonstrate potential N1QL injection attacks.

Instructions

Install Couchbase Server on your local machine, and choose to load the "beer-sample" sample data. Then compile and run the application.

Each tab is preloaded with a different possible attack. These attacks would allow access to data that the developer did not intend. There is a button for each attack, one the unsafe version and the other the safe version. You can easily compare the results to see how the preventative measure works for each attack.

Preventative Measures

  • Use named or positional parameters instead of inserting user input directly into the query
  • If inserted user input directly into the query, escape single quotes in user input strings (') with a pair of single quotes ('')
  • Remove comments from the query and place in code instead (this is an additional layer of protection)
  • Escape N1QL identifiers with ticks and escape ticks in user input with a pair of ticks

About

Example of N1QL injection attack against Couchbase Server 4.0

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages