The TCP protocol can be thought of like a state machine (as can many protocols). Data can only be sent in what is commonly refered to as the established state. The connection is only in the established state when the 3 way handshake is complete. Data is not sent in the ACK packet.

If you could provide some background as to why you want to put data in the ACK packet instead of just sending another packet we might be able to help you find an alternative. I don't see an immediate reason that one would need to put data in the ACK packet.

Wikipedia:TCP has some great entry level information into this protocol.

Update: After reading your title I infer that you may be interested in sneaking data across a network by using the 3 way handshaking. I believe that there is a better way of doing it. A packet sniffer/analyzer (like wireshark) would immediately flag the ack+data packets as not conforming to known protocols. However... you can sneak data through on the syn packets using the sequence number. By creating a raw socket you can craft your own SYN packet with a meaningful sequence number (rather than a random one). Then your own TCP engine will likely reject the SYN+ACK response (because it didn't know about your raw socket). If your TCP engine does not work that way you can always send a RST packet to terminate the process. Then you send a new SYN packet with a sequence number corresponding to the next 32 bits of your data. This will appear less suspicious (especially if you encrypt the data) because it will appear to be an old style TCP Denial of Service SYN flood attack foiled because of modern tcp engines.

Of course my inference could be completely wrong and that lengthy passage could be completely worthless to you but hopefully it helps a little.


In reply to Re: Piggybacking data on TCP ACK by zek152
in thread Piggybacking data on TCP ACK by rrekhi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.