Exploitable Crashes

  • Revision slug: Exploitable_Crashes
  • Revision title: Exploitable Crashes
  • Revision id: 334553
  • Created:
  • Creator: joshmoz
  • Is current revision? No
  • Comment

Revision Content

 

What is an Exploitable Crash?

A crash report from your debugger, your OS, or Mozilla crash-stats can tell you a lot about whether or not a crash is exploitable. You want to look primarily for three things, in order:

  1. Look at the top frame of the stack trace. If you see a hex address such as 0x292c2830 rather than a function name such as nsListBoxBodyFrame::GetRowCount at the top of the stack, a bug has caused the program to transfer control to a "random" part of memory that isn't part of the program. These crashes are almost always exploitable to run arbitrary code.
  2. Look at the crash reason, which will usually be something like "KERN_PROTECTION_FAILURE (0x0002) at 0x00000000". This is typically located right above the stack trace. The last number, in this case 0x00000000, is the memory address Firefox was prevented from accessing. If the address is always zero (or close to zero, such as 0x0000001c), it's probably a null dereference bug. These bugs cause the browser to crash, but they do so in a predictable way, so they are not exploitable. Most crashes fall into this category.
  3. Check the length of the stack trace. If it's over 300 functions long, it's likely to be a too-much-recursion crash. Like null dereferences, these crashes are not exploitable.

Any other crash where Firefox tries to use memory it does not have access to indicates some kind of memory safety bug. These crashes can often be exploited to run arbitrary code, but you can't be as certain as in the case where you see a bogus address at the top of the stack in step 1.

Finding Exploitable Crashes

Exploitable crashes are most often discovered through normal testing and usage, when developers recognize a crash stack in gdb or submitted to a bug as exploitable.

Additionally, Mozilla developers make heavy use of two tools in particular to find exploitable situations before they show up as exploitable crash reports.

The first tool is AddressSanitizer (ASAN). There is an MDN article documenting its use with Mozilla projects here.

The other tool is Valgrind. There is an MDN article documenting its use with Mozilla projects here.

Once You've Determined a Crash is Exploitable

Once you've determined that a crash is exploitable, take the following steps. If you need help with any of the steps (e.g. perhaps you lack necessary bugzilla priviledges) please email security@mozilla.org.

  1. Make sure a bug is on file.
  2. Mark the bug as security-sensitive by putting it into the "Security-Sensitive Core Bug" group. Do this before making comments or taking actions that expose exploitability publicly.
  3. Put a security severity rating in the bug's keywords. If you're not sure what rating to give, err on the higher side so the bug will get more attention.
  4. Explain in a comment why the issue seems exploitable.

Other Tools

Apple has a tool called "crashwrangler" that are still being maintained as of 2012. There is little public information about it, and it is hard to find even on the Apple developer site. To get them go to the Mac Developer Center downloads section -> Other Downloads -> search for "crashwrangler".

Microsoft released a debugger extension tool in 2009 called "!exploitable". It hasn't been updated since 2009.

Other References

Revision Source

<p>&nbsp;</p>
<h2 id="What_is_an_Exploitable_Crash.3F">What is an Exploitable Crash?</h2>
<p>A crash report from your debugger, your OS, or <a href="https://crash-stats.mozilla.com/" title="https://crash-stats.mozilla.com/">Mozilla crash-stats</a> can tell you a lot about whether or not a crash is exploitable. You want to look primarily for three things, in order:</p>
<ol>
  <li>Look at the <strong>top frame of the stack trace</strong>. If you see a hex address such as 0x292c2830 rather than a function name such as nsListBoxBodyFrame::GetRowCount at the top of the stack, a bug has caused the program to transfer control to a "random" part of memory that isn't part of the program. These crashes are almost always exploitable to run arbitrary code.</li>
  <li>Look at the crash reason, which will usually be something like "KERN_PROTECTION_FAILURE (0x0002) at 0x00000000". This is typically located right above the stack trace. The last number, in this case 0x00000000, is <strong>the memory address Firefox was prevented from accessing</strong>. If the address is always zero (or close to zero, such as 0x0000001c), it's probably a null dereference bug. These bugs cause the browser to crash, but they do so in a predictable way, so they are not exploitable. Most crashes fall into this category.</li>
  <li>Check the <strong>length of the stack trace</strong>. If it's over 300 functions long, it's likely to be a too-much-recursion crash. Like null dereferences, these crashes are not exploitable.</li>
