All Projects → nim4 → Dbshield

nim4 / Dbshield

Licence: mit
Database firewall written in Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Dbshield

Linq2db
Linq to database provider.
Stars: ✭ 2,211 (+256.61%)
Mutual labels:  oracle, database, mysql, postgresql, mariadb, db2
Jooq
jOOQ is the best way to write SQL in Java
Stars: ✭ 4,695 (+657.26%)
Mutual labels:  oracle, database, mysql, postgresql, db2
Symmetric Ds
SymmetricDS is a database and file synchronization solution that is platform-independent, web-enabled, and database agnostic. SymmetricDS was built to make data replication across two to tens of thousands of databases and file systems fast, easy and resilient. We specialize in near real time, bi-directional data replication across large node networks over the WAN or LAN.
Stars: ✭ 450 (-27.42%)
Mutual labels:  oracle, database, mysql, postgresql, db2
Typeorm
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
Stars: ✭ 26,559 (+4183.71%)
Mutual labels:  oracle, database, mysql, postgresql, mariadb
Liquibase
Main Liquibase Source
Stars: ✭ 2,910 (+369.35%)
Mutual labels:  oracle, database, mysql, mariadb, db2
Dbeaver
Free universal database tool and SQL client
Stars: ✭ 23,752 (+3730.97%)
Mutual labels:  oracle, database, mysql, postgresql, db2
Csv2db
The CSV to database command line loader
Stars: ✭ 102 (-83.55%)
Mutual labels:  oracle, database, mysql, postgresql, db2
Sqlprovider
A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
Stars: ✭ 423 (-31.77%)
Mutual labels:  oracle, mysql, postgresql, mariadb
Qxorm
QxOrm library - C++ Qt ORM (Object Relational Mapping) and ODM (Object Document Mapper) library - Official repository
Stars: ✭ 176 (-71.61%)
Mutual labels:  oracle, mysql, postgresql, mariadb
Sharding Method
分表分库的新思路——服务层Sharding框架,全SQL、全数据库兼容,ACID特性与原生数据库一致,能实现RR级别读写分离,无SQL解析性能更高
Stars: ✭ 188 (-69.68%)
Mutual labels:  oracle, mysql, mariadb, db2
Sqlcheck
Automatically identify anti-patterns in SQL queries
Stars: ✭ 2,062 (+232.58%)
Mutual labels:  oracle, database, mysql, postgresql
Obevo
Obevo is a database deployment tool that handles enterprise scale schemas and complexity
Stars: ✭ 192 (-69.03%)
Mutual labels:  oracle, database, postgresql, db2
Fluentmigrator
Fluent migrations framework for .NET
Stars: ✭ 2,636 (+325.16%)
Mutual labels:  oracle, database, mysql, db2
Rom Sql
SQL support for rom-rb
Stars: ✭ 169 (-72.74%)
Mutual labels:  oracle, mysql, postgresql, mariadb
Denodb
MySQL, SQLite, MariaDB, PostgreSQL and MongoDB ORM for Deno
Stars: ✭ 498 (-19.68%)
Mutual labels:  database, mysql, postgresql, mariadb
E Commerce Db
Database schema for e-commerce (webstores) sites.
Stars: ✭ 245 (-60.48%)
Mutual labels:  oracle, mysql, postgresql, db2
Phpmyfaq
phpMyFAQ - Open Source FAQ web application for PHP and MySQL, PostgreSQL and other databases
Stars: ✭ 494 (-20.32%)
Mutual labels:  database, mysql, postgresql, mariadb
Directus
Open-Source Data Platform 🐰 — Directus wraps any SQL database with a real-time GraphQL+REST API and an intuitive app for non-technical users.
Stars: ✭ 13,190 (+2027.42%)
Mutual labels:  oracle, database, mysql, postgresql
Kangaroo
SQL client and admin tool for popular databases
Stars: ✭ 127 (-79.52%)
Mutual labels:  oracle, database, mysql, postgresql
Sqlfiddle3
New version based on vert.x and docker
Stars: ✭ 242 (-60.97%)
Mutual labels:  oracle, database, mysql, postgresql

