SlideShare une entreprise Scribd logo
1  sur  78
Télécharger pour lire hors ligne
Safety
   LAMP
data security
in the age of
    agile
  languages
    Josh Berkus
    PostgreSQL Experts, Inc.
    Enterprise LAMP 2009
LAMP 1.0 (1998)
Linux

Apache

MySQL

Perl,PHP,Python
LAMP 1.1 (2002)
Linux

Apache

Middleware

PostgreSQL
LAMP 2.0 (2008)
Linux,Solaris,
   BSD
Apache,Lighttpd,
  appservers
MySQL,PostgreSQL,
  SQLite,CouchDB,
  Memcached,etc.
Python,Ruby,PHP,Perl,
   Javascript
LAMP 2.0 (2008)
Linux,Solaris,
   BSD
Apache,Lighttpd,
  appservers
MySQL,PostgreSQL,
  SQLite,CouchDB,
  Memcached,etc.
Python,Ruby,PHP,Perl,
   Javascript
Why should
       you
      care
     about
data security?
“I don't need to
       know”
“Our network security will take
care of it.”
“I applied all the web server and
PHP patches.”
“Security belongs in the
application layer.”
“Database security slows
development.”
“Nobody will hack my website. We
run Linux.”
microsoft
nokia
government agencies
the U.N.
political parties
The cost of
unsafe data
Contacting 19,000 customers:
$380,000
Paying for credit reports for
19,000 customers:
$931,000
Shipping stolen merchandise:
$4,600,000
Lost customer goodwill and
reputation as an insecure &
careless company:
Priceless!
Why is LAMP
         special?
1. Agility
 LAMP platforms are designed for
 rapid development and deployment
2. Constant Upgrades
 LAMP components are rapidly
 advancing
3. Lightweight
 LAMP stacks are simple and have few
 layers
Why is LAMP
         special?
1. Agility
 rapidly deploy security holes

2. Constant Upgrades
 new versions    new exploits

3. Lightweight
 few layers    fast to hack
How do you make
your data safe?
security
principles
one:
security != control
control systems
control systems
correctly employed


improved security
control systems
incorrectly employed


  reduced security
two:
  security
is a process
two:
  security
is a process

not a result
security process
     1.plan
     2.design
     3.develop
     4.test
     5.deploy
     6.monitor
     7.repeat
perimeter-only
   security
                                     anti-DOS
                                           firewall


           open               open
database          webserver            load-
 server                                balancer


   insecure                           secure
perimeter-only
   security
                                     anti-DOS
                                           firewall


           open               open
database          webserver            load-
 server                                balancer


   insecure                           secure
perimeter-only
   security
                                     anti-DOS
                                           firewall


           open               open
database          webserver            load-
 server                                balancer


   insecure                           secure
multilayer security
  permissions    tripwire              anti-DOS
         abstraction    updates              firewall


               restricted       restricted
audit
        database       webserver             load-
         server                              balancer


                            secure
three:
every component
     in your
   LAMP stack
must be secure
four:
how much security
   do you need?
Performance
Deployment Speed
              Cost
    Data Security
five:
have a threat model
What is your vulnerable data?
(assets)
Who wants this data? (threats)
How will they get it? (attack
vectors)
What are the consequences of
lost data? (costs)
How do you make
your data safe?
your database
        engine can help
  permissions    tripwire              anti-DOS
         abstraction    updates              firewall


               restricted       restricted
audit
        database       webserver             router
         server


                            secure
attack vectors
 Primary attack vectors for data
 theft in LAMP:
1.SQL injection
2.direct connection
3.application server compromise
4.staff malfeasance/mistake
5.physical access
attack vectors
 Primary attack vectors for data
 theft in LAMP:
1.SQL injection
2.direct connection
3.application server compromise
4.staff malfeasance/mistake
5.physical access
database tools
1.access control
2.authentication
3.drivers
4.privileges
5.data abstraction
6.encryption
7.data auditing
8.advanced security frameworks
access control
Goal: Use database access control
lists to prevent connections from
anywhere but specified networks.




       database   webserver
        server
access control
Network Isolation:
 isolated network segment
 only appservers & admins can connect
 use firewall tools to restrict ports &
 networks
access control
Database Access Control
 restrict which users can connect to
 which databases from which networks
PostgreSQL
 pg_hba.conf, listen_addresses,
 pgbouncer
