{"id":36,"date":"2018-08-01T11:36:20","date_gmt":"2018-08-01T11:36:20","guid":{"rendered":"https:\/\/www.imperva.com\/learn\/?post_type=application_security&#038;p=36"},"modified":"2024-08-29T14:40:03","modified_gmt":"2024-08-29T14:40:03","slug":"tcp-transmission-control-protocol","status":"publish","type":"ddos","link":"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/","title":{"rendered":"Transmission control protocol (TCP)"},"content":{"rendered":"<h2>What is the transmission control protocol (TCP)<\/h2>\n<p>The transmission control protocol (TCP) is the internet standard ensuring the successful exchange of data packets between devices over a network. TCP is the underlying communication protocol for a wide variety of applications, including web servers and websites, email applications, FTP and peer-to-peer apps.<\/p>\n<p>TCP operates with the internet protocol (IP) to specify how data is exchanged online. IP is responsible for sending each packet to its destination, while TCP guarantees that bytes are transmitted in the order in which they were sent with no errors or omissions. Together, the two protocols are referred to as TCP\/IP.<\/p>\n<h2>Establishing a TCP connection: the three-way handshake<\/h2>\n<p>Establishing a TCP connection requires that both the client and server participate in what is known as a\u00a0<a href=\"https:\/\/www.imperva.com\/learn\/performance\/cdn-and-ssl-tls\/#ssl-handshake\" target=\"_blank\" rel=\"noopener noreferrer\">three-way handshake<\/a>. The process can be broken down as follows:<\/p>\n<ol>\n<li>A client sends the server a SYN packet\u2014a connection request from its source port to a server\u2019s destination port.<\/li>\n<li>The server responds with a SYN\/ACK packet, acknowledging the receipt of the connection request.<\/li>\n<li>The client receives the SYN\/ACK packet and responds with an ACK packet of its own.<\/li>\n<\/ol>\n<p>After the connection is established, TCP works by breaking down transmitted data into segments, each of which is packaged into a datagram and sent to its destination.<\/p>\n<h2>TCP header structure<\/h2>\n<p>TCP wraps each data packet with a header containing 10 mandatory fields totaling 20 bytes (or octets). Each header holds information about the connection and the current data being sent.<\/p>\n<p>The 10 TCP header fields are as follows:<\/p>\n<ol>\n<li><strong>Source port<\/strong>\u00a0\u2013 The sending device\u2019s port.<\/li>\n<li><strong>Destination port<\/strong>\u00a0\u2013 The receiving device\u2019s port.<\/li>\n<li><strong>Sequence number<\/strong>\u00a0\u2013 A device initiating a TCP connection must choose a random initial sequence number, which is then incremented according to the number of transmitted bytes.<\/li>\n<li><strong>Acknowledgment number<\/strong>\u00a0\u2013 The receiving device maintains an acknowledgment number starting with zero. It increments this number according to the number of bytes received.<\/li>\n<li><strong>TCP data offset<\/strong>\u00a0\u2013 This specifies the size of the TCP header, expressed in 32-bit words. One word represents four bytes.<\/li>\n<li><strong>Reserved data<\/strong>\u00a0\u2013 The reserved field is always set to zero.<\/li>\n<li><strong>Control flags<\/strong>\u00a0\u2013 TCP uses nine control flags to manage data flow in specific situations, such as the initiating of a reset.<\/li>\n<li><strong>Window size TCP checksum<\/strong>\u00a0\u2013 The sender generates a checksum and transmits it in every packet header. The receiving device can use the checksum to check for errors in the received header and payload.<\/li>\n<li><strong>Urgent pointer<\/strong>\u00a0\u2013 If URG control flag is set, this value indicates an offset from the sequence number, indicating the last urgent data byte.<\/li>\n<li style=\"text-align: left;\"><strong>mTCP optional data<\/strong>\u00a0\u2013 These are optional fields for setting maximum segment sizes, selective acknowledgments and enabling window scaling for more efficient use of high-bandwidth networks.<\/li>\n<\/ol>\n<h2>TCP DDoS vulnerabilities and methods of mitigation<\/h2>\n<p>TCP is vulnerable to several types of\u00a0<a href=\"https:\/\/www.imperva.com\/learn\/application-security\/ddos-attacks\/\" target=\"_blank\" rel=\"noopener noreferrer\">DDoS attacks<\/a>, including:<\/p>\n<h3>SYN flood<\/h3>\n<p><a href=\"https:\/\/www.imperva.com\/learn\/application-security\/syn-flood\/\" target=\"_blank\" rel=\"noopener noreferrer\">SYN floods<\/a>\u00a0occur during the initial stage of a three-way handshake by sending TCP connection requests (SYN packets) to every port on a target machine faster than it can process the requests. The server attempts to process the attacker\u2019s fake SYN requests and becomes unresponsive to legitimate TCP requests, preventing the completion of the handshake.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-37 size-full\" src=\"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood.jpg\" alt=\"SYN flood attack progression.\" width=\"650\" height=\"467\" srcset=\"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood.jpg 650w, https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood-300x216.jpg 300w, https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood-508x365.jpg 508w, https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood-510x366.jpg 510w, https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood-70x50.jpg 70w, https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood-501x360.jpg 501w, https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood-420x302.jpg 420w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><small>SYN flood attack progression.<\/small><\/p>\n<p>This causes the targeted machine to exhaust all of its available ports. In many cases, SYN packets are the go-to payload and are used simply to saturate a target\u2019s network pipe.<\/p>\n<p>There are several ways to mitigate SYN floods, including:<\/p>\n<ol>\n<li><strong>Micro-blocks<\/strong>\u00a0\u2013 The server allocates a micro-record in its memory for each SYN request instead of a complete connection object, thus reducing potential resource strain from too many requests.<\/li>\n<li><strong>SYN cookies<\/strong>\u00a0\u2013 The server uses cryptographic hashing to verify a TCP request before allocating memory.<\/li>\n<li><strong>RST cookies<\/strong>\u00a0\u2013 The server intentionally sends an incorrect response after the initial SYN request. If the client is legitimate, the server receives an RST packet, telling the server something is wrong.<\/li>\n<li><strong>TCP stack tweaking<\/strong>\u00a0\u2013 You can decrease the timeout for releasing memory allocated to a connection, or selectively drop incoming connections.<\/li>\n<\/ol>\n<p>Note that in addition to the \u201cclassic\u201d SYN flood attack method, many DDoS offenders use fake SYN payloads to mount generic network layer assaults \u2013 the type that simply aims to cause network congestion with an overload of fake packets. Mitigating these attacks requires the ability to scale up network resources on demand, e.g., using a cloud mitigation solution.<\/p>\n<h3>STOMP DDoS attack<\/h3>\n<p>STOMP is a text-based protocol that allows applications to communicate with message brokers using TCP. In a STOMP DDoS attack, perpetrators use a botnet to open large numbers of TCP handshakes with applications. The attackers then send junk data disguised as STOMP TCP requests, saturating the network. If the server is prepared to parse STOMP requests, the attack can also exhaust server resources.<\/p>\n<h3>TCP fragmentation (Teardrop)<\/h3>\n<p>A teardrop attack is a type of\u00a0<a href=\"https:\/\/www.imperva.com\/learn\/application-security\/ip-fragmentation-attack-teardrop\/\" target=\"_blank\" rel=\"noopener noreferrer\">IP fragmentation<\/a>\u00a0attack that targets the TCP\/IP reassembly mechanism, occurring after a three-way handshake has been completed and data is being transmitted. It involves an attacker deliberately sending data packets with defective segment offset fields, preventing the receiver from correctly putting together the fragmented data. Data packets overlap and quickly overwhelm the victim\u2019s servers.<\/p>\n<p>Preventing TCP fragmentation attacks requires the inspection of incoming packets using routers, secure proxies or a\u00a0<a href=\"https:\/\/www.imperva.com\/products\/ddos-protection-services\/\" target=\"_blank\" rel=\"noopener noreferrer\">cloud-based DDoS protection service<\/a>. Packets with incorrect fragmentation are then detected and dropped before they reach your server.<\/p>\n<div class=\"ddos-banner\"><div class=\"wrap\"><p>See how Imperva DDoS Protection can help you with TCP DDoS attacks.<\/p>\n<div class=\"cta-container\">\n                                                    <a class=\"impv-yellow-btn\"  event-action=\"Click\"  event-category=\"LC Banner\"  event-label=\"Request demo\"  gtm-track  target=\"_self\" href=\"javascript:openModal('modalid3533', '\/learn\/banner\/virtual\/request-demo\/', 'Personal Demo Request | Imperva');\">Request demo<\/a>\n                                                    <a class=\"gst-yellow-dark-text-btn\"  event-action=\"Click\"  event-category=\"LC Banner\"  event-label=\"Learn more\"  gtm-track  target=\"_self\" href=\"https:\/\/www.imperva.com\/products\/ddos-protection-services\/\">Learn more<\/a>\n                                                <\/div><\/div><\/div><h2>TCP DDoS mitigation<\/h2>\n<p>Imperva allows you to scale up your network resources, enabling the absorption of TCP attacks of all sizes. Our dedicated multi-terabit scrubbing solutions use deep packet inspection (DPI) to identify and block malicious traffic before it gets a chance to reach your server.<\/p>\n<p>The service can be deployed via BGP based or DNS based rerouting, either as an always-on or on-demand solution.<\/p>","protected":false},"featured_media":0,"template":"","categories":[10],"class_list":["post-36","ddos","type-ddos","status-publish","hentry","category-ddos"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is TCP | Header Structure to DDoS Connection | Imperva<\/title>\n<meta name=\"description\" content=\"Transmission control protocol (TCP) enables the exchange of data over the internet. Learn how TCP headers ensure successful online communication, as well as the DDoS threats targeting the protocol.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is TCP | Header Structure to DDoS Connection | Imperva\" \/>\n<meta property=\"og:description\" content=\"Transmission control protocol (TCP) enables the exchange of data over the internet. Learn how TCP headers ensure successful online communication, as well as the DDoS threats targeting the protocol.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/\" \/>\n<meta property=\"og:site_name\" content=\"Learning Center\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-29T14:40:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data2\" content=\"Itamar Verta\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/\",\"url\":\"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/\",\"name\":\"What is TCP | Header Structure to DDoS Connection | Imperva\",\"isPartOf\":{\"@id\":\"https:\/\/www.imperva.com\/learn\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood.jpg\",\"datePublished\":\"2018-08-01T11:36:20+00:00\",\"dateModified\":\"2024-08-29T14:40:03+00:00\",\"description\":\"Transmission control protocol (TCP) enables the exchange of data over the internet. Learn how TCP headers ensure successful online communication, as well as the DDoS threats targeting the protocol.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/#primaryimage\",\"url\":\"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood.jpg\",\"contentUrl\":\"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood.jpg\",\"width\":650,\"height\":467},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.imperva.com\/learn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DDoS\",\"item\":\"https:\/\/www.imperva.com\/learn\/edge-security\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Transmission control protocol (TCP)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.imperva.com\/learn\/#website\",\"url\":\"https:\/\/www.imperva.com\/learn\/\",\"name\":\"Learning Center\",\"description\":\"Imperva\",\"publisher\":{\"@id\":\"https:\/\/www.imperva.com\/learn\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.imperva.com\/learn\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.imperva.com\/learn\/#organization\",\"name\":\"Imperva Inc\",\"url\":\"https:\/\/www.imperva.com\/learn\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.imperva.com\/learn\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2023\/06\/Linkedin-FB-OG-sharing.jpeg\",\"contentUrl\":\"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2023\/06\/Linkedin-FB-OG-sharing.jpeg\",\"width\":1200,\"height\":627,\"caption\":\"Imperva Inc\"},\"image\":{\"@id\":\"https:\/\/www.imperva.com\/learn\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is TCP | Header Structure to DDoS Connection | Imperva","description":"Transmission control protocol (TCP) enables the exchange of data over the internet. Learn how TCP headers ensure successful online communication, as well as the DDoS threats targeting the protocol.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/","og_locale":"en_US","og_type":"article","og_title":"What is TCP | Header Structure to DDoS Connection | Imperva","og_description":"Transmission control protocol (TCP) enables the exchange of data over the internet. Learn how TCP headers ensure successful online communication, as well as the DDoS threats targeting the protocol.","og_url":"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/","og_site_name":"Learning Center","article_modified_time":"2024-08-29T14:40:03+00:00","og_image":[{"url":"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"5 minutes","Written by":"Itamar Verta"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/","url":"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/","name":"What is TCP | Header Structure to DDoS Connection | Imperva","isPartOf":{"@id":"https:\/\/www.imperva.com\/learn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/#primaryimage"},"image":{"@id":"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/#primaryimage"},"thumbnailUrl":"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood.jpg","datePublished":"2018-08-01T11:36:20+00:00","dateModified":"2024-08-29T14:40:03+00:00","description":"Transmission control protocol (TCP) enables the exchange of data over the internet. Learn how TCP headers ensure successful online communication, as well as the DDoS threats targeting the protocol.","breadcrumb":{"@id":"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/#primaryimage","url":"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood.jpg","contentUrl":"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2019\/01\/syn-flood.jpg","width":650,"height":467},{"@type":"BreadcrumbList","@id":"https:\/\/www.imperva.com\/learn\/ddos\/tcp-transmission-control-protocol\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.imperva.com\/learn\/"},{"@type":"ListItem","position":2,"name":"DDoS","item":"https:\/\/www.imperva.com\/learn\/edge-security\/"},{"@type":"ListItem","position":3,"name":"Transmission control protocol (TCP)"}]},{"@type":"WebSite","@id":"https:\/\/www.imperva.com\/learn\/#website","url":"https:\/\/www.imperva.com\/learn\/","name":"Learning Center","description":"Imperva","publisher":{"@id":"https:\/\/www.imperva.com\/learn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.imperva.com\/learn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.imperva.com\/learn\/#organization","name":"Imperva Inc","url":"https:\/\/www.imperva.com\/learn\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.imperva.com\/learn\/#\/schema\/logo\/image\/","url":"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2023\/06\/Linkedin-FB-OG-sharing.jpeg","contentUrl":"https:\/\/www.imperva.com\/learn\/wp-content\/uploads\/sites\/13\/2023\/06\/Linkedin-FB-OG-sharing.jpeg","width":1200,"height":627,"caption":"Imperva Inc"},"image":{"@id":"https:\/\/www.imperva.com\/learn\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.imperva.com\/learn\/wp-json\/wp\/v2\/ddos\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.imperva.com\/learn\/wp-json\/wp\/v2\/ddos"}],"about":[{"href":"https:\/\/www.imperva.com\/learn\/wp-json\/wp\/v2\/types\/ddos"}],"version-history":[{"count":7,"href":"https:\/\/www.imperva.com\/learn\/wp-json\/wp\/v2\/ddos\/36\/revisions"}],"predecessor-version":[{"id":3069,"href":"https:\/\/www.imperva.com\/learn\/wp-json\/wp\/v2\/ddos\/36\/revisions\/3069"}],"wp:attachment":[{"href":"https:\/\/www.imperva.com\/learn\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.imperva.com\/learn\/wp-json\/wp\/v2\/categories?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}