{"id":1158,"date":"2015-03-07T09:10:40","date_gmt":"2015-03-07T15:10:40","guid":{"rendered":"http:\/\/www.nathanhunstad.com\/blog\/?p=1158"},"modified":"2015-03-07T09:13:49","modified_gmt":"2015-03-07T15:13:49","slug":"splunk-reporting-port-scans","status":"publish","type":"post","link":"https:\/\/www.nathanhunstad.com\/blog\/2015\/03\/splunk-reporting-port-scans\/","title":{"rendered":"Splunk Reporting: Port Scans"},"content":{"rendered":"<p>It\u2019s been a while since I\u2019ve done some Splunk work on my home network, but lately I&#8217;ve been\u00a0thinking about port scans, specifically about reporting on port scans against my environment.\u00a0I\u2019m not terribly worried about people scanning my network since it is quite locked down, but why not check on it to see if anything interesting is going on? Before too long I had a new dashboard; details below the jump.<\/p>\n<p><!--more--><\/p>\n<p>The last time <a href=\"http:\/\/www.nathanhunstad.com\/blog\/2014\/08\/splunk-reporting-mapping-brute-force-attempts\/\" target=\"_blank\">I did this<\/a>, I was trying to map brute force attempts. Port scans are similar, so I started with the search I did for the brute force attempts, tweaked it a bit with some help from the internets, and this is what I got:<\/p>\n<p><span style=\"font-family: 'Courier New';\">index=firewall RuleName=WAN-*default-D | bucket _time span=30 | eventstats dc(DPT) AS PortsScanned by SRC, _time | where PortsScanned &gt; 5 | dedup SRC, PortsScanned | table SRC, PortsScanned, _time<\/span><\/p>\n<p>Walking through this step by step: the first section says to search my firewall index, and to only include logs of rules that match WAN-*default-D, which is my rule nomenclature for traffic that originates from the WAN zone and is dropped by my default drop rule (meaning no pre-existing connection existed, it just came out of the blue). Then it buckets the time into 30 second buckets, since it could take several seconds to do a port scan of numerous ports. The eventstats command counts the number of distinct (<span style=\"font-family: 'Courier New';\">dc<\/span>) destination ports (<span style=\"font-family: 'Courier New';\">DPT<\/span>) that are scanned in each time bucket from the same source IP (<span style=\"font-family: 'Courier New';\">SRC<\/span>)\u00a0 and names that field PortsScanned. It then only includes results where the number of ports scanned is greater than 5: a single port is not a scan! Finally, it dedups the data and shows it in a nice table.<\/p>\n<p>The result is this:<\/p>\n<p><a href=\"http:\/\/www.nathanhunstad.com\/blog\/wp-content\/uploads\/2015\/03\/image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"image\" src=\"http:\/\/www.nathanhunstad.com\/blog\/wp-content\/uploads\/2015\/03\/image_thumb.png\" alt=\"image\" width=\"664\" height=\"221\" border=\"0\" \/><\/a><\/p>\n<p>A little dashboard work, and now I have a dashboard panel that includes a way to quickly change the time span:<\/p>\n<p><a href=\"http:\/\/www.nathanhunstad.com\/blog\/wp-content\/uploads\/2015\/03\/image1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"image\" src=\"http:\/\/www.nathanhunstad.com\/blog\/wp-content\/uploads\/2015\/03\/image_thumb1.png\" alt=\"image\" width=\"676\" height=\"189\" border=\"0\" \/><\/a><\/p>\n<p>As before, I could easily map this with the <span style=\"font-family: 'Courier New';\">iplocation<\/span> and <span style=\"font-family: 'Courier New';\">geostats<\/span> functions. Quick and easy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It\u2019s been a while since I\u2019ve done some Splunk work on my home network, but lately I&#8217;ve been\u00a0thinking about port scans, specifically about reporting on port scans against my environment.\u00a0I\u2019m not terribly worried about people scanning my network since it is quite locked down, but why not check on it to see if anything interesting&hellip; <a class=\"more-link\" href=\"https:\/\/www.nathanhunstad.com\/blog\/2015\/03\/splunk-reporting-port-scans\/\">Continue reading <span class=\"screen-reader-text\">Splunk Reporting: Port Scans<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[127,19],"tags":[268,252],"class_list":["post-1158","post","type-post","status-publish","format-standard","hentry","category-security","category-tech-2","tag-port-scan","tag-splunk","entry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.nathanhunstad.com\/blog\/wp-json\/wp\/v2\/posts\/1158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nathanhunstad.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nathanhunstad.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nathanhunstad.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nathanhunstad.com\/blog\/wp-json\/wp\/v2\/comments?post=1158"}],"version-history":[{"count":2,"href":"https:\/\/www.nathanhunstad.com\/blog\/wp-json\/wp\/v2\/posts\/1158\/revisions"}],"predecessor-version":[{"id":1161,"href":"https:\/\/www.nathanhunstad.com\/blog\/wp-json\/wp\/v2\/posts\/1158\/revisions\/1161"}],"wp:attachment":[{"href":"https:\/\/www.nathanhunstad.com\/blog\/wp-json\/wp\/v2\/media?parent=1158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nathanhunstad.com\/blog\/wp-json\/wp\/v2\/categories?post=1158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nathanhunstad.com\/blog\/wp-json\/wp\/v2\/tags?post=1158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}