MySQL
 users table, MySQL Proxy
authentication
Goal: prevent privilege escalation
through direct connections to the
database.

psql -U postgres -h
masterserver -c 'update users
set password = 'haxx0r'
where login = 'administrator'
authentication
      methods
ident: host OS responsible for
security
 good for: administrative tasks
 bad for: external users
authentication
      methods
hashed user/password
  good for: most things
  bad for: application server /
  network compromise
authentication
      methods
krb5 / sspi / ldap: identity
checked against authentication
servers
  good for: network/application
  server compromises
  bad for: performance,
  troubleshooting, uptime
driver tools
Goal: prevent SQL injection

prepared queries:
 $q = prepare(“SELECT * FROM profile
 WHERE user = ?”);
 execute($q, db_escape($this_user));
driver tools
Goal: prevent SQL injection

switches
 no multi-statement
 read-only connection
database privileges
Goal: prevent authenticated low-
level users from modifying or
accessing restricted data.


          SELECT FROM users;




           UPDATE users;
database privileges
     Privileges Rule #1:
 your app should not be connecting
as the database owner or superuser
ROLEs
create some ROLEs (users and groups)
   public
   application_user               db_admin
   application_admin
                                  superuser
                                         users

      admins
                          dataentry              readonly

claudio        felipe
                         leo          wei-chen    guest
privileges
best way to restrict access to
specific data
SQL standard
Both MySQL & PostgreSQL support:
 database/schema, table, column
privileges
PostgreSQL privileges:
 tables: SELECT, INSERT, UPDATE,
 DELETE, ALTER
 schema: USAGE, CREATE, ALTER
 function: EXECUTE, ALTER
 database: CONNECT, TEMP, CREATE, OWNER
database
          abstraction
Goal: prevent theft of sensitive
data by not allowing direct access
to base tables

schema admin     schema      member
 rights          members
 settings       profiles
                messages
               view
               user_names
  users        login()
               change_pw()
database
        abstraction
views
 a VIEW is a “stored query” with its
 own permissions
 limit access to specific rows or
 columns
stored procedures
 SECURITY DEFINER procedures allow
 controlled privilege escalation
 make sure to lock them down, though!
encryption
Goal: prevent misuse of sensitive
data by anyone who has managed to
capture it

the only protection against
physical possesion
encrypt your backups!
encryption
1.   encrypted authentication
2.   encrypted connections
3.   encryption of specific data
4.   whole database encryption
the biggest problem
  with encryption




         ?
What do you do if
they get in anyway?
sometimes your other measures fail
 exploits
 loopholes
 misconfiguration
sometimes the bad guys have
legitimate access
 users
 staff
 sysadmins
database auditing
Goal: know what happened after it
happened, and be able to restore
your data without searching backup
tapes.
auditing: logs
dozens of log options
 users
 connections
 queries run
 errors
the log can help you analyze a
break-in
 maybe even tell you what was stolen
secure your logs
best way to find “DBA corruption”
 make sure that not even the admins can
 erase/alter all copies
 make sure few people can change
 postgresql.conf
use a secured log server
 “syslog” is good for this
make a plan for secure log
archiving
data auditing
Goal: figure out exactly which data
changed, when and how, and be able to
reverse it.

Methods
 Triggers
 Replication
 Snapshots
data auditing
table members.profiles
 member | interests
   josh | pottery, cooking

table audit_members.profiles
 member | interests | changed   | change_by
   josh | gaming    | 5/23/01   | claudio
   josh | pottery   | 3/24/08   | felipe
xtreme security:
   multilevel
xtreme security:
   SE Postgres
contact
Josh Berkus
 josh.berkus@pgexperts.com
 it.toolbox.com/blogs/database-soup
PostgreSQL
 www.postgresql.org
 SEPostgres:
 http://code.google.com/p/sepgsql
PostgreSQL Experts, Inc.
 www.pgexperts.com
    Thanks to KaiGai Kohei for SEPostgres diagrams, and to Harrison Fisk for MySQL examples.
    Thanks to Google Images for the various images, which belong to their original owners.
    Copyright 2009 Josh Berkus, distributable under the creative commons attribution license

Contenu connexe

Tendances

BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery
BlueHat v17 ||  Detecting Compromise on Windows Endpoints with Osquery  BlueHat v17 ||  Detecting Compromise on Windows Endpoints with Osquery
BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery
BlueHat Security Conference
 
