<?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>Krzysztof Burghardt’s blog &#187; Security</title>
	<atom:link href="http://blog.burghardt.pl/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.burghardt.pl</link>
	<description>Create. Break. Fix. Repeat.</description>
	<lastBuildDate>Mon, 05 Jul 2010 07:35:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>nCipher HSM with OpenSSL</title>
		<link>http://blog.burghardt.pl/2010/03/ncipher-hsm-with-openssl/</link>
		<comments>http://blog.burghardt.pl/2010/03/ncipher-hsm-with-openssl/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 22:36:50 +0000</pubDate>
		<dc:creator>Krzysztof Burghardt</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[CHIL]]></category>
		<category><![CDATA[HSM]]></category>
		<category><![CDATA[nCipher]]></category>
		<category><![CDATA[OpenSSL]]></category>

		<guid isPermaLink="false">http://www.burghardt.pl/?p=370</guid>
		<description><![CDATA[<p>I just finished playing with some nCipher&#8217;s HSM. Unfortunately there is no integration guide for OpenSSL that cover CHIL interface and nCipher hardware security modules.</p>
<p>nCipher&#8217;s installation guide is quite good, but after you finish installing hardware, drivers and daemons, you are on your own.</p>
<p>I found only two helpful sources: Andrea Campi&#8217;s blog entry about nCipher NetHSM [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished playing with some <a href="http://iss.thalesgroup.com/">nCipher&#8217;s</a> <a href="http://en.wikipedia.org/wiki/Hardware_security_module">HSM</a>. Unfortunately there is no integration guide for <a href="http://www.openssl.org/">OpenSSL</a> that cover CHIL interface and nCipher hardware security modules.</p>
<p>nCipher&#8217;s installation guide is quite good, but after you finish installing hardware, drivers and daemons, you are on your own.</p>
<p>I found only two helpful sources: Andrea Campi&#8217;s blog entry about <a href="http://blog.webcom.it/articles/2006/04/07/ncipher-nethsm-with-openssl-tutorial/">nCipher NetHSM and OpenSSL</a> and Marek Marcola&#8217;s <a href="http://www.mail-archive.com/openssl-users@openssl.org/msg47199.html">post on openssl-users mailing list</a>.</p>
<p>Both guides ends on key generation and self-signed certificates. Its enough to get CHIL enabled application to work with nCipher&#8217;s HSM, but will not help you to convert any existing OpenSSL (not an CHIL-aware) application to use HSM.</p>
<p><span id="more-370"></span></p>
<h2>CHIL enabled OpenSSL</h2>
<p>When you have driver, hardserver and chil library for your HSM installed the next step is to install OpenSSL with CHIL support enabled. Modern Linux distribution may have CHIL already enabled. If so, there should be <em>libchil.so</em> library in <em>/usr/lib/ssl/engines</em> directory.</p>
<p>If <em>libchil.so</em> is missing follow OpenSSL installation steps as described in <a href="http://iss.thalesgroup.com/Resources/~/media/Files/Integration%20Guides/Apache22x.ashx">Apache2.2.x, OpenSSL 0.9.8x and nCipher Modules Integration Guide</a>.</p>
<p>When OpenSSL in installed, add <em>/opt/nfast/toolkits/hwcrhk</em> to LD_LIBRARY_PATH:</p>
<pre>
$ export LD_LIBRARY_PATH=/opt/nfast/toolkits/hwcrhk
</pre>
<p>To check if OpenSSL is able to communicate with HSM trough CHIL interface run:</p>
<pre>
$ openssl engine -t chil
(chil) CHIL hardware engine support
     [ available ]
</pre>
<p>If CHIL is <strong>available</strong> benchmark HSM with:</p>
<pre>
$ openssl speed rsa -engine chil -elapsed -multi 50
</pre>
<h2>Hardware accelerated cryptography</h2>
<p>Use <a href="http://www.openssl.org/docs/crypto/engine.html">engine</a> interface to switch to cryptography implementation from hardware security module.</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">#include &lt;openssl/engine.h&gt;</span><br />
<br />
ENGINE <span style="color: #339933;">*</span>hwEngine <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span><br />
<br />
<span style="color: #993333;">int</span> enable_chil<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; ENGINE_load_builtin_engines<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>hwEngine <span style="color: #339933;">=</span> ENGINE_by_id<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;CHIL&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>ENGINE_set_default<span style="color: #009900;">&#40;</span>hwEngine<span style="color: #339933;">,</span> ENGINE_METHOD_ALL<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">2</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>When application finish its cryptography operations, it should free engine.</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333;">void</span> disable_chil<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>hwEngine<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ENGINE_finish<span style="color: #009900;">&#40;</span>hwEngine<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; hwEngine <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ENGINE_cleanup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<h2>Hardware key protection/storage</h2>
<p>If you want to make your private keys more secure you should use hardware key protection (or even storage).</p>
<p>Hardware protected keys are stored on local filesystem, but encrypted by key stored only in HSM. To generate such key use:</p>
<pre>
$ /opt/nfast/bin/generatekey hwcrhk
</pre>
<p>Answer some questions (Protected by? module, Key type? RSA, Key size? 4096, Key identifier? keyname) and your encrypted (by module, as you choose in question above) private key is saved in <em>/opt/nfast/kmdata/local/key_hwcrhk_rsa-keyname</em>.</p>
<p>When using locally stored encryption keys you load them as in this example (I use <a href="http://www.openssl.org/docs/crypto/evp.html">EVP</a> interface for high-level cryptographic functions):</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">EVP_PKEY <span style="color: #339933;">*</span>pkey <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span><br />
<br />
<span style="color: #993333;">int</span> load_key<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; fp <span style="color: #339933;">=</span> fopen<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;filename.key&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>fp <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; pkey <span style="color: #339933;">=</span> PEM_read_PrivateKey<span style="color: #009900;">&#40;</span>fp<span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span> NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>When you have CHIL keys, loading them is also very simple:</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333;">void</span> load_key_chil<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; pkey <span style="color: #339933;">=</span> ENGINE_load_private_key<span style="color: #009900;">&#40;</span>hwEngine<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;rsa-keyname&quot;</span><span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span> NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>When key is no longer in use destroy it with:</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333;">void</span> free_key<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; EVP_PKEY_free<span style="color: #009900;">&#40;</span>pkey<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>If application just need to do some hardware accelerated RSA or it need to use hardware protected keys those code pieces along with CHIL-enabled OpenSSL is all you need.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.burghardt.pl/2010/03/ncipher-hsm-with-openssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sptrace 1.4.2 released</title>
		<link>http://blog.burghardt.pl/2009/03/sptrace-142-released/</link>
		<comments>http://blog.burghardt.pl/2009/03/sptrace-142-released/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 09:00:06 +0000</pubDate>
		<dc:creator>Krzysztof Burghardt</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[gdb]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[LKM]]></category>
		<category><![CDATA[ltrace]]></category>
		<category><![CDATA[ptrace]]></category>
		<category><![CDATA[strace]]></category>

		<guid isPermaLink="false">http://www.burghardt.pl/?p=292</guid>
		<description><![CDATA[<p>New version of sptrace was released today. Sptrace is a secure ptrace() Linux Kernel Module (LKM). It limits users&#8217; access to the ptrace() call. Module was updated to reflect changes in new kernel releases and tested with 2.6.26.</p>
<p></p>
<p>When someone not allowed to trace processes uses program that call ptrace() (like strace, ltrace or gdb) current and [...]]]></description>
			<content:encoded><![CDATA[<p>New version of <a href="/2007/12/limiting-access-to-ptrace-call-in-linux/">sptrace</a> was released today. Sptrace is a <strong>secure ptrace()</strong> Linux Kernel Module (LKM). It limits users&#8217; access to the <em>ptrace()</em> call. Module was updated to reflect changes in new kernel releases and tested with 2.6.26.</p>
<p><span id="more-292"></span></p>
<p>When someone not allowed to trace processes uses program that call <em>ptrace()</em> (like strace, ltrace or gdb) current and parent processes names, pids, uids and euids are logged, e.g.:</p>
<pre>
Mar 13 08:51:11 ghost kernel: [ 8086.730499] sptrace: ptrace() DENIED for (gdb:6810) UID(1000) EUID(1000), parent (gdb:6785) UID(1000) EUID(1000)
Mar 13 08:51:11 ghost kernel: [ 8086.984694] sptrace: ptrace() DENIED for (gdb:6785) UID(1000) EUID(1000), parent (tcsh:32216) UID(1000) EUID(1000)
Mar 13 08:51:44 ghost kernel: [ 8119.928920] sptrace: ptrace() DENIED for (gdb:6923) UID(1000) EUID(1000), parent (tcsh:32216) UID(1000) EUID(1000)
</pre>
<p>Program that call <em>ptrace()</em> will get EPERM error:</p>
<pre>
$ strace ls
strace: ptrace(PTRACE_TRACEME, ...): Operation not permitted
$ ltrace ls
PTRACE_TRACEME: Operation not permitted
PTRACE_SETOPTIONS: Operation not permitted
$ gdb -p 32215
GNU gdb 6.8-debian
[...]
This GDB was configured as "i486-linux-gnu".
Attaching to process 32215
ptrace: Operation not permitted.
</pre>
<p>Module log both allowed and denied <em>ptrace()</em> calls. Allowed traces as logged as:</p>
<pre>
Mar 11 19:14:48 ghost kernel: [ 6445.524669] sptrace: ptrace() by (ltrace:27558) UID(1000) EUID(1000), parent (ltrace:27557) UID(1000) EUID(1000)
Mar 11 19:14:48 ghost kernel: [ 6445.525460] sptrace: ptrace() by (ltrace:27557) UID(1000) EUID(1000), parent (tcsh:26606) UID(1000) EUID(1000)
</pre>
<p>By default <strong>sptrace</strong> deny access to <em>ptrace()</em> to all non root users (GID != 0). Root group (or wheel) is allowed to use this call. To disable tracing for all users, including those in root group pass parameter <strong>ptrace_group=-1</strong>, e.g.:</p>
<pre>
$ insmod ./sptrace.ko ptrace_group=-1
</pre>
<p>Download: <a href="http://www.burghardt.pl/files/sptrace-1.4.2.tar.gz">sptrace-1.4.2.tar.gz</a> (<a href="http://www.burghardt.pl/files/sptrace-1.4.2.tar.gz.asc">.asc</a>)</p>
<p>md5sum: 9a23198cbdcd256b11e2b0dc2c03b331<br />
sha1sum: 458f9b15e9a5b02cd18759b6b09a4b41d062d7cd</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.burghardt.pl/2009/03/sptrace-142-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClamFS 1.0.0 has been released</title>
		<link>http://blog.burghardt.pl/2009/02/clamfs-100-has-been-released/</link>
		<comments>http://blog.burghardt.pl/2009/02/clamfs-100-has-been-released/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 14:18:45 +0000</pubDate>
		<dc:creator>Krzysztof Burghardt</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[ClamAV]]></category>
		<category><![CDATA[ClamFS]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[WINE]]></category>

		<guid isPermaLink="false">http://www.burghardt.pl/?p=273</guid>
		<description><![CDATA[<p>ClamFS 1.0.0 has been released yesterday. It contains some new features that might be quite interesting for its users.</p>
<p></p>
Completed clamd results caching
<p>This was a long waiting feature. Version 0.9.1 cache only information about clean files. Infected files was scanned on every access. Starting from version 1.0.0 information about both clean and infected files are kept in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://clamfs.sourceforge.net/">ClamFS</a> <a href="http://freshmeat.net/releases/293686/">1.0.0</a> has been released yesterday. It contains some new features that might be quite interesting for its users.</p>
<p><span id="more-273"></span></p>
<h2>Completed clamd results caching</h2>
<p>This was a long waiting feature. Version 0.9.1 cache only information about clean files. Infected files was scanned on every access. Starting from version 1.0.0 information about both clean and infected files are kept in cache while files that cannot be scanned (mostly because of permission problems) are discarded from cache.</p>
<h2>Starting without clamd available</h2>
<p>A new &#8220;check&#8221; option was added to allow you to mount a ClamFS file system when clamd is not available, such as during an early stage of the boot process. To disable ClamAV Daemon (clamd) check on ClamFS startup set option check to no:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;clamd</span> <span style="color: #000066;">socket</span>=<span style="color: #ff0000;">&quot;/var/run/clamav/clamd.ctl&quot;</span> <span style="color: #000066;">check</span>=<span style="color: #ff0000;">&quot;no&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></div></div>
<h3>Mounting file systems from /etc/fstab</h3>
<p>With &#8220;check=no&#8221; mounting ClamFS file systems form <em>/etc/fstab</em> is possible using fuse mount helper (<em>/sbin/mount.fuse</em>). ClamFS will be started on boot with configuration file defined here provided as its argument. Simple definition of ClamFS mount point in <em>/etc/fstab</em> looks like:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">clamfs#/etc/clamfs/share.xml &nbsp;/clamfs/share &nbsp;fuse &nbsp;defaults &nbsp;0 &nbsp;0</div></div>
<h2>Read-only mounts</h2>
<p>The &#8220;readonly&#8221; option was added to the filesystem options allowing you to create a read-only protected file system. Just extend filesystem definition in config file with readonly option set to yes:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filesystem</span> <span style="color: #000066;">root</span>=<span style="color: #ff0000;">&quot;/share&quot;</span> <span style="color: #000066;">mountpoint</span>=<span style="color: #ff0000;">&quot;/clamfs/share&quot;</span> <span style="color: #000066;">readonly</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></div></div>
<h2>File system and cache statistics</h2>
<p>ClamFS has file system statistics that allow you to monitor and tune its performance. Statistics module keep track of file system usage and cache hits. Stats module is configured with &#8220;stats&#8221; tag. It can dump statistics periodically and on ClamFS dismount:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;stats</span> <span style="color: #000066;">atexit</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000066;">every</span>=<span style="color: #ff0000;">&quot;3600&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></div></div>
<p>Statistics are dumped to configured logging target. Here is an example of such statistics dumped to syslog:</p>
<pre>
Feb  8 14:52:51 ghost clamfs: --- begin of statistics ---
Feb  8 14:52:51 ghost clamfs: Early cache hit: 1038
Feb  8 14:52:51 ghost clamfs: Early cache miss: 1030
Feb  8 14:52:51 ghost clamfs: Late cache hit: 1038
Feb  8 14:52:51 ghost clamfs: Late cache miss: 0
Feb  8 14:52:51 ghost clamfs: Whitelist hit: 10
Feb  8 14:52:51 ghost clamfs: Blacklist hit: 108
Feb  8 14:52:51 ghost clamfs: Files bigger than maximal-size: 3
Feb  8 14:52:51 ghost clamfs: open() function called 2081 times (allowed: 1803, denied: 278)
Feb  8 14:52:51 ghost clamfs: Scan failed 278 times
Feb  8 14:52:51 ghost clamfs: --- end of statistics ---
</pre>
<h2>Better default extension blacklist</h2>
<p>Default blacklist in configuration file was extended. I advise all users to incorporate <a href="http://clamfs.svn.sourceforge.net/viewvc/clamfs/tags/clamfs-1.0.0/doc/clamfs.xml?view=markup">blacklist from version 1.0.0</a> into their configuration files.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.burghardt.pl/2009/02/clamfs-100-has-been-released/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Multiple FreeBSD jails sharing one IP address</title>
		<link>http://blog.burghardt.pl/2009/01/multiple-freebsd-jails-sharing-one-ip-address/</link>
		<comments>http://blog.burghardt.pl/2009/01/multiple-freebsd-jails-sharing-one-ip-address/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 22:19:35 +0000</pubDate>
		<dc:creator>Krzysztof Burghardt</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[ezjail]]></category>
		<category><![CDATA[jail]]></category>
		<category><![CDATA[PF]]></category>

		<guid isPermaLink="false">http://www.burghardt.pl/?p=203</guid>
		<description><![CDATA[<p>If you want to use multiple jails on FreeBSD with only one external IP addresses you may set up all jails on private addressed with little help of loopback interface, NAT and PF.</p>
<p></p>
Networking
<p>Each jail requires one IP address. First create lo1 loopback interface and assign IPs to it:</p>

# ifconfig lo1 create
# ifconfig lo1 inet 10.0.0.1 netmask [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to use multiple jails on FreeBSD with only one external IP addresses you may set up all jails on private addressed with little help of <a href="http://en.wikipedia.org/wiki/Loopback">loopback</a> interface, <a href="http://en.wikipedia.org/wiki/Network_Address_Translation">NAT</a> and <a href="http://en.wikipedia.org/wiki/PF_(firewall)">PF</a>.</p>
<p><span id="more-203"></span></p>
<h2>Networking</h2>
<p>Each jail requires one IP address. First create lo1 loopback interface and assign IPs to it:</p>
<pre>
# ifconfig lo1 create
# ifconfig lo1 inet 10.0.0.1 netmask 255.255.255.0 alias
# ifconfig lo1 inet 10.0.0.2 netmask 255.255.255.0 alias
...
</pre>
<p>To make this permanent add following lines to <em>/etc/rc.conf</em>:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">cloned_interfaces</span>=<span style="color: #ff0000;">&quot;lo1&quot;</span><br />
<span style="color: #007800;">ifconfig_lo1</span>=<span style="color: #ff0000;">&quot;inet 10.0.0.254 netmask 255.255.255.0&quot;</span><br />
<span style="color: #007800;">ifconfig_lo1_alias0</span>=<span style="color: #ff0000;">&quot;inet 10.0.0.1 netmask 255.255.255.0&quot;</span><br />
...</div></div>
<p>Now configure port redirection (forwarding) from your IP to your jails&#8217;s IPs. Here is my <a href="http://www.openbsd.org/faq/pf/index.html">PF</a> line (add it to <em>/etc/pf.conf</em>):</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">rdr on re0 proto tcp from any to ext._ip port http -&gt; 10.0.0.1 port http<br />
rdr on re0 proto tcp from any to ext._ip port ircd -&gt; 10.0.0.2 port ircd<br />
...</div></div>
<p>If jails need network access (e.g. to download ports) create <a href="http://en.wikipedia.org/wiki/Network_address_translation">NAT</a> on your external network interface:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">nat on re0 from lo1:network to any -&gt; (re0)</div></div>
<p>Finally reload PF rules:</p>
<pre>
# pfctl -d
# pfctl -e -f /etc/pf.conf
</pre>
<h2>Ezjail</h2>
<p>Install <strong>ezjail</strong> from <em>/usr/ports/sysutils/ezjail</em>:</p>
<pre>
# cd /usr/ports/sysutils/ezjail
# make install clean
</pre>
<p>After ezjail installation create base jail. This jail is used as skeleton of all jails. Before creating base jail you need to have current FreeBSD sources in <em>/usr/src</em>. If you have built them add <strong>-i</strong> option to update command to prevent (re)building them:</p>
<pre>
# ezjail-admin update
</pre>
<h2>Creating jails</h2>
<p>When basejail is installed we are ready to create jails:</p>
<pre>
# ezjail-admin create -f default apachejail 10.0.0.1
# ezjail-admin create -f default ircjail 10.0.0.2
</pre>
<h2>See also</h2>
<ul>
<li><a href="http://erdgeist.org/arts/software/ezjail/">ezjail &#8211; jail administration framework</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.burghardt.pl/2009/01/multiple-freebsd-jails-sharing-one-ip-address/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Source code (security) auditing utilities available in Debian</title>
		<link>http://blog.burghardt.pl/2009/01/source-code-security-auditing-utilities-available-in-debian/</link>
		<comments>http://blog.burghardt.pl/2009/01/source-code-security-auditing-utilities-available-in-debian/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 21:05:12 +0000</pubDate>
		<dc:creator>Krzysztof Burghardt</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[static checker]]></category>

		<guid isPermaLink="false">http://www.burghardt.pl/?p=153</guid>
		<description><![CDATA[<p>Debian GNU/Linux provides several packages that can be used to audit C/C++ source code. First three search for programming errors that might lead to potential security flaws:</p>

flawfinder
rats
pscan

<p>Next two tools find bugs in C and C++ source code by doing a static check too, but their checks are [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.debian.org/">Debian GNU/Linux</a> provides several packages that can be used to audit C/C++ source code. First three search for programming errors that might lead to potential security flaws:</p>
<ul>
<li><a href="http://packages.debian.org/flawfinder">flawfinder</a></li>
<li><a href="http://packages.debian.org/rats">rats</a></li>
<li><a href="http://packages.debian.org/pscan">pscan</a></li>
</ul>
<p>Next two tools find bugs in C and C++ source code by doing a static check too, but their checks are not security-related:</p>
<ul>
<li><a href="http://packages.debian.org/splint">splint</a></li>
<li><a href="http://packages.debian.org/cppcheck">cppcheck</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.burghardt.pl/2009/01/source-code-security-auditing-utilities-available-in-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web browser anonymity threats</title>
		<link>http://blog.burghardt.pl/2008/05/web-browser-anonymity-threats/</link>
		<comments>http://blog.burghardt.pl/2008/05/web-browser-anonymity-threats/#comments</comments>
		<pubDate>Tue, 13 May 2008 22:05:35 +0000</pubDate>
		<dc:creator>Krzysztof Burghardt</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[anonymity]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[identity]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[proxy servers]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[web browser]]></category>

		<guid isPermaLink="false">http://www.burghardt.pl/?p=81</guid>
		<description><![CDATA[<p>Anonymity in important for many people. Few years ago, it was problematic issue only for hackers, human rights workers and anonymity freaks. They want to keep they identity in secret for obvious reasons. They were traced only by law enforcement agencies and government. Today everything is much more difficult. Hundreds of advertising agencies trying to reveal [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.eff.org/issues/anonymity">Anonymity</a> in important for many people. Few years ago, it was problematic issue only for hackers, human rights workers and anonymity freaks. They want to keep they identity in secret for obvious reasons. They were traced only by law enforcement agencies and government. Today everything is much more difficult. Hundreds of advertising agencies trying to reveal identity of people to target their commercials better.</p>
<p>Web browser can give them so many information. For example in which languages you speak (browser shares your language preferences with sites you visit)., in which city you live (this can be obtained from IP), how big is your computer display (web page can get your display resolution), what video player or office suite you have installed (they can query installed browser plugins) and much more...</p>
<p><span id="more-81"></span></p>
<h2>Server side</h2>
<p>Various information are available from <a href="http://en.wikipedia.org/wiki/PHP">PHP</a> and <a href="http://en.wikipedia.org/wiki/Apache HTTP Server">Apache</a>.</p>
<p>This include IP address, hostname (<a href="http://en.wikipedia.org/wiki/Reverse_DNS_lookup">reverse DNS lookup</a>), source port and sometimes user name:</p>
<pre>
Your IP: 38.107.191.91Your hostname: 38.107.191.91Your source port: 6864Your username: </pre>
<p>Those basic information are available from <strong>_SERVER</strong> <a href="http://en.wikipedia.org/wiki/Associative_array">associative array</a> members named <strong>REMOTE_ADDR</strong>, <strong>REMOTE_PORT</strong> and <strong>REMOTE_USER</strong>.</p>
<p>Here is an example how to get hostname quering DNS using <em>gethostbyaddr()</em>:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <a href="http://www.php.net/gethostbyaddr"><span style="color: #990000;">gethostbyaddr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>In the same way we can obtain name and version of browser (<strong>HTTP_USER_AGENT</strong>). You are using:</p>
<pre>
CCBot/1.0 (+http://www.commoncrawl.org/bot.html)</pre>
<p><strong>HTTP_REFERER</strong> reveals site you come form. Currently:</p>
<pre>
</pre>
<p>We are able to check what browser accepts as a response (<strong>HTTP_ACCEPT</strong>, <strong>HTTP_ACCEPT_ENCODING</strong>, <strong>HTTP_ACCEPT_CHARSET</strong>):</p>
<pre>
HTTP_ACCEPT: text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5HTTP_ACCEPT_ENCODING: gzipHTTP_ACCEPT_LANGUAGE: en-us,en;q=0.5HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.7</pre>
<p>Those settings may leak your language and, if you leave default settings, your browser identity.</p>
<h3>Proxy</h3>
<p>Proxy servers often adds new headers to those sent by browser. We can access them using <strong>HTTP_X_FORWARDED_FOR</strong> and <strong>HTTP_FORWARDED</strong> . Some proxy servers sets also headers like <strong>HTTP_CLIENT_IP</strong>, <strong>HTTP_VIA</strong>, <strong>HTTP_PROXY_CONNECTION</strong>, <strong>HTTP_XROXY_CONNECTION</strong>.</p>
<p>Currently they are set to:</p>
<pre>
X-Forwarded-For: Forwarded: Client-IP: Via: PROXY: XROXY: </pre>
<p>If none of above is set user is probably using direct connection. However some proxy servers (often called "high anonymous proxy" or "elite proxy") forward requests without adding any headers or even removing some headers that leaks browser identity.</p>
<h2>Client side</h2>
<p>Web browser may leak user identity to anyone who is able to run <a href="http://en.wikipedia.org/wiki/JavaScript">JavaScript</a>. By default browsers run any script embedded into web page.</p>
<pre>
<script language="JavaScript">
jsver = "1.0";
</script><script language="JavaScript1.1">
jsver = "1.1";
</script><script language="JavaScript1.2">
jsver = "1.2";
</script><script language="JavaScript1.3">
jsver = "1.3";
</script><script language="JavaScript1.4">
jsver = "1.4";
</script><script language="JavaScript1.5">
jsver = "1.5";
</script><script language="JavaScript1.6">
jsver = "1.6";
</script><script language="JavaScript1.7">
jsver = "1.7";
</script><script language="JavaScript1.8">
jsver = "1.8";
</script><script language="JavaScript1.9">
jsver = "1.9";
</script><script language="JavaScript">document.write("JavaScript is <strong>enabled</strong> in your browser (version ", jsver, ")");</script><noscript>JavaScript is <strong>disabled</strong> in your browser.</noscript>
</pre>
<p>Browser identity is hold in <strong>navigator</strong> object. Its name is in <strong>navigator.appName</strong> Currently:</p>
<pre>
<script language="JavaScript">document.write(navigator.appName);</script><noscript>JavaScript disabled</noscript>
</pre>
<p>Browser code name (<strong>navigator.appCodeName</strong>):</p>
<pre>
<script language="JavaScript">document.write(navigator.appCodeName);</script><noscript>JavaScript disabled</noscript>
</pre>
<p>Browser version (<strong>navigator.appVersion</strong>):</p>
<pre>
<script language="JavaScript">document.write(navigator.appVersion);</script><noscript>JavaScript disabled</noscript>
</pre>
<p>Finally, platform it is running on (<strong>navigator.platform</strong>):</p>
<pre>
<script language="JavaScript">document.write(navigator.platform);</script><noscript>JavaScript disabled</noscript>
</pre>
<p>History length (or how many pages were visited - <strong>history.length</strong>):</p>
<pre>
<script language="JavaScript">document.write(history.length);</script><noscript>JavaScript disabled</noscript>
</pre>
<p>Screen size and dept is hold in <strong>screen</strong> object. Example code to obtain screen properties:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span>screen.<span style="color: #660066;">width</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot; x &quot;</span><span style="color: #339933;">,</span>screen.<span style="color: #660066;">height</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot; x &quot;</span><span style="color: #339933;">,</span> screen.<span style="color: #660066;">colorDepth</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot; bpp (available for browser: &quot;</span><span style="color: #339933;">,</span> window.<span style="color: #660066;">screen</span>.<span style="color: #660066;">availWidth</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot; x &quot;</span><span style="color: #339933;">,</span> window.<span style="color: #660066;">screen</span>.<span style="color: #660066;">availHeight</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Result of the above:</p>
<pre>
<script language="JavaScript">document.write(screen.width," x ",screen.height, " x ", screen.colorDepth, " bpp (available for browser: ", window.screen.availWidth, " x ", window.screen.availHeight, ")");</script><noscript>JavaScript disabled</noscript>
</pre>
<p>Referrer can be read from <strong>document.referrer</strong>:</p>
<pre>
<script language="JavaScript">document.write(document.referrer);</script><noscript>JavaScript disabled</noscript>
</pre>
<p>Using simple loop one can iterate trough installed plugins:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">plugins</span>.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> navigator.<span style="color: #660066;">plugins</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; plugin <span style="color: #339933;">=</span> navigator.<span style="color: #660066;">plugins</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span>plugin.<span style="color: #000066;">name</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot; (&quot;</span><span style="color: #339933;">,</span> plugin.<span style="color: #660066;">filename</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;)<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Result of above code:</p>
<pre>
<script language="JavaScript">
if (navigator.plugins.length) {
  for (i = 0; i < navigator.plugins.length; i++) {
    plugin = navigator.plugins[i];
    document.write(plugin.name, " (", plugin.filename, ")\n");
  }
}
</script><noscript>JavaScript disabled</noscript>
</pre>
<h3>Java</h3>
<p>If Java is enabled JavaScript can use Java VM to obtain more information from OS. <strong>navigator.javaEnabled()</strong> returns true or false if Java is enabled.</p>
<pre>
<script language="JavaScript">if (navigator.javaEnabled()) document.write("Java is enabled");else document.write("Java is disabled");</script><noscript>JavaScript is disabled. Unable to check availability of Java Runtime Environment.</noscript>
</pre>
<p>JavaScript with small help of Java can obtain client IP address with:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">javaEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; addr<span style="color: #339933;">=</span>java.<span style="color: #660066;">net</span>.<span style="color: #660066;">InetAddress</span>.<span style="color: #660066;">getLocalHost</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; host<span style="color: #339933;">=</span>addr.<span style="color: #660066;">getHostName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; ip<span style="color: #339933;">=</span>addr.<span style="color: #660066;">getHostAddress</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span>ip<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot; (hostname: &quot;</span><span style="color: #339933;">,</span> host<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Results:</p>
<pre>
<script language="JavaScript">
if (navigator.javaEnabled()) {
  addr=java.net.InetAddress.getLocalHost();
  host=addr.getHostName();
  ip=addr.getHostAddress();
  document.write(ip, " (hostname: ", host, ")");
} else {
  document.write("Java disabled");
}
</script><noscript>JavaScript disabled. Unable to use Java Runtime Environment.</noscript>
</pre>
<p>Or with alternative version:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">javaEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; host<span style="color: #339933;">=</span> window.<span style="color: #660066;">location</span>.<span style="color: #660066;">host</span><span style="color: #339933;">;</span><br />
&nbsp; port<span style="color: #339933;">=</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">port</span> <span style="color: #339933;">||</span> <span style="color: #CC0000;">80</span><span style="color: #339933;">;</span><br />
&nbsp; sock<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> java.<span style="color: #660066;">net</span>.<span style="color: #660066;">Socket</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; sock.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> java.<span style="color: #660066;">net</span>.<span style="color: #660066;">InetSocketAddress</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'0.0.0.0'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; sock.<span style="color: #660066;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> java.<span style="color: #660066;">net</span>.<span style="color: #660066;">InetSocketAddress</span><span style="color: #009900;">&#40;</span>host<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>port<span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span><span style="color: #CC0000;">80</span><span style="color: #339933;">:</span>port<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; addr<span style="color: #339933;">=</span>sock.<span style="color: #660066;">getLocalAddress</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; host<span style="color: #339933;">=</span>addr.<span style="color: #660066;">getHostName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; ip<span style="color: #339933;">=</span>addr.<span style="color: #660066;">getHostAddress</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span>ip<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot; (hostname: &quot;</span><span style="color: #339933;">,</span> host<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Java disabled&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Results:</p>
<pre>
<script language="JavaScript">
if (navigator.javaEnabled()) {
  host= window.location.host;
  port=window.location.port || 80;
  sock=new java.net.Socket();
  sock.bind(new java.net.InetSocketAddress('0.0.0.0', 0));
  sock.connect(new java.net.InetSocketAddress(host, (!port)?80:port));
  addr=sock.getLocalAddress();
  host=addr.getHostName();
  ip=addr.getHostAddress();
  document.write(ip, " (hostname: ", host, ")");
} else {
  document.write("Java disabled");
}
</script><noscript>JavaScript disabled. Unable to use Java Runtime Environment.</noscript>
</pre>
<h3>Java applets</h3>
<p>Another possibility to obtain IP address of client is using <a href="http://en.wikipedia.org/wiki/Java_applet">Java applets</a>. Here is sample applet that tries to connect back to web server and reveal client address:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">// &lt;applet code=&quot;ShowIP&quot; width=&quot;240&quot; height=&quot;30&quot;&gt;&lt;/applet&gt;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.applet.*</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.*</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.*</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ShowIP <span style="color: #000000; font-weight: bold;">extends</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aapplet+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Applet</span></a> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> m_ip<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_ip <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asocket+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Socket</span></a><span style="color: #009900;">&#40;</span>getDocumentBase<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getHost</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, getDocumentBase<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getPort</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getLocalAddress</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getHostAddress</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_ip <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;unknown&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> stop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> paint<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Agraphics+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Graphics</span></a> g<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; g.<span style="color: #006633;">drawString</span><span style="color: #009900;">&#40;</span>m_ip, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Applet in action:<br />
<applet codebase="/wp-content/uploads/2008/04/" code="ShowIP" width="240" height="30"></applet></p>
<h3>ActiveX and other threats</h3>
<p><a href="http://en.wikipedia.org/wiki/ActiveX">ActiveX</a> object can reveal client identity, too. Fortunately AvtiveX works only in <a href="http://en.wikipedia.org/wiki/Internet_Explorer">Internet Explorer</a> on Windows. Maybe also Flash's Action Script can be used to achieve this. If you known any other possibilities let me known.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.burghardt.pl/2008/05/web-browser-anonymity-threats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying IPsec in small LAN in 3 easy steps</title>
		<link>http://blog.burghardt.pl/2008/03/deploying-ipsec-in-small-lan-in-3-easy-steps/</link>
		<comments>http://blog.burghardt.pl/2008/03/deploying-ipsec-in-small-lan-in-3-easy-steps/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 22:04:48 +0000</pubDate>
		<dc:creator>Krzysztof Burghardt</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[IPsec]]></category>
		<category><![CDATA[racoon]]></category>

		<guid isPermaLink="false">http://www.burghardt.pl/2008/03/deploying-ipsec-in-small-lan-in-3-easy-steps/</guid>
		<description><![CDATA[<p>I think about installing IPsec on computers in my home LAN for some time. There are many configurations possible: tunnel mode, transport mode, peer-to-peer solution or star topology with single VPN hub. Also there are different IPsec implementations. KAME for *BSD, Openswan, strongSwan and Linux 2.6 PF_KEY implementation (which can be used with setkey and racoon [...]]]></description>
			<content:encoded><![CDATA[<p>I think about installing <a href="http://en.wikipedia.org/wiki/IPsec">IPsec</a> on computers in my home <a href="http://en.wikipedia.org/wiki/LAN">LAN</a> for some time. There are many configurations possible: tunnel mode, transport mode, peer-to-peer solution or star topology with single VPN hub. Also there are different IPsec implementations. <a href="http://www.kame.net/">KAME</a> for *BSD, <a href="http://www.openswan.org/">Openswan</a>, <a href="http://www.strongswan.org/">strongSwan</a> and Linux 2.6 PF_KEY implementation (which can be used with setkey and racoon or with OpenBSD&#8217;s isakmpd). Choosing one is not easy, but for me the simplest method was best. I choose Linux 2.6 PF_KEY with <a href="http://ipsec-tools.sourceforge.net/">ipsec-tools</a> and <a href="http://www.kame.net/racoon/">racoon</a> for dynamic key exchange (now part of ipsec-tools). Its simple, easy to implement and&#8230; configuration files without any modification (except file paths) can be used also in FreeBSD (tested with 6.3-RELEASE).</p>
<p><span id="more-46"></span></p>
<p><strong>Step 1.</strong> Use <a href="http://openvpn.net/howto.html#pki">OpenVPN easyRSA</a> to set up your own <a href="http://en.wikipedia.org/wiki/Certificate_authority">Certificate Authority</a>, generate certificates and keys and sign them. You will need to create links to certificates and keys in form hash.(r)0. Use this command to compute hash:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># openssl x509 -hash -in keys/ca.crt</span></div></div>
<p>And then create links replacing question marks by hashes.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># ln -s ca.crt keys/????????.0</span><br />
<span style="color: #666666; font-style: italic;"># ln -s crl.pem keys/????????.r0</span></div></div>
<p><strong>Step 2.</strong> When you have all your certificates created you need only to do two more things. First create <em>/etc/ipsec-tools.conf</em> to set Security Policy Database (SPD):</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/sbin/setkey -f</span><br />
<br />
<span style="color: #666666; font-style: italic;">## Flush the SAD and SPD</span><br />
<br />
flush;<br />
spdflush;<br />
<br />
<span style="color: #666666; font-style: italic;">## SPDs for racoon</span><br />
<br />
spdadd 192.168.1.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> 192.168.1.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> any <span style="color: #660033;">-P</span> out ipsec esp<span style="color: #000000; font-weight: bold;">/</span>transport<span style="color: #000000; font-weight: bold;">//</span>use;<br />
spdadd 192.168.1.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> 192.168.1.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> any <span style="color: #660033;">-P</span> <span style="color: #000000; font-weight: bold;">in</span> &nbsp;ipsec esp<span style="color: #000000; font-weight: bold;">/</span>transport<span style="color: #000000; font-weight: bold;">//</span>use;</div></div>
<p><strong>Step 3.</strong> And then configure racoon to negotiate and maintain Security Association Database  (SAD). Racoon read configuration from <em>/etc/racoon/racoon.conf</em>:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">path certificate <span style="color: #ff0000;">&quot;/etc/racoon/certs&quot;</span>;<br />
<br />
sainfo anonymous <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; encryption_algorithm aes256,aes128,blowfish128,3des;<br />
&nbsp; &nbsp; authentication_algorithm hmac_sha256,hmac_sha1,hmac_md5;<br />
&nbsp; &nbsp; compression_algorithm deflate;<br />
&nbsp; &nbsp; lifetime <span style="color: #000000; font-weight: bold;">time</span> <span style="color: #000000;">30</span> min;<br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
remote anonymous <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; exchange_mode main,aggressive;<br />
&nbsp; &nbsp; lifetime <span style="color: #000000; font-weight: bold;">time</span> <span style="color: #000000;">60</span> min;<br />
&nbsp; &nbsp; certificate_type x509 <span style="color: #ff0000;">&quot;host.crt&quot;</span> <span style="color: #ff0000;">&quot;host.key&quot;</span>;<br />
&nbsp; &nbsp; verify_cert on;<br />
&nbsp; &nbsp; my_identifier asn1dn;<br />
&nbsp; &nbsp; proposal <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; encryption_algorithm 3des;<br />
&nbsp; &nbsp; &nbsp; &nbsp; hash_algorithm sha1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; authentication_method rsasig;<br />
&nbsp; &nbsp; &nbsp; &nbsp; dh_group modp1024;<br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span></div></div>
<p>Now (re)start setkey and racoon on all hosts in LAN. If everything is fine IPsec should be in use for all local connections.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.burghardt.pl/2008/03/deploying-ipsec-in-small-lan-in-3-easy-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>O tym jak to Chuck Norris skopiował dane z Naszej Klasy na dyskietkę</title>
		<link>http://blog.burghardt.pl/2008/01/o-tym-jak-to-chuck-norris-skopiowal-dane-z-naszej-klasy-na-dyskietke/</link>
		<comments>http://blog.burghardt.pl/2008/01/o-tym-jak-to-chuck-norris-skopiowal-dane-z-naszej-klasy-na-dyskietke/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 20:08:10 +0000</pubDate>
		<dc:creator>Krzysztof Burghardt</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Polish]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[cURL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.burghardt.pl/2008/01/o-tym-jak-to-chuck-norris-skopiowal-dane-z-naszej-klasy-na-dyskietke/</guid>
		<description><![CDATA[<p>Hacking.pl opublikował artykuł Nasza-Klasa.pl &#8211; pobierz sobie dane milionów Polaków. Zasugerowano w nim, że każdy może pobrać dane wszystkich użytkowników Naszej-Klasy. Na alarm uderzył również Dziennik Internautów i Computerworld. Wszyscy zwrócili uwagę na fakt, że prosty robot internetowy może skopiować strony z portalu, przefiltrować ciekawe informacje i zapisać je na dysku. Niestety większości umknął jeden ważny [...]]]></description>
			<content:encoded><![CDATA[<p>Hacking.pl opublikował artykuł <a href="http://hacking.pl/pl/news-7280-Nasza_Klasapl_pobierz_sobie_dane_milionow_Polakow_.html">Nasza-Klasa.pl &#8211; pobierz sobie dane milionów Polaków</a>. Zasugerowano w nim, że każdy może pobrać dane wszystkich użytkowników Naszej-Klasy. Na alarm uderzył również <a href="http://di.com.pl/news/18791,1.html">Dziennik Internautów</a> i <a href="http://www.computerworld.pl/news/137795.html">Computerworld</a>. Wszyscy zwrócili uwagę na fakt, że prosty <a href="http://pl.wikipedia.org/wiki/Robot_internetowy">robot internetowy</a> może skopiować strony z portalu, przefiltrować ciekawe informacje i zapisać je na dysku. Niestety większości umknął jeden ważny problem&#8230; czas potrzebny do skopiowania 8 milionów stron.</p>
<p><span id="more-76"></span></p>
<p>Prosty skrypt w <a href="http://www.php.net">PHP</a> korzystający z biblioteki <a href="http://pl.wikipedia.org/wiki/CURL">cURL</a> może wyglądać tak:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> getProfile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_init"><span style="color: #990000;">curl_init</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://nasza-klasa.pl/profile/<span style="color: #006699; font-weight: bold;">$id</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_COOKIE<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;nk_session=[ tu wpisać identyfikator sesji ]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_USERAGENT<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Mozilla/5.0 (Windows NT 5.1; U; en)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/curl_exec"><span style="color: #990000;">curl_exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> parseProfile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rawData</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color: #990000;">preg_match_all</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/wartosc&quot;&gt;(.*)&lt;/iU'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rawData</span><span style="color: #339933;">,</span> <span style="color: #000088;">$m</span><span style="color: #339933;">,</span> PREG_SET_ORDER<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;,&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;,&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;,&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;,&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;,&quot;</span> <span style="color: #339933;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;,&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;,&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;,&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">8</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;,&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000088;">$fh</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nk.log&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;plik nie chce się otworzyć :-(&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4085305</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4085305</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">25</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$i</span> &quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/fputs"><span style="color: #990000;">fputs</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fh</span><span style="color: #339933;">,</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;,&quot;</span> <span style="color: #339933;">.</span> parseProfile<span style="color: #009900;">&#40;</span>getProfile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">++</span><span style="color: #000088;">$i</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<a href="http://www.php.net/fclose"><span style="color: #990000;">fclose</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fh</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>A czas jego wykonania? Na moim komputerze (i łączu internetowym) pobranie 25 profili, zaczynając od mojego, trwa:</p>
<pre>
/usr/bin/time -v php5 nk.php 2>&#038;1 | grep wall
	Elapsed (wall clock) time (h:mm:ss or m:ss): 6:39.42
</pre>
<p>Policzmy zatem. 8 milionów profili do pobrania. ~6 i pół minuty na każde 25 z nich.</p>
<pre>
( ( ( 8000000 / 25 ) * 6.5 ) / 60 ) / 24 = 1444.(4) dni
1444.(4) / 365 =~ 3.95738 lat
</pre>
<p>Już po 4 latach pobierania profili miałbym komplet danych użytkowników Naszej Klasy. Nie ma zatem realnych szans na skopiowanie wszystkich danych z Naszej Klasy. Chyba, że&#8230; zrobi to Chuck Norris. Tak samo jak kiedyś skopiował cały Internet na dyskietkę ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.burghardt.pl/2008/01/o-tym-jak-to-chuck-norris-skopiowal-dane-z-naszej-klasy-na-dyskietke/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Limiting access to ptrace() call in Linux</title>
		<link>http://blog.burghardt.pl/2007/12/limiting-access-to-ptrace-call-in-linux/</link>
		<comments>http://blog.burghardt.pl/2007/12/limiting-access-to-ptrace-call-in-linux/#comments</comments>
		<pubDate>Fri, 28 Dec 2007 23:19:42 +0000</pubDate>
		<dc:creator>Krzysztof Burghardt</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[LKM]]></category>
		<category><![CDATA[ltrace]]></category>
		<category><![CDATA[ptrace]]></category>
		<category><![CDATA[strace]]></category>

		<guid isPermaLink="false">http://www.burghardt.pl/2007/12/limiting-access-to-ptrace-call-in-linux/</guid>
		<description><![CDATA[<p>Ability to trace and debug software on servers is not needed for most users. Giving them right to trace processes may leak information and if ptrace() is vulnerable lead to more problems.</p>
<p>Sptrace is a secure ptrace() Linux Kernel Module (LKM). It limits users&#8217; access to the ptrace() call. It can disable strace (and ltrace) altogether, or [...]]]></description>
			<content:encoded><![CDATA[<p>Ability to trace and debug software on servers is not needed for most users. Giving them right to trace processes may leak information and if ptrace() is vulnerable lead to more problems.</p>
<p>Sptrace is a <strong>secure ptrace()</strong> Linux Kernel Module (LKM). It limits users&#8217; access to the <em>ptrace()</em> call. It can disable strace (and ltrace) altogether, or if you add a ptrace group to your system, only users in that group will be able to use <em>ptrace()</em> call.</p>
<p><span id="more-68"></span></p>
<p>When someone not allowed to trace processes uses program that call <em>ptrace()</em> current and parent processes names, pids, uids and euids are logged, e.g.:</p>
<pre>
Dec 29 00:39:27 techie kernel: sptrace: ptrace() DENIED for (strace:28733) UID(1000) EUID(1000), parent (strace:28732) UID(1000) EUID(1000)
Dec 29 00:39:40 techie kernel: sptrace: ptrace() DENIED for (ltrace:28745) UID(1000) EUID(1000), parent (ltrace:28744) UID(1000) EUID(1000)
</pre>
<p>New version was just adjusted to reflect changes in Linux and was tested with latest kernel version available (2.6.23). Support for 2.4 line is still there, but it is no longer tested.</p>
<p>Download: <a href="http://www.burghardt.pl/files/sptrace-1.4.1.tar.gz">sptrace-1.4.1.tar.gz</a> (<a href="http://www.burghardt.pl/files/sptrace-1.4.1.tar.gz.asc">.asc</a>)</p>
<p>md5sum: d0b58eced8f60e696c39dfaf4b306771<br />
sha1sum: 49696880b92837e35e16b6a34c346b00084df4e2</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.burghardt.pl/2007/12/limiting-access-to-ptrace-call-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
