<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>code-analysis &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/code-analysis/</link>
	<description>Feed of posts on WordPress.com tagged "code-analysis"</description>
	<pubDate>Wed, 10 Feb 2010 10:03:23 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Creating a toy virtual machine with PyPy]]></title>
<link>http://indefinitestudies.org/2010/02/08/creating-a-toy-virtual-machine-with-pypy/</link>
<pubDate>Mon, 08 Feb 2010 19:30:32 +0000</pubDate>
<dc:creator>dan</dc:creator>
<guid>http://indefinitestudies.org/2010/02/08/creating-a-toy-virtual-machine-with-pypy/</guid>
<description><![CDATA[Here, you can use &#8220;virtual machine&#8221; as in &#8220;Java Virtual Machine&#8221;, not as in ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:justify;">Here, you can use &#8220;virtual machine&#8221; as in &#8220;Java Virtual Machine&#8221;, not as in virtualization. We will play with the virtual machine described in the paper <em><a href="http://codespeak.net/pypy/extradoc/talk/icooolps2009/bolz-tracing-jit.pdf">Tracing the Meta-Level: PyPy&#8217;s Tracing JIT Compiler</a></em> by C.F. Bolz, A. Cuni, M. Fijalkowski and A. Rigo (it&#8217;s a great read by the way).</p>
<p style="text-align:justify;"><a href="http://codespeak.net/pypy">PyPy</a> is a fascinating project, too complex to describe here. Among other things, PyPy can take any interpreter written in a subset of Python, translate it to C, and automatically generate a JIT compiler for this language. Does it sound too good to be true? Let&#8217;s try this.</p>
<ul style="text-align:justify;">
<li>grab <a href="http://codespeak.net/pypy/dist/pypy/doc/getting-started.html#svn-check-out">PyPy source code</a></li>
<li style="text-align:justify;">create the interpreter in pypy/translator/goal/target-toy.py with the following code:</li>
</ul>
<pre style="text-align:justify;">import os, sys
import autopath
import py

# these are the opcodes for the interpreted language
JUMP_IF_A  = 1
MOV_A_R    = 2
MOV_R_A    = 3
ADD_R_TO_A = 4
DECR_A     = 5
RETURN_A   = 6

<em>from pypy.rlib.jit import JitDriver
tlrjitdriver = JitDriver(greens = ['pc', 'bytecode'],
                         reds = ['a', 'regs'])</em>

# the main interpreter loop
def interpret(bytecode, a):
   regs = [0] * 256
   pc = 0
   while True:
<em>       tlrjitdriver.jit_merge_point(bytecode=bytecode, pc=pc, a=a, regs=regs)
</em>       opcode = bytecode[pc]
       pc += 1
       if opcode == JUMP_IF_A:
           target = bytecode[pc]
           pc += 1
           if a:
<em>               if target&#60;pc:
                   tlrjitdriver.can_enter_jit(bytecode=bytecode, pc=target, a=a, regs=regs)
</em>               pc = target
       elif opcode == MOV_A_R:
           n = bytecode[pc]
           pc += 1
           regs[n] = a
       elif opcode == MOV_R_A:
           n = bytecode[pc]
           pc += 1
           a = regs[n]
       elif opcode == ADD_R_TO_A:
           n = bytecode[pc]
           pc += 1
           a += regs[n]
       elif opcode == DECR_A:
           a -= 1
       elif opcode == RETURN_A:
           return a

# __________  Entry point  __________
def entry_point(argv):
    # the program we want to interpret
    # it computes the square of its argument
    bytecode = [
        MOV_A_R,    0, # i = a
        MOV_A_R,    1, # copy of ’a’
        # 4:
        MOV_R_A,    0, # i--
        DECR_A,
        MOV_A_R,    0,
        MOV_R_A,    2, # res += a
        ADD_R_TO_A, 1,
        MOV_A_R,    2,
        MOV_R_A,    0, # if i!=0: goto 4
        JUMP_IF_A,  4,
        MOV_R_A,    2,
        RETURN_A
    ]
    result = interpret(bytecode, int(argv[1]))
    print result
    return 0

def jitpolicy(driver):
    from pypy.jit.metainterp.policy import JitPolicy
    return JitPolicy()

# _____ Define and setup target ___
def target(*args):
    return entry_point, None

# main function, if this script is called from the command line
if __name__ == '__main__':
    entry_point(sys.argv)</pre>
<div><span style="color:#ffffff;">.</span></div>
<ul style="text-align:justify;">
<li>the lines in italic are the annotations for the JIT compiler. We need to give PyPy some insight on the interpreted language by declaring what is the instruction pointer (the green variables), the beginning of the dispatch loop and the backward branches (see the paper for full details).</li>
<li>check that you can execute this script correctly by running <code>python target-toy.py 12</code>, the output should be 144</li>
<li>PyPy can translate this script in C. For this, first install the <a href="http://codespeak.net/pypy/dist/pypy/doc/getting-started-python.html#translating-the-pypy-python-interpreter">dependencies</a> and then run the following command: <code>python translate.py target-toy.py</code></li>
<li>this should give you an executable target-toy-c, rename it target-toy-native and check that <code>./target-toy-native 12</code> yields 144</li>
<li>now we can ask PyPy to translate target-toy.py in C and generate a JIT compiler for it. For this, we just run <code>python translate.py --opt=jit target-toy.py</code>
<ul>
<li>note: the 64-bit backend of PyPy is not implemented yet, so if you are on a 64-bit system, you will have to struggle a bit. You will have to use a 32-bit Python interpreter (see my former post), create an alias for gcc -m32 (let&#8217;s call it gcc32) and then pass the option &#8211;cc=gcc32 to translate.py.</li>
</ul>
</li>
<li>this should give you another target-toy-c executable, rename it to target-toy-jit and check that <code>./target-toy-jit 12 yields 144</code></li>
</ul>
<p style="text-align:justify;">Ok, everything is working, so let&#8217;s now see how all this performs by computing large squares:<br />
<code><br />
~/pypy-trunk/pypy/translator/goal$ time python target-toy.py 1000000<br />
1000000000000<br />
real	0m18.637s</code></p>
<p style="text-align:justify;"><code> </code></p>
<p style="text-align:justify;"><code>~/pypy-trunk/pypy/translator/goal$ time ./target-toy-native 1000000<br />
-727379968<br />
real	0m0.024s</code></p>
<p style="text-align:justify;"><code> </code></p>
<p style="text-align:justify;"><code>~/pypy-trunk/pypy/translator/goal$ time ./target-toy-jit 1000000<br />
-727379968<br />
[...]<br />
real	0m0.005s</code></p>
<p style="text-align:justify;">The first run is the <strong>square program interpreted by our program, itself interpreted by the Python interpreter</strong>. Double interpretation is slow.</p>
<p style="text-align:justify;">The second run is the <strong>square program interpreted by a native version of our interpret function</strong>. Interpretation by native code is ok.</p>
<p style="text-align:justify;">The third run is the <strong>s</strong><strong>quare program interpreted and JIT&#8217;ed on the fly</strong>. It&#8217;s super awesome <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align:justify;">Final note: I must thank everybody from #pypy on freenode, for their help and resilience to stupid questions. Thanks guys!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Getting Started with Savarin]]></title>
<link>http://indefinitestudies.org/2010/01/20/getting-started-with-savarin/</link>
<pubDate>Wed, 20 Jan 2010 10:39:28 +0000</pubDate>
<dc:creator>dan</dc:creator>
<guid>http://indefinitestudies.org/2010/01/20/getting-started-with-savarin/</guid>
<description><![CDATA[(disclaimer: the author of Savarin, Matthieu Kaczmarek, is a colleague working in the office next do]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><em>(disclaimer: the author of Savarin, Matthieu Kaczmarek, is a colleague working in the office next door and a friend of mine)</em></p>
<p>Savarin is a free online binary classification service (you can think of it as automatic diff&#8217;ing against large databases of programs). It is in beta, not fully polished yet, but you can still squeeze some interesting results out of it. Here is your daily shot of binary analysis, freshly brewed.</p>
<p>You will need:</p>
<ul>
<li>2 different malware samples in the same malware family. We are going to use Sasser.A (already in Savarin&#8217;s database) and an unpacked Sasser.G (md5 <a href="http://www.offensivecomputing.net/?q=ocsearch&#38;ocq=b973853d0863070aca89ce00d4ee0fb9">b973853d0863070aca89ce00d4ee0fb9</a> [offensivecomputing.net])</li>
<li>IDA with IDAPython for the actual diff&#8217;ing (I have IDA 5.5, I don&#8217;t know if this works with the free version)</li>
</ul>
<p>Let&#8217;s go:</p>
<ol>
<li>open <a href="http://savarin.loria.fr">Savarin</a></li>
<li>in <em>&#8220;Classification against custom database&#8221;</em>, choose <strong>SasserA</strong></li>
<li>upload the Sasser.G sample</li>
<li>in the results page, click <em>More </em>to see the similarity with other binaries in the Sasser family</li>
<li>you can see that the sample is 41.95% similar to a sample with md5 <em>edc66a4031f5a41f9ddf08595a1d4c92</em></li>
</ol>
<p>At this point, you have a classification of a sample against a (small) database of programs. You can therefore see the distance between this sample and other samples. If you ask me, it&#8217;s a lot better to see that unknownsample.exe is 80% similar to badguy.exe and 90% similar to badguy2.0.exe than just &#8220;infected&#8221; or &#8220;not infected&#8221;.</p>
<p>For the actual diff&#8217;ing, follow these steps:</p>
<ol>
<li>open the Sasser.G sample in IDA</li>
<li>download the IDAPython analysis report on Savarin&#8217;s analysis page (this report contains all the data needed to visualize the binary differences in IDA)</li>
<li>execute the IDAPython analysis report</li>
<li>right now, the situation is pretty anticlimactic since you should see no change apart from a few lines in the console. Wait until next step for the interesting stuff. Yes, you had nothing to do in this step, so what?</li>
<li>type <strong>SavColor(&#8216;md5.edc66a4031f5a41f9ddf08595a1d4c92&#8242;, 0&#215;0088ff)</strong> in the IDAPython console (it is the md5 value of the Sasser.A sample)</li>
<li>type <strong>SavComment(&#8216;md5.edc66a4031f5a41f9ddf08595a1d4c92&#8242;) </strong>in the IDAPython console</li>
<li>this is it, now you can browse the Sasser.G sample, and the common parts with Sasser.A will be colored. Additionally, for two matching instructions you will see the corresponding address in the Sasser.A sample.</li>
</ol>
<p>The Fine Screenshots:</p>

</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Packers, egg, sausage and packers]]></title>
<link>http://indefinitestudies.org/2009/12/21/packers-egg-sausage-and-packers/</link>
<pubDate>Mon, 21 Dec 2009 12:58:48 +0000</pubDate>
<dc:creator>dan</dc:creator>
<guid>http://indefinitestudies.org/2009/12/21/packers-egg-sausage-and-packers/</guid>
<description><![CDATA[Thanks to Silvio Cesare and Felix Gröbert, I now have 44 species in my packer zoo. I tested TraceSur]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Thanks to <a href="http://silviocesare.wordpress.com/">Silvio Cesare</a> and <a href="http://groebert.org/felix/">Felix Gröbert</a>, I now have 44 species in my packer zoo. I tested TraceSurfer on these 44 packers, here are the <a href="http://spreadsheets.google.com/ccc?key=0ApX4HUDSLDoEdGRCMzRFeS1wNlRNdlZuXzl6WkhWNlE&#38;hl=fr">full results</a> and the <a href="http://picasaweb.google.fr/reynaud.daniel/Hostname?authkey=Gv1sRgCP7r66DGlsOXvQE&#38;feat=directlink">visualizations</a>.</p>
<p><em>(quick recap: TraceSurfer uses Pin to trace every instruction in target binaries, extracting a trace file. Then the trace is analysed (or surfed) to detect layers of self-modifying code (or code waves) and code protection patterns)</em></p>
<p><strong>Highlights:</strong></p>
<ul>
<li>only 35 binaries execute correctly on my machine</li>
<li>Pin v. 31933 works on 30 of these binaries (<strong>success rate of 85.71%</strong>)</li>
<li>some packers don&#8217;t seem to pack anything since they have only 1 code wave (!Epack Lite 1.4, Pepack, VmProtect). Either the binaries are indeed packed and I fail to detect the self-modifying code, or they&#8217;re not self-modifying at all. It&#8217;s probably the latter, since the trace sizes are very close to the original (unpacked) binary.</li>
<li>very few packers seem to use <strong>code scrambling</strong> (supposedly an advanced anti-dumping technique): Acprotect, Petite and the Yoda family</li>
<li><strong>integrity checking</strong> seems to be more popular, it is used in Acprotect, Themida, Enigma, Pelock, NSPack&#8230;</li>
<li>given the trace size, it seems that <strong>anti-emulation loops</strong> can be found in Morphine (164M instructions) and !Epack 1.0 (87M instructions)</li>
<li>nice similarities between <a href="http://picasaweb.google.fr/lh/photo/wNbPKhOt7ye3jYJob4_laQ?authkey=Gv1sRgCP7r66DGlsOXvQE&#38;feat=directlink">Yoda Crypter 1.3</a> and <a href="http://picasaweb.google.fr/lh/photo/WNNDDQN3bC_IviHvTuw4og?authkey=Gv1sRgCP7r66DGlsOXvQE&#38;feat=directlink">Yoda Protector 1.4</a></li>
<li>the Monster Award is attributed to&#8230; <a href="http://picasaweb.google.fr/lh/photo/43eF225InDlVZUzX7GKDJQ?authkey=Gv1sRgCP7r66DGlsOXvQE&#38;feat=directlink">Themida 1.8.5.2</a> (80M instructions, 31 code waves, 142890 decrypted bytes + integrity checking)</li>
</ul>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Finding these trailing commas in Javascript code]]></title>
<link>http://vati2000.wordpress.com/2009/11/29/finding-these-trailing-commas-in-javascript-code/</link>
<pubDate>Sun, 29 Nov 2009 00:03:16 +0000</pubDate>
<dc:creator>jsteemann</dc:creator>
<guid>http://vati2000.wordpress.com/2009/11/29/finding-these-trailing-commas-in-javascript-code/</guid>
<description><![CDATA[I have been annoyed so much this week by a Javascript issue with Internet Explorer. In IE6, IE7, and]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I have been annoyed so much this week by a Javascript issue with Internet Explorer.</p>
<p>In IE6, IE7, and IE 8 it seems to be a problem to write code like this:</p>
<pre>a={ foo: true, bar: false, };
</pre>
<p>The code seems to work all fine in Firefox and Safari, however, in Internet Explorer it will cause a Javascript error because of the last comma not followed by another declaration. Removing the last comma will make the code work in IE as well .</p>
<p>The issue is well known and Google has a lot of advice on it (simply search Google for &#8220;trailing comma javascript ie&#8221;).</p>
<p>I wanted to have something that auto-detects this issue for frequently changing Javascript code in a specific folder and that should be run as part of a test suite.</p>
<p><a href="http://www.jslint.com/">JSLint</a> seems to be an excellent validation tool, however, it&#8217;s written in Javascript and I don&#8217;t like the clumsy workarounds that are suggested to execute Javascript on the command line.</p>
<p>There are also full-featured Javascript tools like <a href="http://www.mozilla.org/rhino/">Rhino</a> and stuff around, however, they are not lightweight and cannot be run when there is no Java around.</p>
<p>So I put something together in PHP that tries to find the trailing commas in a bunch of Javascript files as well. It is small and simple and does not pretend to do anything else like all the other validators around.</p>
<p>The code can be found at <a href="http://code.google.com/p/phpcodetools/">http://code.google.com/p/phpcodetools/</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Copy and paste detector for PHP code]]></title>
<link>http://vati2000.wordpress.com/2009/11/28/copy-and-paste-detector-for-php-code/</link>
<pubDate>Sat, 28 Nov 2009 23:13:33 +0000</pubDate>
<dc:creator>jsteemann</dc:creator>
<guid>http://vati2000.wordpress.com/2009/11/28/copy-and-paste-detector-for-php-code/</guid>
<description><![CDATA[Copying and pasting existing code normally leads to having a lot of redundant code around. Not only ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Copying and pasting existing code normally leads to having a lot of redundant code around. Not only will the codebase grow in size but furthermore, copying &#38; pasting will likely make future bugfixes and changes more time-consuming, error prone and difficult than actually necessary.</p>
<p>I think that even if it is not desired, it is still quite common to have at least a bit of identical code around: code that worked well in one situation is often used as the starting point (read: copied) for a new solution or script.</p>
<p>I was wondering how much identical code I had but didn&#8217;t really have a clue.</p>
<p>So I hacked together a small script that will go through a list of PHP files, read their code and try to find the duplicate codes parts in them and between them.</p>
<p>The duplication detection works as follows:</p>
<ul>
<li>Foreach PHP script that is read, all single and multilines comments will be removed (this is done using PHP&#8217;s built-in tokenizer)</li>
<li>The remaining code is processed line by line. Each line is normalized by removing all whitespace and curly brackets (this is done to account for different indenting styles people use)</li>
<li>For all remaining non-empty lines, a fingerprint is calculated using CRC32 and stored in a buffer</li>
<li>When the code of all scripts has been read and processed, all possible pairs of files will be checked for identical code</li>
<li>Code is considered identical if 10 consecutive code lines (there is an option to change this to a different value) from two lines are identical. Note that different comments and indenting are ignored here and just the net code is relevant.</li>
</ul>
<p>For any duplicate code that is found, a message will be printed showing the identical code parts ranges with the corresponding file names and line number ranges.</p>
<p>The output will be sorted so that the longest matches will be reported on top. There will also be a reported of files with duplicate code parts, again sorted with worst cases on top.</p>
<p>Example output when running the check for Zend Framework 1.9, limited to the files in directory Zend/Controller:</p>
<pre>Worst matches:
-    69 matching lines found between Zend/Controller/Router/Abstract.php:70,138 and Zend/Controller/Dispatcher/Abstract.php:282,350
-    69 matching lines found between Zend/Controller/Router/Abstract.php:70,138 and Zend/Controller/Front.php:653,721
-    69 matching lines found between Zend/Controller/Dispatcher/Abstract.php:282,350 and Zend/Controller/Front.php:653,721
-    15 matching lines found between Zend/Controller/Action/Helper/ContextSwitch.php:1139,1153 and Zend/Controller/Action/Helper/ContextSwitch.php:1179,1193
-    12 matching lines found between Zend/Controller/Request/Apache404.php:58,69 and Zend/Controller/Request/Http.php:396,408

Worst files:
-   138: Zend/Controller/Router/Abstract.php
-   138: Zend/Controller/Front.php
-   138: Zend/Controller/Dispatcher/Abstract.php
-    30: Zend/Controller/Action/Helper/ContextSwitch.php
-    12: Zend/Controller/Request/Apache404.php
-    12: Zend/Controller/Request/Http.php</pre>
<p>The script is itself is written in PHP and it should work at least with PHP 5.2.x. It is self-contained and should not have any dependencies to any extensions, libraries etc. than the built-in PHP functions. It is designed to be run from the command line so the output will not be formatted nicely in a web browser.</p>
<p>The command line options when invoking the script are:</p>
<ul>
<li>&#8211;threshold: number of minimum lines that must be identical to be considered a match. Defaults to 10.</li>
<li>&#8211;regex: file inclusion regex. Must be a PCRE enclosed in forward slashes. Defaults to /\.php[345]?$/.</li>
</ul>
<p>Please note that the script should not be run on an extremely large codebase unless you have a lot of time. This is because the script will compare all lines from all lines against all lines from all other files and this can really get slow with a huge number of files.</p>
<p>The project is hosted at Google code and can be downloaded here: <a href="http://code.google.com/p/phpcodetools/">http://code.google.com/p/phpcodetools/</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Security tools from Microsoft]]></title>
<link>http://teamfoundationserver.wordpress.com/2009/11/25/security-tools-from-microsoft/</link>
<pubDate>Wed, 25 Nov 2009 15:07:27 +0000</pubDate>
<dc:creator>Tobias</dc:creator>
<guid>http://teamfoundationserver.wordpress.com/2009/11/25/security-tools-from-microsoft/</guid>
<description><![CDATA[We are currently looking for some tool to help us find weaknesses in our code. There is not lots of ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>We are currently looking for some tool to help us find weaknesses in our code. There is not lots of options currently on the market. A tool we are looking on is <a href="http://www.fortify.com" target="_blank">http://www.fortify.com</a> and <a href="http://www.armorize.com/" target="_blank">http://www.armorize.com/</a>, but who does best work on code? Biggest advantage for Fortify is that it supports many different languages, but damn it is really expensive tools.</p>
<p>Microsoft is&#160; planning to release their Security Tools but i think they are currently on early stage.   <br /><a href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=734&#38;wa=wsignin1.0" target="_blank">https://connect.microsoft.com/site/sitehome.aspx?SiteID=734&#38;wa=wsignin1.0</a></p>
<ul>
<li>CAT.NET &#8211; the managed code security source code scanning tool </li>
<li>WACA &#8211; Web Application Configuration Analyzer </li>
<li>WPL &#8211; Web Protection Library (formerly Anti-XSS) </li>
<li>TAM &#8211; Threat Modeling and Analysis tool</li>
</ul>
<ul>Only tool i tried to so far is CAT.NET but something is going terribly wrong when i run test on code (see error below), but i think this is a great initiative from Microsoft. What is wrong with my pdb, think is have wrong paths set or something…</ul>
<p><strong>Error from my run CAT.NET </strong>&#160;</p>
<ul>
<blockquote>
<p>C:\Program Files (x86)\Microsoft Information Security\Microsoft Code Analysis for .NET (CAT.NET) v2.0&#62;CATNetCmd.exe /fil       <br />e:c:\aDLLFILE.dll /configdir:C:\myPathToFolder        <br />Microsoft (r) Code Analysis Tool for .NET (CAT.NET) Tool 2.0.0.0        <br />Copyright (c) Microsoft Corporation 2009.&#160; All rights reserved. </p>
<p>Running in 32-bit mode </p>
<p>2009-11-25 13:17 : Information : Loading analysis rules&#8230;done.       <br />2009-11-25 13:17 : Information : Total 40 rules loaded by the engine.        <br />2009-11-25 13:17 : Information : Processing analysis rules&#8230;        <br />2009-11-25 13:17 : Information : Initializing configuration analysis engine&#8230;done.        <br />2009-11-25 13:17 : Information : Initializing interprocedural data flow analysis engine&#8230;The available PDB has been str        <br />ipped so it does not contain the required        <br />information for native or IJW images.        <br />Please find the full PDB for this binary and re-run your scenario. </p>
<p>Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indi       <br />cation that other memory is corrupt.        <br />&#160;&#160; at Phx.Pdb.ReaderImplementation.GetDataStream(String sectionNameString)        <br />&#160;&#160; at Phx.PE.ReaderPhase.ReadPEFixups()        <br />&#160;&#160; at Phx.PE.ReaderPhase.SeedFixups()        <br />&#160;&#160; at Phx.PE.ReaderPhase.CodeDiscovery()        <br />&#160;&#160; at Phx.PE.ReaderPhase.Translate()        <br />&#160;&#160; at Phx.PEModuleUnit.LoadGlobalSymbols()        <br />&#160;&#160; at Microsoft.InformationSecurity.CodeAnalysis.Engines.AnalysisEngine.TaintedAnalysisEngine.Initialize(String assembly        <br />path, String[] phoenixargs, Int32 maxnumofpasses, Rules rules)        <br />&#160;&#160; at Microsoft.InformationSecurity.CodeAnalysis.Engines.RulesEngine.RulesEngine.ProcessRules()        <br />&#160;&#160; at Microsoft.InformationSecurity.CodeAnalysis.UI.CommandLine.Program.Main(String[] args)</p>
</blockquote>
</ul>
<ul><strong>Update</strong></ul>
<ul><strong>Seems like it is a Windows 7 problem.</strong></ul>
<p> <a title="http://social.msdn.microsoft.com/Forums/en-US/phoenix/thread/2085fa72-19d8-4a6b-b6e0-8777e4fbfc59?prof=required" href="http://social.msdn.microsoft.com/Forums/en-US/phoenix/thread/2085fa72-19d8-4a6b-b6e0-8777e4fbfc59?prof=required">http://social.msdn.microsoft.com/Forums/en-US/phoenix/thread/2085fa72-19d8-4a6b-b6e0-8777e4fbfc59?prof=required</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Code Analysis Tools - Sample Ant Script]]></title>
<link>http://artofsoftwarereuse.com/2009/11/17/code-analysis-tools-sample-ant-script/</link>
<pubDate>Tue, 17 Nov 2009 20:58:12 +0000</pubDate>
<dc:creator>vijaynarayanan</dc:creator>
<guid>http://artofsoftwarereuse.com/2009/11/17/code-analysis-tools-sample-ant-script/</guid>
<description><![CDATA[When you develop reusable components quality is very important. The higher a reusable asset&#8217;s ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>When you develop reusable components quality is very important. The higher a reusable asset&#8217;s usage, the higher the need for robustness. Unlike monolithic code, defects with reusable assets can rapidly impact several business processes and applications. All the more reason for the criticality of <a href="http://artofsoftwarereuse.com/2009/10/08/automated-tests-are-foundational-to-systematic-reuse/">automated testing</a>. In addition to testing, code analysis tools can detect defects, warn regarding unsafe/potentially buggy code, and also recommend various source code style/formatting improvements. All of these contribute to higher quality. I have used findbugs, pmd, and checkstyle in this space and they are very useful to analyze source code. You can also include these in your continuous integration suite.</p>
<p>Many readers have requested that I post sample code and scripts &#8211; so here is a sample apache <a href="http://www.box.net/shared/rin9aey9p1">ant build script</a> that you can use with your code. Just be sure to modify the properties file to point to appropriate folders. The script will produce html reports for pmd and checkstyle as well as a find bugs output file (for viewing it with the findbugs client).</p>
<div id="attachment_2143" class="wp-caption alignright" style="width: 108px"><a href="http://www.box.net/shared/rin9aey9p1"><img class="size-full wp-image-2143" title="zip" src="http://softwarereuse.wordpress.com/files/2009/11/zip.jpg" alt="" width="98" height="110" /></a><p class="wp-caption-text">Code Analysis Script</p></div>
<p><span style="text-decoration:underline;">Pre-requisites prior to running this script:</span></p>
<p>Set JAVA_HOME to your JDK 1.5 or above folder</p>
<p>Install apache ant 1.6+, findbugs, pmd, and checkstyle in your environment</p>
<p>Make sure the <a href="http://findbugs.sourceforge.net/" target="_blank">findbugs</a>, <a href="http://pmd.sourceforge.net/" target="_blank">pmd</a>, and <a href="http://checkstyle.sourceforge.net/" target="_blank">checkstyle</a> jar files are in ant&#8217;s CLASSPATH.</p>
<p>Let me know if you have issues with using this script. Enjoy!</p>
<p>&#160;</p>
<p><strong>Like this post?</strong> Subscribe to <a href="http://feeds2.feedburner.com/SoftwareReuseInTheRealWorld">RSS feed</a> or get blog <a href="http://feedburner.google.com/fb/a/mailverify?uri=SoftwareReuseInTheRealWorld&#38;loc=en_US">updates via email</a>.</p>
<p style="text-align:right;"><strong> <a href="http://twitter.com/home?status=http://wp.me/ptCiB-yx"><img title="tweet this" src="/files/2009/10/twitter2.png" alt="tweet this" width="32" height="32" /></a> <a href="http://del.icio.us/post?url=http://wp.me/ptCiB-yx&#38;title=Code Analysis Tools - Sample Ant Script"><img title="del.icio.us:Code Analysis Tools - Sample Ant Script" src="/files/2009/10/dellicious.png" alt="add to del.icio.us" width="32" height="32" /></a></strong> <a href="http://www.facebook.com/sharer.php?u=http://wp.me/ptCiB-yx&#38;title=Code Analysis Tools - Sample Ant Script"><img title="facebook:Code Analysis Tools - Sample Ant Script" src="/files/2009/10/48x48.png" alt="post to facebook" width="32" height="32" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[A new visualization for packed and self-modifying programs]]></title>
<link>http://indefinitestudies.org/2009/09/21/a-new-visualization-for-packed-and-self-modifying-programs/</link>
<pubDate>Mon, 21 Sep 2009 14:22:45 +0000</pubDate>
<dc:creator>dan</dc:creator>
<guid>http://indefinitestudies.org/2009/09/21/a-new-visualization-for-packed-and-self-modifying-programs/</guid>
<description><![CDATA[I have been working with my PhD supervisor on a dynamic typing system to detect and visualize the te]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I have been working with my PhD supervisor on a dynamic typing system to detect and visualize the temporal evolution of self-modifying programs (it&#8217;s not as complicated as it sounds). The typing system works as follows:</p>
<ul>
<li>each memory address has a read, write and execution level (r, w, x)</li>
<li>initially, every memory address begin with type (0, 0, 0)</li>
<li>when an address with type (r, w, x) is executed, its type becomes (r, w, w+1)</li>
<li>when an instruction with type (r1, w1, x1) reads a memory address with type (r2, w2, x2), the target address type becomes (x1, w2, x2)</li>
<li>when an instruction with type (r1, w1, x1) writes to a memory address with type (r2, w2, x2), the target address type becomes (r2, x1, x2)</li>
</ul>
<p>With that we can get a trace from a program (with DBI, an emulator, a debugger, whatever) and see what is executed (execution level &#62;= 1). By construction, if we have code with an execution level of 2, it means that it has been written by the program itself before being executed, therefore it is self-modifying code.</p>
<p>Again by construction, if we see code with an execution level k+1, it means that it has been written by code at level k. Hence we can precisely distinguish between different layers of code (in our jargon, different code <em>waves</em>)</p>
<p>Now we can detect some interesting properties based on the type of memory addresses:</p>
<ul>
<li>if an address has been read, written and then executed (RWX), we label it <em>decrypted</em></li>
<li>if an address has only been written and executed (WX), we label it <em>blind write</em></li>
<li>if an address has been executed and then read (XR), we assume there has been an <em>integrity check</em></li>
<li>if an address has been executed and then written (XW), we assume the <em>code has been scrambled</em> (supposedly as an anti-memory-dump technique)</li>
</ul>
<p>Therefore we have a way to trace different layers of code, and some relations between the layers (decryption, blind writes, integrity checking and code scrambling). This gives us the following visualization for some packers:</p>
<p><a href="http://indefinitestudies.wordpress.com/files/2009/09/upx-hostname.jpg"><img class="alignnone size-full wp-image-361" title="upx" src="http://indefinitestudies.wordpress.com/files/2009/09/upx-hostname.jpg" alt="upx-hostname" width="251" height="243" /></a><a href="http://indefinitestudies.wordpress.com/files/2009/09/molebox-hostname.jpg"><img class="alignnone size-medium wp-image-362" title="molebox" src="http://indefinitestudies.wordpress.com/files/2009/09/molebox-hostname.jpg?w=190" alt="molebox-hostname" width="190" height="300" /></a><a href="http://indefinitestudies.wordpress.com/files/2009/09/pec2-hostname.jpg"><img class="alignnone size-medium wp-image-363" title="pec2" src="http://indefinitestudies.wordpress.com/files/2009/09/pec2-hostname.jpg?w=260" alt="pec2-hostname" width="260" height="300" /></a><a href="http://indefinitestudies.wordpress.com/files/2009/09/yp-1.jpg"><img class="alignnone size-medium wp-image-364" title="yoda protector" src="http://indefinitestudies.wordpress.com/files/2009/09/yp-1.jpg?w=300" alt="yp-1" width="300" height="300" /></a><a href="http://indefinitestudies.wordpress.com/files/2009/09/allaple.jpg"><img class="alignnone size-medium wp-image-365" title="allaple" src="http://indefinitestudies.wordpress.com/files/2009/09/allaple.jpg?w=119" alt="allaple" width="119" height="300" /></a><a href="http://indefinitestudies.wordpress.com/files/2009/09/pelock-hostname.jpg"><img class="alignnone size-medium wp-image-366" title="pelock" src="http://indefinitestudies.wordpress.com/files/2009/09/pelock-hostname.jpg?w=300" alt="pelock-hostname" width="300" height="273" /></a><a href="http://indefinitestudies.wordpress.com/files/2009/09/acprotect-hostname.jpg"><img class="alignnone size-medium wp-image-367" title="acprotect" src="http://indefinitestudies.wordpress.com/files/2009/09/acprotect-hostname.jpg?w=145" alt="acprotect-hostname" width="145" height="300" /></a><a href="http://indefinitestudies.wordpress.com/files/2009/09/telock-hostname.jpg"><img class="alignnone size-medium wp-image-368" title="telock" src="http://indefinitestudies.wordpress.com/files/2009/09/telock-hostname.jpg?w=300" alt="telock-hostname" width="300" height="181" /></a></p>
<p>Note 1: thanks to Silvio Cesare for providing the packed samples</p>
<p>Note 2: we are going to present all this stuff at <a href="http://isiom.wssrl.org/index.php?option=com_content&#38;task=view&#38;id=58&#38;Itemid=57">Malware</a> (Montréal) with Jean-Yves Marion and Wadie Guizani, and at <a href="https://deepsec.net/schedule/">Deepsec</a> (Vienna)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Do We Really Need Malware Analysis?]]></title>
<link>http://indefinitestudies.org/2009/09/15/do-we-really-need-malware-analysis/</link>
<pubDate>Tue, 15 Sep 2009 16:32:14 +0000</pubDate>
<dc:creator>dan</dc:creator>
<guid>http://indefinitestudies.org/2009/09/15/do-we-really-need-malware-analysis/</guid>
<description><![CDATA[Recently I&#8217;ve been wondering, how is malware analysis different from traditional program analy]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Recently I&#8217;ve been wondering, how is malware analysis different from traditional program analysis? The fundamental reason is that programs can generally self-modify themselves. There is a direct consequence: with malware we have to admit that we don&#8217;t have static access to the program listing (thus preventing standard program analyses). And since turning self-modifying code (SMC) into normal code is undecidable, we end up only with technical (i.e. partial) solutions. This is why virtually every paper on malware analysis will only be a report on how a given technology/implementation is better/faster/stronger than the others.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">This has a corollary too: since we have only partial solutions, malware authors actively implement techniques to defeat our implementations. This opens a sub-research field: the production of techniques to defeat the analysis-defeating techniques. Yes, there is some irony in this, for instance this about packing -&#62; emulation-based unpacking -&#62; anti-emulation techniques -&#62; other-wonderful-unpacking-techniques&#8230;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Now, you might wonder, how did we get into this quagmire? As Schneier (http://www.schneier.com/blog/archives/2007/05/do_we_really_ne.html) pointed it out before me, this is an accident &#8211; a historic by-product of the way the IT industry evolved. The x86 architecture allowed self-modifying code, and operating systems did nothing to prevent or regulate that. And bam, a research niche was born.</div>
<p><a href="http://indefinitestudies.wordpress.com/files/2009/09/pyzamomgwtf.jpg"><img class="alignright size-medium wp-image-339" title="omgwtf" src="http://indefinitestudies.wordpress.com/files/2009/09/pyzamomgwtf.jpg?w=300" alt="omgwtf" width="180" height="163" /></a>Recently I&#8217;ve been wondering, how is malware analysis different from traditional program analysis? The fundamental reason is that programs can generally self-modify themselves. There is a direct consequence: with malware we have to admit that we don&#8217;t have static access to the program listing (thus preventing standard program analyses). And since turning self-modifying code into normal code is undecidable, we end up only with technical, partial solutions. This is why virtually every paper on malware analysis will only be a report on how a given technology/implementation is better/faster/stronger than the others.</p>
<p>This has a corollary too: since we have only partial solutions, in some cases they don&#8217;t work. And malware authors actively exploit that fact, by implementing techniques to defeat our implementations. This opened a sub-research field: the production of techniques to defeat the analysis-defeating techniques. Yes, there is some irony in this, for instance think about packing -&#62; emulation-based unpacking -&#62; anti-emulation techniques -&#62; other-wonderful-unpacking-techniques&#8230;</p>
<p>Now, you might wonder, how did we get into this quagmire? As <a href="http://www.schneier.com/blog/archives/2007/05/do_we_really_ne.html">Schneier</a> pointed it out before me, this is an accident &#8211; a historic by-product of the way the IT industry evolved. The x86 architecture allowed self-modifying code, and operating systems did nothing to prevent or regulate that. And <em>bam</em>, a research niche was born.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[الأداة CAT.NET]]></title>
<link>http://alnabhani.wordpress.com/2009/09/04/%d8%a7%d9%84%d8%a3%d8%af%d8%a7%d8%a9-cat-net/</link>
<pubDate>Thu, 03 Sep 2009 20:23:35 +0000</pubDate>
<dc:creator>alnabhani</dc:creator>
<guid>http://alnabhani.wordpress.com/2009/09/04/%d8%a7%d9%84%d8%a3%d8%af%d8%a7%d8%a9-cat-net/</guid>
<description><![CDATA[هي اداة برمجية مجانية تقوم شركة مايكروسوفت بإصدارها ، وهي عبارة عن اضافة على Visual Studio 2005 وما ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>هي اداة برمجية مجانية تقوم شركة مايكروسوفت بإصدارها ، وهي عبارة عن اضافة على Visual Studio 2005 وما فوق ، تهدف الى البحث في اكواد مشاريعك عن نقاط الضعف في البيانات ، والتي يقصد بها الثغرات المعروفة كـ SQL Injection ،XSS Injection و XPath Injection في اكوادك وتعرضها عليك ، هذه قائمة بهذه الثغرات التي تكتشفها: </p>
<blockquote><p dir="ltr" align="left">Cross Site Scripting     <br />SQL Injection      <br />Process Command Injection      <br />File Canonicalization      <br />Exception Information      <br />LDAP Injection      <br />XPATH Injection      <br />Redirection to User Controlled Site</p>
</blockquote>
<p>لتحميل هذه الاداة اتبع <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=0178e2ef-9da8-445e-9348-c93f24cc9f9d&#38;displaylang=en" target="_blank">الرابط التالي</a> ، علما بانها لاتزال تحت التطوير beta .</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[DevArena 2009]]></title>
<link>http://rcosic.wordpress.com/2009/07/15/devarena-2009-three-sessions-nominated/</link>
<pubDate>Wed, 15 Jul 2009 07:10:30 +0000</pubDate>
<dc:creator>rcosic</dc:creator>
<guid>http://rcosic.wordpress.com/2009/07/15/devarena-2009-three-sessions-nominated/</guid>
<description><![CDATA[Nowadays, I&#8217;ve been thinking about new sessions I want to lecture on our DevArena IT conferenc]]></description>
<content:encoded><![CDATA[Nowadays, I&#8217;ve been thinking about new sessions I want to lecture on our DevArena IT conferenc]]></content:encoded>
</item>
<item>
<title><![CDATA[FxCop &amp; StyleCop]]></title>
<link>http://burgerminds.wordpress.com/2009/06/28/fxcop-stylecop/</link>
<pubDate>Sun, 28 Jun 2009 14:02:30 +0000</pubDate>
<dc:creator>Locks Free</dc:creator>
<guid>http://burgerminds.wordpress.com/2009/06/28/fxcop-stylecop/</guid>
<description><![CDATA[What is FxCop ? From the MSDN, FxCop is an IL code analyzer. It will analyze assemblies and check fo]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><h2>What is FxCop ?</h2>
<p>From the <a href="http://msdn.microsoft.com/en-us/library/bb429476(VS.80).aspx">MSDN</a>, FxCop is an IL code analyzer. It will analyze assemblies and check for rules violations according to the <a href="http://msdn.microsoft.com/en-us/library/czefa0ke(VS.71).aspx">.NET Design Guidelines</a>.</p>
<p>You can download it (v-1.36) from <a href="http://www.microsoft.com/downloads/details.aspx?familyid=9AEAA970-F281-4FB0-ABA1-D59D7ED09772&#38;displaylang=en">here</a>. It is quite handy, even though not all rules make sense for all projects &#8212; especially if you are developing applications rather than libraries.</p>
<h2><strong>How to use it ?</strong></h2>
<p>Create a project and add compiled libraries for it to analyze. It is better to have it analyze assemblies with debug information so that it can link to the sources.</p>
<p>You can then decide the categories of rules to run and which to exclude. The next step is to analyze your assemblies which will provide a report containing details of all rule violations. This can be a pretty heavy report, especially if you have a large project already advanced in its life cycle.</p>
<p>It is now time to take care of the violations found, either by fixing them, excluding them from the project or excluding them from the source. Sometimes it is not possible or it does not make sense to fix a violation (according to the context) so it is preferable to exclude it so that it does not keep coming back. Excluding them from the project is quick but prone to later problem: conflicts in or loss of the project file, renaming of files/classes/methods. Those problems disappear when using in source exclusion with the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.codeanalysis.suppressmessageattribute.aspx">SuppressMessageAttribute</a> specifying the rule violation to suppress and possibly a justification for future reference. Here is an example (I always put my constant in ALL CAPS):</p>
<blockquote>
<div style="font-family:Courier New;font-size:10pt;color:black;background:white;">
<pre style="margin:0;"><span style="color:#2b91af;">   21</span> [<span style="color:#2b91af;">SuppressMessage</span>( <span style="color:#a31515;">"Microsoft.Naming"</span>, <span style="color:#a31515;">"CA1709:IdentifiersShouldBeCasedCorrectly"</span>,</pre>
<pre style="margin:0;"><span style="color:#2b91af;">   22</span>                   MessageId = <span style="color:#a31515;">"WIDTH"</span>, Justification=<span style="color:#a31515;">"Coding conventions"</span> )]</pre>
</div>
</blockquote>
<p>FxCop is integrated in the team edition of Visual Studio but not in the free or professional edition.</p>
<p>In order to get this attribute to work, the <strong>CODE_ANALYSIS</strong> symbol must be defined during the compilation of the assembly. Without this, FxCop will ignore the violations exclusions defined in the source code.</p>
<p>For batch run (or MS Build integration), you can use the FxCopCmd utility. You can find <a href="http://blogs.msdn.com/fxcop/archive/2007/02/24/faq-how-do-i-run-fxcop-during-a-post-build-event.aspx">here</a> a tutorial on how to integrate FxCopCmd with MS Build.</p>
<h2>StyleCop</h2>
<p>StyleCop is a closely related tool as it does source code analysis but directly on C# code rather than on disassembled MS IL. It also provides a set of rules and can be run from within Visual Studio.</p>
<p>It can be downloaded (latest version) from <a href="http://blogs.msdn.com/sourceanalysis/">here</a>. You can find <a href="http://blogs.msdn.com/sourceanalysis/pages/source-analysis-msbuild-integration.aspx">here</a> a tutorial on how to integrate StyleCop within an MS Build project.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Code Analysis Future]]></title>
<link>http://rcosic.wordpress.com/2009/06/24/code-analysis-future/</link>
<pubDate>Wed, 24 Jun 2009 05:58:20 +0000</pubDate>
<dc:creator>rcosic</dc:creator>
<guid>http://rcosic.wordpress.com/2009/06/24/code-analysis-future/</guid>
<description><![CDATA[Hm, I must say, I&#8217;m little bit disappointed regarding code analysis lately. Currently, there i]]></description>
<content:encoded><![CDATA[Hm, I must say, I&#8217;m little bit disappointed regarding code analysis lately. Currently, there i]]></content:encoded>
</item>
<item>
<title><![CDATA[A guide through the swamp - The CrapMap]]></title>
<link>http://schneide.wordpress.com/2009/06/15/a-guide-through-the-swamp-the-crapmap/</link>
<pubDate>Mon, 15 Jun 2009 09:05:25 +0000</pubDate>
<dc:creator>daniel.lindner</dc:creator>
<guid>http://schneide.wordpress.com/2009/06/15/a-guide-through-the-swamp-the-crapmap/</guid>
<description><![CDATA[One of the most useful metrics to us in the Softwareschneiderei is &#8220;CRAP&#8221;. For java, it ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>One of the most useful metrics to us in the <a href="http://www.softwareschneiderei.de" target="_blank">Softwareschneiderei</a> is &#8220;CRAP&#8221;. For java, it is calculated by the <a href="http://www.crap4j.org" target="_blank">Crap4J tool</a> and provided as an <a href="http://www.crap4j.org/images/crap4jreport_detail.png" target="_blank">HTML report</a>. The report gives you a rough idea whats going on in your project, but to really know what&#8217;s up, you need to look closer.</p>
<p><strong>A closer look on crap</strong></p>
<p>The Crap4J tool spits out lots of numbers, especially for larger projects. But from these numbers, you can&#8217;t easily tell some important questions like:</p>
<ul>
<li>Are there regions (packages, classes) with lots more crap than others?</li>
<li>What are those regions?</li>
</ul>
<p>So we thought about the problem and found it to be solvable by data visualization.</p>
<p><strong>Enter CrapMap</strong></p>
<p>If you need to use advanced data visualization techniques, there is a very helpful project called <a href="http://prefuse.org/" target="_blank">prefuse</a> (which has a <a href="http://schneide.wordpress.com/2009/03/23/visualizations-with-flareprefuse/" target="_blank">successor named flare</a> for web applications). It provides an exhaustive API to <a href="http://prefuse.org/gallery/" target="_blank">visualize nearly everything</a> the way you want to. We wanted our crap statistics drawn in a <a href="http://prefuse.org/gallery/treemap/" target="_blank">treemap</a>. A treemap is a bunch of boxes, crammed together by a clever layouting strategy, each one representing data, for example by its size or color.</p>
<p>The CrapMap is a treemap where every box represents a method. The size gives you a hint of the method&#8217;s complexity, the color indicates its crappyness. Method boxes reside inside their classes&#8217; boxes which reside in package boxes. That way, the treemap represents your code structure.</p>
<p><strong>A picture worth a thousand numbers</strong></p>
<p style="text-align:center;"><a href="http://schneide.wordpress.com/files/2009/04/crapmap1.png"><img class="aligncenter size-medium wp-image-649" title="crapmap1" src="http://schneide.wordpress.com/files/2009/04/crapmap1.png?w=280" alt="crapmap1" width="450" height="480" /></a></p>
<p>This is a screenshot of the CrapMap in action. You see a medium sized project with few crap methods (less than one percent). Each red rectangle is a crappy method, each green one is an acceptable method regarding its complexity.</p>
<p><strong>Adding interaction</strong></p>
<p>You can quickly identify your biggest problem (in terms of complexity) by selecting it with your mouse. All necessary data about this method is shown in the bottom section of the window. The overall data of the project is shown in the top section.</p>
<p>If you want to answer some more obscure questions about your methods, try the search box in the lower right corner. The CrapMap comes with a search engine using your methods&#8217; names.</p>
<p><strong>Using CrapMap on your project</strong></p>
<p>CrapMap is a java swing application, meant for desktop usage. To visualize your own project, you need the report.xml data file of it from Crap4J. Start the CrapMap application and load the report.xml using the &#8220;open file&#8221; dialog that shows up. That&#8217;s all.</p>
<p>In the near future, CrapMap will be hosted on <a href="http://www.dev.java.net/" target="_blank">dev.java.net</a> (<a href="https://crapmap.dev.java.net/" target="_blank">crapmap.dev.java.net</a>). Right now, it&#8217;s only available as a <a href="http://www.softwareschneiderei.de/download/public/crapmap-20090426.zip" target="_blank">binary executable from our download server</a> (1MB download size). When you unzip the archive, double-click the crapmap.jar to start the application. CrapMap requires <a href="http://java.sun.com/javase/" target="_blank">Java6</a> to be installed.</p>
<p><strong>Show your project</strong></p>
<p>We would be pleased to see your CrapMap. Make a screenshot, upload it and leave a comment containing the link to the image.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Framework Design Guidelines]]></title>
<link>http://rcosic.wordpress.com/2009/04/30/design-guidelines-well-designed-framework/</link>
<pubDate>Thu, 30 Apr 2009 16:48:14 +0000</pubDate>
<dc:creator>rcosic</dc:creator>
<guid>http://rcosic.wordpress.com/2009/04/30/design-guidelines-well-designed-framework/</guid>
<description><![CDATA[In era of WPF, Silverlight, Sharepoint and Dynamics technologies, not to mention new Azure platform,]]></description>
<content:encoded><![CDATA[In era of WPF, Silverlight, Sharepoint and Dynamics technologies, not to mention new Azure platform,]]></content:encoded>
</item>
<item>
<title><![CDATA[Easy code inspection using QDox]]></title>
<link>http://schneide.wordpress.com/2009/04/20/easy-code-inspection-using-qdox/</link>
<pubDate>Mon, 20 Apr 2009 07:00:38 +0000</pubDate>
<dc:creator>daniel.lindner</dc:creator>
<guid>http://schneide.wordpress.com/2009/04/20/easy-code-inspection-using-qdox/</guid>
<description><![CDATA[So, you&#8217;ve inspected your Java code in any possible way, using Findbugs, Checkstyle, PMD, Crap]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://schneide.wordpress.com/files/2009/04/qdox-man.jpg"><img class="alignleft size-full wp-image-608" style="margin:10px;" title="Copyright by http://www.clipartof.com/" src="http://schneide.wordpress.com/files/2009/04/qdox-man.jpg" alt="Copyright by http://www.clipartof.com/" width="187" height="200" /></a>So, you&#8217;ve inspected your Java code in any possible way, using <a href="http://findbugs.sourceforge.net/" target="_blank">Findbugs</a>, <a href="http://checkstyle.sourceforge.net/" target="_blank">Checkstyle</a>, <a href="http://pmd.sourceforge.net/" target="_blank">PMD</a>, <a href="http://www.crap4j.org/" target="_blank">Crap4J</a> and many <a href="http://www.hammurapi.biz/hammurapi-biz/ef/xmenu/hammurapi-group/products/hammurapi/index.html" target="_blank">other</a> <a href="http://clarkware.com/software/JDepend.html" target="_blank">tools</a>. You know every number by heart and keep a sharp eye on its trend. But what about some simple questions you might ask yourself about your project, like:</p>
<ul>
<li>How many instance variables aren&#8217;t final?</li>
<li>Are there any setXYZ()-methods without any parameter?</li>
<li>Which classes have more than one constructor?</li>
</ul>
<p>Each of this question isn&#8217;t of much relevance to the project, but its answer might be crucial in one specific situation.</p>
<p><strong>Using QDox for throw-away tooling</strong></p>
<p><strong><a href="http://qdox.codehaus.org/index.html" target="_blank">QDox</a></strong> is a fine little project making steady progress in being a very intuitive Java code structure inspection API. It&#8217;s got a footprint of just one JAR (less than 200k) you need to add to your project and one class you need to remember as a starting point. Everything else can be learnt on the fly, using the code completion feature of your favorite IDE.</p>
<p>Let&#8217;s answer the first question of our list by printing out all the names of all instance variables that aren&#8217;t final. I&#8217;m assuming you call this class in your project&#8217;s root directory.</p>
<blockquote>
<pre>public class NonFinalFinder {
    public static void main(String[] args) {
         File sourceFolder = new File(".");
         JavaDocBuilder parser = new JavaDocBuilder();
         builder.addSourceTree(sourceFolder);
         JavaClass[] javaClasses = parser.getClasses();
         for (JavaClass javaClass : javaClasses) {
             JavaField[] fields = javaClass.getFields();
             for (JavaField javaField : fields) {
                 if (!javaField.isFinal()) {
                     System.out.println("Field "
                       + javaField.getName()
                       + " of class "
                       + javaClass.getFullyQualifiedName()
                       + " is not final.");
                }
            }
        }
    }
}</pre>
</blockquote>
<p>The QDox parser is called <code>JavaDocBuilder</code> for historical reasons. It takes a directory through <code>addSourceTree()</code> and parses all the java files it finds in there recursively. That&#8217;s all you need to program to gain access to your code structure.</p>
<p>In our example, we descend into the code hierarchy using the <code>parser.getClasses()</code> method. From the <code>JavaClass</code> objects, we retrieve their <code>JavaFields</code> and ask each one if it&#8217;s final, printing out its name otherwise.</p>
<p><strong>Praising QDox</strong></p>
<p>The code needed to answer our example question is seven lines in essence. Once you navigate through your code structure, the QDox API is self-explanatory. You only need to remember the first two lines of code to get started.</p>
<p>The QDox project had a long quiet period in the past while making the jump to the Java 5 language spec. Today, it&#8217;s a very active project published under the Apache 2.0 license. The developers add features nearly every day, making it a perfect choice for your next five-minute throw-away tool.</p>
<p><strong>What&#8217;s your tool idea?</strong></p>
<p>Tell me about your code specific aspect you always wanted to know. What would an implementation using QDox look like?</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Following Flow Dependences with Metasm]]></title>
<link>http://indefinitestudies.org/2009/04/07/following-flow-dependences-with-metasm/</link>
<pubDate>Tue, 07 Apr 2009 15:43:19 +0000</pubDate>
<dc:creator>dan</dc:creator>
<guid>http://indefinitestudies.org/2009/04/07/following-flow-dependences-with-metasm/</guid>
<description><![CDATA[Metasm is an LGPL&#8217;ed assembly manipulation framework written in Ruby. It is capable of followi]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://metasm.cr0.org/">Metasm</a> is an LGPL&#8217;ed assembly manipulation framework written in Ruby. It is capable of following flow dependences along multiple paths, a feature called <em>backtracking</em> in metasm jargon and close to the notion of <a href="http://en.wikipedia.org/wiki/Program_slicing">program slicing</a> [wikipedia.org].</p>
<p><span style="text-decoration:underline;">Definition</span>: a node j is <strong>flow-dependent</strong> on a node i if (1) a variable x is referenced at j, (2) x is defined at i and (3) there exists a path from i to j without intervening definitions of x. <a href="http://www.research.ibm.com/people/t/tip/papers/jpl1995.pdf">Source</a> [research.ibm.com]</p>
<p>We are going to use the following ruby script to test the backtracker with different source programs, it takes as input a program (sourcecode), a node (labeled &#8217;sliceme&#8217;) and a variable (eax) and returns the flow-dependences of eax and in some cases, the actual values that eax will take.</p>
<pre style="padding-left:30px;">require 'metasm'
include Metasm

def sliceit(asmsource, label, reg)
    # encode the shellcode
    sc = Shellcode.assemble(Ia32.new, asmsource)
    dasm = sc.disassemble(0)

    # get the address of the label
    offset = sc.encoded.export[label]

    reg = reg.to_sym

    # backtrace
    log = []
    dasm.backtrace(reg, offset, :log =&#62; log)

    # return the trace
    log
end

sourcecode = &#60;&#60;EOS
; asm program here
EOS

slice = sliceit(sourcecode, 'sliceme', 'eax')
# slice est un tableau qui contient le log du backtrace
slice.each { &#124;ev, *args&#124;
    if ev == :di    # decodedinstruction
        after = args[0]
        before = args[1]
        instr = args[2]
        puts "#{instr} [#{before} -&#62; #{after}]"
    end#
}</pre>
<p>Let&#8217;s take some simple code samples. <strong>If there is a single execution path</strong>, metasm can compute the value contained in the variable, for instance:<a href="http://indefinitestudies.wordpress.com/files/2009/04/single.png"><img class="alignright size-full wp-image-280" title="single_path" src="http://indefinitestudies.wordpress.com/files/2009/04/single.png" alt="single_path" width="125" height="176" /></a></p>
<pre style="padding-left:30px;">mov eax, 42h
inc eax
sliceme: jmp eax

-&#62; metasm returns:
5 inc eax [eax -&#62; eax+1]
0 mov eax, 42h [eax+1 -&#62; 43h]</pre>
<p>We can see that useless definitions of the variable are not taken into account:</p>
<pre style="padding-left:30px;">mov eax, 0h
mov eax, 42h
inc eax
sliceme: jmp eax

-&#62; metasm returns:
0ah inc eax [eax -&#62; eax+1]
5 mov eax, 42h [eax+1 -&#62; 43h]</pre>
<p>Definitions of other variables are also ignored (if eax does not depend on them):</p>
<pre style="padding-left:30px;">mov eax, 42h
mov ebx, 0
sliceme: jmp eax

-&#62; metasm returns:
0 mov eax, 42h [eax -&#62; 42h]</pre>
<p>But they are included if eax depends on them:</p>
<pre style="padding-left:30px;">mov ebx, 1h
mov eax, 42h
add eax, ebx
sliceme: jmp eax

-&#62; metasm returns:
0ah add eax, ebx [eax -&#62; eax+ebx]
5 mov eax, 42h [eax+ebx -&#62; ebx+42h]
0 mov ebx, 1 [ebx+42h -&#62; 43h]</pre>
<p><strong>If there are multiple acyclic paths</strong>, metasm will be able to compute the value of the sliced variable along each path, for instance:<a href="http://indefinitestudies.wordpress.com/files/2009/04/multiple.png"><img class="alignright size-full wp-image-281" title="multiple" src="http://indefinitestudies.wordpress.com/files/2009/04/multiple.png" alt="multiple" width="216" height="208" /></a></p>
<pre style="padding-left:30px;">mov eax, 42h
cmp ebx, 0
jnz pouet
dec eax
jmp sliceme
pouet: inc eax
sliceme: jmp eax

-&#62; metasm returns:
0dh inc eax [eax -&#62; eax+1]
0 mov eax, 42h [eax+1 -&#62; 43h]
0ah dec eax [eax -&#62; eax-1]
0 mov eax, 42h [eax-1 -&#62; 41h]</pre>
<p>Metasm states that at the end, eax will be either 41h or 43h but it doesn&#8217;t know which one. It doesn&#8217;t state it explicitly, but the value of eax is <em>control-dependent</em> on ebx.</p>
<p>Finally in the worst case scenario, <strong>if there are cyclic paths</strong> (such as loops), metasm will go through each path once but will be unable to compute the value after the cycle. Note that in the general case, this is undecidable.<a href="http://indefinitestudies.wordpress.com/files/2009/04/cycle.png"><img class="alignright size-full wp-image-282" title="cycle" src="http://indefinitestudies.wordpress.com/files/2009/04/cycle.png" alt="cycle" width="244" height="208" /></a></p>
<pre>mov eax, 0
entry: cmp ebx, 0
jnz sliceme

dec ebx
inc eax
jmp entry

sliceme: jmp eax

-&#62; metasm returns:
0bh inc eax [eax -&#62; eax+1]
0 mov eax, entrypoint_0 [eax -&#62; 0]</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Code Analysis in Visual Studio 2010]]></title>
<link>http://rcosic.wordpress.com/2009/04/06/code-analysis-in-visual-studio-2010/</link>
<pubDate>Mon, 06 Apr 2009 18:15:52 +0000</pubDate>
<dc:creator>rcosic</dc:creator>
<guid>http://rcosic.wordpress.com/2009/04/06/code-analysis-in-visual-studio-2010/</guid>
<description><![CDATA[What&#8217;s new in terms of Code Analysis in Visual Studio 2010 Team Edition (codename Rosario)? Yo]]></description>
<content:encoded><![CDATA[What&#8217;s new in terms of Code Analysis in Visual Studio 2010 Team Edition (codename Rosario)? Yo]]></content:encoded>
</item>
<item>
<title><![CDATA[A Quick Survey on Intermediate Representations for Program Analysis]]></title>
<link>http://indefinitestudies.org/2009/04/03/a-quick-survey-on-intermediate-representations-for-program-analysis/</link>
<pubDate>Fri, 03 Apr 2009 17:45:52 +0000</pubDate>
<dc:creator>dan</dc:creator>
<guid>http://indefinitestudies.org/2009/04/03/a-quick-survey-on-intermediate-representations-for-program-analysis/</guid>
<description><![CDATA[This is mostly a note to myself, but I guess people interested in automating reverse engineering wil]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This is mostly a note to myself, but I guess people interested in automating reverse engineering will be interested at some point in IR suitable for low-level abstractions. I consider top-down IR used by optimizing compilers and bottom-up IR used by decompilers and other reversing tools.</p>
<p><span style="color:#000000;"><strong><span style="text-decoration:underline;">Intermediate Representations for Reverse Engineering </span></strong></span></p>
<p><strong>REIL. </strong>Used in <a href="http://www.zynamics.com/index.php?page=binnavi">BinNavi</a>, the Reverse Engineering Intermediate Language defines a very simple <a href="http://en.wikipedia.org/wiki/RISC">RISC</a> architecture (17 instructions), with the nice property that each instruction has at most one side-effect. Thomas Dullien and Sebastian Porst recently presented at CanSecWest an abstract interpretation framework for REIL (<a href="http://zynamics.com/downloads/csw09.pdf">paper</a>, <a href="http://zynamics.com/downloads/csw09-slides.pdf">slides</a>). It is clearly possible to easily write analyses and transformation passes for REIL without getting into the complexity of the whole x86 architecture, given x86 -&#62; REIL and REIL -&#62; x86 translators.</p>
<p>Here are some sample REIL instructions :</p>
<pre>1006E4B00: str edi, , edi
1006E4D00: sub esp, 4, esp
1006E4D01: and esp, 4294967295, esp
1006E4D02: stm ebp, , esp</pre>
<p><a href="http://www.zynamics.com/BinNavi/manual/html/reil.htm">Language Reference</a></p>
<p><strong>Hex Rays Microcode. </strong>Presented at Black Hat USA 2008 by Ilfak Guilfanov (<a href="http://www.hex-rays.com/idapro/ppt/decompilers_and_beyond_white_paper.pdf">paper</a>, <a href="http://www.hex-rays.com/idapro/ppt/decompilers_and_beyond.ppt">slides</a>), it is an IR used during decompilation. From the paper: <em>&#8220;The microcode language is very detailed and precisely represents how each instruction modifies the memory, registers, and processor condition codes. Typically one CPU instruction is converted into 5-15 microinstructions&#8221;. </em>According to the REIL paper, REIL and the microcode language are significantly different, for instance the microinstructions can have a variable number of operands and perform multiple side effects.</p>
<p>Sample microcode:</p>
<pre>mov esi.4, eoff.4
mov ds.2, seg.2
add eoff.4, #4.4, eoff.4
ldx seg.2, eoff.4, et1.4
mov et1.4, eax.4</pre>
<p>I couldn&#8217;t find the language reference.</p>
<p><strong>ELIR. </strong>Part of the <a href="http://www.eresi-project.org/">ERESI project</a>, the goal of ELIR is to simplify static analysis by providing a platform independent abstraction. An overview was presented at <a href="http://www.eresi-project.org/attachment/wiki/WikiStart/EKO2008_ERESI_slides.pdf">Ekoparty08</a> (slides) and some ideas appeared in <a href="http://www.phrack.com/issues.html?issue=64&#38;id=8#article">Phrack 64</a>, but 30s of Googling didn&#8217;t get me to the language reference or a code sample, so that&#8217;s all I will say about ELIR for the moment.</p>
<p><strong>Pin Inspection API</strong><strong>. </strong>PIN, Intel&#8217;s Dynamic Binary Instrumentation framework provides a very handy instruction inspection API. This is not an IR but provides the same type of information about complex instructions without having to make giant switch statements. For instance, this is the way to log memory writes with PIN given an instruction:</p>
<pre>VOID RecordMemWrite(VOID * addr, UINT32 size) {
    fprintf(trace,",%dW%p", size, addr);
}

// this function is called each time an instruction is encountered
VOID Instruction(INS ins, VOID *v) {
    // isn't that a nice API ?
    if (WRITES &#38;&#38; INS_IsMemoryWrite(ins)) {
        INS_InsertPredicatedCall(
            ins, IPOINT_BEFORE, (AFUNPTR)RecordMemWrite,
            IARG_MEMORYWRITE_EA,
            IARG_MEMORYWRITE_SIZE,
            IARG_END);
    }
}</pre>
<p><a href="http://www.pintool.org/docs/24110/Pin/html/group__INS__BASIC__API__GEN__IA32.html">API Documentation</a></p>
<p><strong>Valgrind IR. </strong>On my todo list.</p>
<p><strong>FermaT Transformation System. </strong>I&#8217;ll have to write something about it someday. Oh lucky you, a <a href="http://en.wikipedia.org/wiki/FermaT_Transformation_System">wikipedia entry</a> and a <a href="http://www.cse.dmu.ac.uk/~mward/martin/papers/index.html">bunch of papers</a>!</p>
<p><strong><span style="text-decoration:underline;">Optimizing Compilers Intermediate Representations</span></strong></p>
<p><strong>LLVM Bitcode. </strong>This language uses low-level <a href="http://en.wikipedia.org/wiki/RISC">RISC</a>-like instructions in <a href="http://en.wikipedia.org/wiki/Static_single_assignment_form">SSA</a> form with type information. It is clean and well defined, and is a very suitable target for platform-independent analysis and optimization. It is designed to convey high-level information in lower level operations, so converting machine code to LLVM bitcode probably requires some intensive work.</p>
<p>Here is the hello world example :</p>
<pre><em>; Declare the string constant as a global constant...</em>
<a href="http://llvm.org/docs/LangRef.html#identifiers">@.LC0</a> = <a href="http://llvm.org/docs/LangRef.html#linkage_internal">internal</a> <a href="http://llvm.org/docs/LangRef.html#globalvars">constant</a> <a href="http://llvm.org/docs/LangRef.html#t_array">[13 x i8]</a> c"hello worldA0"          

<em>; External declaration of the puts function</em>
<a href="http://llvm.org/docs/LangRef.html#functionstructure">declare</a> i32 @puts(i8 *)                                           

<em>; Definition of main function</em>
define i32 @main() {
        <em>; Convert [13 x i8]* to i8  *...</em>
        %cast210 = <a href="http://llvm.org/docs/LangRef.html#i_getelementptr">getelementptr</a> [13 x i8]* @.LC0, i64 0, i64 0 <em>; i8 *</em>

        <em>; Call puts function to write out the string to stdout...</em>
        <a href="http://llvm.org/docs/LangRef.html#i_call">call</a> i32 @puts(i8 * %cast210)
        <a href="http://llvm.org/docs/LangRef.html#i_ret">ret</a> i32 0
}</pre>
<p><a href="http://llvm.org/docs/LangRef.html">Language reference</a></p>
<p><strong>Register Transfer Language. </strong>One of the IR used in GCC, it is an architecture-neutral assembly language that represents instructions in a LISP-like form (d&#8217;oh), like this:</p>
<pre>(insn 2 49 3 test.c:3 (set (mem/c/i:SI (plus:DI (reg/f:DI 6 bp)
                (const_int -20 [0xffffffffffffffec])) [0 argc+0 S4 A32])
        (reg:SI 5 di [ argc ])) 47 {*movsi_1} (nil))</pre>
<p>It feels a bit old-fashioned and less clean than LLVM bitcode, but this is just a gut feeling. Use gcc -fdump-rtl-all to see what it looks like.</p>
<p>Side note: the idea of dumping RTL to a file, performing transformations on it and giving this back to GCC is quite common, but RMS qualifies it as <a href="http://gcc.gnu.org/onlinedocs/gccint/Reading-RTL.html">&#8220;not feasible&#8221;</a>, even though the <a href="http://portal.acm.org/citation.cfm?id=989407">creator of RTL</a> says <a href="http://compilers.iecc.com/comparch/article/93-10-113">it is not only feasible but quite useful actually</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[.NET Framework Design Guidelines - a headstone of Code Analysis]]></title>
<link>http://rcosic.wordpress.com/2009/04/01/net-framework-design-guidelines-a-headstone-of-code-analysis/</link>
<pubDate>Wed, 01 Apr 2009 07:42:36 +0000</pubDate>
<dc:creator>rcosic</dc:creator>
<guid>http://rcosic.wordpress.com/2009/04/01/net-framework-design-guidelines-a-headstone-of-code-analysis/</guid>
<description><![CDATA[Now that I&#8217;ve wrote almost everything to give you an overview of Code Analysis in Visual Studi]]></description>
<content:encoded><![CDATA[Now that I&#8217;ve wrote almost everything to give you an overview of Code Analysis in Visual Studi]]></content:encoded>
</item>
<item>
<title><![CDATA[Code Analysis in Visual Studio 2008]]></title>
<link>http://rcosic.wordpress.com/2009/03/28/code-analysis-in-visual-studio-2008-rules-of-engagement/</link>
<pubDate>Sat, 28 Mar 2009 08:16:24 +0000</pubDate>
<dc:creator>rcosic</dc:creator>
<guid>http://rcosic.wordpress.com/2009/03/28/code-analysis-in-visual-studio-2008-rules-of-engagement/</guid>
<description><![CDATA[This time, I will write something about what new CA rules or modifications Visual Studio 2008 brings]]></description>
<content:encoded><![CDATA[This time, I will write something about what new CA rules or modifications Visual Studio 2008 brings]]></content:encoded>
</item>
<item>
<title><![CDATA[Integrating Code Analysis with Team System in Visual Studio 2008]]></title>
<link>http://rcosic.wordpress.com/2009/03/25/integrating-code-analysis-with-team-system-in-visual-studio-2008/</link>
<pubDate>Wed, 25 Mar 2009 20:00:16 +0000</pubDate>
<dc:creator>rcosic</dc:creator>
<guid>http://rcosic.wordpress.com/2009/03/25/integrating-code-analysis-with-team-system-in-visual-studio-2008/</guid>
<description><![CDATA[This is the continuation of my last post regarding Code Analysis features in Visual Studio 2008 (Tea]]></description>
<content:encoded><![CDATA[This is the continuation of my last post regarding Code Analysis features in Visual Studio 2008 (Tea]]></content:encoded>
</item>
<item>
<title><![CDATA[Code Analysis in Visual Studio 2008 (new features)]]></title>
<link>http://rcosic.wordpress.com/2009/03/24/new-features-of-code-analysis-in-visual-studio-2008/</link>
<pubDate>Tue, 24 Mar 2009 10:33:53 +0000</pubDate>
<dc:creator>rcosic</dc:creator>
<guid>http://rcosic.wordpress.com/2009/03/24/new-features-of-code-analysis-in-visual-studio-2008/</guid>
<description><![CDATA[*I should clarify from the start that the Code Analysis is available only in the Team System edition]]></description>
<content:encoded><![CDATA[*I should clarify from the start that the Code Analysis is available only in the Team System edition]]></content:encoded>
</item>
<item>
<title><![CDATA[More on SWFScan]]></title>
<link>http://thejlog.wordpress.com/2009/03/23/more-on-swfscan/</link>
<pubDate>Mon, 23 Mar 2009 15:54:13 +0000</pubDate>
<dc:creator>apcig</dc:creator>
<guid>http://thejlog.wordpress.com/2009/03/23/more-on-swfscan/</guid>
<description><![CDATA[In SWF Scan 1.0, go to Settings / Checks tab to find what this program actually checks for. The list]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>In SWF Scan 1.0, go to Settings / Checks tab to find what this program actually checks for.</p>
<p>The list comes up, with sortable fields of <strong>Enabled</strong>, <strong>Check Name</strong>, and <strong>Severity</strong>.</p>
<p>I sorted by <strong>Severity</strong>, to find the worst offenders.  Highest on the list is <strong>Critical</strong>, which includes such no-no&#8217;s as</p>
<ul>
<li>Application Source Available</li>
<li>Possible Credit Card Number Disclosure</li>
<li>Insecure Security.allowInsecureDomain() usage</li>
<li>Insecure LocalConnection.allowDomain() usage</li>
<li>Insecure Security.allowDomain() usage</li>
<li>Insecure LocalConnection.allowInsecureDomain() usage</li>
</ul>
<p>These are heavyweight problems to be sitting in source code, and the list then goes on to <strong>High </strong>where some notable items are Possible Social Security Number, Possible Database Connection String to various db vendors to ENABLEDEBUGGER Tag Detected.</p>
<p>Going down the <strong>Severity </strong>category list is <strong>Medium</strong>, <strong>Low</strong>, <strong>Info </strong>and <strong>BestPractice</strong>.</p>
<p>This can be a very useful tool to find potential gotchas that could potentially slip through the cracks, but no one should hardcoding connection strings on a regular basis.  I&#8217;d like to say it&#8217;s scary, but I guess it happens.</p>
<p>Update: InSideRIA article about <a href="http://www.insideria.com/2009/03/swfscan---first-look.html">SWFScan</a></p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
