SlideShare a Scribd company logo
Securing Production
Deployments
Jon Day
Solution Architect
Security
threats
best
practices
“The majority of the HTTP attacks were made to PHPMyadmin, a popular
MySQL and MariaDB remote management system. Many web content
management systems, not to mention WordPress, rely on these these
databases. Vulnerable WordPress plugins were also frequently attacked.
Mind you, this was on a system that even in honeypot mode hadn't emitted
a single packet towards the outside world.”
ZDNet - Jan 23rd 2018
Threats
Viruses
Hacker attacks
Software spoofing
Defense
• Do not allow TCP connections to
MariaDB from the Internet
• Configure MariaDB to listen on
a network interface that is only
accessible from the application
• Design your physical network to
connect the app to MariaDB
• Use bind-address to bind to
a specific network interface
• Use your OS’s firewall
• Keep your OS patched
The Internet
Threats
Denial of Service
Attacks created by
overloading application
SQL query
injection attacks
Defense
• Do not run the application
on your MariaDB Server.
• Do not install unnecessary packages
on your MariaDB Server.
– An overloaded application can use
so much memory that MariaDB
could slow or even be killed by the
OS. This is an effective DDoS
attack vector.
– A compromised application or
service can have many serious side
effects
Applications
Threats
• Disgruntled employees
• Mistakes and human error
Defense
• Limit users who have:
– SSH access
– Sudo privileges
– Set the secure_file_priv option to
ensure that users with the FILE
privilege cannot write or read
MariaDB data or important system
files.
• Do not run MariaDB process (mysqld) as
root
• Avoid hostname wildcards (“%”), use
specific host names / IP addresses
Excessive Trust
Threats
• Disgruntled employees
• Mistakes and human error
Defense
• Do not use the MariaDB “root”
user for application access.
• Minimize the privileges granted
to the MariaDB user accounts used
by your applications
– Don’t grant CREATE or
DROP privileges.
– Don’t grant the FILE privilege.
– Don’t grant the SUPER privilege.
– Don’t grant access to the
mysql database
Excessive Trust
MariaDB
Security
Features
Password Validation
Simple_password_check
plugin
Enforce a minimum
password
length and type/number of
characters to be used
External Authentication
Single Sign On is becoming
mandatory in most Enterprises.
PAM-Authentication Plugin
allows using /etc/shadow and any
PAM based authentication like LDAP
Kerberos-Authentication as a
standardized network authentication
protocol is provided GSSAPI based on
UNIX and SSPI based on Windows
Applications
MariaDB PAM Authentication
GSS-API on Linux
• Red Hat
Directory Server
• OpenLDAP
SSPI on Windows
• Active DirectoryKDC Client MariaDB
2
3
4
1
Ticket
request
Service
ticket
Here is my
service ticket,
authenticate me
Client /
server
session
MariaDB Role Based Access Control
DBA
Developer
Sysadmin
Database
Tables
MariaDB 10
Role: DBA
Permissions:
• Update Schema
• View Statistics
• Create Database
Secured Connections
SSL Connections based on
the TLSv1.2 Protocol
Between MariaDB
Connectors and Server
Between MariaDB
Connectors and MaxScale
SSL can also be enabled
for the replication channel
External Authentication
Application control
of data encryption
Based on the AES
(Advanced Encryption
Standard) or DES
(Data Encryption
Standard) algorithm
Encryption for Data in Motion
Data-at-Rest
Encryption
• Everything:
– Tables or tablespaces
– Log files
• Independent of encryption
capabilities of applications
• Based on encryption keys,
key ids, key rotation and
key versioning
Key
Management
Services
• Encryption plugin API offers choice
– Plugin to implement
the data encryption
– Manage encryption Keys
• MariaDB Enterprise options
– Simple Key Management included
– Amazon AWS KMS Plugin included
– Eperi KMS for on premise key
management – optional
Encryption for Data Rest
Attack Protection with MariaDB MaxScale
Database Firewall Denial of Service Attack
Protection
• Connection pooling protects
against connection surges
• Cache the connections from
MaxScale to the database server
• Rate limitation
• Protects against SQL injection
• Prevents unauthorized user
access and data damage
• White-list or Black-list Queries
– Queries that match a set of rules
– Queries matching rules
for specific users
– Queries that match certain
patterns, columns, statement types
• Multiple ordered rules
MariaDB
MaxScale
Security
Features
MariaDB MaxScale Concept
DATABASE
SERVERS
MASTER
SLAVES
Binlog Cache
Insulates client applications
from the complexities
of backend database cluster
Simplify replication
from database
to other databases
CLIENT
PROTOCOL SUPPORT
AUTHENTICATION
PARSING
DATABASE MONITORING
LOAD BALANCING & ROUTING
QUERY TRANSFORMATION & LOGGING
Flexible, easy to
write plug-ins for
Generic Core
MULTI-THREADED
E-POLL BASED
STATELESS
SHARES THE THREAD POOL
Server Overload Protection with MaxScale
• Server overload protection
– Persistent connection pool to backend
database
– Client connection limitation
– DB firewall - limit_queries
MaxScale
Client Client ClientClient
Max Client Connections per Service
Connection pool of configurable size
Variable number of connections
If queries are executed faster than 15 queries in 5
seconds, following queries are blocked for 10 seconds
rule limit_queries deny limit_queries 15 5 10
Network Overload Protection with MaxScale
• Network overload protection
– Max rows limit
– Max result size limit
– DB firewall - limit_queries
MaxScale
Client Client ClientClient
1
3
MaxRowsLimit Filter4
Max Rows Limit = 500
NumRows Returned > MaxRows Limit
NumRows returned = 1000
Query failed: 1141
Error: No rows returned
5
2
Query
QueryIf queries are executed faster than 15 queries in 5
seconds, following queries are blocked for 10 seconds
rule limit_queries deny limit_queries 15 5 10
What is SQL Injection?
• A kind of web application attack, where user-supplied input comes from:
URL – www.app.com?id=1
Forms – email=a@app.com
Other elements – e.g., cookies, HTTP headers
and is manipulated so that a vulnerable application executes SQL commands injected by
attacker.
• Applications vulnerable to SQL injection:
– Incorrect type handling
– Incorrectly filtered escape characters
– Blind SQL injection
– Second order SQL injection
SELECT * from customer WHERE id = ?
User supplied value for id = 5, injected value is string ‘5 OR 1=1’
SELECT * from customer WHERE id = 5 OR 1=1
This will result in application getting access to entire customer
table instead of just the specific customer
What is SQL Injection?
QUERY FAILED: 1141
ERROR: Required
WHERE/HAVING clause is missing
rule safe_select deny
no_where_clause
on_queries select
rule safe_cust_select deny
regex '.*from.*customers.*'
user %app-user@% match
all rules safe_cust_select
safe_select
Maxscale Database Firewall
DATABASE FIREWALL FILTER
SELECT * FROM CUSTOMERS;
MaxScale
Database Servers
1
2
3
Database Firewall Filter
Allow/Block queries that
MATCH A SET OF RULES
MATCH RULES FOR SPECIFIC USERS
MATCH ON
• date/time
• a WHERE clause
• query type
• column match
• a wildcard or regular expression or function name
Protect against SQL injection
Prevent unauthorized data access
Prevent data damage
Function name blocking - New in 2.2
[Connection Service1]
type=service
router=readconnroute
servers=server1
user=maxuser
passwd=maxpwd
filters=MyDBFirewall
[MyDBFirewall]
type=filter
module=dbfwfilter
rules=/home/user/myrules.txt
Query Blocking Example
rule safe_select deny no_where_clause on_queries select
rule safe_customer_select deny regex
'.*from.*customers.*'
user app-user@% match all rules safe_customer_select
safe_select
MaxScale Whitelisting
• Allows only those queries that
• match a set of rules
• match rules for specific users
• match certain patterns
• multiple ordered rules
– Match on
• date/time
• a WHERE clause
• query type
• column match
• a wildcard or regular expression
Data Masking with MaxScale
SELECT Name, creditcardNum, balance
FROM customerTbl
WHERE id=1001
Name creditcardNum balance
---------------------------------------
John Smith xxxxxx9901 1201.07
Database Servers
Client
HIPPA/PCI/GDPR Requirement:
• Selective Data Masking by column
• Full or partial anonymization
– 4448889901 ⇒ xxxxxx9901
• Pseudo-anonymization
– Column values randomized,
however same value in multiple
rows randomizes to same
string
DATABASE NAME,
TABLE NAME CLASSIFIER
MAY BE PROVIDED
• commerceDb.customerTbl.creditcardNum
• customerTbl.creditcardNum
• credicardNum
Pseudo-anonymization - New in 2.2
Best Practices
Summary
Best Practices
USER MANAGEMENT
Use OS permissions to
restrict access
to MariaDB data
and backups
Use strong
passwords
Allow root access to
MariaDB only from local
clients—no
administrative access
over the network
Use a separate
MariaDB user account
for each of your
applications
Use the unix_socket
authentication plugin so
that only the OS root
user can connect as the
MariaDB root user
Allow access
from a minimal
set of IP addresses
Best Practices
ENCRYPTION
Encrypt some
data in the
application
Encrypt data
at rest
Non-key data
Credit card numbers, PII etc
Encrypt data in
transit using SSL
From clients to
MariaDB MaxScale
From clients to MariaDB
Between MariaDB
replicated servers
InnoDB tablespace encryption
InnoDB redo log encryption
Binary log encryption
Best Practices
Using MaxScale
Restrict the
operations
that clients
(applications)
are allowed
to perform
Identify
and flag
potentially
dangerous
queries
Customize
rules about
what’s
allowed and
what’s not
Use MariaDB
MaxScale as
a Database
Firewall
Implement
connection
pooling
capabilities
can protect
against DDoS
attacks
Best Practices
AUDITING
Ensure regulatory
compliance with
robust logging
Use MariaDB
Audit Plugin
Record
connections,
query executions,
and tables
accessed
Use logs for forensic
analysis after an incident
Logging either to a file or
to syslog
MariaDB Security Gets Stronger
All the Time
MariaDB User Community
Quickly
identifies new
threats
Creates
solutions
Reports
vulnerabilities
Contributes
features
Thank you

