{"id":213,"date":"2006-11-07T12:57:11","date_gmt":"2006-11-07T10:57:11","guid":{"rendered":"http:\/\/my.stargazer.at\/?p=213"},"modified":"2007-05-29T15:15:52","modified_gmt":"2007-05-29T13:15:52","slug":"anti-sandbox-code-anhand-von-norman","status":"publish","type":"post","link":"https:\/\/my.stargazer.at\/de\/2006\/11\/07\/anti-sandbox-code-anhand-von-norman\/","title":{"rendered":"Anti-Sandbox code with norman"},"content":{"rendered":"<p>Unser alter Freund Norman bezeichnet niemand anders, als die Sandbox von norman.no. Sie ist eine virtuelle Maschine, welche eine Verhaltensanalyse von Binaries durchf\u00fchrt.<\/p>\n<p>Mit anderen Worten, seit dem Nepenthes-Modul submit_norman, einer der gr\u00f6ssten Feinde der Botnet-Kiddies, da durch sie schon viele Botnetze identifiziert wurden.<\/p>\n<p><!--more--><\/p>\n<p>Nachdem ich einige Samples gefunden habe, welche die Sandbox erkennen, habe ich mich mit dem Thema genauer befasst.<\/p>\n<blockquote>\n<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;windows.h&gt;<\/p>\n<p>void main()<br \/>\n{<br \/>\n    MessageBox(NULL, &#8222;Hello World&#8220;, &#8222;My first C program&#8220;, MB_OK);<br \/>\n}<\/p>\n<\/blockquote>\n<p>Diese Zeilen Code erinnern an die Anf\u00e4nge des Programmierens, der einfachen Hello-World Programme. Mit diesem Code testen wir die Grundfunktionen der Sandbox. Das Ergebnis der Sandbox ist durchaus zufriedenstellend:<\/p>\n<blockquote>\n<p>Test.exe : Not detected by sandbox (Signature: NO_VIRUS)<br \/>\n[ General information ]<br \/>\n* Display message box (My first C program) : Hello World<br \/>\n* File length: 36864 bytes.<\/p>\n<\/blockquote>\n<p>Unser Programm wird ordnungsgem\u00e4ss analysiert. Ich gehe aufgrund der Informationen davon aus, dass die Sandbox keine normalen Windows DLLs verwendet. Desweiteren ist es beruhigend zu wissen, dass Ausgaben der Programme angezeigt werden. Auf diese Art und Weise kann man den Speicher der Sandbox anzapfen:<\/p>\n<blockquote>\n<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;windows.h&gt;<\/p>\n<p>void main()<br \/>\n{<br \/>\n    char szBuffer[512];<br \/>\n    DWORD dwAddr = (DWORD)GetProcAddress(LoadLibrary(&#8222;user32.dll&#8220;), &#8222;MessageBoxA&#8220;);<br \/>\n    \/\/Get the address of any WINAPI function, we use MessageBoxA() in this example.<\/p>\n<p>    memset(szBuffer, 0, sizeof(szBuffer));<br \/>\n    _snprintf(szBuffer, sizeof(szBuffer) &#8211; 1, &#8222;[ 0x%x, 0x%x, 0x%x, 0x%x, 0x%x ]&#8220;, *(BYTE*)dwAddr, *(BYTE*)(dwAddr + 1), *(BYTE*)(dwAddr + 2), *(BYTE*)(dwAddr + 3), *(BYTE*)(dwAddr + 4));<br \/>\n    \/\/Read the first 5 bytes of connect() into the buffer<\/p>\n<p>    MessageBox(NULL, szBuffer, &#8222;The Title&#8220;, MB_OK);<br \/>\n    \/\/Display the messagebox<br \/>\n}<\/p>\n<\/blockquote>\n<p>Das Ergebnis der Sandbox, wie folgt:<\/p>\n<blockquote>\n<p>Test.exe : Not detected by sandbox (Signature: NO_VIRUS)<br \/>\n[ General information ]<br \/>\n* Display message box (The Title) : [ 0xc8, 0x0, 0x4, 0x0, 0x60 ].<br \/>\n* File length: 40960 bytes.<\/p>\n<\/blockquote>\n<p>Der interessante Teil ist die Speicheradresse, in welcher unsere Messagebox MessageBoxA geladen ist. Vergleichen wir diese mit einem normalen Windows-PC.<\/p>\n<blockquote>\n<p>&#8222;[ 0x8b 0xff 0x55 0x8b 0xec ]&#8220;<\/p>\n<\/blockquote>\n<p>Die beiden Werte sind sehr unterschiedlich und bieten uns eine Art Fingerabdruck anhand dessen wir die Sandbox \u00fcberlisten k\u00f6nnen, wie folgendes Codebeispiel ansatzweise umreisst:<\/p>\n<blockquote>\n<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;windows.h&gt;<\/p>\n<p>void main()<br \/>\n{<br \/>\n    unsigned char szBytes[] = { 0xc8, 0x0, 0x4, 0x0, 0x60 };<br \/>\n    DWORD dwAddr = (DWORD)GetProcAddress(LoadLibrary(&#8222;user32.dll&#8220;), &#8222;MessageBoxA&#8220;);<\/p>\n<p>    if(!memcmp((LPVOID)dwAddr, (LPVOID)szBytes, sizeof(szBytes)))<br \/>\n    {<br \/>\n        MessageBox(NULL, &#8222;Hello Norman.&#8220;, &#8222;Detected.&#8220;, MB_OK);<br \/>\n        ExitProcess(0);<br \/>\n        \/\/Exit the process cleanly so it stops execution and logging of the file<br \/>\n    }<\/p>\n<p>    MessageBox(NULL, &#8222;You will not see that message in the sandbox&#8220;, &#8222;Hidden.&#8220;, MB_OK);<br \/>\n}<\/p>\n<\/blockquote>\n<p>Die Sandbox arbeitet unser Script mit folgendem Ergebnis ab:<\/p>\n<blockquote>\n<p>Test3.exe : Not detected by sandbox (Signature: NO_VIRUS)<br \/>\n[ General information ]<\/p>\n<p>* Display message box (Detected.) : Hello Norman.<br \/>\n* File length: 36864 bytes.<\/p>\n<\/blockquote>\n<p>Lokal ausgef&uuml;hrt hingegen, bekommen wir unsere Messagebox  &#8222;You will not see that message in the sandbox&#8220; zu sehen. Das Ergebnis dieses kleinen Experiments ist wie folgt: Windows bleibt Windows und eine Sandbox ist eine Sandbox&#8230; und alles hat seine Merkmale.<\/p>","protected":false},"excerpt":{"rendered":"<p>Unser alter Freund Norman bezeichnet niemand anders, als die Sandbox von norman.no. Sie ist eine virtuelle Maschine, welche eine Verhaltensanalyse von Binaries durchf\u00fchrt. Mit anderen Worten, seit dem Nepenthes-Modul submit_norman, einer der gr\u00f6ssten Feinde der Botnet-Kiddies, da durch sie schon viele Botnetze identifiziert wurden.<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[231,337,41],"class_list":["post-213","post","type-post","status-publish","format-standard","hentry","category-security","tag-debug","tag-sandbox","tag-windows"],"_links":{"self":[{"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/posts\/213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/comments?post=213"}],"version-history":[{"count":0,"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/posts\/213\/revisions"}],"wp:attachment":[{"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/media?parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/categories?post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/my.stargazer.at\/de\/wp-json\/wp\/v2\/tags?post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}