Securing Hadoop with OSSEC
Securing Hadoop with OSSECSecuring Hadoop with OSSEC
Securing Hadoop with OSSEC
Vic Hargrave
 

Tendances (20)

Microsoft Ignite session: Look under the hood: bypassing antimalware tactics ...
Microsoft Ignite session: Look under the hood: bypassing antimalware tactics ...Microsoft Ignite session: Look under the hood: bypassing antimalware tactics ...
Microsoft Ignite session: Look under the hood: bypassing antimalware tactics ...
 
Cm5 secure code_training_1day_system configuration
Cm5 secure code_training_1day_system configurationCm5 secure code_training_1day_system configuration
Cm5 secure code_training_1day_system configuration
 
Implementing ossec
Implementing ossecImplementing ossec
Implementing ossec
 
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
 
Oracle security 02-administering user security
Oracle security 02-administering user securityOracle security 02-administering user security
Oracle security 02-administering user security
 
Low Hanging Fruit, Making Your Basic MongoDB Installation More Secure
Low Hanging Fruit, Making Your Basic MongoDB Installation More SecureLow Hanging Fruit, Making Your Basic MongoDB Installation More Secure
Low Hanging Fruit, Making Your Basic MongoDB Installation More Secure
 
Web Server Hardening
Web Server HardeningWeb Server Hardening
Web Server Hardening
 
Pukhraj Resume 2013
Pukhraj Resume 2013Pukhraj Resume 2013
Pukhraj Resume 2013
 
10 Deadly Sins of SQL Server Configuration - APPSEC CALIFORNIA 2015
10 Deadly Sins of SQL Server Configuration - APPSEC CALIFORNIA 201510 Deadly Sins of SQL Server Configuration - APPSEC CALIFORNIA 2015
10 Deadly Sins of SQL Server Configuration - APPSEC CALIFORNIA 2015
 
CentOS Linux Server Hardening
CentOS Linux Server HardeningCentOS Linux Server Hardening
CentOS Linux Server Hardening
 
System hardening - OS and Application
System hardening - OS and ApplicationSystem hardening - OS and Application
System hardening - OS and Application
 
Dear Hacker: Infrastructure Security Reality Check
Dear Hacker: Infrastructure Security Reality CheckDear Hacker: Infrastructure Security Reality Check
Dear Hacker: Infrastructure Security Reality Check
 
BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery
BlueHat v17 ||  Detecting Compromise on Windows Endpoints with Osquery  BlueHat v17 ||  Detecting Compromise on Windows Endpoints with Osquery
BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery
 
Securing Hadoop with OSSEC
Securing Hadoop with OSSECSecuring Hadoop with OSSEC
Securing Hadoop with OSSEC
 
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
 
Session9-File Upload Security
Session9-File Upload SecuritySession9-File Upload Security
Session9-File Upload Security
 
Persistant Cookies and LDAP Injection
Persistant Cookies and LDAP InjectionPersistant Cookies and LDAP Injection
Persistant Cookies and LDAP Injection
 
Windows server hardening 1
Windows server hardening 1Windows server hardening 1
Windows server hardening 1
 
Drupal and Security: What You Need to Know
Drupal and Security: What You Need to KnowDrupal and Security: What You Need to Know
Drupal and Security: What You Need to Know
 
Gartner Security & Risk Management Summit 2018
Gartner Security & Risk Management Summit 2018Gartner Security & Risk Management Summit 2018
Gartner Security & Risk Management Summit 2018
 

Similaire à Safety LAMP: data security & agile languages

Dr3150012012202 1.getting started
Dr3150012012202 1.getting startedDr3150012012202 1.getting started
Dr3150012012202 1.getting started
Namgu Jeong
 
0828 Windows Server 2008 新安全功能探討
0828 Windows Server 2008 新安全功能探討0828 Windows Server 2008 新安全功能探討
0828 Windows Server 2008 新安全功能探討
Timothy Chen
 
Microsoft Operating System Vulnerabilities
Microsoft Operating System VulnerabilitiesMicrosoft Operating System Vulnerabilities
Microsoft Operating System Vulnerabilities
Information Technology
 

Similaire à Safety LAMP: data security & agile languages (20)

Database security copy
Database security   copyDatabase security   copy
Database security copy
 
