Package: yersinia
Version: 0.7.1-1.1
Severity: normal
Tags: patch

The IP addresses passed as command line parameters have their bytes 
reversed in the generated packet. For instance in the example below,
the -ipsource parameter 10.11.22.33  is changed to 33.22.11.10.

# yersinia dot1q -attack 1 -interface eth1 -dest 11:22:33:44:55:66
-ipsource 10.11.22.33 -ipdest 10.77.88.99   -vlan1 1111  -vlan2 2222
<*> Starting NONDOS attack sending 802.1Q double enc. packet...
....

tcpdump output:

11:38:27.029116 0e:c4:36:08:12:20 > 11:22:33:44:55:66, ethertype
802.1Q (0x8100), length 58: ethertype 802.1Q, ethertype IPv4, (tos
0x0, ttl 64, id 66, offset 0, flags [none], proto ICMP (1), length 36)
33.22.11.10 > 99.88.77.10: ICMP echo request, id 66, seq 66, length 16

The attached patch seems to cure the problem for the few cases I have 
tried. It removes the call to ntohl(). I hope it makes sense. 
In case you wonder, the second change was done to help to distinguish 
between two otherwise identical error messages.

BTW, I packaged the latest snapshot (+svn48) to check if the bug was fixed
here (no) and for information the debian patch applies cleanly.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing'), (100, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.30
Locale: lang=fr...@euro, lc_ctype=fr...@euro (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/dash

Versions of packages yersinia depends on:
ii  libatk1.0-0               1.28.0-1       The ATK accessibility toolkit
ii  libc6                     2.9-26         GNU C Library: Shared libraries
ii  libcairo2                 1.8.8-2        The Cairo 2D vector graphics libra
ii  libfontconfig1            2.6.0-4        generic font configuration library
ii  libfreetype6              2.3.9-5        FreeType 2 font engine, shared lib
ii  libglib2.0-0              2.22.0-1       The GLib library of C routines
ii  libgtk2.0-0               2.18.0-1       The GTK+ graphical user interface
ii  libncurses5               5.7+20090803-2 shared libraries for terminal hand
ii  libnet1                   1.1.4-2        library for the construction and h
ii  libpango1.0-0             1.26.0-1       Layout and rendering of internatio
ii  libpcap0.8                1.0.0-4        system interface for user-level pa

yersinia recommends no packages.

yersinia suggests no packages.

-- no debconf information

Thank you

-- 
Michel Casabona
--- yersinia/src/parser.c	2008-06-06 08:02:13.000000000 +0200
+++ yersinia-0.7.1+svn48/src/parser.c	2009-09-30 12:04:57.000000000 +0200
@@ -1714,13 +1714,14 @@
                      return -1;
                   }
 
+                  /*
                   if (comm_par[j].type == FIELD_IP)
                   {
                      memcpy((void *)&aux_long, (void *)node->protocol[proto].commands_param[j], 4);
                      aux_long = ntohl(aux_long);
                      memcpy((void *)node->protocol[proto].commands_param[j], (void *)&aux_long, 4);
                   }
-
+                  */
                  
                  if (comm_par[j].filter) /* Use specific filter for this param */
                  {
@@ -1728,7 +1729,7 @@
                     fail = (comm_par[j].filter((void *)node,node->protocol[proto].commands_param[j],*(aux_args+1)));
                     if (fail == -1)
                     {
-                       write_log(2," Bad value '%s' for parameter '%s'!!\n",*(aux_args+1),param);
+                       write_log(2," Bad value '%s' for parameter '%s'!!!\n",*(aux_args+1),param);
                        return -1;
                     }                    
                  }

Reply via email to