Unbreakeable php

Post on 21-Jun-2015

596 views 1 download

description

Será que os problemas de segurança tem apenas causas técnicas? De quem é a culpa de tanto ataque?

Transcript of Unbreakeable php

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 1 / 35

Unbreakable PHP www.galvao.eti.br

Quem?!

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 2 / 35

www.galvao.eti.brUnbreakable PHP

Er Galvão Abbott trabalha há mais de 18 anosdesenvolvendo sistemas e aplicações com interface web, sendo13 anos com PHP e 5 anos com Zend Framework. Trabalhou com diversas empresas de grande porte, tanto nacionais como internacionais.

Palestra em eventos, dá cursos em diversas instituições e é Presidente da ABRAPHP – Associação Brasileira de Profissionais PHP e Diretor da PHP Conference Brasil, o principal evento de PHP da América Latina.

É o fundador e líder do GU PHPBR, Grupo de Usuáriosde abrangência nacional, que hoje conta com mais de 1.200usuários cadastrados.

Site: http://www.galvao.eti.br/Twitter: @galvaoSlides e Documentos: http://slideshare.net/ergalvao

https://speakerdeck.com/galvaoFork me @ http://github.com/galvao

Objetivo

Esta palestra tem por objetivo demonstrar técnicas de programação PHP que minimizamos principais riscos de segurança a uma aplicação web, além de analisar as principais causasda alarmante frequência com que falhas de segurança são exploradas na web.

Serão apresentados os seguintes tópicos:

→ Cenário atual→ Falhas de segurança→ Injeção→ Autenticação e Criptografia→ Causas para a situação atual→ De quem é a culpa?→ Soluções

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 3 / 35

www.galvao.eti.brUnbreakable PHP

Cenário atual...

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 4 / 35

www.galvao.eti.brUnbreakable PHP

Cenário atual...

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 5 / 35

www.galvao.eti.brUnbreakable PHP

Cenário atual...

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 6 / 35

www.galvao.eti.brUnbreakable PHP

Cenário atual...

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 7 / 35

www.galvao.eti.brUnbreakable PHP

Cenário atual...

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 8 / 35

www.galvao.eti.brUnbreakable PHP

Cenário atual...

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 9 / 35

www.galvao.eti.brUnbreakable PHP

Cenário atual...

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 10 / 35

www.galvao.eti.brUnbreakable PHP

Falhas de Segurança

Dos 10 Riscos mais comuns a Aplicações Web...

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 11 / 35

www.galvao.eti.brUnbreakable PHP

8 são relacionados a código-fonte*

Ah, então é culpa do programador!

Será...?

(*) Fonte: OWASP Top 10 2013

Os 3 primeiros problemas...

Injeção (SQL, Client-side, etc...)

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 12 / 35

www.galvao.eti.brUnbreakable PHP

(*) Fonte: OWASP Top 10 2013

Autenticação e Gerenciamento deSessão Falhos

XSS

Com uma solução em comum...

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 13 / 35

www.galvao.eti.brUnbreakable PHP

Isso é sabido desde antes de 2000Filtrar e Validar

Pra deixar bem claro...

há mais de 13 anos

Filtragem e Validação FTW!

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 14 / 35

www.galvao.eti.brUnbreakable PHP

(de uma palestra minha, há mais de 4 anos)

Filtragem e Validação NATIVAS FTW!

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 15 / 35

www.galvao.eti.brUnbreakable PHP

(Nativas desde o PHP 5.2, lançado há praticamente 7 anos)

Quem tem medo de Injeção de SQL?! PDO FTW!

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 16 / 35

www.galvao.eti.brUnbreakable PHP

(Nativa desde o PHP 5.1, lançado há praticamente 8 anos)

Criptografia FTW!

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 17 / 35

www.galvao.eti.brUnbreakable PHP

Quem disse que Mcrypt é difícil?!

1. Escolha uma cifra2. Defina uma chave3. Defina um vetor de inicialização4. Defina um modo5. Divirta-se!