Web Security
Web SecurityWeb Security
Web Security
 
VAPT_FINAL SLIDES.pptx
VAPT_FINAL SLIDES.pptxVAPT_FINAL SLIDES.pptx
VAPT_FINAL SLIDES.pptx
 
Ch11
Ch11Ch11
Ch11
 
Ch11 system administration
Ch11 system administration Ch11 system administration
Ch11 system administration
 
Dr3150012012202 1.getting started
Dr3150012012202 1.getting startedDr3150012012202 1.getting started
Dr3150012012202 1.getting started
 
VAPT PRESENTATION full.pptx
VAPT PRESENTATION full.pptxVAPT PRESENTATION full.pptx
VAPT PRESENTATION full.pptx
 
0828 Windows Server 2008 新安全功能探討
0828 Windows Server 2008 新安全功能探討0828 Windows Server 2008 新安全功能探討
0828 Windows Server 2008 新安全功能探討
 
Microsoft Operating System Vulnerabilities
Microsoft Operating System VulnerabilitiesMicrosoft Operating System Vulnerabilities
Microsoft Operating System Vulnerabilities
 
Microsoft OS Vulnerabilities
Microsoft OS VulnerabilitiesMicrosoft OS Vulnerabilities
Microsoft OS Vulnerabilities
 
Threat_Modelling.pdf
Threat_Modelling.pdfThreat_Modelling.pdf
Threat_Modelling.pdf
 
Database security
Database securityDatabase security
Database security
 
Let's shield Liferay
Let's shield LiferayLet's shield Liferay
Let's shield Liferay
 
Rails Security
Rails SecurityRails Security
Rails Security
 
Thick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash CourseThick Application Penetration Testing: Crash Course
Thick Application Penetration Testing: Crash Course
 
Module 4 qui parle de la sécurisation des applications
Module 4 qui parle de la sécurisation des applicationsModule 4 qui parle de la sécurisation des applications
Module 4 qui parle de la sécurisation des applications
 
Securing Open Source Databases
Securing Open Source DatabasesSecuring Open Source Databases
Securing Open Source Databases
 
Secure programming with php
Secure programming with phpSecure programming with php
Secure programming with php
 
Security of the database
Security of the databaseSecurity of the database
Security of the database
 
Make your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More SafeMake your Azure PaaS Deployment More Safe
Make your Azure PaaS Deployment More Safe
 

Plus de PostgreSQL Experts, Inc.

Elephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and VariantsElephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and Variants
PostgreSQL Experts, Inc.
 

Plus de PostgreSQL Experts, Inc. (20)

Shootout at the PAAS Corral
Shootout at the PAAS CorralShootout at the PAAS Corral
Shootout at the PAAS Corral
 
Shootout at the AWS Corral
Shootout at the AWS CorralShootout at the AWS Corral
Shootout at the AWS Corral
 
Fail over fail_back
Fail over fail_backFail over fail_back
Fail over fail_back
 
PostgreSQL Replication in 10 Minutes - SCALE
PostgreSQL Replication in 10  Minutes - SCALEPostgreSQL Replication in 10  Minutes - SCALE
PostgreSQL Replication in 10 Minutes - SCALE
 
HowTo DR
HowTo DRHowTo DR
HowTo DR
 
Give A Great Tech Talk 2013
Give A Great Tech Talk 2013Give A Great Tech Talk 2013
Give A Great Tech Talk 2013
 
Pg py-and-squid-pypgday
Pg py-and-squid-pypgdayPg py-and-squid-pypgday
Pg py-and-squid-pypgday
 
92 grand prix_2013
92 grand prix_201392 grand prix_2013
92 grand prix_2013
 
Five steps perform_2013
Five steps perform_2013Five steps perform_2013
Five steps perform_2013
 
7 Ways To Crash Postgres
7 Ways To Crash Postgres7 Ways To Crash Postgres
7 Ways To Crash Postgres
 
PWNage: Producing a newsletter with Perl
PWNage: Producing a newsletter with PerlPWNage: Producing a newsletter with Perl
PWNage: Producing a newsletter with Perl
 
10 Ways to Destroy Your Community
10 Ways to Destroy Your Community10 Ways to Destroy Your Community
10 Ways to Destroy Your Community
 
