Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Libnet
[Top] [All Lists]

ptag_state wraparound bug

Subject: ptag_state wraparound bug
Date: Sun, 17 Oct 2004 22:30:10 -0500
Hi all,

I've discovered (through debugging an application error I was having) a
bug in the ptag id creation.  It seems that the value (-1) is used as an
error code in returning from libnet_build_*, and otherwise the return
value from that series of functions is to be a unique integer
representing a tag value for the pblock structure created internally and
linked into the libnet_t structure.

The problem I'm having is that after constructing and sending very many
unique packets (on the order of a billion), the ptag_state incremental
counter which is used to initialize ptag values wraps all the way around
until it contains the unsigned equivalent of (-1), thus artificially
signaling an error code.
 
Here's my first attempt at fixing the problem on my machine--by adding a
line to libnet_build_tcp.c, libnet_build_ip.c, and libnet_pblock.c, like
the following:
                p_data->ptag  =  ++(l->ptag_state);
                l->ptag_state &= 0x7FFFFFFF;  /* added line to control
wraparound of ptag_state so it doesn't hit (-1) */

I have tested this fix, and it works fine on my 32-bit
Intel-architecture machine.  Before accepting it as the best solution, I
would want people to think about non-32-bit machines, non-Intel
architectures, and any efficiency considerations (although the and
operation I implemented should be very efficient).  Any comments?

--David





<Prev in Thread] Current Thread [Next in Thread>
  • ptag_state wraparound bug, Beattie, David <=