[Plugins-writers] Bug in htonl (network_func.nasl) and help needed in building packe payload

From: Jingyu Dong (jdong@private)
Date: Wed Aug 17 2005 - 07:16:31 PDT


Hi Gents,

 

I found a possible bug in htonl function located in network_func.nasl:

1 function htonl(n)

2 {

3   local_var     i, j, s;

 

4   j = n;        

5  for (i = 0; j < 4; j ++)        ######## Here, shouldn't it be i < 4;
i++ ###########

6   {

7     s[i] = j & 0xFF;

8    j >>>= 8;

9   }

10   return raw_string(s[3], s[2], s[1], s[0]);

11 }

 

In line 5, shouldn't it be 'for( i = 0; i < 4; i++ )'?

 

I have checked nessus version 2.2.4 and 2.2.5, but got the same code.

 

I also have a question that needs your help: how can I forge ICMP
payload data?

I need 2 bytes source port, 2 bytes destination port, and 4 bytes
sequence #,

So I wrote like 'data = raw_string( htons(sport), htons(dport),
htonl(seq) );' but it's not working. Any idea?

 

Thank you for the help!

 

Jingyu Dong



 




_______________________________________________
Plugins-writers mailing list
Plugins-writers@private
http://mail.nessus.org/mailman/listinfo/plugins-writers



This archive was generated by hypermail 2.1.3 : Wed Aug 17 2005 - 07:17:52 PDT