More Related Content

What's hot (20)

PPTX
Don't Let Your Shoppers Drop; 5 Rules for Today’s eCommerce
DataStax
 
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
PPTX
Making Every Drop Count: How i20 Addresses the Water Crisis with the IoT and ...
DataStax
 
PDF
When Open Source Meets the Enterprise
MariaDB plc
 
PPTX
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
DataStax
 
PPTX
Leveraging ApsaraDB to Deploy Business Data on the Cloud
Oliver Theobald
 
PPTX
Cassandra Community Webinar: MySQL to Cassandra - What I Wish I'd Known
DataStax
 
PDF
Einführung: MariaDB heute und unsere Vision für die Zukunft
MariaDB plc
 
PDF
Database Security Threats - MariaDB Security Best Practices
MariaDB plc
 
PDF
Big Data Analytics with MariaDB ColumnStore
MariaDB plc
 
PPTX
Webinar | Introducing DataStax Enterprise 4.6
DataStax
 
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
PDF
When Open Source Meets the Enterprise
MariaDB plc
 
PPTX
Webinar: Buckle Up: The Future of the Distributed Database is Here - DataStax...
DataStax
 
PPTX
Webinar: ROI on Big Data - RDBMS, NoSQL or Both? A Simple Guide for Knowing H...
DataStax
 
