<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Samuel Hopstock</title>
    <description>The latest articles on DEV Community by Samuel Hopstock (@masrepus).</description>
    <link>https://dev.to/masrepus</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F390737%2F9a9ec582-80c9-4d41-92bb-620b0140c25f.jpeg</url>
      <title>DEV Community: Samuel Hopstock</title>
      <link>https://dev.to/masrepus</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/masrepus"/>
    <language>en</language>
    <item>
      <title>Bachelor Project: Un{i}packer</title>
      <dc:creator>Samuel Hopstock</dc:creator>
      <pubDate>Wed, 20 May 2020 14:22:51 +0000</pubDate>
      <link>https://dev.to/masrepus/bachelor-project-un-i-packer-44lf</link>
      <guid>https://dev.to/masrepus/bachelor-project-un-i-packer-44lf</guid>
      <description>&lt;h2&gt;
  
  
  Our Project
&lt;/h2&gt;

&lt;p&gt;My partner and I started this project as part of our Bachelor lab course "Honeynets &amp;amp; Malware Forensics". Un{i}packer is a tool for debugging and deobfuscating x86 Windows malware on any platform, including Linux, by using binary emulation. Typically, malware is obfuscated by using so-called packers: The actual code to be executed is compressed and encrypted and stored as a large data blob inside the binary. Only a stub is left that is then used to unpack the malicious code when the binary is executed. Un{i}packer can automatically unpack a variety of different packers and dump the program as a Windows binary, which can then be statically analyzed by the reverse engineer. Any API imports that were intended to be hidden and headers of the binary are fixed, so it could be executed normally on any Windows machine, if desired.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo Link
&lt;/h2&gt;

&lt;p&gt;See Un{i}packer in action as part of the lecture "Malware Analysis and Cyber Threat Intelligence" by a German university:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/ee5_JUIEf8Q"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vWogaON8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-28d89282e0daa1e2496205e2f218a44c755b0dd6536bbadf5ed5a44a7ca54716.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/unipacker"&gt;
        unipacker
      &lt;/a&gt; / &lt;a href="https://github.com/unipacker/unipacker"&gt;
        unipacker
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Automatic and platform-independent unpacker for Windows binaries based on emulation
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;pre&gt;&lt;code&gt; _   _         __  _  __                    _
| | | |       / / (_) \ \                  | |
| | | |_ __  | |   _   | | _ __   __ _  ___| | _____ _ __
| | | | '_ \/ /   | |   \ \ '_ \ / _` |/ __| |/ / _ \ '__|
| |_| | | | \ \   | |   / / |_) | (_| | (__|   &amp;lt;  __/ |
 \___/|_| |_|| |  |_|  | || .__/ \__,_|\___|_|\_\___|_|
              \_\     /_/ | |
                          |_|
&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;
Un{i}packer   &lt;a href="https://pypi.org/project/unipacker/" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/f6b8e66feda36f3508df42839d6d85a612aeb861/68747470733a2f2f62616467652e667572792e696f2f70792f756e697061636b65722e737667" alt="PyPI: unipacker"&gt;&lt;/a&gt; &lt;a href="https://hub.docker.com/r/vfsrfs/unipacker" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/414b5997d986cc264b2ee015efaa8a045dbb7b3f/68747470733a2f2f696d672e736869656c64732e696f2f646f636b65722f636c6f75642f6275696c642f7666737266732f756e697061636b65722e737667" alt="Docker Cloud Build Status"&gt;&lt;/a&gt;
&lt;/h1&gt;
&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Master&lt;/td&gt;
&lt;td&gt;&lt;a href="https://travis-ci.org/unipacker/unipacker" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/4ec76aa449fec552690113f6f2c0bafe6a0fb26f/68747470733a2f2f7472617669732d63692e6f72672f756e697061636b65722f756e697061636b65722e7376673f6272616e63683d6d6173746572" alt="Build Status"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dev&lt;/td&gt;
&lt;td&gt;&lt;a href="https://travis-ci.org/unipacker/unipacker" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/93b95c4404a340a29e9c399dabf5abe8e8c3c5b6/68747470733a2f2f7472617669732d63692e6f72672f756e697061636b65722f756e697061636b65722e7376673f6272616e63683d646576" alt="Build Status"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
Unpacking PE files using Unicorn Engine&lt;/h2&gt;
&lt;p&gt;The usage of runtime packers by malware authors is very common, as it is a technique that helps to hinder analysis
Furthermore, packers are a challenge for antivirus products, as they make it impossible to identify malware by signatures
or hashes alone.&lt;/p&gt;
&lt;p&gt;In order to be able to analyze a packed…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/unipacker/unipacker"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  How We built it (what's the stack? did we run into issues or discover something new along the way?)
&lt;/h2&gt;

&lt;p&gt;Our unpacking framework is written in Python and uses Unicorn Engine, a CPU emulator. We load the PE file (.exe) using the pefile Python library, perform additional memory patching in order to be able to hook into calls to the Windows API that of course is not available out of the box. Any API call needs to be intercepted by us, any necessary steps executed and then we need to give back control to the malware itself, pretending the call was executed as expected.&lt;/p&gt;

&lt;p&gt;Execution can be controlled by the user as they wish. For this purpose we provide a debugger shell interface based on cmd2, where the user can set breakpoints, step through the code, inspect and manipulate registers or memory contents. If desired, the current state can be dumped back to an exe file for further analysis.&lt;/p&gt;

&lt;p&gt;Automatic unpacking steps can be taken as well. Using Yara we identify known packers and adjust execution limits accordingly, so that only the unpacking stub is emulated and not the actual malware code.&lt;/p&gt;

</description>
      <category>octograd2020</category>
    </item>
  </channel>
</rss>
