Escolar Documentos
Profissional Documentos
Cultura Documentos
out $(perl -e "Ax56") TBTZTFPWBASQASONAXPGNLKVURFETPRNGILGDZKDTRJOFCCLZENV QLLUNMVXYRPAEJLXAHHTAGOYOZKPTHACBILGPEKTFLIALGECZZEX JRHXEEAXJPDZKSLCBDHYKMCLDBYVBWPYIDEUGKUUCFYRTGWAQIGB HNVCJKBFFBRFJAITPTRPMIGZHQGUVDGHYOCDYBNNTQPLMLGBUDGT LEWAZYTFVZRKHXJUSIJFEEBFBRWHZMAXXEVBSNLUKSCJPFZJYPQF PASSSCAREWARETRUSTDDOS26XFVRIERY2014SURVEILLANCENSA INJECTIONATTACKSURFACEXSSAUTHENTICATIONVULNERABILITY SHELLCODEREFERENCECSRFCONFIGCRYPTOVALIDATIONTLSREDIR ECTOVERFLOWSENSITIVEDATAHACKINGZEETROPIRATAGECONTROL USERRING0MANINTHEMIDDLEPRIVILEGEESCALATIONARCHITECTU REZERODAYPENETRATIONIPV6METERPRETERHONEYPOTINTRUSION FULLDISCLOSUREPIDROOTKITCLICKJACKINGTROJANFIREWALLBY
UNAUTHORIZEDSOCIALENGINEERINGDISCLAIMERSPROTECTIONFAULTBRUTEFORCEFLO
Ce nest quen passant par-del lutilisable dans la proccupation () que ltre-au-monde (Dasein) parvient mettre jour ltant qui nest plus que l-devant.
Martin Heidegger, Sein und Zeit, trad. Vezin, 15 p. 107, 1927
Plan de travail
(dhabitude)
0. 1. 2. 3.
Plan de travail
(pour nous)
0. 1. 2. 3.
Publicit
la n de ces prsentations vous saurez :
Publicit
la n de ces prsentations vous saurez : Briller en socit
Publicit
la n de ces prsentations vous saurez : Briller en socit Analyser, comprendre voire exploiter des vulnrabilits.
Publicit
la n de ces prsentations vous saurez : Briller en socit Analyser, comprendre voire exploiter des vulnrabilits.Et pourquoi pas en reboucher.
Publicit
la n de ces prsentations vous saurez : Briller en socit Analyser, comprendre voire exploiter des vulnrabilits.Et pourquoi pas en reboucher. Pourquoi ceux qui utilisent PHP, Facebook, Java, MD5, RC4, AES/CBC, HTTP ou Windows ne sont pas uniquement imprudents, mais dangereux
0. Survol
OS : overflow, shellcode, fstrings, ret2libc, rop, funcptr... NETWORK : xss, injection, csrf, (d)dos, h/nids evasion, tor... CRYPTO : prng, sidechannels, information flow, malleability... HUMAN : misdirection, ransomware, social networks, psychology...
Exemples : OS
01.2014 : 750 000+ spam envoys...
goo.gl/ODR7Aw 0. patrickmosca.com/root-a-mac-in-10-seconds-or-less/ 0.
Exemples : OS
01.2014 : 750 000+ spam envoys... depuis un rfrigrateur. (photo AFP)
goo.gl/ODR7Aw 0. patrickmosca.com/root-a-mac-in-10-seconds-or-less/ 0.
Exemples : OS
01.2014 : 750 000+ spam envoys... depuis un rfrigrateur. (photo AFP)
01.2014 : IEEE 1394 SBP-2 DMA (FireWire, Thunderbolt, ExpressCard, PC Card and any other PCI/PCIe interfaces.) Inception
goo.gl/ODR7Aw 0. patrickmosca.com/root-a-mac-in-10-seconds-or-less/ 0.
Exemples : OS
01.2014 : 750 000+ spam envoys... depuis un rfrigrateur. (photo AFP)
01.2014 : IEEE 1394 SBP-2 DMA (FireWire, Thunderbolt, ExpressCard, PC Card and any other PCI/PCIe interfaces.) Inception 01.2014 : 10s pour rooter un Mac en accs physique
goo.gl/ODR7Aw 0. patrickmosca.com/root-a-mac-in-10-seconds-or-less/ 0.
Exemples : NETWORK
Exemples : NETWORK
02.2014 : Twitter, Facebook, Github x2 (@homakov)
Exemples : NETWORK
02.2014 : Twitter, Facebook, Github x2 (@homakov) 01.2014 : Syrian Electronic Army attacks
Exemples : NETWORK
02.2014 : Twitter, Facebook, Github x2 (@homakov) 01.2014 : Syrian Electronic Army attacks 11.2013 : EU Parliament WiFi compromised
Exemples : NETWORK
02.2014 : Twitter, Facebook, Github x2 (@homakov) 01.2014 : Syrian Electronic Army attacks 11.2013 : EU Parliament WiFi compromised 3-7.2013 : NK vs. SK, $500 Million ...
Exemples : CRYPTO
www.righto.com/2014/02/the-bitcoin-malleability-attack-hour-by.html 0. www.tau.ac.il/~tromer/papers/acoustic-20131218.pdf 0.
Exemples : CRYPTO
02.2014 : 25% BitCoin transactions under malleability attack
www.righto.com/2014/02/the-bitcoin-malleability-attack-hour-by.html 0. www.tau.ac.il/~tromer/papers/acoustic-20131218.pdf 0.
Exemples : CRYPTO
02.2014 : 25% BitCoin transactions under malleability attack 12.2013 : RSA4096 with a phone at 4m in <1hr (Genkin, Shamir, Tromer)
www.righto.com/2014/02/the-bitcoin-malleability-attack-hour-by.html 0. www.tau.ac.il/~tromer/papers/acoustic-20131218.pdf 0.
Exemples : CRYPTO
02.2014 : 25% BitCoin transactions under malleability attack 12.2013 : RSA4096 with a phone at 4m in <1hr (Genkin, Shamir, Tromer) 2013 : Dual_EC_DRBG + SIGINT (Snowden, currently in exile)
www.righto.com/2014/02/the-bitcoin-malleability-attack-hour-by.html 0. www.tau.ac.il/~tromer/papers/acoustic-20131218.pdf 0.
Exemples : CRYPTO
02.2014 : 25% BitCoin transactions under malleability attack 12.2013 : RSA4096 with a phone at 4m in <1hr (Genkin, Shamir, Tromer) 2013 : Dual_EC_DRBG + SIGINT (Snowden, currently in exile) 2013 : Target, Adobe, Snapchat
www.righto.com/2014/02/the-bitcoin-malleability-attack-hour-by.html 0. www.tau.ac.il/~tromer/papers/acoustic-20131218.pdf 0.
Exemples : CRYPTO
02.2014 : 25% BitCoin transactions under malleability attack 12.2013 : RSA4096 with a phone at 4m in <1hr (Genkin, Shamir, Tromer) 2013 : Dual_EC_DRBG + SIGINT (Snowden, currently in exile) 2013 : Target, Adobe, Snapchat
www.righto.com/2014/02/the-bitcoin-malleability-attack-hour-by.html 0. www.tau.ac.il/~tromer/papers/acoustic-20131218.pdf 0.
Exemples : HUMAN
Exemples : HUMAN
02.2014 : ESSoS14 Psychology of security, human factors
Exemples : HUMAN
02.2014 : ESSoS14 Psychology of security, human factors 01.2014 : OMG! Ransomware + Decryptor
Exemples : HUMAN
02.2014 : ESSoS14 Psychology of security, human factors 01.2014 : OMG! Ransomware + Decryptor 08.2013 : Hacking humans (B.Jack@BH13, 1.5 month before talk)
Exemples : HUMAN
02.2014 : ESSoS14 Psychology of security, human factors 01.2014 : OMG! Ransomware + Decryptor 08.2013 : Hacking humans (B.Jack@BH13, 1.5 month before talk) 2013 : password is the most common password
Rappel lgal
En France : LSQ, LOPSI, LCEN, LOPPSI (2011)
Rappel lgal
En France : LSQ, LOPSI, LCEN, LOPPSI (2011) Lorsque les ncessits de linformation [...] lexigent, le juge dinstruction peut [...] autoriser [...] les ociers et agents de police [...] mettre en place un dispositif technique ayant pour objet, sans le consentement des intresss, daccder, en tous lieux, des donnes informatiques, de les enregistrer, les conserver et les transmettre.
(Art. 36 de la Loi n 2011-267 du 14 mars 2011 dorientation et de programmation pour la performance de la scurit intrieure)
Linformation, cest exactement le systme du contrle. Et cest vrai, je dis des platitudes, cest vident. Cest vident, sauf que a nous concerne particulirement aujourdhui. a nous concerne aujourdhui parce que [...] nous entrons dans une socit que lon peut appeler une socit de contrle.
Gilles Deleuze, Quest-ce que lacte de cration, confrence du 17/05/1987
1.0. Dmo
data instructions
data instructions A inc ecx (x86) TX4HPZTAZAYVH92 getcpu (multiarch) a bad instruction! (x64)
data instructions A inc ecx (x86) TX4HPZTAZAYVH92 getcpu (multiarch) a bad instruction! (x64)
source code instructions : gcc -s, ... instructions data : gcc, nasm, ... data instruction : objdump -d, ... instructions code : problme mal pos (boomerang)...
Dmo
> > > > echo main () { puts (" Hello world !") ;} gcc -S - O3 hello .c gcc -o hello hello .s objdump -d hello > hello .c
Remarque sur les conventions x86/x64 : |63.....32|31.....16|15....8|7.....0| |AH.....|AL.....| |AX.............| |EAX......................| |RAX................................|
inputs : stdin (user), sockets (network), signals (os)... memory : stack (ram), heap (ram), les, ...
inputs : stdin (user), sockets (network), signals (os)... memory : stack (ram), heap (ram), les, ... cpu
inputs : stdin (user), sockets (network), signals (os)... memory : stack (ram), heap (ram), les, ... cpu
function1 takes control : push caller rbp, rbp = rsp, arg1 at rbp+8 or rbp+16
... arg2 arg1 ret addr caller rbp rsp = rbp
When function2 has nished : it stores its return value in rax, rsp += size, pop registers, pop rbp, ret (=pop ret and jmp there)
... arg2 arg1 ret addr caller rbp callee regs local vars caller regs arg4 arg3 rsp rbp
Then function1 cleans up rsp = rsp + size pop registers pop rbp ret
... arg2 arg1 ret addr rsp rbp (caller)
Dmo
Stack-based buer overow
Demo
segfault_detector.sh
inp = perl -e { print "A" x8000 } for program in / usr / bin /*; do for op in { a .. z } {A .. Z }; do timeout -s 9 1 s $program - $opt $inp done done
Juste un bug ?
Utilisons gdb pour mener lenqute !
> gdb hijack ( gdb ) r $ ( python -c " print ( gdb ) info registers
B *80")
Demo
Control ow hijacking
> gdb hijack ( gdb ) r $ ( python -c " print ( gdb ) info registers
Demo
Control ow hijacking
> gdb hijack ( gdb ) r $ ( python -c " print ( gdb ) info registers > STR = $ ( python -c " print > ./ hijack $STR
B *32+ \ xef \ xbe \ xad \ xde ") A *32+ \ x7c \ x84 \ x04 \ x08 ")
Demo
Control ow hijacking
> gdb hijack ( gdb ) r $ ( python -c " print ( gdb ) info registers > STR = $ ( python -c " print > ./ hijack $STR
B *32+ \ xef \ xbe \ xad \ xde ") A *32+ \ x7c \ x84 \ x04 \ x08 ")
1.4 Shellcoding
From bof to ace !
1.4 Shellcoding
From bof to ace ! Rsum : Donnes utilisateur dans la pile Overow contrle de rip ...
1.4 Shellcoding
From bof to ace ! Rsum : Donnes utilisateur dans la pile Overow contrle de rip ... Ide : Envoyer des donnes excutables !
1.4 Shellcoding
From bof to ace ! Rsum : Donnes utilisateur dans la pile Overow contrle de rip ... Ide : Envoyer des donnes excutables ! ...et les faire excuter.
1.4 Shellcoding
From bof to ace !
1.4 Shellcoding
From bof to ace ! Question 0 : que veut-on excuter ?
1.4 Shellcoding
From bof to ace ! Question 0 : que veut-on excuter ? Souvent, un shell Question 1 : comment crer le code excutable ?
1.4 Shellcoding
From bof to ace ! Question 0 : que veut-on excuter ? Souvent, un shell Question 1 : comment crer le code excutable ? gcc, ou la main Question 2 : cest si simple ?
1.4 Shellcoding
From bof to ace ! Question 0 : que veut-on excuter ? Souvent, un shell Question 1 : comment crer le code excutable ? gcc, ou la main Question 2 : cest si simple ? Juste eviter 0x0...
1.4 Shellcoding
From bof to ace ! Question 0 : que veut-on excuter ? Souvent, un shell Question 1 : comment crer le code excutable ? gcc, ou la main Question 2 : cest si simple ? Juste eviter 0x0... Faut avoir la place (sinon, ret2env etc)...
1.4 Shellcoding
From bof to ace ! Question 0 : que veut-on excuter ? Souvent, un shell Question 1 : comment crer le code excutable ? gcc, ou la main Question 2 : cest si simple ? Juste eviter 0x0... Faut avoir la place (sinon, ret2env etc)... Ne pas se faire gauler.
Demo 1
> ./ shell > ./ shelltest python -c " print A *28+ addr "
Demo 2
IDS evading x86 NOP-sled
(Formation VIA/haXor 2009 Advanced shellcoding)
SUPREMELYCRUTCHESCATARACTINSTRUMENTATIONLOVABLY PERILLABARBSPANISHIZESBEGANAMBIDEXTROUSLY PHOSPHORSAVEDZEALOUSCONVINCEDFIXERS
Demo 2
IDS evading x86 NOP-sled
(Formation VIA/haXor 2009 Advanced shellcoding)
SUPREMELYCRUTCHESCATARACTINSTRUMENTATIONLOVABLY PERILLABARBSPANISHIZESBEGANAMBIDEXTROUSLY PHOSPHORSAVEDZEALOUSCONVINCEDFIXERS
Demo 2
IDS evading x86 NOP-sled
(Formation VIA/haXor 2009 Advanced shellcoding)
SUPREMELYCRUTCHESCATARACTINSTRUMENTATIONLOVABLY PERILLABARBSPANISHIZESBEGANAMBIDEXTROUSLY PHOSPHORSAVEDZEALOUSCONVINCEDFIXERS
Demo 3
Tool-assisted payload
msfpayload linux / x86 / exec CMD =/ bin / sh R | msfencode -b \ x00 \ xff -t c > shellcode .h
CONTRE-CONTRE-MESURES CONTRE-CONTRE-CONTRE-MESURES
-1. Contre-mesures
Demo
Progressivement adopt : Linux (2005), OS X (2007), Android (> 4.0, 2011), Windows (7, 8, 2012) absent de FreeBSD
Progressivement adopt : Linux (2005), OS X (2007), Android (> 4.0, 2011), Windows (7, 8, 2012) absent de FreeBSD
OS, no overhead Breaks some software (legacy), useless on 32 bits, debugging harder, still DoS
Largement adopt : Burroughs 5000 (1961), FreeBSD (2004), Linux (20002004), Windows (2004), OS X (2005), Android (2011) Ubuntu, Fedora, openSUSE ne lactivent pas par dfaut en 32 bits.
-1.3. Canaries
Ide : placer des canaris des endroits stratgiques, vrier sils sont en vie lorsque la fonction retourne. Pas de canaris, pas de retour. Pas de retour, pas de shell.
gcc (1998), Visual Studio (2002) Pas activ par dfaut par clang/LLVM
Demo : -fstack-protector-all
Possible, PoC, mme ASTRE Slow, still quite unknown, quite limited
Bilan : contre-mesures
(SSP/GS) Quand bien mme il y aurait une vulnrabilit, les canaris nous empchent dcraser ret
Bilan : contre-mesures
(SSP/GS) Quand bien mme il y aurait une vulnrabilit, les canaris nous empchent dcraser ret (DEP/NX) Quand bien mme on crase ret, notre code ne sera pas excut
Bilan : contre-mesures
(SSP/GS) Quand bien mme il y aurait une vulnrabilit, les canaris nous empchent dcraser ret (DEP/NX) Quand bien mme on crase ret, notre code ne sera pas excut (ASLR) Quand bien mme on pourrait excuter notre code, on ne sait pas o il est.
Bilan : contre-mesures
(SSP/GS) Quand bien mme il y aurait une vulnrabilit, les canaris nous empchent dcraser ret (DEP/NX) Quand bien mme on crase ret, notre code ne sera pas excut (ASLR) Quand bien mme on pourrait excuter notre code, on ne sait pas o il est. Par ailleurs, chacune de ces contre-mesures peut lancer lalerte.
Bilan : contre-mesures
(SSP/GS) Quand bien mme il y aurait une vulnrabilit, les canaris nous empchent dcraser ret (DEP/NX) Quand bien mme on crase ret, notre code ne sera pas excut (ASLR) Quand bien mme on pourrait excuter notre code, on ne sait pas o il est. Par ailleurs, chacune de ces contre-mesures peut lancer lalerte.
Des ides ?
-1.5. Contre-contre-mesures
ASLR ASLR Alatoire
-1.5. Contre-contre-mesures
ASLR ASLR Alatoire Brute force.
-1.5. Contre-contre-mesures
ASLR ASLR Alatoire Brute force. Revenir en terrain connu : ret2text, funcptr
-1.5. Contre-contre-mesures
ASLR ASLR Alatoire Brute force. Revenir en terrain connu : ret2text, funcptr Juggling : ret2ret, ret2pop, ret2eax
-1.5. Contre-contre-mesures
ASLR ASLR Alatoire Brute force. Revenir en terrain connu : ret2text, funcptr Juggling : ret2ret, ret2pop, ret2eax Global oset table : ret2got (readelf -S a.out|grep got)
-1.5. Contre-contre-mesures
ASLR ASLR Alatoire Brute force. Revenir en terrain connu : ret2text, funcptr Juggling : ret2ret, ret2pop, ret2eax Global oset table : ret2got (readelf -S a.out|grep got) etc. : ret2dtors, jop... T. Mller, ASLR Smack & Laugh Reference
-1.5. Contre-contre-mesures
DEP/NX On ne peut pas excuter notre code.
-1.5. Contre-contre-mesures
DEP/NX On ne peut pas excuter notre code. Mais on peut toujours excuter le sien.
-1.5. Contre-contre-mesures
DEP/NX On ne peut pas excuter notre code. Mais on peut toujours excuter le sien.
ret2libc : retourner dans la libc (sauf ASLR...) ROP Return-oriented programming (Shacham, 2007) .text souvent non randomis (sauf -fPIE) Identier des gadgets qui nissent par ret
-1.5. Contre-contre-mesures
DEP/NX On ne peut pas excuter notre code. Mais on peut toujours excuter le sien.
ret2libc : retourner dans la libc (sauf ASLR...) ROP Return-oriented programming (Shacham, 2007) .text souvent non randomis (sauf -fPIE) Identier des gadgets qui nissent par ret Enchaner les gadgets pour faire ce que lon veut.
-1.5. Contre-contre-mesures
DEP/NX On ne peut pas excuter notre code. Mais on peut toujours excuter le sien.
ret2libc : retourner dans la libc (sauf ASLR...) ROP Return-oriented programming (Shacham, 2007) .text souvent non randomis (sauf -fPIE) Identier des gadgets qui nissent par ret Enchaner les gadgets pour faire ce que lon veut. Turing-complet si le programme est assez grand.
-1.5. Contre-contre-mesures
DEP/NX On ne peut pas excuter notre code. Mais on peut toujours excuter le sien.
ret2libc : retourner dans la libc (sauf ASLR...) ROP Return-oriented programming (Shacham, 2007) .text souvent non randomis (sauf -fPIE) Identier des gadgets qui nissent par ret Enchaner les gadgets pour faire ce que lon veut. Turing-complet si le programme est assez grand. Automatisable : Q (2011), Mona (2011)
-1.5. Contre-contre-mesures
-1.5. Contre-contre-mesures
Canaris et protections anticrasement Alatoire Brute force. Clever brute force (side channel)
-1.5. Contre-contre-mesures
Canaris et protections anticrasement Alatoire Brute force. Clever brute force (side channel) Check on exit. Si a se trouve, on a dj fait ce quon voulait.
-1.5. Contre-contre-mesures
Canaris et protections anticrasement Alatoire Brute force. Clever brute force (side channel) Check on exit. Si a se trouve, on a dj fait ce quon voulait. ebp hijack
-1.5. Contre-contre-mesures
Canaris et protections anticrasement Alatoire Brute force. Clever brute force (side channel) Check on exit. Si a se trouve, on a dj fait ce quon voulait. ebp hijack a provoque une erreur.
-1.5. Contre-contre-mesures
Canaris et protections anticrasement Alatoire Brute force. Clever brute force (side channel) Check on exit. Si a se trouve, on a dj fait ce quon voulait. ebp hijack a provoque une erreur. Hacker le gestionnaire derreur (ret2got, SEH, SafeSEH, SEHOP...)
-1.5. Contre-contre-mesures
-1.6. Ad libidum
Contre-contre-contre-mesures, contre-contre-contre-contre mesures... fPIE + Control Flow Integrity + 64 bit ASLR + fstack-protector-all, ASCII Armored Address Space, ESP protection, code sign...
-1.6. Ad libidum
Contre-contre-contre-mesures, contre-contre-contre-contre mesures... fPIE + Control Flow Integrity + 64 bit ASLR + fstack-protector-all, ASCII Armored Address Space, ESP protection, code sign... ret-less ROP, relative jop, JIT spraying, other (e.g. pi3ki31ny in phrack Vol 0x0e, Issue 0x43, Phile #0x0d)...
-1.6. Ad libidum
Contre-contre-contre-mesures, contre-contre-contre-contre mesures... fPIE + Control Flow Integrity + 64 bit ASLR + fstack-protector-all, ASCII Armored Address Space, ESP protection, code sign... ret-less ROP, relative jop, JIT spraying, other (e.g. pi3ki31ny in phrack Vol 0x0e, Issue 0x43, Phile #0x0d)... Virtualisation, signature de code, obfuscation...
-1.6. Ad libidum
Contre-contre-contre-mesures, contre-contre-contre-contre mesures... fPIE + Control Flow Integrity + 64 bit ASLR + fstack-protector-all, ASCII Armored Address Space, ESP protection, code sign... ret-less ROP, relative jop, JIT spraying, other (e.g. pi3ki31ny in phrack Vol 0x0e, Issue 0x43, Phile #0x0d)... Virtualisation, signature de code, obfuscation... Blue pill, VT-x rootkits, in-memory deobfuscation...
-1.6. Ad libidum
Contre-contre-contre-mesures, contre-contre-contre-contre mesures... fPIE + Control Flow Integrity + 64 bit ASLR + fstack-protector-all, ASCII Armored Address Space, ESP protection, code sign... ret-less ROP, relative jop, JIT spraying, other (e.g. pi3ki31ny in phrack Vol 0x0e, Issue 0x43, Phile #0x0d)... Virtualisation, signature de code, obfuscation... Blue pill, VT-x rootkits, in-memory deobfuscation...
-1.6. Ad libidum
Pourquoi si mous ? [...] Pourquoi si mous, si chissants, si mollissants ? Pourquoi y a-t-il tant de reniement, tant dabngation dans votre cur ? [...] mes frres, je place au-dessus de vous cette table nouvelle : Devenez durs !
Friedrich Nietzsche, Ainsi parlait Zarathoustra, trad. Bianquis, Chap. 3 p. 303, 1885
Conclusion temporaire
They only made it interesting again
Conclusion temporaire
They only made it interesting again
Les ordinateurs modernes sont assez lourdement quips contre ce type dattaque.
Conclusion temporaire
They only made it interesting again
Les ordinateurs modernes sont assez lourdement quips contre ce type dattaque.
Conclusion
Conclusion