PDF
DataStax Training – Everything you need to become a Cassandra Rockstar
DataStax
 
PPTX
RedisConf18 - The Intelligent Database Proxy
Redis Labs
 
PPTX
Don’t Get Caught in a PCI Pickle: Meet Compliance and Protect Payment Card Da...
DataStax
 
PPTX
Webinar: Get On-Demand Education Anytime, Anywhere with Coursera and DataStax
DataStax
 
PPTX
Transforms Document Management at Scale with Distributed Database Solution wi...
DataStax Academy
 
Don't Let Your Shoppers Drop; 5 Rules for Today’s eCommerce
DataStax
 
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
Making Every Drop Count: How i20 Addresses the Water Crisis with the IoT and ...
DataStax
 
When Open Source Meets the Enterprise
MariaDB plc
 
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
DataStax
 
Leveraging ApsaraDB to Deploy Business Data on the Cloud
Oliver Theobald
 
Cassandra Community Webinar: MySQL to Cassandra - What I Wish I'd Known
DataStax
 
Einführung: MariaDB heute und unsere Vision für die Zukunft
MariaDB plc
 
Database Security Threats - MariaDB Security Best Practices
MariaDB plc
 
Big Data Analytics with MariaDB ColumnStore
MariaDB plc
 
Webinar | Introducing DataStax Enterprise 4.6
DataStax
 
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
When Open Source Meets the Enterprise
MariaDB plc
 