Open Source Press Relations
Open Source Press RelationsOpen Source Press Relations
Open Source Press Relations
 
5 (more) Ways To Destroy Your Community
5 (more) Ways To Destroy Your Community5 (more) Ways To Destroy Your Community
5 (more) Ways To Destroy Your Community
 
Preventing Community (from Linux Collab)
Preventing Community (from Linux Collab)Preventing Community (from Linux Collab)
Preventing Community (from Linux Collab)
 
Development of 8.3 In India
Development of 8.3 In IndiaDevelopment of 8.3 In India
Development of 8.3 In India
 
PostgreSQL and MySQL
PostgreSQL and MySQLPostgreSQL and MySQL
PostgreSQL and MySQL
 
50 Ways To Love Your Project
50 Ways To Love Your Project50 Ways To Love Your Project
50 Ways To Love Your Project
 
8.4 Upcoming Features
8.4 Upcoming Features 8.4 Upcoming Features
8.4 Upcoming Features
 
Elephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and VariantsElephant Roads: PostgreSQL Patches and Variants
Elephant Roads: PostgreSQL Patches and Variants
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Dernier (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

Safety LAMP: data security & agile languages

  • 1. Safety LAMP data security in the age of agile languages Josh Berkus PostgreSQL Experts, Inc. Enterprise LAMP 2009
  • 4. LAMP 2.0 (2008) Linux,Solaris, BSD Apache,Lighttpd, appservers MySQL,PostgreSQL, SQLite,CouchDB, Memcached,etc. Python,Ruby,PHP,Perl, Javascript
  • 5. LAMP 2.0 (2008) Linux,Solaris, BSD Apache,Lighttpd, appservers MySQL,PostgreSQL, SQLite,CouchDB, Memcached,etc. Python,Ruby,PHP,Perl, Javascript
  • 6. Why should you care about data security?
  • 7. “I don't need to know” “Our network security will take care of it.” “I applied all the web server and PHP patches.” “Security belongs in the application layer.” “Database security slows development.” “Nobody will hack my website. We run Linux.”
  • 8.
  • 9.
  • 10.
  • 12. nokia
  • 16.
  • 17.
  • 18.
  • 19. The cost of unsafe data Contacting 19,000 customers: $380,000 Paying for credit reports for 19,000 customers: $931,000 Shipping stolen merchandise: $4,600,000 Lost customer goodwill and reputation as an insecure & careless company: Priceless!
  • 20. Why is LAMP special? 1. Agility LAMP platforms are designed for rapid development and deployment 2. Constant Upgrades LAMP components are rapidly advancing 3. Lightweight LAMP stacks are simple and have few layers
  • 21. Why is LAMP special? 1. Agility rapidly deploy security holes 2. Constant Upgrades new versions new exploits 3. Lightweight few layers fast to hack
  • 22. How do you make your data safe?
  • 28.
  • 29. two: security is a process
  • 30. two: security is a process not a result
  • 31. security process 1.plan 2.design 3.develop 4.test 5.deploy 6.monitor 7.repeat
  • 32. perimeter-only security anti-DOS firewall open open database webserver load- server balancer insecure secure
  • 33.
  • 34.
  • 35.
  • 36.
  • 37. perimeter-only security anti-DOS firewall open open database webserver load- server balancer insecure secure
  • 38. perimeter-only security anti-DOS firewall open open database webserver load- server balancer insecure secure
  • 39.
  • 40.
  • 41. multilayer security permissions tripwire anti-DOS abstraction updates firewall restricted restricted audit database webserver load- server balancer secure
  • 42. three: every component in your LAMP stack must be secure
  • 43. four: how much security do you need?
  • 44. Performance Deployment Speed Cost Data Security
  • 45. five: have a threat model What is your vulnerable data? (assets) Who wants this data? (threats) How will they get it? (attack vectors) What are the consequences of lost data? (costs)
  • 46. How do you make your data safe?
  • 47. your database engine can help permissions tripwire anti-DOS abstraction updates firewall restricted restricted audit database webserver router server secure
  • 48. attack vectors Primary attack vectors for data theft in LAMP: 1.SQL injection 2.direct connection 3.application server compromise 4.staff malfeasance/mistake 5.physical access
  • 49. attack vectors Primary attack vectors for data theft in LAMP: 1.SQL injection 2.direct connection 3.application server compromise 4.staff malfeasance/mistake 5.physical access
  • 50. database tools 1.access control 2.authentication 3.drivers 4.privileges 5.data abstraction 6.encryption 7.data auditing 8.advanced security frameworks
  • 51. access control Goal: Use database access control lists to prevent connections from anywhere but specified networks. database webserver server
  • 52. access control Network Isolation: isolated network segment only appservers & admins can connect use firewall tools to restrict ports & networks
  • 53. access control Database Access Control restrict which users can connect to which databases from which networks PostgreSQL pg_hba.conf, listen_addresses, pgbouncer MySQL users table, MySQL Proxy
  • 54. authentication Goal: prevent privilege escalation through direct connections to the database. psql -U postgres -h masterserver -c 'update users set password = 'haxx0r' where login = 'administrator'
  • 55. authentication methods ident: host OS responsible for security good for: administrative tasks bad for: external users
  • 56. authentication methods hashed user/password good for: most things bad for: application server / network compromise
  • 57. authentication methods krb5 / sspi / ldap: identity checked against authentication servers good for: network/application server compromises bad for: performance, troubleshooting, uptime
  • 58. driver tools Goal: prevent SQL injection prepared queries: $q = prepare(“SELECT * FROM profile WHERE user = ?”); execute($q, db_escape($this_user));
  • 59. driver tools Goal: prevent SQL injection switches no multi-statement read-only connection
  • 60. database privileges Goal: prevent authenticated low- level users from modifying or accessing restricted data. SELECT FROM users; UPDATE users;
  • 61. database privileges Privileges Rule #1: your app should not be connecting as the database owner or superuser
  • 62. ROLEs create some ROLEs (users and groups) public application_user db_admin application_admin superuser users admins dataentry readonly claudio felipe leo wei-chen guest
  • 63. privileges best way to restrict access to specific data SQL standard Both MySQL & PostgreSQL support: database/schema, table, column
  • 64. privileges PostgreSQL privileges: tables: SELECT, INSERT, UPDATE, DELETE, ALTER schema: USAGE, CREATE, ALTER function: EXECUTE, ALTER database: CONNECT, TEMP, CREATE, OWNER
  • 65. database abstraction Goal: prevent theft of sensitive data by not allowing direct access to base tables schema admin schema member rights members settings profiles messages view user_names users login() change_pw()
  • 66. database abstraction views a VIEW is a “stored query” with its own permissions limit access to specific rows or columns stored procedures SECURITY DEFINER procedures allow controlled privilege escalation make sure to lock them down, though!
  • 67. encryption Goal: prevent misuse of sensitive data by anyone who has managed to capture it the only protection against physical possesion encrypt your backups!
  • 68. encryption 1. encrypted authentication 2. encrypted connections 3. encryption of specific data 4. whole database encryption
  • 69. the biggest problem with encryption ?
  • 70. What do you do if they get in anyway? sometimes your other measures fail exploits loopholes misconfiguration sometimes the bad guys have legitimate access users staff sysadmins
  • 71. database auditing Goal: know what happened after it happened, and be able to restore your data without searching backup tapes.
  • 72. auditing: logs dozens of log options users connections queries run errors the log can help you analyze a break-in maybe even tell you what was stolen
  • 73. secure your logs best way to find “DBA corruption” make sure that not even the admins can erase/alter all copies make sure few people can change postgresql.conf use a secured log server “syslog” is good for this make a plan for secure log archiving
  • 74. data auditing Goal: figure out exactly which data changed, when and how, and be able to reverse it. Methods Triggers Replication Snapshots
  • 75. data auditing table members.profiles member | interests josh | pottery, cooking table audit_members.profiles member | interests | changed | change_by josh | gaming | 5/23/01 | claudio josh | pottery | 3/24/08 | felipe
  • 76. xtreme security: multilevel
  • 77. xtreme security: SE Postgres
  • 78. contact Josh Berkus josh.berkus@pgexperts.com it.toolbox.com/blogs/database-soup PostgreSQL www.postgresql.org SEPostgres: http://code.google.com/p/sepgsql PostgreSQL Experts, Inc. www.pgexperts.com Thanks to KaiGai Kohei for SEPostgres diagrams, and to Harrison Fisk for MySQL examples. Thanks to Google Images for the various images, which belong to their original owners. Copyright 2009 Josh Berkus, distributable under the creative commons attribution license