Unbreakeable php

35
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 10/4/13 - 1 / 35 Unbreakable PHP www.galvao.eti.br

description

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

Transcript of Unbreakeable php

Page 1: 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

Page 2: Unbreakeable php

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

Page 3: Unbreakeable php

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

Page 4: Unbreakeable 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

Page 5: Unbreakeable 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

Page 6: Unbreakeable 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

Page 7: Unbreakeable 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

Page 8: Unbreakeable 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

Page 9: Unbreakeable 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

Page 10: Unbreakeable 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

Page 11: Unbreakeable 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

Page 12: Unbreakeable php

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

Page 13: Unbreakeable php

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

Page 14: Unbreakeable php

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)

Page 15: Unbreakeable php

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)

Page 16: Unbreakeable php

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)

Page 17: Unbreakeable php

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!

Page 18: Unbreakeable php

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**)

Page 19: Unbreakeable php

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

Page 20: Unbreakeable php

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

Page 21: Unbreakeable php

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

Page 22: Unbreakeable php

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!

Page 23: Unbreakeable php

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

Page 24: Unbreakeable php

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

Page 25: Unbreakeable php

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

Page 26: Unbreakeable php

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?

Page 27: Unbreakeable php

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?

Page 28: Unbreakeable php

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?

Page 29: Unbreakeable php

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!

Page 30: Unbreakeable php

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!

Page 31: Unbreakeable php

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!

Page 32: Unbreakeable php

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!

Page 33: Unbreakeable php

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!

Page 34: Unbreakeable php

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

Page 35: Unbreakeable php

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