Webinar: Buckle Up: The Future of the Distributed Database is Here - DataStax...
DataStax
 
Webinar: ROI on Big Data - RDBMS, NoSQL or Both? A Simple Guide for Knowing H...
DataStax
 
DataStax Training – Everything you need to become a Cassandra Rockstar
DataStax
 
RedisConf18 - The Intelligent Database Proxy
Redis Labs
 
Don’t Get Caught in a PCI Pickle: Meet Compliance and Protect Payment Card Da...
DataStax
 
Webinar: Get On-Demand Education Anytime, Anywhere with Coursera and DataStax
DataStax
 
Transforms Document Management at Scale with Distributed Database Solution wi...
DataStax Academy
 

Similar to Securing data and preventing data breaches (20)

PDF
Securing data and preventing data breaches
MariaDB plc
 
PDF
Database Security Threats - MariaDB Security Best Practices
MariaDB plc
 
PDF
Database Security Threats - MariaDB Security Best Practices
MariaDB plc
 
PDF
Database Security Threats - MariaDB Security Best Practices
MariaDB plc
 
PDF
Using MariaDB TX and MaxScale to meet GDPR - #OPEN18
Kangaroot
 
PDF
Uso de MariaDB TX y MaxScale para el cumplimiento de GDPR
MariaDB plc
 
PDF
Database Security Threats — MariaDB Security Best Practices
MariaDB plc
 
PDF
MariaDB Security Best Practices
Federico Razzoli
 
PDF
Safety LAMP: data security & agile languages
PostgreSQL Experts, Inc.
 
PDF
MySQL server security
Damien Seguy
 
PDF
MariaDB MaxScale
MariaDB plc
 
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
PDF
MariaDB Server & MySQL Security Essentials 2016
Colin Charles
 
PPTX
DevTalks.ro 2019 What's New in MySQL 8.0 Security
Georgi Kodinov
 
PDF
Meet MariaDB Server 10.1 London MySQL meetup December 2015
Colin Charles
 
PDF
MySQL Security
Mario Beck
 
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
PDF
Better encryption & security with MariaDB 10.1 & MySQL 5.7
Colin Charles
 
PPTX
Percona Live Europe 2018: What's New in MySQL 8.0 Security
Georgi Kodinov
 
PPTX
MySQL Tech Tour 2015 - 5.7 Security
Mark Swarbrick
 
Securing data and preventing data breaches
MariaDB plc
 
Database Security Threats - MariaDB Security Best Practices
MariaDB plc
 
Database Security Threats - MariaDB Security Best Practices
MariaDB plc
 
Database Security Threats - MariaDB Security Best Practices
MariaDB plc
 
Using MariaDB TX and MaxScale to meet GDPR - #OPEN18
Kangaroot
 
Uso de MariaDB TX y MaxScale para el cumplimiento de GDPR
MariaDB plc
 
Database Security Threats — MariaDB Security Best Practices
MariaDB plc
 
MariaDB Security Best Practices
Federico Razzoli
 
Safety LAMP: data security & agile languages
PostgreSQL Experts, Inc.
 
MySQL server security
Damien Seguy
 
MariaDB MaxScale
MariaDB plc
 
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
MariaDB Server & MySQL Security Essentials 2016
Colin Charles
 
DevTalks.ro 2019 What's New in MySQL 8.0 Security
Georgi Kodinov
 
Meet MariaDB Server 10.1 London MySQL meetup December 2015
Colin Charles
 
MySQL Security
Mario Beck
 
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
Better encryption & security with MariaDB 10.1 & MySQL 5.7
Colin Charles
 
Percona Live Europe 2018: What's New in MySQL 8.0 Security
Georgi Kodinov
 
MySQL Tech Tour 2015 - 5.7 Security
Mark Swarbrick
 
Ad

More from MariaDB plc (20)

