<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Clearing Passwords in Memory with Python</title>
	<atom:link href="http://www.codexon.com/posts/clearing-passwords-in-memory-with-python/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codexon.com/posts/clearing-passwords-in-memory-with-python</link>
	<description></description>
	<lastBuildDate>Sun, 05 Sep 2010 05:11:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: admin</title>
		<link>http://www.codexon.com/posts/clearing-passwords-in-memory-with-python/comment-page-1#comment-356</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 13 Sep 2009 18:46:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.codexon.com/?p=192#comment-356</guid>
		<description>I&#039;m not sure why people keep questioning this method. It is a standard practice to clear strings in memory when you are done with them in programs written in C/C++, and I show how this is possible in Python.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure why people keep questioning this method. It is a standard practice to clear strings in memory when you are done with them in programs written in C/C++, and I show how this is possible in Python.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jokey</title>
		<link>http://www.codexon.com/posts/clearing-passwords-in-memory-with-python/comment-page-1#comment-355</link>
		<dc:creator>jokey</dc:creator>
		<pubDate>Sun, 13 Sep 2009 13:42:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.codexon.com/?p=192#comment-355</guid>
		<description>What about you just secure the swap itself by encrypting it?

At least OS X and Linux do support that, no idea about Redmond OS though.

Also encrypting your harddisk partition as such might help...
IMHO these security decisions should be left to the user and not the program at hand.
If you do think you should provide something &quot;secure&quot;, why not make the auth system pluggable and offer something really secure like one-time auth or whatever you feel like?</description>
		<content:encoded><![CDATA[<p>What about you just secure the swap itself by encrypting it?</p>
<p>At least OS X and Linux do support that, no idea about Redmond OS though.</p>
<p>Also encrypting your harddisk partition as such might help&#8230;<br />
IMHO these security decisions should be left to the user and not the program at hand.<br />
If you do think you should provide something &#8220;secure&#8221;, why not make the auth system pluggable and offer something really secure like one-time auth or whatever you feel like?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.codexon.com/posts/clearing-passwords-in-memory-with-python/comment-page-1#comment-354</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sat, 12 Sep 2009 23:18:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.codexon.com/?p=192#comment-354</guid>
		<description>Security is &lt;strong&gt;always&lt;/strong&gt; an issue of chances of % and convenience. 

Take the lock on your door for example. It is not 100% secure, but its mostly secure. There&#039;s always a chance that someone may be strong enough to smash it.

Another example would be the encryption key size. Why use 256 bits? Why not use 1 MB? Convenience, and the probability that whoever is cracking your key does not have a giant server farm or futuristic computers.</description>
		<content:encoded><![CDATA[<p>Security is <strong>always</strong> an issue of chances of % and convenience. </p>
<p>Take the lock on your door for example. It is not 100% secure, but its mostly secure. There&#8217;s always a chance that someone may be strong enough to smash it.</p>
<p>Another example would be the encryption key size. Why use 256 bits? Why not use 1 MB? Convenience, and the probability that whoever is cracking your key does not have a giant server farm or futuristic computers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lorg</title>
		<link>http://www.codexon.com/posts/clearing-passwords-in-memory-with-python/comment-page-1#comment-352</link>
		<dc:creator>lorg</dc:creator>
		<pubDate>Sat, 12 Sep 2009 21:45:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.codexon.com/?p=192#comment-352</guid>
		<description>Since this is a security issue you&#039;re discussion, thinking about &#039;the chances&#039; of %s is not enough. Since the scenario is likely to include another program trying to read your process&#039; memory, you have to think of a malicious system.

Another program running alongside could play with timing issues, memory availability, paging, etc... Therefore, if you want this to be secure against the threat you are defending against, you have to consider these issues.</description>
		<content:encoded><![CDATA[<p>Since this is a security issue you&#8217;re discussion, thinking about &#8216;the chances&#8217; of %s is not enough. Since the scenario is likely to include another program trying to read your process&#8217; memory, you have to think of a malicious system.</p>
<p>Another program running alongside could play with timing issues, memory availability, paging, etc&#8230; Therefore, if you want this to be secure against the threat you are defending against, you have to consider these issues.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Dedul</title>
		<link>http://www.codexon.com/posts/clearing-passwords-in-memory-with-python/comment-page-1#comment-350</link>
		<dc:creator>Alex Dedul</dc:creator>
		<pubDate>Wed, 09 Sep 2009 19:13:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.codexon.com/?p=192#comment-350</guid>
		<description>Nice, thank you..</description>
		<content:encoded><![CDATA[<p>Nice, thank you..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.codexon.com/posts/clearing-passwords-in-memory-with-python/comment-page-1#comment-51</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sat, 13 Jun 2009 03:09:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.codexon.com/?p=192#comment-51</guid>
		<description>This solution actually does help. If you zero out the memory as fast as you can, the chances of the memory being swapped out is practically zero.

If instead you leave the password out there, and continue using your program for a couple hours then there&#039;s a high possibility it will be swapped to disk.</description>
		<content:encoded><![CDATA[<p>This solution actually does help. If you zero out the memory as fast as you can, the chances of the memory being swapped out is practically zero.</p>
<p>If instead you leave the password out there, and continue using your program for a couple hours then there&#8217;s a high possibility it will be swapped to disk.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WalterGR</title>
		<link>http://www.codexon.com/posts/clearing-passwords-in-memory-with-python/comment-page-1#comment-50</link>
		<dc:creator>WalterGR</dc:creator>
		<pubDate>Sat, 13 Jun 2009 03:04:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.codexon.com/?p=192#comment-50</guid>
		<description>Comments were nesting too deep, so starting afresh:

&gt; In the general case, your password will not be swapped out to a page file needlessly.

Right, but one never knows when the password will be swapped out, or the program will dump core, or the system will go into hibernate, or...

&gt; You can use VirtualProtect with PAGE_NOCACHE on the page the memory resides on to ensure this. But this is really beyond the scope of the article.

I&#039;m not trying to be argumentative, but your solution doesn&#039;t fully mitigate against the scenarios listed at the top of the article. So I&#039;d say it _is_ in scope.

&gt; I know of no OS API which automatically takes care of the situations that you outlined above.

That seems correct. My memory was wrong.</description>
		<content:encoded><![CDATA[<p>Comments were nesting too deep, so starting afresh:</p>
<p>&gt; In the general case, your password will not be swapped out to a page file needlessly.</p>
<p>Right, but one never knows when the password will be swapped out, or the program will dump core, or the system will go into hibernate, or&#8230;</p>
<p>&gt; You can use VirtualProtect with PAGE_NOCACHE on the page the memory resides on to ensure this. But this is really beyond the scope of the article.</p>
<p>I&#8217;m not trying to be argumentative, but your solution doesn&#8217;t fully mitigate against the scenarios listed at the top of the article. So I&#8217;d say it _is_ in scope.</p>
<p>&gt; I know of no OS API which automatically takes care of the situations that you outlined above.</p>
<p>That seems correct. My memory was wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.codexon.com/posts/clearing-passwords-in-memory-with-python/comment-page-1#comment-49</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sat, 13 Jun 2009 02:54:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.codexon.com/?p=192#comment-49</guid>
		<description>In the general case, your password will not be swapped out to a page file needlessly.

You can use VirtualProtect with PAGE_NOCACHE on the page the memory resides on to ensure this. But this is really beyond the scope of the article.

I know of no OS API which automatically takes care of the situations that you outlined above.</description>
		<content:encoded><![CDATA[<p>In the general case, your password will not be swapped out to a page file needlessly.</p>
<p>You can use VirtualProtect with PAGE_NOCACHE on the page the memory resides on to ensure this. But this is really beyond the scope of the article.</p>
<p>I know of no OS API which automatically takes care of the situations that you outlined above.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WalterGR</title>
		<link>http://www.codexon.com/posts/clearing-passwords-in-memory-with-python/comment-page-1#comment-48</link>
		<dc:creator>WalterGR</dc:creator>
		<pubDate>Sat, 13 Jun 2009 02:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.codexon.com/?p=192#comment-48</guid>
		<description>Edit: I&#039;m thinking something like this:

1. A page of physical memory is allocated.
2. Clear-text password is stored in that page of physical memory.
3. That page is swapped to disk.
4. The code to clear the password executes.
5. The page containing the clear-text password is swapped from disk into physical memory.
6. The clear-text password is scrubbed from physical memory.

I don&#039;t think there&#039;s any guarantee that the clear-text password will also be scrubbed from the swap file.

Likewise, I think this solution is insufficient if step 3 above is replaced with: the program crashes and dumps core; the OS is put into hibernate mode; etc.</description>
		<content:encoded><![CDATA[<p>Edit: I&#8217;m thinking something like this:</p>
<p>1. A page of physical memory is allocated.<br />
2. Clear-text password is stored in that page of physical memory.<br />
3. That page is swapped to disk.<br />
4. The code to clear the password executes.<br />
5. The page containing the clear-text password is swapped from disk into physical memory.<br />
6. The clear-text password is scrubbed from physical memory.</p>
<p>I don&#8217;t think there&#8217;s any guarantee that the clear-text password will also be scrubbed from the swap file.</p>
<p>Likewise, I think this solution is insufficient if step 3 above is replaced with: the program crashes and dumps core; the OS is put into hibernate mode; etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WalterGR</title>
		<link>http://www.codexon.com/posts/clearing-passwords-in-memory-with-python/comment-page-1#comment-47</link>
		<dc:creator>WalterGR</dc:creator>
		<pubDate>Sat, 13 Jun 2009 02:22:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.codexon.com/?p=192#comment-47</guid>
		<description>&gt; There&#039;s nothing wrong with using memset.

Ah, I (mis)remembered SecureZeroMemory doing more work than just guarding against compiler optimization.

Are you familiar enough with the internals and intricate behaviors of Python, OS swap, hibernate, sleep, etc. to guarantee that this will wipe the variable, even if it&#039;s been written out to disk?</description>
		<content:encoded><![CDATA[<p>&gt; There&#8217;s nothing wrong with using memset.</p>
<p>Ah, I (mis)remembered SecureZeroMemory doing more work than just guarding against compiler optimization.</p>
<p>Are you familiar enough with the internals and intricate behaviors of Python, OS swap, hibernate, sleep, etc. to guarantee that this will wipe the variable, even if it&#8217;s been written out to disk?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
