{"id":504,"date":"2025-07-06T19:32:55","date_gmt":"2025-07-06T19:32:55","guid":{"rendered":"https:\/\/epbrtcybersecurityportfolio.xyz\/?p=504"},"modified":"2025-07-06T19:32:55","modified_gmt":"2025-07-06T19:32:55","slug":"ids-ips-evasion","status":"publish","type":"post","link":"https:\/\/epbrtcybersecurityportfolio.xyz\/?p=504","title":{"rendered":"IDS\/IPS Evasion"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><strong>Exercise 1<\/strong><\/h3>\n\n\n\n<p><strong>Description:<\/strong><br><strong>Examine the TCP session between hosts 192.168.1.103 and 192.168.1.104. There is something that is nonstandard about this session. What is it, and why might it cause an IDS evasion?<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Does the session get established?<\/strong><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"131\" src=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-46-1024x131.png\" alt=\"\" class=\"wp-image-505\" srcset=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-46-1024x131.png 1024w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-46-300x38.png 300w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-46-768x98.png 768w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-46.png 1504w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In Packet 64, the client at <strong>192.168.1.104<\/strong> tried to establish a connection with the server at <strong>192.168.1.103<\/strong>. Instead of acknowledging the connection, host <strong>192.168.1.103<\/strong> sent a TCP packet with an SYN flag to the host at <strong>192.168.1.104<\/strong>.  In Packet 66, the client responded with a Syn Ack packet. This packet is flagged as a retransmission as there was a time lapse of 30 seconds between pack 65 and 66. What seems to have happened is that since he did not receive a response to his Syn packet, the client retransmitted it while at the same time acknowledging the Syn packet sent by host <strong>192.168.1.103<\/strong>. The server sent an Ack package in packet 67 to complete the handshake and the session was established. This is what is called a &#8220;four-way handshake&#8221; and it might lead to IDS\/IPS evasion as this session will not be tracked since it is not a conventional three-way handshake. <\/p>\n\n\n\n<p><strong>2. Can Snort find the malicious content?<\/strong><\/p>\n\n\n\n<p><strong>One of the connections that is present in the <code>evade.pcap<\/code> file has content that looks like this:<\/strong><\/p>\n\n\n\n<p>21:56:47.400000 IP 184.168.221.65.52342 &gt; 10.1.15.80: Flags [P.], seq 143:463, ack 1, win 8192, length 421<br>HTTP: GET \/EVILSTUFF HTTP\/1.1..Host: example.com..User-Agent: curl\/7.35.0..Accept: <em>\/<\/em>\u2026.<\/p>\n\n\n\n<p><strong>We can clearly see <code>GET \/EVILSTUFF HTTP\/1.1<\/code> in the packet. Let\u2019s see if we can alert on that using this alert:<\/strong><\/p>\n\n\n\n<p>alert http (msg: &#8220;Evil 1 in URI&#8221;; content: &#8220;EVIL&#8221;; sid:10000005; rev:1;)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"74\" src=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-47.png\" alt=\"\" class=\"wp-image-513\" srcset=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-47.png 696w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-47-300x32.png 300w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/figure>\n\n\n\n<p>Let\u2019s run Snort and see how it does.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"48\" src=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-48-1024x48.png\" alt=\"\" class=\"wp-image-516\" srcset=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-48-1024x48.png 1024w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-48-300x14.png 300w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-48-768x36.png 768w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-48.png 1206w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The alert was not triggered. <\/p>\n\n\n\n<p>3. <strong>Can Zeek find it?<\/strong><\/p>\n\n\n\n<p><strong>Let\u2019s create a Zeek signature specifically designed to find that EVIL URL request. Please create a file named <code>evil.sig<\/code> that contains:<\/strong><\/p>\n\n\n\n<p>signature Evil {<br>ip-proto == tcp<br>dst-port == 80<br>payload \/EVIL\/<br>event &#8220;EVIL URL!&#8221;<br>}<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"352\" height=\"149\" src=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-49.png\" alt=\"\" class=\"wp-image-520\" srcset=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-49.png 352w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-49-300x127.png 300w\" sizes=\"auto, (max-width: 352px) 100vw, 352px\" \/><\/figure>\n\n\n\n<p>Let\u2019s run Zeek against the <code>evade.pcap<\/code> file and see if Zeek finds the known signature:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"658\" height=\"56\" src=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-50.png\" alt=\"\" class=\"wp-image-522\" srcset=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-50.png 658w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-50-300x26.png 300w\" sizes=\"auto, (max-width: 658px) 100vw, 658px\" \/><\/figure>\n\n\n\n<p>Zeek also fails to find the malicious content. <\/p>\n\n\n\n<p><strong>Exercise 2<\/strong><\/p>\n\n\n\n<p><strong>Description: Look at the HTTP traffic between hosts 10.246.50.2 and 10.246.50.6.<\/strong><\/p>\n\n\n\n<p><strong>Examine the HTTP headers on the GET request. What type of attack is this, and what does the code instruct the HTTP server to do? Was the attack successful? How do you know?<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"392\" src=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-51-1024x392.png\" alt=\"\" class=\"wp-image-527\" srcset=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-51-1024x392.png 1024w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-51-300x115.png 300w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-51-768x294.png 768w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-51.png 1303w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The User Agent looks abnormal. Normally it indicates the browser version used by the client, but in this case, it looks like an empty function followed by a ping command:<\/p>\n\n\n\n<p>User-Agent: () { :;}; \/bin\/ping -c1 10.246.50.2<\/p>\n\n\n\n<p>Searching for this kind of exploit online, I found out that this is a Shellshock vulnerability that is delivered via the User-Agent HTTP header value because the User-Agent is an environment variable.<\/p>\n\n\n\n<p>If the attack was successful, I should be able to find a ping request sent from the server (10.246.50.6) to the client (10.246.50.2):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"279\" src=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-53-1024x279.png\" alt=\"\" class=\"wp-image-532\" srcset=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-53-1024x279.png 1024w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-53-300x82.png 300w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-53-768x209.png 768w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-53.png 1273w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The attack was successful.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Exercise 3:<\/strong><\/h3>\n\n\n\n<p><strong>Description:<\/strong><br><strong>Look at the traffic between hosts 192.168.1.105 and 192.168.1.103. The fourth record in the exchange between the hosts is a RST from the client 192.168.1.105 to the server 192.168.1.103. However, as you can observe, 192.168.1.105 continues to send traffic and 192.168.1.103 acknowledges it. Explain the reason why traffic is sent and acknowledged after the RST and why it might cause an IDS evasion.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"535\" src=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-54-1024x535.png\" alt=\"\" class=\"wp-image-534\" srcset=\"https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-54-1024x535.png 1024w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-54-300x157.png 300w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-54-768x401.png 768w, https:\/\/epbrtcybersecurityportfolio.xyz\/wp-content\/uploads\/2025\/07\/image-54.png 1340w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The fourth packet has a bad TCP checksum, meaning that receiving host 192.168.1.103 will drop it, permitting the subsequent sent and acknowledged packets. Some IDS\/IPS systems do not validate the TCP checksum and therefore may stop tracking the session because it sees the RST. This would cause an evasion because the session continues and the destination host receives the malicious traffic without the IDS\/IPS being aware of it.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Exercise 1 Description:Examine the TCP session between hosts 192.168.1.103 and 192.168.1.104. There is something that is nonstandard about this session. What is it, and why might it cause an IDS evasion? In Packet 64, the client at 192.168.1.104 tried to establish a connection with the server at 192.168.1.103. Instead of acknowledging the connection, host 192.168.1.103 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-504","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/epbrtcybersecurityportfolio.xyz\/index.php?rest_route=\/wp\/v2\/posts\/504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/epbrtcybersecurityportfolio.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/epbrtcybersecurityportfolio.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/epbrtcybersecurityportfolio.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/epbrtcybersecurityportfolio.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=504"}],"version-history":[{"count":5,"href":"https:\/\/epbrtcybersecurityportfolio.xyz\/index.php?rest_route=\/wp\/v2\/posts\/504\/revisions"}],"predecessor-version":[{"id":545,"href":"https:\/\/epbrtcybersecurityportfolio.xyz\/index.php?rest_route=\/wp\/v2\/posts\/504\/revisions\/545"}],"wp:attachment":[{"href":"https:\/\/epbrtcybersecurityportfolio.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/epbrtcybersecurityportfolio.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/epbrtcybersecurityportfolio.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}