PDF
MariaDB Berlin Roadshow Slides - 8 April 2025
MariaDB plc
 
PDF
MariaDB München Roadshow - 24 September, 2024
MariaDB plc
 
PDF
MariaDB Paris Roadshow - 19 September 2024
MariaDB plc
 
PDF
MariaDB Amsterdam Roadshow: 19 September, 2024
MariaDB plc
 
PDF
MariaDB Paris Workshop 2023 - MaxScale 23.02.x
MariaDB plc
 
PDF
MariaDB Paris Workshop 2023 - Newpharma
MariaDB plc
 
PDF
MariaDB Paris Workshop 2023 - Cloud
MariaDB plc
 
PDF
MariaDB Paris Workshop 2023 - MariaDB Enterprise
MariaDB plc
 
PDF
MariaDB Paris Workshop 2023 - Performance Optimization
MariaDB plc
 
PDF
MariaDB Paris Workshop 2023 - MaxScale
MariaDB plc
 
PDF
MariaDB Paris Workshop 2023 - novadys presentation
MariaDB plc
 
PDF
MariaDB Paris Workshop 2023 - DARVA presentation
MariaDB plc
 
PDF
MariaDB Tech und Business Update Hamburg 2023 - MariaDB Enterprise Server
MariaDB plc
 
PDF
MariaDB SkySQL Autonome Skalierung, Observability, Cloud-Backup
MariaDB plc
 
PDF
Einführung : MariaDB Tech und Business Update Hamburg 2023
MariaDB plc
 
PDF
Hochverfügbarkeitslösungen mit MariaDB
MariaDB plc
 
PDF
Die Neuheiten in MariaDB Enterprise Server
MariaDB plc
 
PDF
Global Data Replication with Galera for Ansell Guardian®
MariaDB plc
 
PDF
Introducing workload analysis
MariaDB plc
 
PDF
Under the hood: SkySQL monitoring
MariaDB plc
 
MariaDB Berlin Roadshow Slides - 8 April 2025
MariaDB plc
 
MariaDB München Roadshow - 24 September, 2024
MariaDB plc
 
MariaDB Paris Roadshow - 19 September 2024
MariaDB plc
 
MariaDB Amsterdam Roadshow: 19 September, 2024
MariaDB plc
 
MariaDB Paris Workshop 2023 - MaxScale 23.02.x
MariaDB plc
 
MariaDB Paris Workshop 2023 - Newpharma
MariaDB plc
 
MariaDB Paris Workshop 2023 - Cloud
MariaDB plc
 
MariaDB Paris Workshop 2023 - MariaDB Enterprise
MariaDB plc
 
MariaDB Paris Workshop 2023 - Performance Optimization
MariaDB plc
 
MariaDB Paris Workshop 2023 - MaxScale
MariaDB plc
 
MariaDB Paris Workshop 2023 - novadys presentation
MariaDB plc
 
MariaDB Paris Workshop 2023 - DARVA presentation
MariaDB plc
 
MariaDB Tech und Business Update Hamburg 2023 - MariaDB Enterprise Server
MariaDB plc
 
MariaDB SkySQL Autonome Skalierung, Observability, Cloud-Backup
MariaDB plc
 
Einführung : MariaDB Tech und Business Update Hamburg 2023
MariaDB plc
 
Hochverfügbarkeitslösungen mit MariaDB
MariaDB plc
 
Die Neuheiten in MariaDB Enterprise Server
MariaDB plc
 
Global Data Replication with Galera for Ansell Guardian®
MariaDB plc
 
Introducing workload analysis
MariaDB plc
 
Under the hood: SkySQL monitoring
MariaDB plc
 
Ad

Recently uploaded (20)

PPT
dsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasassas2.ppt
UzairAfzal13
 
PPTX
This PowerPoint presentation titled "Data Visualization: Turning Data into In...
HemaDivyaKantamaneni
 
PPTX
原版定制AIM毕业证(澳大利亚音乐学院毕业证书)成绩单底纹防伪如何办理
Taqyea
 
PPT
Data base management system Transactions.ppt
gandhamcharan2006
 
PPTX
materials that are required to used.pptx
drkaran1421
 
PPTX
Pre-Interrogation_Assessment_Presentation.pptx
anjukumari94314
 