É, divirta-se!

Mcrypt FTW!

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 18 / 35

www.galvao.eti.brUnbreakable PHP

(disponível há muito tempo**)

O(s) problema(s) com segurança?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 19 / 35

www.galvao.eti.brUnbreakable PHP

Torna o sistema Lento

Demanda muito Tempo

É muito Complicado

É um assunto muito Misterioso

É um assunto pra Depois

O(s) problema(s) com segurança?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 20 / 35

www.galvao.eti.brUnbreakable PHP

Torna o sistema Lento

Demanda muito Tempo

É muito Complicado

É um assunto muito Misterioso

É um assunto pra Depois

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 21 / 35

Unbreakable PHP www.galvao.eti.br

Misterioso?!?!?! OWASP FTW!

www.owasp.org

É um assunto muito MisteriosoTop 10

Zed Attack Proxy

ASVS

Cheat Sheets

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 22 / 35

Unbreakable PHP www.galvao.eti.br

Pra quando?!

Security First,

É um assunto pra Depois

Security Always!

O(s) problema(s) com segurança?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 23 / 35

www.galvao.eti.brUnbreakable PHP

A Diretoria...

só quer Sucesso

O(s) problema(s) com segurança?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 24 / 35

www.galvao.eti.brUnbreakable PHP

A Diretoria...

só quer Sucesso

O Gerente de Projetos...

só quer Prazo

O(s) problema(s) com segurança?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 25 / 35

www.galvao.eti.brUnbreakable PHP

A Diretoria...

só quer Sucesso

O Comercial...

só quer Vender

O Gerente de Projetos...

só quer Prazo

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 26 / 35

www.galvao.eti.brUnbreakable PHP

A Infra...

não quer se Incomodar

O(s) problema(s) com segurança?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 27 / 35

www.galvao.eti.brUnbreakable PHP

O Programador...

só quer programar!

A Infra...

não quer se Incomodar

O(s) problema(s) com segurança?

Culpa de quem, mesmo?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 28 / 35

www.galvao.eti.brUnbreakable PHP

A culpa é da Diretoria?

A culpa é do GP?

A culpa é do Comercial?

A culpa é da Infra?

A culpa é do Programador?

Culpa de quem, mesmo?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 29 / 35

www.galvao.eti.brUnbreakable PHP

A culpa é da Diretoria?

A culpa é do GP?

A culpa é do Comercial?

A culpa é da Infra?

A culpa é do Programador?

SIM!

Culpa de quem, mesmo?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 30 / 35

www.galvao.eti.brUnbreakable PHP

A culpa é da Diretoria?

A culpa é do GP?

A culpa é do Comercial?

A culpa é da Infra?

A culpa é do Programador?

SIM!SIM!SIM!

Culpa de quem, mesmo?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 31 / 35

www.galvao.eti.brUnbreakable PHP

A culpa é da Diretoria?

A culpa é do GP?

A culpa é do Comercial?

A culpa é da Infra?

A culpa é do Programador?

SIM!SIM!

SIM!

Culpa de quem, mesmo?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 32 / 35

www.galvao.eti.brUnbreakable PHP

A culpa é da Diretoria?

A culpa é do GP?

A culpa é do Comercial?

A culpa é da Infra?

A culpa é do Programador?

SIM!SIM!

SIM!SIM!

Culpa de quem, mesmo?

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 33 / 35

www.galvao.eti.brUnbreakable PHP

A culpa é da Diretoria?

A culpa é do GP?

A culpa é do Comercial?

A culpa é da Infra?

A culpa é do Programador?

SIM!SIM!

SIM!SIM!

SIM!

E se não estiver convencido(a) ainda, tem outra...

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 34 / 35

www.galvao.eti.brUnbreakable PHP

INGENUIDADE

Obrigado! (… e “desculpa qualquer coisa!”)

? Dúvidas?↓ Críticas?↑ Elogios?!

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 35 / 35

www.galvao.eti.brUnbreakable PHP