Linux Windows Go Report Card codecov Dev chat GoDoc MIT licensed

DBShield

Protects your data by inspecting incoming queries from your application server and rejecting abnormal ones.


How it works?

For example, this is how web server normally interacts with database server:

Sample Web Server and DB

By adding DBShield in front of database server we can protect it against abnormal queries. To detect abnormal queries we first run DBShield in learning mode. Learning mode lets any query pass but it records information about it (pattern, username, time and source) into the internal database.

Learning mode

After collecting enough patterns we can run DBShield in protect mode. Protect mode can distinguish abnormal query pattern, user and source and take action based on configurations.

Protect mode


Demo

For demo, we are using sqlmap(automatic SQL injection and database takeover tool) to exploit the SQL injection vulnerability at user.php

In the first scenario, the sqlmap successfully exploits the SQL injection when web application connected directly to the database(MySQL), In the second scenario, we modify the user.php so DBShield gets between the web application and database which will drop the injection attempt and make sqlmap fail.

Demo

Sample Outputs

CLI

$ go run main.go
2016/10/15 16:25:31 [INFO]  Config file: /etc/dbshield.yml
2016/10/15 16:25:31 [INFO]  Internal DB: /tmp/model/10.0.0.21_postgres.db
2016/10/15 16:25:31 [INFO]  Listening: 0.0.0.0:5000
2016/10/15 16:25:31 [INFO]  Backend: postgres (10.0.0.21:5432)
2016/10/15 16:25:31 [INFO]  Protect: true
2016/10/15 16:25:31 [INFO]  Web interface on https://127.0.0.1:8070/
2016/10/15 16:25:33 [INFO]  Connected from: 10.0.0.20:35910
2016/10/15 16:25:33 [INFO]  Connected to: 10.0.0.21:5432
2016/10/15 16:25:33 [INFO]  SSL connection
2016/10/15 16:25:34 [DEBUG] Client handshake done
2016/10/15 16:25:34 [DEBUG] Server handshake done
2016/10/15 16:25:34 [INFO]  User: postgres
2016/10/15 16:25:34 [INFO]  Database: test
2016/10/15 16:25:34 [INFO]  Query: SELECT * FROM stocks where id=-1 or 1=1
2016/10/15 16:25:34 [WARN]  Pattern not found: [53 55 51 52 55 52 50 53 55 51 53 49 115 116 111 99 107 115 53 55 51 53 50 105 100 54 49 52 53 53 55 51 55 57 53 55 52 48 52 53 55 51 55 57 54 49 53 55 51 55 57] (SELECT * FROM stocks where id=-1 or 1=1)
2016/10/15 16:25:34 [WARN]  Dropping connection

Web Interface

Web UI


Installation

Get it

$ go get -u github.com/nim4/DBShield

Then you can see help using "-h" argument:

$ $GOPATH/bin/DBShield -h
DBShield 1.0.0-beta3
Usage of DBShield:
  -a	get list of abnormal queries
  -c file
      config file (default "/etc/dbshield.yml")
  -h	show help
  -k	show parsed config and exit
  -l	get list of captured patterns
  -version
      show version

and run it with your configuration, like:

$ $GOPATH/bin/DBShield -c config.yml

see sample configuration file

⚠️ WARNING: Do NOT use default certificates in production environments!


Supports:

Database Protect SSL
DB2 Yes No
MariaDB Yes Yes
MySQL Yes Yes
Oracle Yes No
Postgres Yes Yes

To Do

(Sorted by priority)

  • Improve documentation
  • Add Microsoft SQL Server
  • Add more command-line arguments
  • Get 90% test coverage
  • Support Oracle SSL
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].