PPTX
GEN CHEM ACCURACY AND PRECISION eme.pptx
yeagere932
 
PPTX
Enterprise Architecture and TOGAF Presn
starksolutionsindia
 
PDF
apidays Munich 2025 - Let’s build, debug and test a magic MCP server in Postm...
apidays
 
PPTX
apidays Munich 2025 - Federated API Management and Governance, Vince Baker (D...
apidays
 
PPTX
Learning Tendency Analysis of Scratch Programming Course(Entry Class) for Upp...
ryouta039
 
PDF
apidays Munich 2025 - The life-changing magic of great API docs, Jens Fischer...
apidays
 
PDF
apidays Munich 2025 - Automating Operations Without Reinventing the Wheel, Ma...
apidays
 
PPTX
Data Analysis for Business - make informed decisions, optimize performance, a...
Slidescope
 
PPTX
apidays Munich 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (Aavista Oy)
apidays
 
PPTX
Lecture_9_EPROM_Flash univeristy lecture fall 2022
ssuser5047c5
 
PPTX
Introduction to Artificial Intelligence.pptx
StarToon1
 
PDF
Basotho Satisfaction with Electricity(Statspack)
KatlehoMefane
 
PDF
MusicVideoProjectRubric Animation production music video.pdf
ALBERTIANCASUGA
 
PPTX
Mircosoft azure SQL detailing about how to use SQL with Microsoft Azure.
shrijasheth64
 
dsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasassas2.ppt
UzairAfzal13
 
This PowerPoint presentation titled "Data Visualization: Turning Data into In...
HemaDivyaKantamaneni
 
原版定制AIM毕业证(澳大利亚音乐学院毕业证书)成绩单底纹防伪如何办理
Taqyea
 
Data base management system Transactions.ppt
gandhamcharan2006
 
materials that are required to used.pptx
drkaran1421
 
Pre-Interrogation_Assessment_Presentation.pptx
anjukumari94314
 
GEN CHEM ACCURACY AND PRECISION eme.pptx
yeagere932
 
Enterprise Architecture and TOGAF Presn
starksolutionsindia
 
apidays Munich 2025 - Let’s build, debug and test a magic MCP server in Postm...
apidays
 
apidays Munich 2025 - Federated API Management and Governance, Vince Baker (D...
apidays
 
Learning Tendency Analysis of Scratch Programming Course(Entry Class) for Upp...
ryouta039
 
apidays Munich 2025 - The life-changing magic of great API docs, Jens Fischer...
apidays
 
apidays Munich 2025 - Automating Operations Without Reinventing the Wheel, Ma...
apidays
 
Data Analysis for Business - make informed decisions, optimize performance, a...
Slidescope
 
apidays Munich 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (Aavista Oy)
apidays
 
Lecture_9_EPROM_Flash univeristy lecture fall 2022
ssuser5047c5
 
Introduction to Artificial Intelligence.pptx
StarToon1
 
Basotho Satisfaction with Electricity(Statspack)
KatlehoMefane
 
MusicVideoProjectRubric Animation production music video.pdf
ALBERTIANCASUGA
 
Mircosoft azure SQL detailing about how to use SQL with Microsoft Azure.
shrijasheth64
 

Securing data and preventing data breaches

  • 3. “The majority of the HTTP attacks were made to PHPMyadmin, a popular MySQL and MariaDB remote management system. Many web content management systems, not to mention WordPress, rely on these these databases. Vulnerable WordPress plugins were also frequently attacked. Mind you, this was on a system that even in honeypot mode hadn't emitted a single packet towards the outside world.” ZDNet - Jan 23rd 2018
  • 4. Threats Viruses Hacker attacks Software spoofing Defense • Do not allow TCP connections to MariaDB from the Internet • Configure MariaDB to listen on a network interface that is only accessible from the application • Design your physical network to connect the app to MariaDB • Use bind-address to bind to a specific network interface • Use your OS’s firewall • Keep your OS patched The Internet
  • 5. Threats Denial of Service Attacks created by overloading application SQL query injection attacks Defense • Do not run the application on your MariaDB Server. • Do not install unnecessary packages on your MariaDB Server. – An overloaded application can use so much memory that MariaDB could slow or even be killed by the OS. This is an effective DDoS attack vector. – A compromised application or service can have many serious side effects Applications
  • 6. Threats • Disgruntled employees • Mistakes and human error Defense • Limit users who have: – SSH access – Sudo privileges – Set the secure_file_priv option to ensure that users with the FILE privilege cannot write or read MariaDB data or important system files. • Do not run MariaDB process (mysqld) as root • Avoid hostname wildcards (“%”), use specific host names / IP addresses Excessive Trust
  • 7. Threats • Disgruntled employees • Mistakes and human error Defense • Do not use the MariaDB “root” user for application access. • Minimize the privileges granted to the MariaDB user accounts used by your applications – Don’t grant CREATE or DROP privileges. – Don’t grant the FILE privilege. – Don’t grant the SUPER privilege. – Don’t grant access to the mysql database Excessive Trust
  • 9. Password Validation Simple_password_check plugin Enforce a minimum password length and type/number of characters to be used External Authentication Single Sign On is becoming mandatory in most Enterprises. PAM-Authentication Plugin allows using /etc/shadow and any PAM based authentication like LDAP Kerberos-Authentication as a standardized network authentication protocol is provided GSSAPI based on UNIX and SSPI based on Windows Applications
  • 10. MariaDB PAM Authentication GSS-API on Linux • Red Hat Directory Server • OpenLDAP SSPI on Windows • Active DirectoryKDC Client MariaDB 2 3 4 1 Ticket request Service ticket Here is my service ticket, authenticate me Client / server session
  • 11. MariaDB Role Based Access Control DBA Developer Sysadmin Database Tables MariaDB 10 Role: DBA Permissions: • Update Schema • View Statistics • Create Database
  • 12. Secured Connections SSL Connections based on the TLSv1.2 Protocol Between MariaDB Connectors and Server Between MariaDB Connectors and MaxScale SSL can also be enabled for the replication channel External Authentication Application control of data encryption Based on the AES (Advanced Encryption Standard) or DES (Data Encryption Standard) algorithm Encryption for Data in Motion
  • 13. Data-at-Rest Encryption • Everything: – Tables or tablespaces – Log files • Independent of encryption capabilities of applications • Based on encryption keys, key ids, key rotation and key versioning Key Management Services • Encryption plugin API offers choice – Plugin to implement the data encryption – Manage encryption Keys • MariaDB Enterprise options – Simple Key Management included – Amazon AWS KMS Plugin included – Eperi KMS for on premise key management – optional Encryption for Data Rest
  • 14. Attack Protection with MariaDB MaxScale Database Firewall Denial of Service Attack Protection • Connection pooling protects against connection surges • Cache the connections from MaxScale to the database server • Rate limitation • Protects against SQL injection • Prevents unauthorized user access and data damage • White-list or Black-list Queries – Queries that match a set of rules – Queries matching rules for specific users – Queries that match certain patterns, columns, statement types • Multiple ordered rules
  • 16. MariaDB MaxScale Concept DATABASE SERVERS MASTER SLAVES Binlog Cache Insulates client applications from the complexities of backend database cluster Simplify replication from database to other databases CLIENT PROTOCOL SUPPORT AUTHENTICATION PARSING DATABASE MONITORING LOAD BALANCING & ROUTING QUERY TRANSFORMATION & LOGGING Flexible, easy to write plug-ins for Generic Core MULTI-THREADED E-POLL BASED STATELESS SHARES THE THREAD POOL
  • 17. Server Overload Protection with MaxScale • Server overload protection – Persistent connection pool to backend database – Client connection limitation – DB firewall - limit_queries MaxScale Client Client ClientClient Max Client Connections per Service Connection pool of configurable size Variable number of connections If queries are executed faster than 15 queries in 5 seconds, following queries are blocked for 10 seconds rule limit_queries deny limit_queries 15 5 10
  • 18. Network Overload Protection with MaxScale • Network overload protection – Max rows limit – Max result size limit – DB firewall - limit_queries MaxScale Client Client ClientClient 1 3 MaxRowsLimit Filter4 Max Rows Limit = 500 NumRows Returned > MaxRows Limit NumRows returned = 1000 Query failed: 1141 Error: No rows returned 5 2 Query QueryIf queries are executed faster than 15 queries in 5 seconds, following queries are blocked for 10 seconds rule limit_queries deny limit_queries 15 5 10
  • 19. What is SQL Injection? • A kind of web application attack, where user-supplied input comes from: URL – www.app.com?id=1 Forms – [email protected] Other elements – e.g., cookies, HTTP headers and is manipulated so that a vulnerable application executes SQL commands injected by attacker. • Applications vulnerable to SQL injection: – Incorrect type handling – Incorrectly filtered escape characters – Blind SQL injection – Second order SQL injection SELECT * from customer WHERE id = ? User supplied value for id = 5, injected value is string ‘5 OR 1=1’ SELECT * from customer WHERE id = 5 OR 1=1 This will result in application getting access to entire customer table instead of just the specific customer
  • 20. What is SQL Injection?
  • 21. QUERY FAILED: 1141 ERROR: Required WHERE/HAVING clause is missing rule safe_select deny no_where_clause on_queries select rule safe_cust_select deny regex '.*from.*customers.*' user %app-user@% match all rules safe_cust_select safe_select Maxscale Database Firewall DATABASE FIREWALL FILTER SELECT * FROM CUSTOMERS; MaxScale Database Servers 1 2 3 Database Firewall Filter Allow/Block queries that MATCH A SET OF RULES MATCH RULES FOR SPECIFIC USERS MATCH ON • date/time • a WHERE clause • query type • column match • a wildcard or regular expression or function name Protect against SQL injection Prevent unauthorized data access Prevent data damage Function name blocking - New in 2.2
  • 22. [Connection Service1] type=service router=readconnroute servers=server1 user=maxuser passwd=maxpwd filters=MyDBFirewall [MyDBFirewall] type=filter module=dbfwfilter rules=/home/user/myrules.txt Query Blocking Example rule safe_select deny no_where_clause on_queries select rule safe_customer_select deny regex '.*from.*customers.*' user app-user@% match all rules safe_customer_select safe_select
  • 23. MaxScale Whitelisting • Allows only those queries that • match a set of rules • match rules for specific users • match certain patterns • multiple ordered rules – Match on • date/time • a WHERE clause • query type • column match • a wildcard or regular expression
  • 24. Data Masking with MaxScale SELECT Name, creditcardNum, balance FROM customerTbl WHERE id=1001 Name creditcardNum balance --------------------------------------- John Smith xxxxxx9901 1201.07 Database Servers Client HIPPA/PCI/GDPR Requirement: • Selective Data Masking by column • Full or partial anonymization – 4448889901 ⇒ xxxxxx9901 • Pseudo-anonymization – Column values randomized, however same value in multiple rows randomizes to same string DATABASE NAME, TABLE NAME CLASSIFIER MAY BE PROVIDED • commerceDb.customerTbl.creditcardNum • customerTbl.creditcardNum • credicardNum Pseudo-anonymization - New in 2.2
  • 26. Best Practices USER MANAGEMENT Use OS permissions to restrict access to MariaDB data and backups Use strong passwords Allow root access to MariaDB only from local clients—no administrative access over the network Use a separate MariaDB user account for each of your applications Use the unix_socket authentication plugin so that only the OS root user can connect as the MariaDB root user Allow access from a minimal set of IP addresses
  • 27. Best Practices ENCRYPTION Encrypt some data in the application Encrypt data at rest Non-key data Credit card numbers, PII etc Encrypt data in transit using SSL From clients to MariaDB MaxScale From clients to MariaDB Between MariaDB replicated servers InnoDB tablespace encryption InnoDB redo log encryption Binary log encryption
  • 28. Best Practices Using MaxScale Restrict the operations that clients (applications) are allowed to perform Identify and flag potentially dangerous queries Customize rules about what’s allowed and what’s not Use MariaDB MaxScale as a Database Firewall Implement connection pooling capabilities can protect against DDoS attacks
  • 29. Best Practices AUDITING Ensure regulatory compliance with robust logging Use MariaDB Audit Plugin Record connections, query executions, and tables accessed Use logs for forensic analysis after an incident Logging either to a file or to syslog
  • 30. MariaDB Security Gets Stronger All the Time MariaDB User Community Quickly identifies new threats Creates solutions Reports vulnerabilities Contributes features