<?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>Altentee » Performance &#38; Test Automation Experts &#187; security</title>
	<atom:link href="http://altentee.com/blogs/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://altentee.com</link>
	<description>Performance and Test Automation Experts</description>
	<lastBuildDate>Fri, 04 Nov 2011 03:17:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>Improved SPNEGO or Kerberos support with LoadRunner</title>
		<link>http://altentee.com/blogs/2009/improved-spnego-or-kerberos-support-with-loadrunner/</link>
		<comments>http://altentee.com/blogs/2009/improved-spnego-or-kerberos-support-with-loadrunner/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 05:12:29 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[loadrunner]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2009/improved-spnego-or-kerberos-support-with-loadrunner/</guid>
		<description><![CDATA[Previously I identified a way in which to test SPNEGO or Kerberos authentication with LoadRunner. However this implementation was buggy in the sense that if you ran your load tests under reasonable load with the WinInet replay engine (instead of sockets) you were likely to encounter the following error: Error -27492: "HttpSendRequest" failed, Windows error [...]]]></description>
			<content:encoded><![CDATA[<p><strong><a href="http://90kts.com/blog/2008/performance-testing-spnego-or-kerberos-with-loadrunner/">Previously </a></strong>I identified a way in which to test SPNEGO or Kerberos authentication with LoadRunner. However this implementation was buggy in the sense that if you ran your load tests under reasonable load with the WinInet replay engine (instead of sockets) you were likely to encounter the following error:</p>
<p><code>Error -27492: "HttpSendRequest" failed, Windows error code=12057 (certificate revoked) and retry limit (0) exceeded for URL="<br />
https://someplacesecure.com.au/secure.html", Snapshot Info [MSH 1 2]</code></p>
<p>This error occurs when using WinInet replay instead of sockets with Integrated Authentication enabled in run-time settings. The purpose of this was to allow vusers to use SSO with SPNEGO authentication in an IBM WebSEAL environment.</p>
<p>After spending some time with the mystical HP level 3 support, they identified an undocumented flag which helps out significantly in this. So, instead of using the WinInet replay engine (which is not encouraged by HP) you should do something similar to the following.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">vuser_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Preferred run-time settings</span>
	<span style="color: #666666; font-style: italic;">// Browser -&gt; Browser Emulation</span>
       <span style="color: #666666; font-style: italic;">// [ ] Simulate a new user on each iteration</span>
       <span style="color: #666666; font-style: italic;">// Preferences -&gt; Options</span>
       <span style="color: #666666; font-style: italic;">// Enable Integration Authentication [Yes]</span>
&nbsp;
	web_set_sockets_option<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;INITIAL_BASIC_AUTH&quot;</span><span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	web_set_user<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;DOMAIN.LOCAL\\username&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;password&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;someplacesecure.com.au:443&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	web_url<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;myportal&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;URL=https://someplacesecure.com.au/wps&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Resource=0&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Referer=&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Mode=HTML&quot;</span><span style="color: #339933;">,</span>
		LAST<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The magic is in the <code>web_set_sockets_option("INITIAL_BASIC_AUTH","1")</code> flag. Set that and you can then use LoadRunner in Sockets mode which as it turns out, is much more stable.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2009/improved-spnego-or-kerberos-support-with-loadrunner/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Performance Testing SPNEGO or Kerberos with LoadRunner</title>
		<link>http://altentee.com/blogs/2008/performance-testing-spnego-or-kerberos-with-loadrunner/</link>
		<comments>http://altentee.com/blogs/2008/performance-testing-spnego-or-kerberos-with-loadrunner/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 08:15:39 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[loadrunner]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2008/performance-testing-spnego-or-kerberos-with-loadrunner/</guid>
		<description><![CDATA[Alas, it can&#8217;t be done in JMeter. So this is how it works in LoadRunner &#8230; This challenge came up recently and we were able to figure out how to test SPNEGO or Kerberos using Integrated Windows Authentication with LoadRunner. To test this I built a VM with Win2K3, an AD domain and IIS6. To [...]]]></description>
			<content:encoded><![CDATA[<p>Alas, it can&#8217;t be done in JMeter. So this is how it works in LoadRunner &#8230;<br />
This challenge came up recently and we were able to figure out how to test SPNEGO or Kerberos using Integrated Windows Authentication with LoadRunner.<br />
<span id="more-209"></span><br />
To test this I built a VM with Win2K3, an AD domain and IIS6. To enforce kerberos only authentication I modified IIS as per the following:<br />
<a href='http://90kts.com/blog/wp-content/uploads/2008/10/kerb1.png' title='kerb1.png'><img src='http://90kts.com/blog/wp-content/uploads/2008/10/kerb1.png' alt='kerb1.png' /></a></p>
<p>I didn&#8217;t have WebSEAL (which is what I was ultimately trying to simulate) but I believe this is reasonably close, to quote:</p>
<blockquote><p>Integrated Windows authentication uses Kerberos v5 authentication and NTLM authentication. Kerberos is an industry-standard authentication protocol that is used to verify user or host identity. If Active Directory is installed on a domain controller running Windows 2000 Server or Windows Server 2003, and the client browser supports the Kerberos v5 authentication protocol, Kerberos v5 authentication is used; otherwise, NTLM authentication is used.</p></blockquote>
<p>So to log on to my test page I needed to provide domain credentials in IE. I also made sure my client IE enforces IWA as per the following:<br />
<a href='http://90kts.com/blog/wp-content/uploads/2008/10/kerb2.png' title='kerb2.png'><img src='http://90kts.com/blog/wp-content/uploads/2008/10/kerb2.png' alt='kerb2.png' /></a></p>
<p>If I don&#8217;t provide my domain credentials (in this case: smallbusiness\fred) then I get knocked back with a 401 as expected.</p>
<p>On generation of my LR script the first response is a 401.2. It then does a second request with the authorization header i.e.<br />
<code>Authorization: Negotiate TlRMTVNTUAABAAAAB4IIogAAAAAAAAAAAAAAAAAAAAAFAs4OAAAADw==</code></p>
<p>The response header to this tells me to authenticate i.e.<br />
<code>WWW-Authenticate: Negotiate TlRMTVNTUAACAAAAGgAaADgAAAAFgomir1xcxf5zo2MAAAAAAAAAAOIA4gBSAAAABQLODgAAAA9TAE0AQQBMAEwAQgBVAFMASQBOAEUAUwBTAAIAGgBTAE0AQQBMAEwAQgBVAFMASQBOAEUAUwBTAAEAHgBLAE8ATwBQAFMALQA5ADYAWABZADIAVwBEAFUANgAEACYAcwBtAGEAbABsAGIAdQBzAGkAbgBlAHMAcwAuAGwAbwBjAGEAbAADAEYAawBvAG8AcABzAC0AOQA2AHgAeQAyAHcAZAB1ADYALgBzAG0AYQBsAGwAYgB1AHMAaQBuAGUAcwBzAC4AbABvAGMAYQBsAAUAJgBzAG0AYQBsAGwAYgB1AHMAaQBuAGUAcwBzAC4AbABvAGMAYQBsAAAAAAA=</code></p>
<p>The next request authorizes presumably with the correct token i.e.<br />
<code>Authorization: Negotiate TlRMTVNTUAADAAAAGAAYAIgAAAAYABgAoAAAABoAGgBIAAAACAAIAGIAAAAeAB4AagAAAAAAAAC4AAAABYKIogUCzg4AAAAPcwBtAGEAbABsAGIAdQBzAGkAbgBlAHMAcwBmAHIAZQBkAEsATwBPAFAAUwAtADkANgBYAFkAMgBXAEQAVQA2AB15bTxE3i63AAAAAAAAAAAAAAAAAAAAALQ6IC82wYIBXpniDchRG9zSW8/bC4891w==</code></p>
<p>From which the response is gravy, and my homepage loads.<br />
So the recording process looks like it went through the necessary authentication steps.</p>
<p>Now in my LR script Action() I can set the domain credentials dynamically with web_set_user (hence emulate multiple users) i.e.<br />
<code>web_set_user("smallbusiness\\fred","********", "smallbusiness.local:80");</code></p>
<p>Then follow with a web_url request to the server i.e.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">	web_url<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;smallbusiness.local&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;URL=http://smallbusiness.local/&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Resource=0&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;RecContentType=text/html&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Referer=&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Snapshot=t1.inf&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #ff0000;">&quot;Mode=HTML&quot;</span><span style="color: #339933;">,</span>
		LAST<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Play that back and it fails. (Assuming WebSEAL will reject NTLM which in this case my test rig won&#8217;t, but I can make that assumption&#8230;)</p>
<p>Now change a couple of runtime settings:<br />
Internet Protocol->Preferences->Options->Authentication->Enable Integrated Authentication<br />
<a href='http://90kts.com/blog/wp-content/uploads/2008/10/kerb3.png' title='kerb3.png'><img src='http://90kts.com/blog/wp-content/uploads/2008/10/kerb3.png' alt='kerb3.png' /></a></p>
<p>This makes sure that when the server asks for authentication via the first 401.2/1, that SPNEGO/Negotiate/Kerberos is tried *first* before any other protocol (like NTLM)</p>
<p>You also need to change:<br />
Internet Protocol->Preferences->Advanced->WinInet [checked]:<br />
<a href='http://90kts.com/blog/wp-content/uploads/2008/10/kerb4.png' title='kerb4.png'><img src='http://90kts.com/blog/wp-content/uploads/2008/10/kerb4.png' alt='kerb4.png' /></a></p>
<p>This instructs VuGen to use the WinInet replay engine instead of the standard Sockets replay. VuGen has two HTTP replay engines: Sockets-based (default) or WinInet based. The WinInet is the engine used by Internet Explorer and it supports all of the features incorporated into the IE browser. I think this *better* emulates the IE client settings for IWA &#8230;</p>
<p>And re-run the script. I now get past the authentication using Kerberos and successfully load my home page&#8230; This can be repeated for WebSEAL provided you first do a web_set_user (so it knows what domain credentials to use) which effectively lets you run the test with multiple users&#8230; Great for testing those WebSEAL/SPNEGO/Kerberos single sign on solutions&#8230; <img src='http://altentee.com/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2008/performance-testing-spnego-or-kerberos-with-loadrunner/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>SSH and SCP over alternate ports</title>
		<link>http://altentee.com/blogs/2007/ssh-and-scp-over-alternate-ports/</link>
		<comments>http://altentee.com/blogs/2007/ssh-and-scp-over-alternate-ports/#comments</comments>
		<pubDate>Sat, 05 May 2007 12:05:59 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2007/ssh-and-scp-over-alternate-ports/</guid>
		<description><![CDATA[For an internet facing SSH server, it is probably common practice to have sshd listening on a non-standard port. Coupled with key pair authentication, this reduces the profile you present to simple brute force attacks. Connecting to a SSH server on a non standard port is relatively simple: ssh -p username@servername.com You may however need [...]]]></description>
			<content:encoded><![CDATA[<p>For an internet facing SSH server, it is probably common practice to have sshd listening on a non-standard port. Coupled with key pair authentication, this reduces the profile you present to simple brute force attacks.</p>
<p>Connecting to a SSH server on a non standard port is relatively simple:<br />
<code><br />
ssh -p <yourPort> username@servername.com<br />
</code></p>
<p>You may however need to copy files from the SSH server on an alternate port. Easy:<br />
<code><br />
scp -P <yourPort> username@servername.com:/path/to/remote/file ~/home/path/to/local/file<br />
</code></p>
<p>But what happens if you&#8217;re using a proprietary client other than scp from the console that won&#8217;t support non standard ports?</p>
<p><span id="more-275"></span><br />
The simplest way to do this I found is with port forwarding.</p>
<p>First, and you will need to be root to do this, forward the priveleged port 22 on your local machine to the remote port on the target:<br />
<code><br />
sudo ssh -p <yourPort> -L 22:127.0.0.1:<yourPort> username@servername.com<br />
</code></p>
<p>Then after that your client can just talk to localhost and it will be bound to the forwarded port on the remote host:<br />
<code><br />
scp username@127.0.0.1:/path/to/remote/file ~/home/path/to/local/file<br />
</code></p>
<p>Now your proprietary apps can talk merrily away. By the way, this is an extremely good method for running Microsoft RDP sessions over a secure SSH tunnel:<br />
<code><br />
ssh -p <yourPort> -L 3389:127.0.01:3389 username@servername.com<br />
</code></p>
<p>Then just use remote desktop but point it to local host:<br />
<code><br />
mstsc /v:127.0.0.1<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2007/ssh-and-scp-over-alternate-ports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Faking it! (UDP packets that is&#8230;)</title>
		<link>http://altentee.com/blogs/2007/faking-it-udp-packets-that-is/</link>
		<comments>http://altentee.com/blogs/2007/faking-it-udp-packets-that-is/#comments</comments>
		<pubDate>Wed, 02 May 2007 22:51:51 +0000</pubDate>
		<dc:creator>Tim Koopmans</dc:creator>
				<category><![CDATA[Altentee]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://90kts.com/blog/2007/faking-it-udp-packets-that-is/</guid>
		<description><![CDATA[An associate of mine recently wanted a load script that could simulate thousands of UDP packets carrying a custom payload coming from different IP addresses. They were implementing a customised RFID solution that needed to simulate load from a lot of sources (think active RFID tags). There are many different ways you can accomplish this, [...]]]></description>
			<content:encoded><![CDATA[<p>An associate of mine recently wanted a load script that could simulate thousands of UDP packets carrying a custom payload coming from different IP addresses. They were implementing a customised RFID solution that needed to simulate load from a lot of sources (think active RFID tags).</p>
<p>There are many different <a href="http://webloadtesting.typepad.com/web_performance/2004/05/ip_spoofing_let.html">ways</a> you can accomplish this, solutions like LoadRunner will offer the ability to spoof source IP addresses, but in this case the client couldn&#8217;t afford hefty licensing fees. So getting back to basics, I launched the *flood* from a cygwin shell running ruby.</p>
<p>The code looked a little like this&#8230;</p>
<p><span id="more-274"></span><br />
<strong>UDP Faker.rb</strong><br />
<code><br />
def ipchecksum(data)<br />
    checksum = data.unpack("n*").inject(0) { |s, x| s + x }<br />
    ((checksum >> 16) + (checksum &#038; 0xffff)) ^ 0xffff<br />
end</p>
<p>require 'socket'</p>
<p>class UDP_Faker</p>
<p>    @@id = 1234 - 1</p>
<p>    def initialize<br />
        @s = Socket.new(Socket::PF_INET, Socket::SOCK_RAW, Socket::IPPROTO_RAW)<br />
        @s.setsockopt(Socket::IPPROTO_IP, Socket::IP_HDRINCL, 1)<br />
    end</p>
<p>    def send(src, sport, dst, dport, payload = '')<br />
        dst_numeric = dst.split(/\./).map { |x| x.to_i }<br />
        to = [ Socket::AF_INET,<br />
            dport, dst_numeric, '' ].flatten.pack('snCCCCa8')<br />
        packet = make_ip_header([<br />
            [ '01000101', 'B8' ],                # version, hlen<br />
            [ 0, 'C' ],                          # tos<br />
            [ 28 + payload.size, 'n' ],          # total len<br />
            [ @@id += 1, 'n' ],                  # id<br />
            [ 0, 'n' ],                          # flags, offset<br />
            [ 64, 'C' ],                         # ttl<br />
            [ 17, 'C' ],                         # protocol<br />
            [ 0, 'n' ],                          # checksum<br />
            [ ip2long(src), 'N' ],               # source<br />
            [ ip2long(dst), 'N' ],               # destination<br />
        ])<br />
        packet << make_udp_header([<br />
            [ sport, 'n'],                        # source port<br />
            [ dport, 'n' ],                       # destination port<br />
            [ 8 + payload.size, 'n' ],            # len<br />
            [ 0, 'n' ]                            # checksum (mandatory)<br />
        ])<br />
        packet << payload<br />
        @s.send(packet, 0, to)<br />
    end</p>
<p>    private</p>
<p>    def ip2long(ip)<br />
        long = 0<br />
        ip.split(/\./).reverse.each_with_index do |x, i|<br />
            long += x.to_i << (i * 8  )<br />
        end<br />
        long<br />
    end</p>
<p>    def ipchecksum(data)<br />
        checksum = data.unpack("n*").inject(0) { |s, x| s + x }<br />
        ((checksum >> 16) + (checksum &#038; 0xffff)) ^ 0xffff<br />
    end</p>
<p>    def make_ip_header(parts)<br />
        template = ''<br />
        data = []<br />
        parts.each do |part|<br />
            data += part[0..-2]<br />
            template << part[-1]<br />
        end<br />
        data_str = data.pack(template)<br />
        checksum = ipchecksum(data_str)<br />
        data[-3] = checksum<br />
        data.pack(template)<br />
    end</p>
<p>    def make_udp_header(parts)<br />
        template = ''<br />
        data = []<br />
        parts.each do |part|<br />
            data += part[0..-2]<br />
            template << part[-1]<br />
        end<br />
        data.pack(template)<br />
    end</p>
<p>end</p>
<p>testRun = UDP_Faker.new<br />
loop do<br />
	#             Source IP	     Port  Destination IP   Port   Payload<br />
	testRun.send('203.64.36.24', 2069, '124.191.161.6', 81,    'Blob: here comes the data ...')<br />
end<br />
# TODO: Loop through a range of source IP addy's.<br />
# Return response from server. Use correctly formatted blob.<br />
</code></p>
<p>In a similar vein, but long since shutdown, the guys at <a href="http://www.thehackerschoice.com">Hackers Choice</a> provided some excellent C code for flooding TCP connections, which I also found useful in this project in order to conduct some stress to break testing. Understandably, some people might misuse this script, but for internal uses, I found it extremely useful to flood the TCP/IP stack. You can dowload the code here: <a href='http://90kts.com/blog/wp-content/uploads/2007/05/flood_connect.c' title='flood_connect.c'>flood_connect.c</a></p>
<p>It's usage is along the lines of this:<br />
<code><br />
Options:<br />
    -S           use SSL after TCP connect (not usuable with -u, sets port=443)<br />
    -u           use UDP protocol (default: TCP) (not usable with -c)<br />
    -p port      port to connect to (default: %d)<br />
    -f forks     number of forks to additionally spawn (default: 0)<br />
    -i file      data to send to the port (default: none)<br />
    -n connects  maximum number of connects (default: unlimited)<br />
    -N delay     delay between connects in ms (default: 0)<br />
    -c           close after connect (and sending data, if used with -i)<br />
                 use twice to shutdown SSL sessions hard (-S -c -c)<br />
    -C delay     delay before closing the port (for use with -c) (default: 0)<br />
    -d           dump data read from server<br />
    -D delay     delay before trying to read+dump data from server (default: 0)<br />
    -e           stop when no more connects possible (default: retry forever)<br />
    -k           no keep-alive after finnishing with connects, terminate!<br />
    -v           verbose mode<br />
    TARGET       target to flood attack (ip or dns)<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://altentee.com/blogs/2007/faking-it-udp-packets-that-is/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