</ol>
<p>Any other crash where Firefox tries to use memory it does not have access to indicates some kind of memory safety bug. These crashes can often be exploited to run arbitrary code, but you can't be as certain as in the case where you see a bogus address at the top of the stack in step 1.</p>
<h2 id="Finding_Exploitable_Crashes">Finding Exploitable Crashes</h2>
<p>Exploitable crashes are most often discovered through normal testing and usage, when developers recognize a crash stack in gdb or submitted to a bug as exploitable.</p>
<p>Additionally, Mozilla developers make heavy use of two tools in particular to find exploitable situations before they show up as exploitable crash reports.</p>
<p>The first tool is <a href="http://www.chromium.org/developers/testing/addresssanitizer" title="http://www.chromium.org/developers/testing/addresssanitizer">AddressSanitizer (ASAN)</a>. There is an MDN article documenting its use with Mozilla projects <a href="https://developer.mozilla.org/en-US/docs/Building_Firefox_with_Address_Sanitizer" title="https://developer.mozilla.org/en-US/docs/Building_Firefox_with_Address_Sanitizer">here</a>.</p>
<p>The other tool is <a href="http://valgrind.org/" title="http://valgrind.org/">Valgrind</a>. There is an MDN article documenting its use with Mozilla projects <a href="https://developer.mozilla.org/en-US/docs/Debugging_Mozilla_with_Valgrind" title="https://developer.mozilla.org/en-US/docs/Debugging_Mozilla_with_Valgrind">here</a>.</p>
<h2 id="Once_You've_Determined_a_Crash_is_Exploitable">Once You've Determined a Crash is Exploitable</h2>
<p>Once you've determined that a crash is exploitable, take the following steps. If you need help with any of the steps (e.g. perhaps you lack necessary bugzilla priviledges) please email <a href="mailto:security@mozilla.org" title="mailto:security@mozilla.org">security@mozilla.org</a><strong>.</strong></p>
<ol>
  <li>Make sure a bug is on file.</li>
  <li>Mark the bug as security-sensitive by putting it into the "Security-Sensitive Core Bug" group. Do this before making comments or taking actions that expose exploitability publicly.</li>
  <li>Put a <a href="https://wiki.mozilla.org/Security_Severity_Ratings" title="Security Severity Rating">security severity rating</a> in the bug's keywords. If you're not sure what rating to give, err on the higher side so the bug will get more attention.</li>
  <li>Explain in a comment why the issue seems exploitable.</li>
</ol>
<h2 id="Other_Tools">Other Tools</h2>
<p>Apple has a tool called "crashwrangler" that are still being maintained as of 2012. There is little public information about it, and it is hard to find even on the Apple developer site. To get them go to the Mac Developer Center downloads section -&gt; Other Downloads -&gt; search for "crashwrangler".</p>
<p>Microsoft released a debugger extension tool in 2009 called "!exploitable". It hasn't been updated since 2009.</p>
<h2 id="Other_References">Other References</h2>
<ul>
  <li><a class="external" href="http://www.squarefree.com/2006/11/02/determining-whether-a-crash-looks-exploitable/" title="http://www.squarefree.com/2006/11/02/determining-whether-a-crash-looks-exploitable/">Jesse Ruderman's 2006 blog post on exploitability</a>. This post provided much material for this article.</li>
</ul>
Revert to this revision