Escolar Documentos
Profissional Documentos
Cultura Documentos
Marinha do Brasil
OSTENSIVO 5-1
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-2
OSTENSIVO GUIA DE ESTUDO
Conceitos
OSTENSIVO 5-3
OSTENSIVO GUIA DE ESTUDO
Exemplos:
“Papel e caneta” x “Máquina de escrever” x “Word”
“Mural de recados” x “Orkut/Facebook”
“Telefone” x “SMS” x “Whatsapp”
OSTENSIVO 5-4
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-5
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-6
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-7
OSTENSIVO GUIA DE ESTUDO
Custo da falha
http://www.youtube.com/watch?v=kYUrqdUyEpI
OSTENSIVO 5-8
OSTENSIVO GUIA DE ESTUDO
Processo de Desenvolvimento
OSTENSIVO 5-9
OSTENSIVO GUIA DE ESTUDO
Tipos de Sistemas
OSTENSIVO 5-10
OSTENSIVO GUIA DE ESTUDO
Tipos de Sistemas
OSTENSIVO 5-11
OSTENSIVO GUIA DE ESTUDO
Interpretação
OSTENSIVO 5-12
OSTENSIVO GUIA DE ESTUDO
Segurança do executável
OSTENSIVO 5-13
OSTENSIVO GUIA DE ESTUDO
Assinatura de executáveis
OSTENSIVO 5-14
OSTENSIVO GUIA DE ESTUDO
Arquitetura de Aplicações
OSTENSIVO 5-15
OSTENSIVO GUIA DE ESTUDO
Arquitetura de Sistemas
OSTENSIVO 5-16
OSTENSIVO GUIA DE ESTUDO
Arquiteturas de Aplicações
OSTENSIVO 5-17
OSTENSIVO GUIA DE ESTUDO
Arquiteturas multicamadas
OSTENSIVO 5-18
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-19
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-20
OSTENSIVO GUIA DE ESTUDO
Antes das aplicações WEB, criar uma aplicação era apenas uma
das etapas para torná-la operacional. Era necessário ainda distribuí-la e mantê-
la atualizada. Ambas as tarefas podem simplesmente tornar impraticável
determinado uso de um sistema de informação.
Algumas das características que tornaram as aplicações WEB
populares foram:
OSTENSIVO 5-21
OSTENSIVO GUIA DE ESTUDO
Aplicações Web
OSTENSIVO 5-22
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-23
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-24
OSTENSIVO GUIA DE ESTUDO
Conexões HTTP
HTTP não persistente:
• No máximo, um objeto é enviado sobre uma conexão TCP; e
• O HTTP/1.0 utiliza HTTP não persistente.
HTTP persistente:
• Múltiplos objetos podem ser enviados sobre uma conexão;
• TCP entre o cliente e o servidor;e
• O HTTP/1.1 utiliza conexões persistentes em seu modo padrão.
OSTENSIVO 5-25
OSTENSIVO GUIA DE ESTUDO
Conceitos HTTP
OSTENSIVO 5-26
OSTENSIVO GUIA DE ESTUDO
Métodos HTTP
OSTENSIVO 5-27
OSTENSIVO GUIA DE ESTUDO
Uma boa prática é não permitir que um servidor retorne estes códigos
de erro em aplicações já em produção. Em ambientes de desenvolvimento e
homologação é importante que estas opções estejam disponíveis.
OSTENSIVO 5-28
OSTENSIVO GUIA DE ESTUDO
Requisição HTTP
OSTENSIVO 5-29
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-30
OSTENSIVO GUIA DE ESTUDO
Principais ameaças
A1 – Injection;
A2 – Broken Authentication and Session Management;
A3 – Cross-Site Scripting (XSS);
A4 – Insecure Direct Object Rferences;
A5 – Security Misconfiguration;
A6 – Sensitive Data Exposure;
A7 - Missing Function Level Access Control
A8 – Cross-Site Request Forgey (CSRF)
A9 – Using Components with Known Vulnerabilities;e
A-10 – Unvalidated Redirects and Forwards.
OSTENSIVO 5-31
OSTENSIVO GUIA DE ESTUDO
A1.Injection = Injeção
OSTENSIVO 5-32
OSTENSIVO GUIA DE ESTUDO
A2.Broken Authentication
OSTENSIVO 5-33
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-34
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-35
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-36
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-37
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-38
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-39
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-40
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-41
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-42
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-43
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-44
OSTENSIVO GUIA DE ESTUDO
Ameaça OWASP
OSTENSIVO 5-45
OSTENSIVO GUIA DE ESTUDO
Buffer Overflow
OSTENSIVO 5-46
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-47
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-48
OSTENSIVO GUIA DE ESTUDO
Depuração de aplicação
OSTENSIVO 5-49
OSTENSIVO GUIA DE ESTUDO
Depuração – Ferramentas
OSTENSIVO 5-50
OSTENSIVO GUIA DE ESTUDO
SQL Injection
OSTENSIVO 5-51
OSTENSIVO GUIA DE ESTUDO
O código que trata a tela de login geralmente vai pegar o que o usuário
digitou como login e como senha e precisa verificar no banco de dados se existe um
usuário com aquele login e cuja senha seja aquela. Geralmente a aplicação terá uma
tabela no banco de dados, que pode ser chamar, por exemplo “User”. Essa tabela terá
uma coluna “Login” e outra coluna “Pass”. Nesta situação, uma forma de fazer isso é
montar uma query na forma:
SELECT * FROM User WHERE Login =‘Fulano’ AND Pass=‘123’
Como tudo após o -- pode ser ignorado, a query irá retornar todos os
registros da tabela, pois 1 é sempre igual a 1. Mesmo que o Login sempre seja
diferente de ‘’, como é um OU, sempre vai retornar verdadeiro.
OSTENSIVO 5-52
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-53
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-54
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-55
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-56
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-57
OSTENSIVO GUIA DE ESTUDO
LDAP Injevtion
OSTENSIVO 5-58
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-59
OSTENSIVO GUIA DE ESTUDO
Script Injection
OSTENSIVO 5-61
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-62
OSTENSIVO GUIA DE ESTUDO
Enumeração de Páginas
OSTENSIVO 5-63
OSTENSIVO GUIA DE ESTUDO
Enumeração de Páginas
OSTENSIVO 5-64
OSTENSIVO GUIA DE ESTUDO
Alteração de parâmetros
OSTENSIVO 5-65
OSTENSIVO GUIA DE ESTUDO
Campos Ocultos
OSTENSIVO 5-66
OSTENSIVO GUIA DE ESTUDO
Campos Ocultos
OSTENSIVO 5-67
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-68
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-69
OSTENSIVO GUIA DE ESTUDO
Directory Transversal
Contramedidas:
OSTENSIVO 5-70
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-71
OSTENSIVO GUIA DE ESTUDO
Contramedidas
OSTENSIVO 5-72
OSTENSIVO GUIA DE ESTUDO
Cookies são usados para manter estado de seções HTTP, pois este não
é um protocolo orientado a seções. O envenenamento permite que um atacante
insira um conteúdo malicioso, moficando a experiência on-line do usuário e
assim obtendo acesso a informação não autorizada.
Um proxy pode ser usado para re-escrever dados de seção,
mostrando os dados em um cookie e especificando um novo ID de usuário, por
exemplo.
Contramedidas:
• Não armazenar senhas em texto claro ou com cifras fracas em cookies;
• Implementar limite de tempo para cookies;
• As credenciais de autenticação de cookies devem ser associadas com os
endereços IP; e
• Habilitar funções de logout nas aplicações.
OSTENSIVO 5-73
OSTENSIVO GUIA DE ESTUDO
Outro ponto que deve-se levar em conta é o fato de que, por mais
que a aplicação tenha segurança implementada, existe a chance do ataque se
originar na máquina do usuário. Obviamente a aplicação não pode garantir que a
máquina do usuário está imune a problemas. Mas existem alguns cuidados que
podem ser tomados para evitar problemas.
OSTENSIVO 5-74
OSTENSIVO GUIA DE ESTUDO
CAPTCHA
OSTENSIVO 5-75
OSTENSIVO GUIA DE ESTUDO
Outros ataques
Existem outros ataques menos comuns, mas nem por isso menos
importantes, por exemplo aqueles em que os agentes potenciais de ataque são
da própria equipe da aplicação, desenvolvedores e administradores. Esses
ataques podem ser evitados ou mitigados com alguns controles simples:
•Manter o código fonte em um sistema de gerência de versões;
OSTENSIVO 5-76
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-77
OSTENSIVO GUIA DE ESTUDO
Identificação e Autenticação
OSTENSIVO 5-78
OSTENSIVO GUIA DE ESTUDO
Autenticação Biométrica
A autenticação biométrica tem sido cada vez mais usada, porém não
é o meio preferencial, visto que ainda é cara e, em alguns casos incomoda.
Considere ainda que existem falhas de diversos tipos, por exemplo, ataques
conhecidos. O número de autenticação biométrica é muito grande e incorpora
diversos aspectos do corpo humano.
A digital do dedo é a forma mais comum, porém existem algumas
restrições: existem pessoas que não as possuem, particularmente trabalhadores
de indústria química, de cimento e outros materiais abrasivos. Sem contar, por
óbvio, amputados. Os dispositivos mais comuns geram muitos erros. Tanto erros
falso negativo quanto falso positivo, ou seja, deixam de reconhecer uma digital
válida ou, o que é pior, reconhecem como válida uma digital que não é.
Para os fãs de filmes de ação, fiquem avisados que não funciona
cortar o dedo da pessoa para passar no mecanismo. Mas existem ainda casos de
quebra deste mecanismo com películas de gelatina com a impressão de digital de
outra pessoa.
Outros mecanismos tem melhor resultado, como a de retina e a de
iris, porém são caros ainda. A autenticação facial tem grande utilidade na
identificação de pessoas sem a cooperação desta, o que pode ser útil em algumas
aplicações.
OSTENSIVO 5-79
OSTENSIVO GUIA DE ESTUDO
Certificado Digital
OSTENSIVO 5-80
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-81
OSTENSIVO GUIA DE ESTUDO
Login e Senha
OSTENSIVO 5-82
OSTENSIVO GUIA DE ESTUDO
Armazenamento da Senha
OSTENSIVO 5-83
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-84
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-85
OSTENSIVO GUIA DE ESTUDO
Gestão de Identidade
OSTENSIVO 5-86
OSTENSIVO GUIA DE ESTUDO
Métrica da Senha
OSTENSIVO 5-87
OSTENSIVO GUIA DE ESTUDO
Bloqueio da senha
OSTENSIVO 5-88
OSTENSIVO GUIA DE ESTUDO
Bloqueio da senha
OSTENSIVO 5-89
OSTENSIVO GUIA DE ESTUDO
Resposta da Autenticação
OSTENSIVO 5-90
OSTENSIVO GUIA DE ESTUDO
Acesso ao Sistema
OSTENSIVO 5-91
OSTENSIVO GUIA DE ESTUDO
Contorno do mecanismo
OSTENSIVO 5-92
OSTENSIVO GUIA DE ESTUDO
Contorno...como resolver
OSTENSIVO 5-93
OSTENSIVO GUIA DE ESTUDO
Conexão ao BD
OSTENSIVO 5-94
OSTENSIVO GUIA DE ESTUDO
Atender todos os itens acima parece algo bastante difícil. Hoje existe
uma solução quase que global e que funciona muito bem: Web Services sobre
HTTPS com certificados digitais em ambas as pontas. Essa solução deve sempre
ser buscada em novos sistemas. O problema é que, quando fazemos interface com
um sistema mais antigo, nem sempre temos essa possibilidade.
OSTENSIVO 5-95
OSTENSIVO GUIA DE ESTUDO
Integridade de dados
OSTENSIVO 5-96
OSTENSIVO GUIA DE ESTUDO
Informação Residual
OSTENSIVO 5-97
OSTENSIVO GUIA DE ESTUDO
Privacidade
OSTENSIVO 5-98
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-99
OSTENSIVO GUIA DE ESTUDO
Ambiente Seguro
OSTENSIVO 5-100
OSTENSIVO GUIA DE ESTUDO
Segregação de Ambiente
OSTENSIVO 5-101
OSTENSIVO GUIA DE ESTUDO
Banco de Desenvolvimento
OSTENSIVO 5-102
OSTENSIVO GUIA DE ESTUDO
Gerência de Versionamento
OSTENSIVO 5-103
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-104
OSTENSIVO GUIA DE ESTUDO
Desenvolvimento terceirizado
OSTENSIVO 5-105
OSTENSIVO GUIA DE ESTUDO
Central de Testes
OSTENSIVO 5-106
OSTENSIVO GUIA DE ESTUDO
O Erro na Aplicação
OSTENSIVO 5-107
OSTENSIVO GUIA DE ESTUDO
Ferramenta de Gestão
OSTENSIVO 5-108
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-109
OSTENSIVO GUIA DE ESTUDO
Inspeção de Código
OSTENSIVO 5-110
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-111
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-112
OSTENSIVO GUIA DE ESTUDO
Nestes casos, espera-se que ocorra um erro, mas que esse erro
seja normal, ou seja, não comprometa a segurança do sistema.
OSTENSIVO 5-113
OSTENSIVO GUIA DE ESTUDO
Teste integrado
OSTENSIVO 5-114
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-115
OSTENSIVO GUIA DE ESTUDO
Teste de Invasão
OSTENSIVO 5-116
OSTENSIVO GUIA DE ESTUDO
Ferramentas – Invasão
OSTENSIVO 5-117
OSTENSIVO GUIA DE ESTUDO
OSTENSIVO 5-118
OSTENSIVO GUIA DE ESTUDO
Ferramentas
Nikto
OSTENSIVO 5-119
OSTENSIVO GUIA DE ESTUDO
Ferramentas
Dirbuster
OSTENSIVO 5-120
OSTENSIVO GUIA DE ESTUDO
Ferramentas
W3AF
OSTENSIVO 5-121
OSTENSIVO GUIA DE ESTUDO
Ferramentas
Web Scarab
OSTENSIVO 5-122
OSTENSIVO GUIA DE ESTUDO
Ferramentas
BurpSuite
OSTENSIVO 5-123
OSTENSIVO GUIA DE ESTUDO
Ferramentas
Guyère
OSTENSIVO 5-124
OSTENSIVO GUIA DE ESTUDO
Ferramentas
SQL Map
OSTENSIVO 5-125
OSTENSIVO GUIA DE ESTUDO
Ferramentas
OSTENSIVO 5-126
OSTENSIVO GUIA DE ESTUDO
Ferramentas
ModSecurity
OSTENSIVO 5-127
OSTENSIVO GUIA DE ESTUDO
Ferramentas
Pirni
OSTENSIVO 5-128
OSTENSIVO GUIA DE ESTUDO
Ferramentas
DisAid
OSTENSIVO 5-129
OSTENSIVO GUIA DE ESTUDO
Ferramentas
Acunetix
OSTENSIVO 5-130
OSTENSIVO GUIA DE ESTUDO
Ferramentas
Safeval
OSTENSIVO 5-131