<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-34943364</id><updated>2011-09-20T15:46:57.948+01:00</updated><category term='download'/><category term='challenge'/><category term='obfuscation'/><category term='python'/><category term='anti'/><category term='graphics'/><category term='packer'/><category term='done'/><category term='gnireenigne'/><category term='puzzle'/><category term='irl'/><category term='seh'/><category term='français'/><category term='pe'/><category term='kabopan'/><category term='libdasm'/><category term='misc'/><category term='asm'/><title type='text'>c..k..i</title><subtitle type='html'>reverse engineering experiments and documentations</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>69</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-34943364.post-1157458308699428703</id><published>2011-09-05T17:16:00.003+01:00</published><updated>2011-09-05T17:37:01.657+01:00</updated><title type='text'>vous devez chausser du 48 ou bien mettre des scholls</title><content type='html'>&lt;span style="font-style: italic;"&gt;last post here ?&lt;/span&gt;&lt;br /&gt;As I now prefer to write and update technical documents in my &lt;a href="http://wiki.corkami.com/"&gt;wiki&lt;/a&gt;, and notify people via my announcement-only &lt;a href="http://twitter.com/#%21/corkami"&gt;twitter account&lt;/a&gt;, rather than write on this blog, it will be unlikely updated in the future.&lt;br /&gt;&lt;br /&gt;So, to keep yourself updated, I suggest to check &lt;a href="http://twitter.com/#%21/corkami"&gt;@corkami&lt;/a&gt;.&lt;br /&gt;If you want to use an RSS reader, you can point it to this &lt;a href="http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=corkami"&gt;address&lt;/a&gt;, which doesn't require your own twitter account . For some reasons, Google Reader doesn't like it: to solve the problem, you can use a service such as &lt;a href="http://freemyfeed.com/"&gt;Freemyfeed&lt;/a&gt; (no need of login/password). It gives you an url like this &lt;a href="http://freemyfeed.com/feed/aHR0cDovL2FwaS50d2l0dGVyLmNvbS8xL3N0YXR1c2VzL3VzZXJfdGltZWxpbmUucnNzP3NjcmVlbl9uYW1lPWNvcmthbWk6Ojo6NUJUdTNoUUd1aWVFZGRVdEtiU2JOam82TWc9PQ=="&gt;one&lt;/a&gt;, which works fine with Google Reader.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;&lt;/blockquote&gt;&lt;hr /&gt;&lt;span style="font-style: italic;"&gt;dernier billet ici ?&lt;/span&gt;&lt;br /&gt;Comme je préfère désormais écrire et maintenir des documents techniques sur mon &lt;a href="http://wiki.corkami.com/"&gt;wiki&lt;/a&gt;, et avertir des mises-à-jour via mon &lt;a href="http://twitter.com/#%21/corkami"&gt;compte twitter&lt;/a&gt; (utilisé uniquement pour cela), plutôt que d'écrire sur ce blog, il a peu de chances d'être mis à jour à l'avenir.&lt;br /&gt;&lt;br /&gt;Pour vous tenir au courant, je vous conseille donc de regarder&lt;span style="text-decoration: underline;"&gt; &lt;/span&gt;&lt;a href="http://twitter.com/#%21/corkami"&gt;@corkami&lt;/a&gt;.&lt;br /&gt;Si vous voulez utiliser un lecteur RSS, vous pouvez l'utiliser avec cette &lt;a href="http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=corkami"&gt;adresse&lt;/a&gt;, qui ne nécessite pas d'avoir votre propre compte twitter.&lt;br /&gt;Pour des raisons inconnues, Google Reader ne semble pas l'accepter: pour résoudre le problème, vous pouvez utiliser un service tel que &lt;a href="http://freemyfeed.com/"&gt;Freemyfeed&lt;/a&gt; (sans identifiant ni mot de passe). Vous obtiendrez une adresse alors comme &lt;a href="http://freemyfeed.com/feed/aHR0cDovL2FwaS50d2l0dGVyLmNvbS8xL3N0YXR1c2VzL3VzZXJfdGltZWxpbmUucnNzP3NjcmVlbl9uYW1lPWNvcmthbWk6Ojo6NUJUdTNoUUd1aWVFZGRVdEtiU2JOam82TWc9PQ=="&gt;celle-ci&lt;/a&gt;, qui fonctionne sans problème avec Google Reader.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-1157458308699428703?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/1157458308699428703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2011/09/vous-devez-chausser-du-48-ou-bien.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1157458308699428703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1157458308699428703'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2011/09/vous-devez-chausser-du-48-ou-bien.html' title='vous devez chausser du 48 ou bien mettre des scholls'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-9094996130328737838</id><published>2011-07-14T18:10:00.001+01:00</published><updated>2011-07-14T18:30:20.848+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='anti'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='packer'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><title type='text'>too scared to go to prison, we're unable to make decisions</title><content type='html'>&lt;div&gt;I still don't have the time to write a decent blog article, but at least, I managed to do a few things since the last post (if you don't follow me on twitter or reddit):&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Trying to improve my screencasting methodology, I created a screencast &lt;a href="http://rejava.sourceforge.net/hello.html"&gt;tutorial &lt;/a&gt;on reJava  (compare with my &lt;a href="https://sites.google.com/site/corkami/ollydbg-tracing"&gt;previous one&lt;/a&gt; and let me know which one is better).&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/corkami/wiki/PDFTricks"&gt;a summary of PDF tricks page&lt;/a&gt;, with various categories (encodings, structures, javascript...), and for each example, a handmade, clean and minimal PoC.&lt;/li&gt;&lt;li&gt;In order to study a way to document in details a binary, I created a &lt;a href="http://www.mediafire.com/?f4cecrbsp7oeda8"&gt;commented IDB of a PE file packed with UPX&lt;/a&gt; - released as is, on request but I find it a sub-optimal way to document assembly, especially as it's not really possible to easily move this information to another IDB.&lt;/li&gt;&lt;li&gt;a small &lt;a href="http://bit.ly/m2KDh7"&gt;update&lt;/a&gt; to my PE infographics, some fixes, and improvments of the resource section.&lt;/li&gt;&lt;li&gt;a merge from the aPlib part of Kabopan as a single independent &lt;a href="http://goo.gl/UTP6o"&gt;aplib.py&lt;/a&gt;&lt;/li&gt;&lt;li&gt;a &lt;a href="http://bit.ly/jdDapV"&gt;commented disassembly&lt;/a&gt; of Peter Ferrie's new EICAR file &lt;/li&gt;&lt;li&gt;a &lt;a href="http://goo.gl/e7K47"&gt;commented disassembly&lt;/a&gt; of Yosuke Hasegawa's AA86, the symbol &lt;span&gt;&lt;span&gt;assembler.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;Example: "Hello World" code:&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;blockquote&gt;@^^^^^-%+)@@^^^!;@@_!,((,.((-$+)@*+@!!@-,!"(+@@,$-,!"($%&amp;amp;,&amp;amp;,&amp;amp;_&amp;amp;,"@"'%_&amp;amp;"',&amp;amp;$&amp;amp;-@*@$"&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(68, 68, 68); font-family: Arial, 'Helvetica Neue', sans-serif; font-size: 15px; line-height: 19px; "&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;a handy &lt;a href="http://bit.ly/lS35xn"&gt;python script&lt;/a&gt; to rename unicode filenames (and &lt;a href="http://bit.ly/jwI3Mb"&gt;back&lt;/a&gt;), very handy for these tools that don't support unicode filenames.&lt;br /&gt;ex: 日本.txt &amp;lt;=&amp;gt; &amp;amp;'#26085;&amp;amp;'#26412;.txt&lt;/li&gt;&lt;li&gt;a yED &lt;a href="http://bit.ly/iHDS4S"&gt;graph of intel AVX2 opcodes&lt;/a&gt; descriptions (&lt;a href="http://www.mediafire.com/?5gt3xk9g181m2v8"&gt;png&lt;/a&gt;): totally useless in itself, yet all these opcodes are scary.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-9094996130328737838?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/9094996130328737838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2011/07/too-scared-to-go-to-prison-were-unable.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/9094996130328737838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/9094996130328737838'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2011/07/too-scared-to-go-to-prison-were-unable.html' title='too scared to go to prison, we&apos;re unable to make decisions'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-8532135020634070133</id><published>2011-04-01T18:35:00.003+01:00</published><updated>2011-04-01T19:03:55.198+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='seh'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='anti'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><title type='text'>Mireille est une star au fin fond du Tibet</title><content type='html'>&lt;span style="font-size:100%;"&gt;Here are a few things that I released recently but didn't get a regular blog post, just a twitter entry:&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;&lt;a href="http://code.google.com/p/corkami/wiki/UsermodeTest"&gt;Usermode test&lt;/a&gt;(v0.1): a usermode opcode tester, covering most opcodes, including rare, obsolete, recent, undocumented, 64 bits, exception triggers, anti-debugs.... (gathering and extending the result of my previous blog entries and programs)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Following Peter Ferrie's article, I wrote a commented &lt;a href="http://corkami.googlecode.com/svn-history/r399/trunk/misc/jjencode.txt"&gt;source&lt;/a&gt; of JJencode, the funny javascript obfuscator, along with a dumb decryption script.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;I extended y0da's binary corpus, with various compiled files and my own experimental PEs, to build my own &lt;a href="http://code.google.com/p/corkami/downloads/list?can=2&amp;amp;q=binary+corpus"&gt;binary corpus&lt;/a&gt;. It covers a lot of different compilers, sections layout, image directories,...&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;I created a simple &lt;a href="https://sites.google.com/site/corkami/ollydbg-tracing"&gt;screencast &lt;/a&gt;to introduce tracing with OllyDbg, based on Oleh's tutorial.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-8532135020634070133?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/8532135020634070133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2011/04/mireille-est-une-star-au-fin-fond-du.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8532135020634070133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8532135020634070133'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2011/04/mireille-est-une-star-au-fin-fond-du.html' title='Mireille est une star au fin fond du Tibet'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-229204275919174107</id><published>2011-02-01T21:24:00.003Z</published><updated>2011-02-01T21:38:05.212Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>I wear my crown of thorns, on my liar's chair</title><content type='html'>&lt;span style="font-style: italic;"&gt;a bit of nostalgia (virii)&lt;br /&gt;&lt;/span&gt;my first contact with a computer virus was &lt;a href="http://en.wikipedia.org/wiki/Ping-Pong_virus"&gt;Ping-Pong&lt;/a&gt;, which infected our 10 Mhz 8086. Hopefully, a magazine was giving the solution (for free!): they were giving the hex sequence to search and replace !!!&lt;br /&gt;While it was a working solution, it was not exactly 'user-friendly': Hey Grandma, launch PCTools 4.30, open the hex editor, then.... err, nevermind !&lt;br /&gt;&lt;br /&gt;My 2nd interaction with a virus was Tequila: it kept re-infecting our computer. However, because our 20 Mb hard disk was very noisy, I could eventually recognize the sound of the virus infecting the &lt;a href="http://en.wikipedia.org/wiki/Master_boot_record"&gt;MBR&lt;/a&gt; ! Instant detection, but once again, not exactly the most user friendly !&lt;br /&gt;&lt;br /&gt;Hopefully, Anti-Virus softwares are now a bit better than 'listen to your hard disk' or 'search and replace yourself' !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-229204275919174107?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/229204275919174107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2011/02/i-wear-my-crown-of-thorns-on-my-liars.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/229204275919174107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/229204275919174107'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2011/02/i-wear-my-crown-of-thorns-on-my-liars.html' title='I wear my crown of thorns, on my liar&apos;s chair'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-6950791997580807814</id><published>2011-02-01T19:03:00.000Z</published><updated>2011-02-01T20:18:46.385Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><title type='text'>Mais je me lâche la main, je m’éloigne de moi...</title><content type='html'>&lt;span style="font-style: italic;"&gt;unpacking drivers in user-mode (2)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Following my &lt;a href="http://corkami.blogspot.com/2010/02/blog-post.html"&gt;previous&lt;/a&gt; post on the topic, I came up with a few more tricks:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;since packed drivers typically use  ExAllocatePool*, you need a user-mode equivalent to extract the packed  driver. So I just made my fake ntoskrnl call VirtualAlloc* for the trick&lt;/li&gt;&lt;li&gt;they often use RtlImageNtHeader, so I added a redirection for it in the fake ntoskrnl.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;some drivers import HAL.DLL and CLASSPNP.SYS, I made fake ones for them too.&lt;/li&gt;&lt;li&gt;some drivers load ntoskrnl.exe manually. in this case, i'd use (under OllyDbg) &lt;span style="font-family:'courier new',monospace;"&gt;&lt;a href="http://rammichael.com/multimate-assembler" target="_blank"&gt;multimate-assembler&lt;/a&gt;&lt;/span&gt;, with a standard snippet.&lt;/li&gt;&lt;li&gt;it's important to recognize when the driver is trying to locate ntoskrnl, to be able to correct execution. Here are the various ways that I can recall:&lt;/li&gt;&lt;/ul&gt;&lt;ol&gt;&lt;li&gt;calling SIDT will give you the IDT, which is present in ntoskrnl.&lt;/li&gt;&lt;li&gt;calling RDMSR with ECX=176 gives you Sysenter address, you can then locate ntoskrnl header.&lt;/li&gt;&lt;li&gt;standard range checking:&lt;/li&gt;&lt;/ol&gt;&lt;blockquote&gt;&lt;span style="font-family:'courier new',monospace;"&gt;&lt;div&gt;mov eax, 0ffdff12ch&lt;/div&gt;&lt;div&gt;    mov eax, [eax]&lt;/div&gt;&lt;div&gt;loop:&lt;/div&gt;&lt;div&gt;    and ax, f001&lt;/div&gt;&lt;div&gt;    dec eax&lt;/div&gt;&lt;div&gt;    cmp [eax], 5a4d&lt;/div&gt;&lt;div&gt;    jnz loop&lt;/div&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;As usual, I included the (minimal) sources - happy unpacking!&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/usermode_drivers2.zip"&gt;Sources and binaries&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-6950791997580807814?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/6950791997580807814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/09/mais-je-me-lache-la-main-je-meloigne-de.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6950791997580807814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6950791997580807814'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/09/mais-je-me-lache-la-main-je-meloigne-de.html' title='Mais je me lâche la main, je m’éloigne de moi...'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-2590656465816323168</id><published>2010-07-14T18:19:00.001+01:00</published><updated>2010-07-14T18:22:25.445+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='obfuscation'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Ne trouvez-vous donc pas, l'histoire un peu répétitive ?</title><content type='html'>&lt;span style="font-style:italic;"&gt;a simple API jump&lt;/span&gt;&lt;br /&gt;If you check Wine's &lt;a href="http://source.winehq.org/source/dlls/ntdll/rtl.c#L848"&gt;source&lt;/a&gt;:&lt;blockquote style="white-space:pre;font-family:courier new;"&gt;void WINAPI RtlCopyLuid (PLUID LuidDest, const LUID *LuidSrc)&lt;br /&gt;{&lt;br /&gt;    *LuidDest = *LuidSrc;&lt;br /&gt;}&lt;/blockquote&gt;you see that this little NtDll API is very strong: no check is done, so it could be used literally for anything. A simple way to use it is just to jump, by setting the right arguments.&lt;a name='more'&gt;&lt;/a&gt;&lt;blockquote style="white-space:pre;font-family:courier new;"&gt;mov eax, esp&lt;br /&gt;sub eax, 10h&lt;br /&gt;push jump_target&lt;br /&gt;push esp&lt;br /&gt;push eax&lt;br /&gt;call RtlCopyLuid&lt;/blockquote&gt;&lt;a href="http://corkami.googlecode.com/files/jumps.zip"&gt;Jumps&lt;/a&gt; is now updated with it. (Part 1 &lt;a href="http://corkami.blogspot.com/2010/01/they-say-jump-you-say.html"&gt;here&lt;/a&gt;)&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;un saut simple via API &lt;/span&gt;&lt;br /&gt;Si on regarde le &lt;a href="http://source.winehq.org/source/dlls/ntdll/rtl.c#L848"&gt;source&lt;/a&gt; de Wine:&lt;blockquote style="white-space:pre;font-family:courier new;"&gt;void WINAPI RtlCopyLuid (PLUID LuidDest, const LUID *LuidSrc)&lt;br /&gt;{&lt;br /&gt;    *LuidDest = *LuidSrc;&lt;br /&gt;}&lt;/blockquote&gt;on voit que cette petite API de NtDll est très puissante: aucune vérification, donc elle pourrait être vraiment utilisée pour tout et n'importe quoi. Une façon simple de l'utiliser est pour sauter, en préparant correctement la pile:&lt;!-- more --&gt;&lt;blockquote style="white-space:pre;font-family:courier new;"&gt;mov eax, esp&lt;br /&gt;sub eax, 10h&lt;br /&gt;push jump_target&lt;br /&gt;push esp&lt;br /&gt;push eax&lt;br /&gt;call RtlCopyLuid&lt;/blockquote&gt;cette technique est maintenant ajoutée à &lt;a href="http://corkami.googlecode.com/files/jumps.zip"&gt;Jumps&lt;/a&gt; (première partie &lt;a href="http://corkami.blogspot.com/2010/01/they-say-jump-you-say.html"&gt;ici&lt;/a&gt;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-2590656465816323168?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/2590656465816323168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/07/ne-trouvez-vous-donc-pas-lhistoire-un.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2590656465816323168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2590656465816323168'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/07/ne-trouvez-vous-donc-pas-lhistoire-un.html' title='Ne trouvez-vous donc pas, l&apos;histoire un peu répétitive ?'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-4128018160823149356</id><published>2010-07-11T19:43:00.004+01:00</published><updated>2010-07-11T19:53:06.991+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>...Weiß noch nicht, dass er tanzen muss</title><content type='html'>&lt;span style="font-style:italic;"&gt;misc update&lt;/span&gt;&lt;br /&gt;Just to let you know I updated the &lt;a href="http://corkami.blogspot.com/p/map.html"&gt;Map&lt;/a&gt; and &lt;a href="http://code.google.com/p/corkami/downloads/list"&gt;Downloads&lt;/a&gt;, hoping things will be a little more detailed about my various experiments.&lt;br /&gt;&lt;hr&gt;&lt;span style="font-style:italic;"&gt;petite mise à jour&lt;/span&gt;&lt;br /&gt;Simplement pour vous dire que j'ai mis à jour la &lt;a href="http://corkami.blogspot.com/p/map.html"&gt;Carte&lt;/a&gt; et les &lt;a href="http://code.google.com/p/corkami/downloads/list"&gt;Téléchargements&lt;/a&gt;, en espérant que les choses soient un peu plus claires concernant mes bidouillages.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-4128018160823149356?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/4128018160823149356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/07/wei-noch-nicht-dass-er-tanzen-muss.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4128018160823149356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4128018160823149356'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/07/wei-noch-nicht-dass-er-tanzen-muss.html' title='...Weiß noch nicht, dass er tanzen muss'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-1863168325176607608</id><published>2010-07-08T18:14:00.004+01:00</published><updated>2010-07-08T18:25:37.673+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Sans réfléchir, ne me demande pas comment...</title><content type='html'>&lt;span style="font-style: italic;"&gt;a bit of nostalgia&lt;/span&gt;&lt;br /&gt;my first game crack was purely accidental (i own the game too!):&lt;br /&gt;both edited by Microprose, F15 Strike eagle II and F19 stealth fighter had the same structure:&lt;br /&gt;a small  (F15|F9).COM file calling the main GAME.EXE file&lt;br /&gt;what if you swap one game's .COM with the other game's ?&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;well, it turns out that in F15, the protection check was in the .COM, and in F19, it was in the EXE.&lt;br /&gt;so if you swapped COM files, F19 was getting 2 protections checks... and F15... none :)&lt;br /&gt;&lt;br /&gt;my first cheat patch was not completely accidental, but totally lucky too (I had no assembly knowledge at the time):&lt;br /&gt;by checking in games magazines, I noticed it was often a matter of switching a 74 xx with a 75 xx, or replacing it with a 90 90...&lt;br /&gt;so I took my favorite game at the time (Super Off-Road Racer), a hex-editor (PC-Tools 4.30 ! yeah !), and looked for hex sequences, trying blindly one after each other:&lt;br /&gt;and ... it worked... I eventually (ahh, youth !) replaced the right sequence, giving me infinite nitros...&lt;br /&gt;&lt;br /&gt;it was... in 1990 ! Doh! I feel old, suddenly...&lt;hr /&gt;&lt;span style="font-style: italic;"&gt;a bit of nostalgia&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;mon premier crack était purement accidentel (j'avais le jeu original, cela dit):&lt;br /&gt;tous deux de MicroProse, F15 Strike eagle II et F19 stealth fighter avaient la même structure:&lt;br /&gt;un petit fichier (F15|F9).COM qui appelle le GAME.EXE principal&lt;br /&gt;que ce passe-t-il si on intervertit les 2 fichiers COM ?&lt;br /&gt;et bien, il s'avère que dans F15, la vérification de la copie se trouvait dans le COM, et dans F19, dans l'EXE...&lt;br /&gt;donc, si on intervertit les 2, F19 vérifiait successivement les 2 disquettes... et F15... aucune :D&lt;br /&gt;&lt;br /&gt;mon premier patch pour tricher n'était pas complètement accidentel, mais quand même très chanceux (je n'avais aucune connaissance d'assembleur à l'époque):&lt;br /&gt;à force de regarder les magazines qui proposaient des patchs, j'avais remarqué que souvent, il s'agissait de remplacer un 74 xx par un 75 xx, ou de tout remplacer par un 90 90...&lt;br /&gt;Donc j'ai pris mon jeu favori à l'époque (Super Off-Road Racer), mon éditeur hexadécimal favori (PC-Tools 4.30 ! yeah !), et j'ai essayé de remplacer chaque séquence au pif, l'une après l'autre...&lt;br /&gt;et... ça a fini par marcher (ahhh, jeunesse !)... au hasard, j'ai fini par patcher la bonne séquence, me donnant les nitros infinies...&lt;br /&gt;&lt;br /&gt;tout cela... en 1990 ! Je me sens vieux, tout d'un coup...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-1863168325176607608?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/1863168325176607608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/07/sans-reflechir-ne-me-demande-pas.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1863168325176607608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1863168325176607608'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/07/sans-reflechir-ne-me-demande-pas.html' title='Sans réfléchir, ne me demande pas comment...'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-1859738501725240524</id><published>2010-04-07T09:46:00.004+01:00</published><updated>2010-04-07T09:55:28.942+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Wir halten zusammen, keiner kämpft allein</title><content type='html'>&lt;span style="font-style:italic;"&gt;Finished PE/Packers/Opcodes graphics&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As I added Data Directories to the PE infographics, my 3 infographics projects are now finished:&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/pe.pdf"&gt;PE format&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;Packers&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/opcodes.pdf"&gt;Opcodes&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It was fun, hope you like them.&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Infographies PE/Packeurs/Instructions terminées&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Je viens de rajouter les Data Directories à mon infographie sur le PE. Mes 3 projets en cours d'infographies sont donc terminés :&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/pe.pdf"&gt;PE format&lt;/a&gt; (anglais)&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;Packers&lt;/a&gt; (anglais)&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/opcodes.pdf"&gt;Opcodes&lt;/a&gt; (anglais)&lt;br /&gt;&lt;br /&gt;C'était intéressant, j'espère que ça vous plait.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-1859738501725240524?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/1859738501725240524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/04/wir-halten-zusammen-keiner-kampft.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1859738501725240524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1859738501725240524'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/04/wir-halten-zusammen-keiner-kampft.html' title='Wir halten zusammen, keiner kämpft allein'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-6672443514853518524</id><published>2010-04-05T20:52:00.004+01:00</published><updated>2010-04-05T22:32:20.159+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='packer'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Before you judge me, take a look at you</title><content type='html'>&lt;span style="font-style:italic;"&gt;Packers' algorithms&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I created one last diagram, showing Packers' most common algorithms.&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;Packers' infographics&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have no plan to do any other on the topic. Let me know if you have a suggestion for an extra one.&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Algorithmes de Packeurs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;J'ai crée une dernière infographie qui montre les algorithmes les plus communs dans les packeurs.&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;Packers' infographics (anglais)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Je n'ai pas le projet d'en faire un autre sur le sujet, dites-moi si vous avez des suggestions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-6672443514853518524?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/6672443514853518524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/04/before-you-judge-me-take-look-at-you.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6672443514853518524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6672443514853518524'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/04/before-you-judge-me-take-look-at-you.html' title='Before you judge me, take a look at you'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-1083688370798025988</id><published>2010-04-04T22:53:00.003+01:00</published><updated>2010-04-04T23:06:36.624+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='packer'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Si tu cherches un peu de gaîté, viens donc faire un tour à...</title><content type='html'>&lt;span style="font-style:italic;"&gt;Typical behavior of the various kinds of packers&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I made an infographic showing 3 different kinds of packer, their usual steps and the caracteristics of each of these steps.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;Packers&lt;/a&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Comportement habituel des diverses sortes de packeurs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;J'ai fait une infographie représentant 3 différentes sortes de packeurs, leurs étapes habituelles, et les caractéristiques de chaque étape.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;Packers (anglais)&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-1083688370798025988?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/1083688370798025988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/04/si-tu-cherches-un-peu-de-gaite-viens.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1083688370798025988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1083688370798025988'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/04/si-tu-cherches-un-peu-de-gaite-viens.html' title='Si tu cherches un peu de gaîté, viens donc faire un tour à...'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-4605106464081342423</id><published>2010-04-03T18:28:00.004+01:00</published><updated>2010-04-04T23:39:43.577+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>I time every journey to bump into you</title><content type='html'>&lt;span style="font-style:italic;"&gt;PE file and memory layouts&lt;/span&gt;&lt;br /&gt;I created a graph (diagram?) for the PE format, showing 'standard' layouts of a PE file, on disk and in memory.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/pe.pdf"&gt;PE Format: Headers, Layouts&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Initially, I wanted to include all PE details, but it would make it overly complex (or impossible, as I make them on a netbook).&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Organisations fichier et mémoire d'un PE&lt;/span&gt;&lt;br /&gt;J'ai créé un graphe (schéma, diagramme ?) pour le format PE, qui montre les organisations 'standards' d'un PE, sur le disque et en mémoire.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/pe.pdf"&gt;PE Format: Headers, Layouts (ANGLAIS)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A l'origine, je voulais y mettre tous les détails du PE, mais ça le rendrait illisible (ou ingérable, vu que je fais tout ça sur un netbook).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-4605106464081342423?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/4605106464081342423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/04/i-time-every-journey-to-bump-into-you.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4605106464081342423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4605106464081342423'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/04/i-time-every-journey-to-bump-into-you.html' title='I time every journey to bump into you'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-8452010084255668656</id><published>2010-04-02T23:24:00.006+01:00</published><updated>2010-12-12T20:56:17.399Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='anti'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Lutte contre les mots faciles, lutte contre la haine des ...</title><content type='html'>&lt;span style="font-style:italic;"&gt;user-mode opcodes cheat sheets&lt;/span&gt;&lt;br /&gt;I mostly work on user-mode code, or kernel-mode code that actually uses a very limited amount of privileged opcodes, just to access CR0 and IF. Besides, FPU/MMX/SSE are usually used as junk or pure calculation that I can ignore.&lt;br /&gt;&lt;br /&gt;So, from that limited perspective, the amount of opcodes is much reduced.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;A Perspective of two-byte opcodes&lt;/span&gt;&lt;br /&gt;After my overview of one-byte opcodes, I made a graph of two-byte opcodes according to that perspective.&lt;br /&gt;It makes it much more readable than expected!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Opcodes' reminders&lt;/span&gt;&lt;br /&gt;Also, I checked every user-mode opcode, and wrote a one-liner to describe them, as well as a small example. I put together an executable with all the examples, just to see them in action - and test your favorite emulator ;)&lt;br /&gt;&lt;br /&gt;It makes them small opcodes' reminders, in printable text and executable code formats.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;All obvious opcodes are naturally included, but also (since ALL user-mode opcodes are present):&lt;br /&gt;&lt;blockquote style="white-space:pre;font-family:courier new;"&gt;ARPL, BOUND, LDS, LAR, STR, XADD, SYSENTER, &lt;br /&gt;XLAT, VERR, SALC, AAA, CMPXCHG, SIDT...&lt;/blockquote&gt;aka 'all the ones I forget too quickly'.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/opcodes.pdf"&gt;Opcodes (One-byte overview, two-byte perspective, opcodes' description)&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/opcodes_desc.exe"&gt;Opcodes test executable&lt;/a&gt; (&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/asm/opcodes_desc.asm?r=245"&gt;source&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;The executable may not work on (older?) AMD cpus (because of SYSENTER), and may fail under virtualization or other OS but XP (SIDT, STR, etc...)&lt;br /&gt;&lt;br /&gt;Thanks to Costin Ionescu and BeatriX.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Sysenter Anti-stepping&lt;/span&gt;&lt;br /&gt;I noticed that, like Int2E, Sysenter behaves differently if stepped or ran over.&lt;br /&gt;for example, with EAX = 0:&lt;br /&gt;if stepping, &lt;blockquote style="white-space:pre;font-family:courier new;"&gt;ECX, EDX = 1, -1.&lt;/blockquote&gt;If ran normally, &lt;br /&gt;&lt;blockquote style="white-space:pre;font-family:courier new;"&gt;ECX, EDX = esp - 4, @KiFastSystemCallRet.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Penses-bêtes pour instructions en mode utilisateur&lt;/span&gt;&lt;br /&gt;Je travaille principalement avec du code en mode utilisateur, ou du code noyau qui n'utilise en fait qu'un nombre très limité d'instructions privilégiées, juste pour accéder a CR0 et IF. De plus, FPU/MMX/SSE sont utilisés d'habitude comme code pourri, ou comme calcul pur que je peux ignorer.&lt;br /&gt;&lt;br /&gt;Donc, avec cette perspective limitée, le nombre d'instructions est bien réduit.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Une perspective des instructions sur deux octets&lt;/span&gt;&lt;br /&gt;Après ma vue d'ensemble sur les instructions sur un octet, j'ai fait un graphe des instructions sur 2 octets selon cette perspective.&lt;br /&gt;Ça rend les choses beaucoup plus lisibles que je ne l'imaginais!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Penses-bêtes d'instructions&lt;/span&gt;&lt;br /&gt;De plus, j'ai regardé chaque instruction utilisateur, et écrit une courte description pour chacun, avec un petit exemple. J'ai fait un exécutable avec tous ces exemples, juste pour voir ces instructions en action - et tester votre émulateur favori ;)&lt;br /&gt;&lt;br /&gt;Ça donne 2 petits pense-bêtes pour instructions, l'un en texte imprimable, et l'autre en code exécutable.&lt;br /&gt;&lt;br /&gt;Toutes les instructions évidentes sont bien évidemment présentes, mais aussi (puisqu'elles y sont TOUTES):&lt;br /&gt;&lt;blockquote style="white-space:pre;font-family:courier new;"&gt;ARPL, BOUND, LDS, LAR, STR, XADD, SYSENTER, &lt;br /&gt;XLAT, VERR, SALC, AAA, CMPXCHG, SIDT...&lt;/blockquote&gt;autrement dit, 'celles que j'oublie toujours trop vite'.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/opcodes.pdf"&gt;Opcodes (One-byte overview, two-byte perspective, opcodes' description) (ANGLAIS)&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/opcodes_desc.exe"&gt;le fichier de test des opcodes&lt;/a&gt; (&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/asm/opcodes_desc.asm?r=245"&gt;source&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;L'exécutable peut ne pas fonctionner sur les (vieux?) processeurs AMD à cause de SYSENTER, et échouer sur une VM ou un OS autre que XP (SIDT, STR, etc...)&lt;br /&gt;&lt;br /&gt;Merci à Costin Ionescu et BeatriX.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Anti-pas-à-pas SYSENTER&lt;/span&gt;&lt;br /&gt;J'ai remarqué que, comme Int2E, SYSENTER se comporte différemment si lancé ou exécuté pas-à-pas.&lt;br /&gt;Par exemple, avec EAX = 0:&lt;br /&gt;en pas-à-pas, &lt;blockquote style="white-space:pre;font-family:courier new;"&gt;ECX, EDX = 1, -1.&lt;/blockquote&gt;en exécution normale, &lt;br /&gt;&lt;blockquote style="white-space:pre;font-family:courier new;"&gt;ECX, EDX = esp - 4, @KiFastSystemCallRet.&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-8452010084255668656?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/8452010084255668656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/04/lutte-contre-les-mots-faciles-lutte.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8452010084255668656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8452010084255668656'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/04/lutte-contre-les-mots-faciles-lutte.html' title='Lutte contre les mots faciles, lutte contre la haine des ...'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-1481920439266289404</id><published>2010-03-29T13:04:00.005+01:00</published><updated>2010-12-12T20:44:42.096Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='packer'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>If you wanna make the world a better place, take a look at ...</title><content type='html'>&lt;span style="font-style:italic;"&gt;typical packer entry-points&lt;/span&gt;&lt;br /&gt;It can be useful to have a reminder of the most usual packers' entry point - especially the light ones, which are likely to be hacked or used as an inner layer.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;PDF&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I also merged all the current packers graphs (including the new one) into a single PDF.&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;Features, Landscape, Detailed, Usual EntryPoints&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;début de packeurs standards&lt;/span&gt;&lt;br /&gt;Ça peut être utile d'avoir sous la main le début des packeurs les plus courants - surtout les plus légers, qui ont le plus de chances d'être hackés ou utilisés comme sous-couche.&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;PDF&lt;/a&gt;&lt;br /&gt;J'ai aussi fusionné tous mes graphes actuels sur les packeurs (y compris celui d'aujourd'hui) en un seul PDF.&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;Features, Landscape, Detailed, Usual EntryPoints&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-1481920439266289404?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/1481920439266289404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/03/if-you-wanna-make-world-better-place.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1481920439266289404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1481920439266289404'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/03/if-you-wanna-make-world-better-place.html' title='If you wanna make the world a better place, take a look at ...'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-461433250200015781</id><published>2010-03-29T00:35:00.001+01:00</published><updated>2010-04-04T23:40:52.192+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='anti'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Quand mes 'elles' se froissent et mes 'ils' se noient</title><content type='html'>&lt;span style="font-style:italic;"&gt;pages on anti-debuggers and PE oddities&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I created 2 new pages: one is about anti-debuggers (nothing new, just a compact and a printable form), and the other about PE oddities.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.blogspot.com/p/pe.html"&gt;PE&lt;/a&gt; &lt;a href="http://corkami.blogspot.com/p/anti.html"&gt;Anti&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;They are in progress - feel free to comment, correct, flame, suggest, etc...&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;pages sur les anti-débogueurs et les bizarreries du PE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;J'ai crée 2 pages: une sur les anti-débogueurs (rien de neuf, juste une forme compacte et imprimable) et une autre sur les bizarreries du PE.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.blogspot.com/p/pe.html"&gt;PE&lt;/a&gt; &lt;a href="http://corkami.blogspot.com/p/anti.html"&gt;Anti&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Elles sont en cours d'écritures - n'hésitez pas à commenter, corriger, reprocher, suggérer...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-461433250200015781?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/461433250200015781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/03/quand-mes-elles-se-froissent-et-mes-ils.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/461433250200015781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/461433250200015781'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/03/quand-mes-elles-se-froissent-et-mes-ils.html' title='Quand mes &apos;elles&apos; se froissent et mes &apos;ils&apos; se noient'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-4915404168602608800</id><published>2010-03-28T22:15:00.006+01:00</published><updated>2010-12-12T20:41:24.417Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Life's a piece of sh.t, when you look at it</title><content type='html'>&lt;span style="font-style:italic;"&gt;Overview of one-byte opcodes&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I made a simple one-page overview of one-byte opcodes:&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/opcodes.pdf"&gt;PDF&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Of course, if you want more info on the opcodes, check &lt;a href="http://ref.x86asm.net/"&gt;x86asm&lt;/a&gt; and &lt;a href="http://sandpile.org"&gt;sandpile&lt;/a&gt;.&lt;br /&gt;But sometimes, all I need is just a small reminder.&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Une vue d'ensemble des instructions de 1 octet&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;J'ai fait une vue d'ensemble simplifiée des instructions de 1 octet :&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/opcodes.pdf"&gt;PDF&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Bien sûr, pour avoir plus d'informations sur les instructions, allez voir &lt;a href="http://ref.x86asm.net/"&gt;x86asm&lt;/a&gt; et &lt;a href="http://sandpile.org"&gt;sandpile&lt;/a&gt;.&lt;br /&gt;Mais parfois, j'ai juste besoin d'un petit rappel, sans avoir besoin de sortir l'artillerie lourde.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-4915404168602608800?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/4915404168602608800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/03/lifes-piece-of-sht-when-you-look-at-it.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4915404168602608800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4915404168602608800'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/03/lifes-piece-of-sht-when-you-look-at-it.html' title='Life&apos;s a piece of sh.t, when you look at it'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-8267060643216382109</id><published>2010-03-24T23:07:00.003Z</published><updated>2010-12-12T20:33:39.124Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='packer'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Aurais-je été meilleur ou pire que ces gens, si j'avais été...</title><content type='html'>&lt;span style="font-style:italic;"&gt;packers' categories and features&lt;/span&gt;&lt;br /&gt;Following my &lt;a href="http://corkami.blogspot.com/2010/02/none-can-outrun-or-equal-power-of.html"&gt;graph of the packers' landscape&lt;/a&gt;, I made a graph showing the different categories of packers, and what kind of features they have.&lt;br /&gt;Then, to go deeper in details, I made a more detailed list of the various features for each of these kinds.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;a graph of the different packers' categories and their features&lt;/a&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;a detailed list of packers' features&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- more --&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;les sortes de packeurs et leurs caractéristiques&lt;/span&gt;&lt;br /&gt;Après mon &lt;a href="http://corkami.blogspot.com/2010/02/none-can-outrun-or-equal-power-of.html"&gt;graphe sur le monde des packeurs&lt;/a&gt;, j'ai fait un graphe qui montre les différentes catégories de packeurs et le genre de caractéristiques qu'ils ont:&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;les types de packeurs et leurs caractéristiques&lt;/a&gt; (anglais)&lt;br /&gt;ensuite, pour aller plus dans les détails, j'ai fait une liste qui détaille chaque catégories.&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;list détaillée du fonctionnement interne d'un packeur&lt;/a&gt; (anglais)&lt;br /&gt;&lt;br /&gt;Je ne prévois pas pour l'instant de faire des versions françaises à mes codes sources ou graphes, faites-moi savoir si ça vous gène.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-8267060643216382109?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/8267060643216382109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/03/aurais-je-ete-meilleur-ou-pire-que-ces.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8267060643216382109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8267060643216382109'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/03/aurais-je-ete-meilleur-ou-pire-que-ces.html' title='Aurais-je été meilleur ou pire que ces gens, si j&apos;avais été...'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-4744797252341799294</id><published>2010-03-19T01:36:00.003Z</published><updated>2010-03-19T02:05:50.007Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>You can't hide nowhere, with the torchlight on</title><content type='html'>&lt;span style="font-style: italic;"&gt;a emptier TinyPE&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.phreedom.org/solar/code/tinype/"&gt;TinyPE&lt;/a&gt; is an impressive project, that explains step-by-step how to make an incredible 97 bytes functional PE. It also shows that a PE can't be any smaller, otherwise &lt;span style="font-family: courier new;"&gt;IMAGE_OPTIONAL_HEADER32.Subsystem&lt;/span&gt;, which is a critical field, wouldn't be defined - it's even already shortened from a word to a byte.&lt;br /&gt;&lt;br /&gt;However, the original TinyPE still defines a section and SizeOfOptionalHeader, which are not necessary.&lt;br /&gt;Removing them makes such a PE not only Tiny, but also very small in amount of information - yet it works, naturally, and there's quite some room for code (relatively).&lt;br /&gt;In the end, here are the only defined fields, across all PE headers fields:&lt;a name='more'&gt;&lt;/a&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;.e_magic&lt;br /&gt;...&lt;br /&gt;NT_SIGNATURE&lt;br /&gt;...&lt;br /&gt;Machine&lt;br /&gt;...&lt;br /&gt;Characteristics&lt;br /&gt;Magic&lt;br /&gt;...&lt;br /&gt;AddressOfEntryPoint&lt;br /&gt;...&lt;br /&gt;ImageBase&lt;br /&gt;SectionAlignment       ; also e_lfanew&lt;br /&gt;FileAlignment&lt;br /&gt;...&lt;br /&gt;MajorSubsystemVersion&lt;br /&gt;...&lt;br /&gt;SizeOfImage&lt;br /&gt;SizeOfHeaders&lt;br /&gt;...&lt;br /&gt;Subsystem&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/PE/tinype.asm?r=179"&gt;source&lt;/a&gt; &lt;a href="http://corkami.googlecode.com/files/tinype.exe"&gt;binary&lt;/a&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;un TinyPE encore plus vide&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.phreedom.org/solar/code/tinype/"&gt;TinyPE&lt;/a&gt; est un projet impressionant, qui explique étape par étape comment faire un PE fonctionnel de 97 octets. Il montre aussi qu'on ne peut pas faire un PE plus petit, sans quoi &lt;span style="font-family: courier new;"&gt;IMAGE_OPTIONAL_HEADER32.Subsystem&lt;/span&gt;, qui est un champ critique, ne serait pas défini - il est d'ailleurs déjà réduit de mot à octet.&lt;br /&gt;&lt;br /&gt;Cependant, le TinyPE original défini encore une section et SizeOfOptionalHeader, qui ne sont pas nécessaires.&lt;br /&gt;Les enlever fait un PE non seulement ridicule, mais aussi avec une quantité d'information très faible - pourtant il fonctionne, bien évidemment, et laisse relativement pas mal de place pour y mettre du code.&lt;br /&gt;Au final, voici les seuls champs définis, parmi tous ceux des en-têtes de PE:&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;.e_magic&lt;br /&gt;...&lt;br /&gt;NT_SIGNATURE&lt;br /&gt;...&lt;br /&gt;Machine&lt;br /&gt;...&lt;br /&gt;Characteristics&lt;br /&gt;Magic&lt;br /&gt;...&lt;br /&gt;AddressOfEntryPoint&lt;br /&gt;...&lt;br /&gt;ImageBase&lt;br /&gt;SectionAlignment       ; also e_lfanew&lt;br /&gt;FileAlignment&lt;br /&gt;...&lt;br /&gt;MajorSubsystemVersion&lt;br /&gt;...&lt;br /&gt;SizeOfImage&lt;br /&gt;SizeOfHeaders&lt;br /&gt;...&lt;br /&gt;Subsystem&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/PE/tinype.asm?r=179"&gt;source&lt;/a&gt; &lt;a href="http://corkami.googlecode.com/files/tinype.exe"&gt;binaire&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-4744797252341799294?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/4744797252341799294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/03/you-cant-hide-nowhere-with-torchlight.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4744797252341799294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4744797252341799294'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/03/you-cant-hide-nowhere-with-torchlight.html' title='You can&apos;t hide nowhere, with the torchlight on'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-8105285561935732217</id><published>2010-03-03T21:33:00.000Z</published><updated>2010-03-03T21:33:00.186Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='anti'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Si c'est ton corps qui bouge, c'est ton coeur qui fait tout</title><content type='html'>&lt;span style="font-style: italic;"&gt;Getting the current EIP&lt;/span&gt;&lt;br /&gt;While standard code starts at a fixed address, there are several cases when your code needs to know its current IP:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;after a vulnerability has been triggered, shellcodes can't know in advance where they are executing exactly&lt;/li&gt;&lt;li&gt;packers often allocates a buffer and decompress their next layer of code, which will likely need to locate itself at some point&lt;/li&gt;&lt;li&gt;relocating code is a good way to avoid breakpoints: same code, somewhere else&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Thus, I'll enumerate ways to get your current EIP, in a file, on which you can test your emulator or debugger.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Call/Pop&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since Calls push the next address on the stack, you just need to grab it with a POP and will get the current address. Since a standard &lt;span style="font-family:courier new;"&gt;E8 call&lt;/span&gt; is encoded on 5 bytes, such a 'next line' call is often written &lt;span style="font-family:'courier new';"&gt;CALL $ + 5&lt;/span&gt;.&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;    call $ + 5&lt;br /&gt;after_call:&lt;br /&gt;    pop edx&lt;br /&gt;    cmp edx, after_call&lt;br /&gt;    jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;FPU&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;the FPU knows the address of the last executed fpu instruction. so, to get the current IP, use any FPU opcode - even &lt;span style="font-family:courier new;"&gt;FNOP&lt;/span&gt; - then store the FPU environment in memory via &lt;span style="font-family:courier new;"&gt;F(N)STENV&lt;/span&gt;:&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;_fpu:&lt;br /&gt;    fnop&lt;br /&gt;    fnstenv [fpuenv]&lt;br /&gt;    mov edx,[fpuenv.DataPointer]&lt;br /&gt;    cmp edx, _fpu&lt;br /&gt;    jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Interrupts&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Interrupts 2C and 2E will put into EDX the next address. If you step on it with a debugger, it will probably not work correctly&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;    int 02eh&lt;br /&gt;after_int:&lt;br /&gt;    cmp edx, after_int&lt;br /&gt;    jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Exceptions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When an exception is triggered, the context of the trigger will be put on the stack, so it's possible to know the address of the trigger this way:&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;handler:&lt;br /&gt;    mov eax, [esp + 0ch]&lt;br /&gt;    cmp dword [eax + 0b8h], address&lt;br /&gt;    jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Most exceptions are triggered before executing an incorrect line:&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;    xor eax, eax&lt;br /&gt;_on_the_instruction:&lt;br /&gt;    mov [eax], eax&lt;/blockquote&gt;&lt;br /&gt;Some exceptions are triggered AFTER executing an instruction that launched them (on purpose):&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;    db 0f1h   ; IceBP&lt;br /&gt;_trigger_after_execution&lt;br /&gt;&lt;/blockquote&gt;And then some exceptions are triggered the instruction after, to enable stepping:&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;    push 302h&lt;br /&gt;    popf&lt;br /&gt;    jmp bad&lt;br /&gt;_after bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Have fun! If I missed something, drop a comment!&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/getip.exe"&gt;Binary&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/asm/getip.asm?r=179"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Obtenir l'EIP courant&lt;/span&gt;&lt;br /&gt;Alors que du code standard commence d'habitude à une adresse fixée, il y a plusieurs cas où votre code a besoin de savoir son adresse courante:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;après qu'une vulnérabilité soit exploitée, les &lt;i&gt;shellcodes&lt;/i&gt; ne peuvent pas savoir à l'avance où ils s'exécutent exactement&lt;/li&gt;&lt;li&gt;les packeurs allouent souvent une mémoire tampon et y décompressent leur couche de code suivante, qui aura besoin de savoir sa propre adresse&lt;/li&gt;&lt;li&gt;déplacer du code est une façon facile de contourner les points d'arrêt: même code, mais autre part&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Je vais donc énumérer les méthodes existantes dans un fichier qui vous permettra de vérifier le comportement correct de votre émulateur ou débogueur.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Call/Pop&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Puisque les instructions de type Calls mettent l'adresse suivante sur la pile, on a juste besoin de la récupérer avec un &lt;span style="font-family:'courier new';"&gt;POP&lt;/span&gt;. Et puisque un &lt;span style="font-family:'courier new';"&gt;E8 call&lt;/span&gt; standard est encodé sur 5 octets, un tel 'appelle la ligne suivante' est souvent écrit &lt;span style="font-family:'courier new';"&gt;CALL $ + 5&lt;/span&gt;.&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;    call $ + 5&lt;br /&gt;after_call:&lt;br /&gt;    pop edx&lt;br /&gt;    cmp edx, after_call&lt;br /&gt;    jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;FPU&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Le coprocesseur arithmétique sait à quelle adresse a eu lieu la dernière instruction FPU. Donc, pour obtenir l'adresse courante, utilisez n'importe quel instruction FPU - même &lt;span style="font-family:'courier new';"&gt;FNOP&lt;/span&gt; - et ensuite stockez l'environnement FPU en mémoire via &lt;span style="font-family:'courier new';"&gt;F(N)STENV&lt;/span&gt; :&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;_fpu:&lt;br /&gt;    fnop&lt;br /&gt;    fnstenv [fpuenv]&lt;br /&gt;    mov edx,[fpuenv.DataPointer]&lt;br /&gt;    cmp edx, _fpu&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Interruptions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Les interrupts 2C et 2E mettrons dans EDX l'adresse suivante. Si vous êtes en pas-à-pas avec un débogueur, cela ne marchera probablement pas.&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;    int 02eh&lt;br /&gt;after_int:&lt;br /&gt;    cmp edx, after_int&lt;br /&gt;    jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Exceptions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Quand une exception est déclenchée, le contexte lors du déclenchement est stocké dans la pile, donc il est possible de savoir l'adresse de cette façon.&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;handler:&lt;br /&gt;    mov eax, [esp + 0ch]&lt;br /&gt;    cmp dword [eax + 0b8h], adresse&lt;br /&gt;    jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;La plupart des exceptions sont déclenchées avant l'exécution d'une ligne incorrecte :&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;    xor eax, eax&lt;br /&gt;_on_the_instruction:&lt;br /&gt;    mov [eax], eax&lt;/blockquote&gt;&lt;br /&gt;Certaines seront déclenchées APRÈS une instruction qui les a appelée (volontairement) :&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;    db 0f1h   ; IceBP&lt;br /&gt;_trigger_after_execution&lt;br /&gt;&lt;/blockquote&gt;Et enfin, certaines exceptions sont déclenchées après l'instruction SUIVANTE, pour permettre le pas-à-pas logiciel :&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;    push 302h&lt;br /&gt;    popf&lt;br /&gt;    jmp bad&lt;br /&gt;_after bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Amusez-vous bien ! Si j'ai oublié quelque chose, laissez-moi un commentaire !&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/getip.exe"&gt;Binaire&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/asm/getip.asm?r=179"&gt;Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-8105285561935732217?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/8105285561935732217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/03/si-cest-ton-corps-qui-bouge-cest-ton.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8105285561935732217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8105285561935732217'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/03/si-cest-ton-corps-qui-bouge-cest-ton.html' title='Si c&apos;est ton corps qui bouge, c&apos;est ton coeur qui fait tout'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-9080298862554179625</id><published>2010-03-01T22:01:00.003Z</published><updated>2010-12-12T20:31:27.270Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>no, I'm your father</title><content type='html'>&lt;span style="font-style:italic;"&gt;misc news&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Opcodes 'complete'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;my &lt;a href="http://corkami.blogspot.com/2010/01/when-cpus-have-too-many-opcodes.html"&gt;file&lt;/a&gt; listing all known 32 bits opcodes is almost done: everything documented should be in (including AVX, XOP, Padlock, LWP), and 99% of undocumented stuff I can think of is in (to be blogged later)&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/asm/opcodes32.asm?r=191"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Packers graph now printable&lt;/span&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;I updated my &lt;a href="http://corkami.blogspot.com/2010/02/none-can-outrun-or-equal-power-of.html"&gt;packer's landscape graph&lt;/a&gt;, with a few fixes, and now printable. (tbbl) &lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;PDF&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;MakePE : Exports, Relocs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In order to make custom PE myself, I generate the structure manually. However, it would be very annoying to generate manually everything everytime, so my &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/makepe.py?r=180"&gt;MakePE&lt;/a&gt; script makes it easy to generate, for example, an import table. It's just an ASM pre-processor.&lt;br /&gt;As I just added support for exports and relocations, this piece of code would generate a complete export entry in a DLL:&lt;blockquote style="white-space:pre;font-family:courier new;"&gt;;%EXPORT DbgPrint&lt;br /&gt;    mov ebx, [esp+4]&lt;br /&gt;    push MB_ICONINFORMATION ; UINT uType&lt;br /&gt;;%reloc 1&lt;br /&gt;    push Driver             ; LPCTSTR lpCaption&lt;br /&gt;...&lt;br /&gt;;%reloc 2&lt;br /&gt;;%IMPORT user32.dll!MessageBoxA&lt;br /&gt;&lt;br /&gt;;%IMPORTS&lt;br /&gt;;%EXPORTS dll.dll&lt;br /&gt;;%relocs&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Blog Map&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I created a separate &lt;a href="http://corkami.blogspot.com/p/map.html"&gt;page&lt;/a&gt; (updates won't be mentioned in the RSS feed) to make it easier to find older blog entries. It will also tell you what I plan to blog on - and might be already in the source repository.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;PE headers graph&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since its &lt;a href="http://corkami.blogspot.com/2010/01/din-nebunia-de-culori-vreau-sa-aleg-si.html"&gt;initial release&lt;/a&gt;, I did minor changes to my PE headers' &lt;a href="http://corkami.googlecode.com/files/pe.pdf"&gt;graph&lt;/a&gt;, with a lighter layout and 64 bits information.&lt;br /&gt;&lt;br /&gt;&lt;hr/&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;nouvelles diverses&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Opcodes 'complet'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Mon &lt;a href="http://corkami.blogspot.com/2010/01/when-cpus-have-too-many-opcodes.html"&gt;fichier&lt;/a&gt; qui énumère tous les opcodes 32 bits est presque fini: tout ce qui est documenté devrait y être (y compris AVX, XOP, Padlock, LWP), et 99% de ce qui n'est pas documenté devrait y être (j'en reparlerais dans un billet dédié).&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/asm/opcodes32.asm?r=191"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;graph sur les Packers: imprimable&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;J'ai mis à jour mon &lt;a href="http://corkami.blogspot.com/2010/02/none-can-outrun-or-equal-power-of.html"&gt;graph sur le monde des packeurs&lt;/a&gt;, avec quelques correctifs, et il est maintenant imprimable (billet à venir) &lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;PDF&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;MakePE : Exports, Relocs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Pour faire des PE spéciaux, je génère la structure à la main. Ça serait néanmoins très répétitif de tout générer à chaque fois, donc mon script &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/makepe.py?r=180"&gt;MakePE&lt;/a&gt; permet de générer facilement, par exemple, une table d'import. C'est juste un préprocesseur pour fichier assembleur.&lt;br /&gt;Comme je viens d'ajouter la gestion des exports et des relocations, ce bout de code génère un export complet dans une DLL :&lt;br /&gt;&lt;blockquote style="white-space:pre;font-family:courier new;"&gt;;%EXPORT DbgPrint&lt;br /&gt;    mov ebx, [esp+4]&lt;br /&gt;    push MB_ICONINFORMATION ; UINT uType&lt;br /&gt;;%reloc 1&lt;br /&gt;    push Driver             ; LPCTSTR lpCaption&lt;br /&gt;...&lt;br /&gt;;%reloc 2&lt;br /&gt;;%IMPORT user32.dll!MessageBoxA&lt;br /&gt;&lt;br /&gt;;%IMPORTS&lt;br /&gt;;%EXPORTS dll.dll&lt;br /&gt;;%relocs&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Carte du blog&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;J'ai créé une &lt;a href="http://corkami.blogspot.com/p/map.html"&gt;page&lt;/a&gt; séparée (les changements ne seront pas mentionnés dans le flux RSS) pour pouvoir retrouver facilement des vieilles entrées du blog. Ça vous montrera aussi ce sur quoi j'ai l'intention d'écrire - et qui est peut-être déjà dans le dépôt du source.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;graphe: en-têtes PE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Depuis sa &lt;a href="http://corkami.blogspot.com/2010/01/din-nebunia-de-culori-vreau-sa-aleg-si.html"&gt;diffusion initiale&lt;/a&gt;, j'ai fait quelques changements mineurs dans mon &lt;a href="http://corkami.googlecode.com/files/pe.pdf"&gt;graphe&lt;/a&gt; sur les en-têtes du PE, avec une mise en page plus légère et les informations 64 bits.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-9080298862554179625?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/9080298862554179625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/03/no-im-your-father.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/9080298862554179625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/9080298862554179625'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/03/no-im-your-father.html' title='no, I&apos;m your father'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-4253519363598297516</id><published>2010-02-28T23:11:00.001Z</published><updated>2010-03-02T22:09:44.084Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='seh'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='anti'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>And when I start to come undone, stitch me together</title><content type='html'>&lt;span style="font-style:italic;"&gt;Exception triggers&lt;/span&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms680657(VS.85).aspx"&gt;Structured Exceptions Handling&lt;/a&gt; is a complex mechanism that makes many anti-debuggers / anti-emulators possible. After setting a handler (check &lt;a href="http://vxheavens.com/lib/vrg03.html"&gt;Subtle SEH&lt;/a&gt; for exotic ways, but never used in the wild), you trigger the exception. And typically, packers rely blindly on the trigger itself, such as the actual error code: in short, trigger the wrong exception, and execution will fail (tampering is deected).&lt;br /&gt;The most common ones are:&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;Int3          BREAKPOINT       080000003h&lt;br /&gt;mov [0], ...  ACCESS_VIOLATION 0c0000005h&lt;br /&gt;&lt;/blockquote&gt;But what about the rest?&lt;br /&gt;&lt;br /&gt;I put together common exception triggers. There is no point listing all of them and all possible triggers, just common ones found in packers or malware, or the ones with a non-obvious behavior.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Access violation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is probably the most common one, as it can happen 'naturally'. Access a wrong address, and it will trigger. Note that would also happen on trying to write a readonly address.&lt;br /&gt;Also, most interrupts, including &lt;span style="font-family:courier new;"&gt;CD01 Int 1&lt;/span&gt; and &lt;span style="font-family:courier new;"&gt;CD20 int 20h&lt;/span&gt;, will trigger this exception. This is different from &lt;span style="font-family:courier new;"&gt;F1 IceBP&lt;/span&gt;, which is sometimes written &lt;span style="font-family:courier new;"&gt;Int1&lt;/span&gt;, and triggers a Single step exception, and Int 20h used to be for &lt;span style="font-family:courier new;"&gt;VxdCalls&lt;/span&gt; under Windows 9x, so this is not relevant today anymore.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To be exact, all interrupts 00-FFh, except 3, 4, 2A-2E, trigger this exception.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Breakpoint&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One of the most common, as it's triggered by &lt;span style="font-family:courier new;"&gt;CC Int3&lt;/span&gt;. It's also triggered by it's double bytes counterpart &lt;span style="font-family:courier new;"&gt;CD03 Int 3&lt;/span&gt;. &lt;br /&gt;It's also triggered by &lt;span style="font-family:courier new;"&gt;CD2D Int 2Dh&lt;/span&gt;, but that one is special: no exception is triggered if a debugger is present, which makes it a stealth anti-debug. It's quite interesting to see that one with your own debugger, the best way to avoid it is to patch it with another Breakpoint trigger like CC. However, a packer using this trick will likely check the bytes that triggered the exception, so pay attention ;)&lt;br /&gt;Last, calling the API &lt;span style="font-family:courier new;"&gt;kernel32.dll!DebugBreak&lt;/span&gt;, does, as expected, execute an Int3. This is just the 'clean' way to trigger a breakpoint exception.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Page guard violation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Similar to access violation, this exception can be triggered by accessing an address with the PAGE_GUARD memory protection. However, this is the technic that OllyDbg itself uses for software memory breakpoint, so OllyDbg will just stop and give a message&lt;blockquote style="white-space:pre;font-family:courier new;"&gt;Break-on-access when executing [....]&lt;/blockquote&gt;instead of offering you to skip the exception as usual &lt;blockquote style="white-space:pre;font-family:courier new;"&gt;Use Shift+F7/F8/F9 to pass exception to program&lt;/blockquote&gt;, which makes things annoying.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Privileged Instruction&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That one is quite straightfoward. Typically it's triggered with opcodes such as &lt;span style="font-family:courier new;"&gt;F4 HLT&lt;/span&gt;, &lt;span style="font-family:courier new;"&gt;FA cli&lt;/span&gt;, &lt;span style="font-family:courier new;"&gt;FB sti&lt;/span&gt;. If you're debugging a driver in user mode, operations such as accessing &lt;span style="font-family:courier new;"&gt;0F20C0 mov eax,cr0&lt;/span&gt; will trigger it. And the classic anti-vmware &lt;span style="font-family:courier new;"&gt;in 'VMXh', 'VX'&lt;/span&gt; will trigger it, if not in vmware.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Single step&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Single step exception occurs AFTER the 'undocumented' &lt;span style="font-family:courier new;"&gt;F1 IceBP/Int1&lt;/span&gt;. The other ways to trigger is using the hardware breakpoints - but that's worth a dedicated blog entry - and setting TF, the trap flag (100h in EFLAGS), via &lt;span style="font-family:courier new;"&gt;9d popf&lt;/span&gt; or an context change (exception, SetContext). In the case of TF, the exception is triggered after the FOLLOWING instruction is executed, which makes you think nothing happens while stepping. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Invalid Handle&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Invalid Handle is triggered when an API is called with an invalid handle, and is usually handled internally by the system. However, OllyDbg fails to skip it - even if you explicitly bypass it - so it makes it an easy anti-ollydbg. Using OllyAdvanced or a similar plugin will help to fix the problem.&lt;br /&gt;This exception is usually triggered by &lt;span style="font-family:courier new;"&gt;kernel32.dll!CloseHandle&lt;/span&gt;, but there are many other possibilities such as &lt;span style="font-family:courier new;"&gt;advapi32.dll!RegCloseKey&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Invalid lock sequence&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;F0 Lock&lt;/span&gt; is a prefix that can only be used on specific opcodes (add/xadd/adc/or/and/sub/sbb/xchg/dec/inc/not/neg (*NOT* mov!), btr/btc/bts (not bt), cmpxchg/cmpxchg8b), and on memory operands only, so using it on even a &lt;span style="font-family:courier new;"&gt;F090 lock: nop&lt;/span&gt; will trigger an exception, or a &lt;span style="font-family:courier new;"&gt;F000c0 lock: add eax, eax&lt;/span&gt;.&lt;br /&gt;it also became famous for crashing Pentium CPUs via &lt;span style="font-family:courier new;"&gt;f00fc7c8 lock:cmpxchg8b eax&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Integer overflow&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Integer overflow is a standard exception that can be triggered on typical arithmetical operations, such as DIV, but also by &lt;span style="font-family:courier new;"&gt;CD04 int 4&lt;/span&gt; - the only interrupt to do so - and &lt;span style="font-family:courier new;"&gt;CE into&lt;/span&gt;, which triggers on OF, which is the only conditional interrupt.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;the File&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/asm/seh_triggers.asm?spec=svn192&amp;r=192"&gt;file&lt;/a&gt; itself implements all these triggers and exceptions. Because of the Int2D/Page Guard/CloseHandle, it will not run easily under a naked OllyDbg. And All interrupts are generated and triggered, so it triggers in total 264 exceptions.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/seh_triggers.zip"&gt;Binary&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Let me know if I missed a trigger that is commonly used as an anti-analysis.&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;déclencheurs d'exceptions&lt;/span&gt;&lt;br /&gt;les SEH (&lt;a href="http://msdn.microsoft.com/en-us/library/ms680657(VS.85).aspx"&gt;Structured Exceptions Handling&lt;/a&gt;) sont un mécanisme complexe qui permet beaucoup d'anti-débogueurs/anti-émulateurs. Après avoir défini le handler (voir &lt;a href="http://vxheavens.com/lib/vrg03.html"&gt;Subtle SEH&lt;/a&gt; pour des façons exotiques mais jamais utilisées en vrai), on peut déclencher l'exception. Et en général, les packeurs utilisent directement les caractéristiques du déclenchement lui-même, tel que son code d'erreur: en raccourci, déclenchez la mauvaise exception, et l'exécution échouera (quelque chose d'anormal a été détecté).&lt;br /&gt;Les plus communs sont :&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;Int3          BREAKPOINT       080000003h&lt;br /&gt;mov [0], ...  ACCESS_VIOLATION 0c0000005h&lt;br /&gt;&lt;/blockquote&gt;Mais qu'en est-il du reste ?&lt;br /&gt;&lt;br /&gt;J'ai rassemblé les déclenchements d'exception répandus. Il n'y a pas d'interêt à les énumérer tous, donc juste ceux qu'on trouve communément dans les packeurs et les malwares, ou ceux dont le comportement est inattendu.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Access violation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;C'est probablement le plus répandu, puisqu'il peut arriver 'naturellement'. Accédez à une adresse inexistante, et cela déclenchera. Cela se produit aussi si on essaie d'écrire à une adresse en lecture seule.&lt;br /&gt;De même, la plupart des interruptions, y compris &lt;span style="font-family:courier new;"&gt;CD01 Int 1&lt;/span&gt; et &lt;span style="font-family:courier new;"&gt;CD20 int 20h&lt;/span&gt;, vont déclencher cette exception. C'est différent de &lt;span style="font-family:courier new;"&gt;F1 IceBP&lt;/span&gt;, parfois écrit &lt;span style="font-family:courier new;"&gt;Int1&lt;/span&gt; et qui déclenche une exception Single Step, et Int 20h était avant utilisée pour les &lt;span style="font-family:courier new;"&gt;VxdCalls&lt;/span&gt; sous Windows 9X, ce qui n'est plus d'actualité.&lt;br /&gt;&lt;br /&gt;Pour être exact, toutes les interruptions de 0 à FFh, exceptées 3, 4, 2A-2E, déclenche cette exception.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Breakpoint&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Une des plus communes, puisqu'elle est déclenchée par le point d'arrêt logiciel, &lt;span style="font-family:courier new;"&gt;CC Int3&lt;/span&gt;. Elle est aussi déclenchée par son équivalent sur 2 octets, &lt;span style="font-family:courier new;"&gt;CD03 Int 3&lt;/span&gt;. &lt;br /&gt;Elle est aussi déclenchée par l'interruption &lt;span style="font-family:courier new;"&gt;CD2D Int 2Dh&lt;/span&gt;, mais celle-ci est spéciale: aucune exception n'est déclenchée si un débogueur est présent, ce qui en fait un anti-débogueur silencieux. C'est plutôt intéressant à voir sous son propre débogueur, et la meilleure façon de l'éviter est de patcher avec un autre déclencheur de Breakpoint tel que CC. Cependant, un packeur utilisant cette astuce vérifiera les octets originaux dès que possible, donc gardez l'oeil ouvert ;)&lt;br /&gt;Enfin, appeler l'API &lt;span style="font-family:courier new;"&gt;kernel32.dll!DebugBreak&lt;/span&gt; fera, comme on si attend, exécuter une Int3. C'est la façon propre de déclencher une exception de type Breakpoint.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Page guard violation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Un peu comme l'exception 'access violation', cette exception sera déclenchée en accédant à une adresse qui est protégé par l'accès PAGE_GUARD. Par contre, c'est la technique qu'OllyDbg lui-même utilise pour les points d'arrêts mémoire logiciel, donc OllyDbg s'arrêtera tout simplement en donnant le message &lt;blockquote style="white-space:pre;font-family:courier new;"&gt;Break-on-access when executing [....]&lt;/blockquote&gt;plutôt que l'habituel &lt;blockquote style="white-space:pre;font-family:courier new;"&gt;Use Shift+F7/F8/F9 to pass exception to program&lt;/blockquote&gt;ce qui complique les choses.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Privileged Instruction&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Cette exception est directe: d'habitude, elle est déclenchee par des opcodes tels que &lt;span style="font-family:courier new;"&gt;F4 HLT&lt;/span&gt;, &lt;span style="font-family:courier new;"&gt;FA cli&lt;/span&gt;, &lt;span style="font-family:courier new;"&gt;FB sti&lt;/span&gt;. Si vous déboguez un driver en mode utilisateur, des opérations tels qu'accéder à cr0 (&lt;span style="font-family:courier new;"&gt;0F20C0 mov eax,cr0&lt;/span&gt;) la déclencheront. Et l'anti-vmware classique &lt;span style="font-family:courier new;"&gt;in 'VMXh', 'VX'&lt;/span&gt; la déclenchera - si on n'est pas sous VmWare.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Single step&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;L'exception Single step se produit APRÈS l'opcode 'non documenté &lt;span style="font-family:courier new;"&gt;F1 IceBP/Int1&lt;/span&gt;. L'autre manière de la déclencher est les points-d'arrêts matériels - mais ça justifie un billet dans ce blog à eux seuls - et lever le drapeau TF, appelé trap flag (100h dans EFLAGS), via &lt;span style="font-family:courier new;"&gt;9d popf&lt;/span&gt; ou un changement de contexte (exception, SetContext). Dans le cas de TF, l'exception sera déclenchée après l'exécution de l'instruction SUIVANTE, ce qui laisse penser que rien ne se produit lors de l'exécution pas à pas: popf - exécution - exception !&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Invalid Handle&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Invalid Handle est déclenchée quand une API est appelée avec un handle invalide, et est gérée par le système en interne. Cependant, OllyDbg n'arrive pas à la passer silencieusement - même si on l'a bien précisée dans les options - ce qui en fait un anti-Ollydbg facile. Utiliser OllyAdvanced ou un plug-in similaire pourra résoudre ce problème.&lt;br /&gt;Cette exception est déclenchée d'habitude par &lt;span style="font-family:courier new;"&gt;kernel32.dll!CloseHandle&lt;/span&gt;, mais il y a beaucoup d'autres possibilités telles que &lt;span style="font-family:courier new;"&gt;advapi32.dll!RegCloseKey&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Invalid lock sequence&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;F0 Lock&lt;/span&gt; est un préfixe qui ne peut être utilisé que certains opcodes spécifiques (add/xadd/adc/or/and/sub/sbb/xchg/dec/inc/not/neg (*PAS* mov!), btr/btc/bts (PAS bt), cmpxchg/cmpxchg8b), et sur la mémoire uniquement, donc même un innocent &lt;span style="font-family:courier new;"&gt;F090 lock: nop&lt;/span&gt; va déclencher l'exception, de même qu'un &lt;span style="font-family:courier new;"&gt;F000c0 lock: add eax, eax&lt;/span&gt;.&lt;br /&gt;Il est aussi devenu célèbre pour faire planter les processeurs Pentiums via &lt;span style="font-family:courier new;"&gt;f00fc7c8 lock:cmpxchg8b eax&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Integer overflow&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Integer overflow est une exception pouvant être déclenchée par une opération arithmétique standard telle que DIV, mais aussi par &lt;span style="font-family:courier new;"&gt;CD04 int 4&lt;/span&gt; - la seule interruption à le faire - et &lt;span style="font-family:courier new;"&gt;CE into&lt;/span&gt;, qui déclenche sur le drapeau OF, qui est la seule interruption conditionnelle.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;le fichier&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Le &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/asm/seh_triggers.asm?spec=svn192&amp;r=192"&gt;fichier&lt;/a&gt; implémente tous ces déclencheurs et exceptions. À cause des Int2D/Page Guard/CloseHandle, il ne tournera pas directement sous un OllyDbg nu. Et, comme toutes les interruptions sont générées et déclenchées, il déclenchera au total 264 exceptions.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/seh_triggers.zip"&gt;Binaire&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;N'hésitez pas à me signaler si j'ai oublié une exception ou un déclencheur particulier, utilisé comme anti-analyse.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-4253519363598297516?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/4253519363598297516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/02/and-when-i-start-to-come-undone-stitch.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4253519363598297516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4253519363598297516'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/02/and-when-i-start-to-come-undone-stitch.html' title='And when I start to come undone, stitch me together'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-8455939040717678663</id><published>2010-02-26T22:58:00.002Z</published><updated>2010-02-26T22:58:00.078Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='irl'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>I have legalised robbery - called it belief</title><content type='html'>&lt;span style="font-style:italic;"&gt;Real life security (fails?)&lt;/span&gt;&lt;br /&gt;How secure is your network if your front door is wide open?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Lock&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Like software protection (and, say, virtualization), a different design in locks can bring added protection and extra features. If you are interested in your own front door security, I advise reading about the fascinating &lt;a href="http://images.google.com/images?q=drumm%20geminy%20lock"&gt;Geminy Lock&lt;/a&gt; and &lt;a href="http://images.google.ie/images?q=abloy%20key"&gt;Abloy&lt;/a&gt; articles &lt;a href="http://toool.nl/Articles_by_Han_Fey"&gt;here&lt;/a&gt;. It's impressive to see that a Geminy withstood more than 30 minutes of continuous attacks, and that an Abloy can have 2 different keys (one to open and one to close).&lt;br /&gt;Also, even more fascinating (analysed in the 'Abloy special products' PDF), the Rosengrens RKL-10, which is resettable: lost your keys? order a new set and reset the lock! But this unique feature doesn't make it necessarily weaker.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Hotel room&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Following the video about the Dubai assassination, &lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="412" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/4267205001?isVid=1&amp;publisherID=1543367581" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=66672644001&amp;playerID=4267205001&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/4267205001?isVid=1&amp;publisherID=1543367581" bgcolor="#FFFFFF" flashVars="videoId=66672644001&amp;playerID=4267205001&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="412" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;,&lt;br /&gt;Barry Wels &lt;a href="http://blackbag.nl/?p=1269"&gt;blogged&lt;/a&gt; to enlighten us: this video shows you don't need to be a hacker to enter a hotel room:&lt;br /&gt;&lt;object width="560" height="340"&gt;&lt;param name="movie" value="http://www.youtube.com/v/WAkJRpKeyYg&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/WAkJRpKeyYg&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;House alarm&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I was personally quite shocked to discover that disabling a (standard) house alarm doesn't need any special tool (no security screw or anything, just tampering detection), which proves that it doesn't really protect you from anything - except maybe your own insurance.&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;(Echec de ?) Sécurité dans la vie réelle&lt;/span&gt;&lt;br /&gt;Quelle est la securité de votre réseau si votre porte d'entrée est grande ouverte ?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Serrure&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Comme les protections logicielles (et, par exemple, la virtualisation), une conception différente de serrure peut améliorer la protection et apporter de nouvelles possibilités. Si vous êtes intéressés par la sécurité de votre propre porte d'entrée, je vous conseille de lire au sujet des fascinantes serrures &lt;a href="http://images.google.com/images?q=drumm%20geminy%20lock"&gt;Geminy&lt;/a&gt; et &lt;a href="http://images.google.ie/images?q=abloy%20key"&gt;Abloy&lt;/a&gt; &lt;a href="http://toool.nl/Articles_by_Han_Fey"&gt;ICI&lt;/a&gt;. C'est impressionant de voir que le Geminy ait pu tenir plus de 30 minutes d'attaques permanentes (sans céder ni devenir inutilisable), ou que le Abloy permette 2 clefs différentes (une pour ouvrir et une pour fermer).&lt;br /&gt;De même, encore plus fascinant, le Rosengrens RKL-10 (présenté dans le PDF 'Abloy special products'), qui est réinitialisable: vous avez perdu vos clefs ? achetez un nouveau trousseau et réinitialisez la serrure! mais cette possibilité unique ne l'a pas rendu plus vulnérable..&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Chambre d'hôtel&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;À la suite de la vidéo sur l'assassinat à Dubai, &lt;!-- more --&gt;&lt;br /&gt;&lt;object id="flashObj" width="486" height="412" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9/4267205001?isVid=1&amp;publisherID=1543367581" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;param name="flashVars" value="videoId=66672644001&amp;playerID=4267205001&amp;domain=embed&amp;" /&gt;&lt;param name="base" value="http://admin.brightcove.com" /&gt;&lt;param name="seamlesstabbing" value="false" /&gt;&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="swLiveConnect" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9/4267205001?isVid=1&amp;publisherID=1543367581" bgcolor="#FFFFFF" flashVars="videoId=66672644001&amp;playerID=4267205001&amp;domain=embed&amp;" base="http://admin.brightcove.com" name="flashObj" width="486" height="412" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" swLiveConnect="true" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;,&lt;br /&gt;Barry Wels &lt;a href="http://blackbag.nl/?p=1269"&gt;a écrit&lt;/a&gt; pour éclairer notre lanterne: cette vidéo montre qu'on n'a pas besoin d'être un hackeur pour pénétrer dans une chambre d'hôtel sans effraction:&lt;br /&gt;&lt;object width="560" height="340"&gt;&lt;param name="movie" value="http://www.youtube.com/v/WAkJRpKeyYg&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/WAkJRpKeyYg&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Alarme domestique&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;J'ai été personnellement plutôt choqué de découvrir que désactiver une alarme domestique (standard) ne nécessite aucun outil particulier (aucune vis de sécurité ni rien, juste une détection d'effraction, sûrement évitable ou annulable), ce qui prouve que ça ne protège pas vraiment de quoi que ce soit - à part peut-être de votre assurance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-8455939040717678663?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/8455939040717678663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/02/i-have-legalised-robbery-called-it.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8455939040717678663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8455939040717678663'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/02/i-have-legalised-robbery-called-it.html' title='I have legalised robbery - called it belief'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-3053339097798460639</id><published>2010-02-25T11:45:00.001Z</published><updated>2010-02-26T11:09:07.733Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='libdasm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Combien d'échecs avant que l'on comprenne? et d'autos brûlées, pour voter...</title><content type='html'>&lt;span style="font-style:italic;"&gt;Libdasm downloads&lt;/span&gt;&lt;br /&gt;I don't have much time lately for &lt;a href="http://code.google.com/p/libdasm/"&gt;Libdasm&lt;/a&gt;, but it's not a reason to ignore it totally.&lt;br /&gt;I think it was a bad idea to remove downloads (and binaries?), let me know what you think!&lt;br /&gt;On one hand, it's handy to just have source in one click, but on the other hand, I don't think it's that relevant to bundle binaries, &lt;br /&gt;because they depend on your compiler or OS, and if you code, well, you're likely to have the compiler (and it compiles quickly and easily).&lt;br /&gt;&lt;br /&gt;Let me know what you think, by commenting or replying in the &lt;a href="http://groups.google.com/group/libdasm"&gt;group&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the meantime I added the original archive, and the current source as downloads.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Téléchargements pour Libdasm&lt;/span&gt;&lt;br /&gt;Je n'ai pas beaucoup de temps à consacrer à &lt;a href="http://code.google.com/p/libdasm/"&gt;Libdasm&lt;/a&gt; ces temps-ci, mais ce n'est pas une raison de le laisser tomber dans l'oubli. Je pense que c'était une erreur de jugement de supprimer les téléchargements (et les binaires?), dites-moi ce que vous en pensez!&lt;br /&gt;D'un coté, c'est pratique d'avoir le source en un seul click, mais d'un autre coté, je ne pense pas que ça soit cohérent d'inclure les binaires, car ils dépendent de votre compilateur et OS, et si vous programmez, on s'attend à ce que vous ayez le compilateur (et libdasm se compile vite et bien).&lt;br /&gt;&lt;br /&gt;Dites-moi ce que vous en pensez, par exemple en laissant un commentaire.&lt;br /&gt;&lt;br /&gt;En attendant, j'ai mis à disposition la dernière version officielle, et le source de la version en cours.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-3053339097798460639?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/3053339097798460639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/02/combien-dechecs-avant-que-lon-comprenne.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3053339097798460639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3053339097798460639'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/02/combien-dechecs-avant-que-lon-comprenne.html' title='Combien d&apos;échecs avant que l&apos;on comprenne? et d&apos;autos brûlées, pour voter...'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-2942474471180537140</id><published>2010-02-23T23:54:00.008Z</published><updated>2010-12-12T20:23:44.878Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='packer'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>None can outrun or equal ... the power ... of Megablast</title><content type='html'>&lt;span style="font-style:italic;"&gt;a graphical representation of the packers landscape&lt;/span&gt;&lt;br /&gt;I created a graphical representation of the packers' landscape. It's certainly far from complete (could it ever be, honestly ?), but it might be useful to you.&lt;br /&gt;&lt;br /&gt;Comments are welcome!&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;PDF&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/graphs/packers_landscape.svg?r=147"&gt;svg&lt;/a&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;une représentation graphique du monde des packeurs&lt;/span&gt;&lt;br /&gt;J'ai fait une représentation graphique du monde des packeurs. Ce n'est sûrement pas complet (comment pourrait-ce l'être ?), mais ça peut vous être utile.&lt;br /&gt;&lt;br /&gt;Les commentaires sont les bienvenus.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/packers.pdf"&gt;PDF&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/graphs/packers_landscape.svg?r=147"&gt;svg&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-2942474471180537140?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/2942474471180537140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/02/none-can-outrun-or-equal-power-of.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2942474471180537140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2942474471180537140'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/02/none-can-outrun-or-equal-power-of.html' title='None can outrun or equal ... the power ... of Megablast'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-1304637079323121144</id><published>2010-02-17T21:57:00.004Z</published><updated>2010-02-25T09:28:57.410Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Just remember, it's not so long since you were young</title><content type='html'>&lt;span style="font-style:italic;"&gt;English only?&lt;/span&gt;&lt;br /&gt;I removed the previous poll since it looks like it was not worth it - my twitter will stay suspended ;)&lt;br /&gt;&lt;br /&gt;However, now I'm asking you if you're ok with this blog being bilingual, English first then French.&lt;br /&gt;It might annoy English reader, or fustrate french readers. Or maybe French readers only read the english part.&lt;br /&gt;the 3 possible conclusions of that poll would be:&lt;br /&gt;- keep as is&lt;br /&gt;- split french into another blog&lt;br /&gt;- remove french&lt;br /&gt;&lt;br /&gt;the poll is on your right.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Isoler le Français?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;J'ai enlevé le sondage précédent, il semble que ça n'en valait pas la peine - mon twitter restera inactif ;)&lt;br /&gt;&lt;br /&gt;Cependant, je vous demande maintenant si c'est bien que ce blog soit bilingue (Anglais puis Français): vous ne lisez que la partie anglaise ? l'anglais vous gène et vous aimeriez le français sur un blog indépendant ? faites-le savoir!&lt;br /&gt;Les 3 décisions envisagées à la suite de ce sondage sont :&lt;br /&gt;- garder tel quel&lt;br /&gt;- isoler le français dans un autre blog&lt;br /&gt;- supprimer le français&lt;br /&gt;&lt;br /&gt;le sondage est à votre droite sur la page.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-1304637079323121144?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/1304637079323121144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/02/english-and-french.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1304637079323121144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1304637079323121144'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/02/english-and-french.html' title='Just remember, it&apos;s not so long since you were young'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-3163494107085295735</id><published>2010-02-13T09:16:00.010Z</published><updated>2010-02-22T22:33:04.390Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>葉っぱ一枚あればいい</title><content type='html'>&lt;span style="font-style:italic;"&gt;Drivers in user-mode&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Ever wanted to trace a driver directly from OllyDbg, without the usual&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;Unable to start file 'driver.sys'&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Why&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I &lt;a href="http://corkami.blogspot.com/2010/01/shock-to-system.html"&gt;already&lt;/a&gt; introduced the basics of a driver, at PE level.&lt;br /&gt;It might be interesting to run a driver in user-mode, for example, to unpack it: &lt;br /&gt;On one hand, if a driver is packed, you just won't be able to quickly run and dump it the usual way, so you'd have to use a kernel debugger. &lt;br /&gt;On the other hand, typically, packed drivers unpack themselves with no or few API calls, no or few privileged instruction, which makes you think:&lt;br /&gt;'this is standard user-mode code that just runs inside a driver to unpack itself, if only I could just run it the usual way'.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Loading the driver&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But there are 2 things that prevent Driver.sys from loading under a user-mode debugger:&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;The Subsystem itself: the file will just refuse to load if it's Native, so just change that to Gui or Console, either manually or with a line of PEFile:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;p.OPTIONAL_HEADER.Subsystem = 2&lt;br /&gt;    # = pefile.SUBSYSTEM_TYPE['IMAGE_SUBSYSTEM_WINDOWS_GUI']&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Then, a driver will import ntoskrnl.exe, which will eventually fail in user-mode.&lt;br /&gt;If you don't need APIs - or can emulate them manually - the easiest solution is just to get rid of the imports altogether. Just delete the RVA of the Imports data directory - with PEFile, that translates as:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;p.OPTIONAL_HEADER.DATA_DIRECTORY[1].VirtualAddress = 0&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;So, now you have a driver, without imports - which means it won't be able to call any API - that will load in OllyDbg. Maybe that's enough to reach code after the unpacking stub - most kernel packers are not complex - and then get the original file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Further&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Even though ntoskrnl.exe is Native itself, it's loaded like any other file (from user-mode), so if you want to be able to run a few API calls in your driver, a solution is to create a fake ntoskrnl.exe, and emulate the required APIs.&lt;br /&gt;A normal file with exports and relocations will do.&lt;br /&gt;In my example, I redirected ntoskrnl.exe!DbgPrint to user32.dll!MessageBoxA, which makes the HelloWorld driver work directly from your explorer window.&lt;br /&gt;&lt;br /&gt;This turns the original kernel-level call&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;push helloworld&lt;br /&gt;call DbgPrint&lt;br /&gt;&lt;/blockquote&gt;into a standard MessageBoxA call&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;00400216  CALL to MessageBoxA from ntoskrnl.00400211&lt;br /&gt;00000000  hOwner = NULL&lt;br /&gt;00010215  Text = "Hello World!"&lt;br /&gt;00400217  Title = "User mode Ntoskrnl"&lt;br /&gt;00000040  Style = MB_OK|MB_ICONASTERISK|MB_APPLMODAL&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;However, after the Subsystem and the APIs, the extra problem is that the driver might use privileged instructions, such as&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;FB sti&lt;br /&gt;FA cli&lt;br /&gt;0F20C0 mov eax, cr0&lt;br /&gt;0F22C0 mov cr0, eax&lt;br /&gt;&lt;/blockquote&gt;Besides nopping each of them, there is no generic solution, as they might be obfuscated. A possible solution would be to load the executable with your own SEH, to skip such instructions (Exception: PRIVILEGED INSTRUCTION, 0C0000096h).&lt;br /&gt;I am not sure it's worth the trouble, if it gets too complicated, you're just better with a kernel debugger.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Detection&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Also, it's possible to detect if you're executed in user-mode (which is not the same as detecting kernel or user debuggers), for example by checking the value of CS:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;default CS under XP&lt;br /&gt;    user mode   1B&lt;br /&gt;    kernel mode  8&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;HelloWorld driver, Sys2Exe python script, fake Ntoskrnl&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/usermode_drivers.zip"&gt;Sources and binaries&lt;/a&gt;&lt;br /&gt;(compile with MakePE)&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Drivers en mode utilisateur&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Avez-vous déjà voulu analyser un driver directement depuis OllyDbg, sans l'habituel&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;Unable to start file 'driver.sys'&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Pourquoi&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;J'ai &lt;a href="http://corkami.blogspot.com/2010/01/shock-to-system.html"&gt;déjà&lt;/a&gt; parlé des bases des drivers, au niveau PE.&lt;br /&gt;Ça peut être interessant d'exécuter un driver en mode utilisateur, par exemple pour le décompresser :&lt;br /&gt;D'un coté, si le driver est packé, on ne peut pas le lancer et le dumper rapidement comme d'habitude, donc on devrait utiliser un débogueur noyau.&lt;br /&gt;D'un autre coté, la plupart du temps, les drivers packés se décompressent eux-même en n'utilisant aucune ou très peu d'APIs, aucune ou très peu d'instructions privilégiées, ce qui nous amène à penser:&lt;br /&gt;'C'est du code utilisateur normal, dans un driver. Si seulement je pouvais l'exécuter comme d'habitude'&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Charger un driver&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Mais il y a 2 choses qui empêchent Driver.sys de s'exécuter dans un débogueur utilisateur:&lt;br /&gt;Le Subsystem lui-même: le fichier refusera tout simplement de se charger s'il est &lt;span style="font-style:italic;"&gt;Native&lt;/span&gt;, donc changez le en &lt;span style="font-style:italic;"&gt;Gui&lt;/span&gt; ou &lt;span style="font-style:italic;"&gt;Console&lt;/span&gt;, manuellement ou avec une ligne de PEFile:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;p.OPTIONAL_HEADER.Subsystem = 2&lt;br /&gt;    # = pefile.SUBSYSTEM_TYPE['IMAGE_SUBSYSTEM_WINDOWS_GUI']&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Ensuite, le driver importe ntoskrnl.exe, ce qui finira par échouer en mode utilisateur.&lt;br /&gt;Si on n'a pas besoin des APIs - ou qu'on peut les simuler à la main - la solution la plus simple est de se débarasser directement des imports. Il suffit de supprimer la RVA du &lt;span style="font-style:italic;"&gt;data directory&lt;/span&gt; Imports - avec PEFile, cela donne:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;p.OPTIONAL_HEADER.DATA_DIRECTORY[1].VirtualAddress = 0&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Donc, on a maintenant un driver sans imports - donc qui ne pourra pas appeler d'API - qui marchera dans OllyDbg. Peut-être ça suffira pour atteindre le code après la décompression - la plupart des packeurs noyaux ne sont pas complexes - et d'obtenir le fichier original.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Un peu plus loin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Même si ntoskrnl.exe est lui-même &lt;span style="font-style:italic;"&gt;Native&lt;/span&gt;, il est chargé comme n'importe quel fichier (depuis le mode utilisateur), donc si on veut exécuter quelques appels API depuis notre driver, une solution est de créer un ntoskrnl.exe factice, qui émulera les APIs requises.&lt;br /&gt;Un fichier normal avec exports et relocations suffira.&lt;br /&gt;Dans mon exemple, j'ai redirigé ntoskrnl.exe!DbgPrint vers user32.dll!MessageBoxA, ce qui permet au driver HelloWorld de marcher directement depuis votre fenêtre d'explorateur.&lt;br /&gt;&lt;br /&gt;Cela change l'appel original au niveau noyau&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;push helloworld&lt;br /&gt;call DbgPrint&lt;br /&gt;&lt;/blockquote&gt;en un appel MessageBoxA standard&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;00400216  CALL to MessageBoxA from ntoskrnl.00400211&lt;br /&gt;00000000  hOwner = NULL&lt;br /&gt;00010215  Text = "Hello World!"&lt;br /&gt;00400217  Title = "User mode Ntoskrnl"&lt;br /&gt;00000040  Style = MB_OK|MB_ICONASTERISK|MB_APPLMODAL&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Cependant, après le Subsystem et les APIs, un problème possible est que le driver utilise des instructions privilégiées, telles que&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;FB sti&lt;br /&gt;FA cli&lt;br /&gt;0F20C0 mov eax, cr0&lt;br /&gt;0F22C0 mov cr0, eax&lt;br /&gt;&lt;/blockquote&gt;A part nopper chacune d'entre elles, il n'y a pas de solution générique, puisqu'elles pourraient être dissimulées. Une solution possible serait de charger l'exécutable avec votre propre SEH, pour sauter de telles instructions (Exception: PRIVILEGED INSTRUCTION, 0C0000096h).&lt;br /&gt;Je ne suis pas sûr que ça en vaille la peine, si ça devient trop compliqué, autant utiliser un débogueur noyau.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Détection&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;D'autre part, il est possible de détecter si on est exécuté en mode utilisateur - ce qui n'est pas la même chose de détecter un débogueur noyau ou utilisateur - par exemple en vérifiant la valeur de CS:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;valeur par défaut de CS, sous XP&lt;br /&gt;    niveau utilisateur 1B&lt;br /&gt;    niveau noyau        8&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;driver HelloWorld, script python Sys2Exe, Ntoskrnl factice&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/usermode_drivers.zip"&gt;Sources et binaires&lt;/a&gt;&lt;br /&gt;(compiler avec MakePE)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-3163494107085295735?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/3163494107085295735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/02/blog-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3163494107085295735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3163494107085295735'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/02/blog-post.html' title='葉っぱ一枚あればいい'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-6939399540939067468</id><published>2010-02-09T22:40:00.003Z</published><updated>2010-12-12T20:18:08.559Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Militant quotidien de l'inhumanité</title><content type='html'>&lt;span style="font-style:italic;"&gt;TLS and Imports&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When is an apparently incorrect TLS entry actually executing a file ?&lt;br /&gt;&lt;br /&gt;I &lt;a href="http://corkami.blogspot.com/2010/01/world-before-columbus.html"&gt;already&lt;/a&gt; introduced TLS:&lt;br /&gt;before execution of the Entrypoint, each callback is taken as is - since it's a VA - and executed, until a null entry or an exception occurs.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-large;"&gt;linked to Imports&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But if you make the callbacks point to one of the imports:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;AddressOfCallBacks    dd __imp__WinExec&lt;br /&gt;&lt;/blockquote&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;In the file, the import to WinExec will originally point to a Hint+Name structure:&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;WinExec:&lt;br /&gt;    jmp [__imp__WinExec]&lt;br /&gt;&lt;br /&gt;__imp__WinExec:&lt;br /&gt;    DD aWinExec - IMAGEBASE ; RVA&lt;br /&gt;    DD 0&lt;br /&gt;&lt;br /&gt;aWinExec:&lt;br /&gt;    dw 0            ; Hint&lt;br /&gt;    db 'WinExec',0  ; Name&lt;br /&gt;&lt;/blockquote&gt;so it doesn't look like it's a valid VA. At least, not yet.&lt;br /&gt;&lt;br /&gt;Once the file is loaded, it will points to the API.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;0040026C:&lt;br /&gt;    7C86250D  kernel32.WinExec&lt;br /&gt;&lt;/blockquote&gt;So it's 'now' a valid VA, and TLS execution will happen correctly. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-large;"&gt;Arguments&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You're calling an API, but you just don't control the parameters.&lt;br /&gt;If it's your own DLL, you could still do anything. In any case, the first parameter on the stack is actually the IMAGEBASE, which points to the start of the file. Thus, MZ... and nothing prevents this signature to be taken as a normal parameter:&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;EIP 7C86250D kernel32.WinExec&lt;/blockquote&gt;Stack:&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;7C90118A CALL to WinExec from ntdll.7C901187&lt;br /&gt;00400000 CmdLine = "MZ"&lt;br /&gt;00000001 ShowState = SW_SHOWNORMAL&lt;br /&gt;&lt;/blockquote&gt;(7C90118A corresponds to NtDLL's LdrInitializeThunk + 24, which is indeed TLS execution return)&lt;br /&gt;&lt;br /&gt;So, what will it do ? Execute a file named MZ. Or, if you modify the header a bit more, a file named MZsomething.&lt;br /&gt;&lt;br /&gt;Thus, with an obscure TLS entry, you get a free pre-entry point API call - here, a file execution.&lt;br /&gt;&lt;br /&gt;This is a funny trick by Peter Ferrie in his &lt;a href="http://corkami.blogspot.com/2010/01/world-before-columbus.html?showComment=1264192239236#c2772935458739470308"&gt;comment&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/tls_import.zip"&gt;Binary&lt;/a&gt; and &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/tls_import.asm?r=97"&gt;source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;TLS et Imports&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Quand est-ce qu'un TLS apparemment incorrect exécute correctement un fichier ?&lt;br /&gt;&lt;br /&gt;J'ai &lt;a href="http://corkami.blogspot.com/2010/01/world-before-columbus.html"&gt;déjà&lt;/a&gt; parlé du TLS:&lt;br /&gt;avant l'exécution de l'Entrypoint, chaque &lt;span style="font-style:italic;"&gt;callback&lt;/span&gt; est pris tel quel - puisque c'est une adresse virtuelle - et exécuté, jusqu'à une entrée nulle ou qu'une exception se produise.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-large;"&gt;TLS et imports&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Mais si on fait pointer un des &lt;span style="font-style:italic;"&gt;callbacks&lt;/span&gt; vers un des imports:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;AddressOfCallBacks    dd __imp__WinExec&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Dans le fichier, l'import vers WinExec pointe initialement vers une structure Hint+Name:&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;WinExec:&lt;br /&gt;    jmp [__imp__WinExec]&lt;br /&gt;&lt;br /&gt;__imp__WinExec:&lt;br /&gt;    DD aWinExec - IMAGEBASE ; RVA&lt;br /&gt;    DD 0&lt;br /&gt;&lt;br /&gt;aWinExec:&lt;br /&gt;    dw 0            ; Hint&lt;br /&gt;    db 'WinExec',0  ; Name&lt;br /&gt;&lt;/blockquote&gt;donc ça n'a pas l'air d'une VA valide. Du moins, pas pour l'instant.&lt;br /&gt;&lt;br /&gt;Une fois que le fichier sera chargé, cela pointera vers l'API en mémoire.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;0040026C:&lt;br /&gt;    7C86250D  kernel32.WinExec&lt;br /&gt;&lt;/blockquote&gt;Donc c'est 'à présent' une VA valide, et l'exécution du TLS se produira correctement. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-large;"&gt;Paramètres&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Vous appelez donc une API, sans contrôler les paramètres.&lt;br /&gt;Si c'est votre propre DLL, vous pouvez faire ce que vous voulez. Dans tous les cas, le premier paramètre sur la pile est l'IMAGEBASE, qui pointe vers le début du fichier. MZ, donc...et rien n'interdit cette signature d'être interprétée comme un paramètre normal:&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;EIP 7C86250D kernel32.WinExec&lt;/blockquote&gt;Stack:&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;7C90118A CALL to WinExec from ntdll.7C901187&lt;br /&gt;00400000 CmdLine = "MZ"&lt;br /&gt;00000001 ShowState = SW_SHOWNORMAL&lt;br /&gt;&lt;/blockquote&gt;(7C90118A correspond à NtDLL LdrInitializeThunk + 24, qui est effectivement le point de retour des TLS)&lt;br /&gt;&lt;br /&gt;Donc, que va-t-il se passer ? Un fichier nommé MZ sera exécuté. Ou, si on modifie l'en-tête, un fichier nommé MZquelquechose.&lt;br /&gt;&lt;br /&gt;Donc, avec un TLS bizarre, on obtient gratuitement un appel d'API avant l'EntryPoint - dans le cas présent, l'exécution d'un fichier.&lt;br /&gt;&lt;br /&gt;Merci à Peter Ferrie pour cette astuce dans son &lt;a href="http://corkami.blogspot.com/2010/01/world-before-columbus.html?showComment=1264192239236#c2772935458739470308"&gt;commentaire&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/tls_import.zip"&gt;Binaire&lt;/a&gt; et &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/tls_import.asm?r=97"&gt;source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-6939399540939067468?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/6939399540939067468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/02/militant-quotidien-de-linhumanite.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6939399540939067468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6939399540939067468'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/02/militant-quotidien-de-linhumanite.html' title='Militant quotidien de l&apos;inhumanité'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-6677885551812190058</id><published>2010-02-08T22:17:00.004Z</published><updated>2010-12-12T20:14:53.470Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='obfuscation'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>If you want to strike me down in anger</title><content type='html'>&lt;span style="font-style:italic;"&gt;Messing with loops&lt;/span&gt;&lt;br /&gt;Do you understand these snippets?&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;setz ah            setnz cl&lt;br /&gt;aad 11             xor eax, eax&lt;br /&gt;add eax,04000f3    mov fs:[eax], esp&lt;br /&gt;jmp eax            ror cl, 01&lt;br /&gt;                   into&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;the problem&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When reversing a program, fast forwarding by skipping loops is important - no one wants to step through each iteration. Also, detecting loop behavior is important in emulators, especially when extra loops are inserted to make them time out.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Let's take a simple example:&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;If you want to reset ECX and artificially create unneededed computing cycles, you can use&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;E2FE loop $&lt;/blockquote&gt;which just decrements ECX until it's zero. It might take several seconds (!), even if it's a simple operation altogether. So, it might be critical to detect and fast-forward it (emulate all its cycles at once). For a manual analysis, the skip is trivial.&lt;br /&gt;&lt;br /&gt;So, to make either time-constrained emulation or manual analysis harder, you can make your loop harder to detect. Typically, when you analyze loops, you'll find the conditional jump, identify the exit point, and set a breakpoint on it.&lt;br /&gt;Making the conditional jump or the exit point harder to find is what you'd be looking for to make reversing harder.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;No Jxx&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An easy way to hide the conditional jump and the exit address is to merge both jumps (to loop start and exit) in a single, calculated, unconditional jump, like this:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;jmp loop_start + (condition) * (loop_end - loop_start)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;So, after your loop condition, which sets some flag&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;dec cl&lt;/blockquote&gt;turn the flag into a number (0 or 1, then)&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;setz reg16&lt;/blockquote&gt;multiply by the distance between loop start and end&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;mov eax, loop_end - loop_start&lt;br /&gt;mul reg16&lt;br /&gt;&lt;/blockquote&gt;or, in an unsual way (on AH only)&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;aad loop_end - loop_start&lt;/blockquote&gt;&lt;br /&gt;add the start address&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;add eax, loop_start&lt;br /&gt;&lt;/blockquote&gt;now you can jump inconditionally &lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;jmp eax&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Now, you get a standard loop, but with only one jump to both continue and exit, and you have to dig into the code to compute in advance the exit point. Obfuscating the critical information  'end - start' will make it even more difficult to exit from this loop quickly, especially because in this case the loop_exit might not be near the loop body.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;a needle in the haystack&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Another way is to add several decoy conditional jumps. Make them, as well as the real exit conditional jump, obfuscated (ie, jump on a comparison with 05fb4e3 instead of 0, with the counter hidden somewhere), make them jump to code being decrypted (to prevent software breakpoints), make more than 4 of them (to exhaust hardware breakpoints), and you get a loop that you can't exit of easily, for which you need to check every execution of each of these conditional jumps.&lt;br /&gt;I made a simple example, in which 4 different registers are influenced by a counter (left obvious on purpose here), and compared to odd values, then jumping to different destinations:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;cmp ax,0cafb&lt;br /&gt;je 00400130&lt;br /&gt;...&lt;br /&gt;cmp bx,0bf21&lt;br /&gt;je 0040012f&lt;br /&gt;...&lt;br /&gt;cmp dx,0c0d1&lt;br /&gt;je 0040012e&lt;br /&gt;...&lt;br /&gt;cmp si,0bab0&lt;br /&gt;je 00400131&lt;/blockquote&gt;Of course, this example is simplified. Add more junk code and randomization, you'll get what a few packers do.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;SEH obfuscation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://pferrie.tripod.com"&gt;Peter Ferrie&lt;/a&gt; wrote an interesting kind of obfuscated loop:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;push 3&lt;br /&gt;pop ecx&lt;br /&gt;call l1&lt;br /&gt;pop eax&lt;br /&gt;pop eax&lt;br /&gt;pop esp&lt;br /&gt;pop ecx&lt;br /&gt;l1:&lt;br /&gt; dec ecx&lt;br /&gt; push ecx&lt;br /&gt; setne cl&lt;br /&gt; xor eax, eax&lt;br /&gt; mov dword ptr fs:[eax], esp&lt;br /&gt; ror cl, 01&lt;br /&gt; into&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;In this case, the counter is decremented with a &lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;dec ecx&lt;br /&gt;&lt;/blockquote&gt;which sets ZF.&lt;br /&gt;&lt;br /&gt;the ZF flag is moved to OF by the combination of&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;setne cl   ; cl = ZF ? 0 : 1&lt;br /&gt;ror cl, 01 ; cl = ZF ? 0 (OF cleared) : 80 (OF set)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;and the hidden conditional jump is &lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;CE into&lt;/blockquote&gt;which triggers Int4 if OF is set, and nothing otherwise.&lt;br /&gt;&lt;br /&gt;In short, this loop works by setting an exception handler, then, depending on ZF then OF, trigger an exception via Int4 (and loop) or just exit the loop.&lt;br /&gt;However the devil is in the details: &lt;br /&gt;the PUSH ecx both saves the counter on the stack, and set the right structure for an SEH (even though the next forwarder is wrong, since it will be the value of the counter and not the next SEH in the chain).&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;00000002  Pointer to next SEH record&lt;br /&gt;004000F8  SE handler&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Also, to restore ESP on each exception iteration, instead of using 4 bytes:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;8b642408 mov esp,[esp+8]&lt;/blockquote&gt;It's implemented as 2 discarded pop and a real one, which is 3 bytes&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;58 pop eax&lt;br /&gt;58 pop eax&lt;br /&gt;5c pop esp&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That's 3 examples of obfuscated loops, and the first 2 are used in widespread packers (Waledac, PESpin) already.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Update&lt;/span&gt;:&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Hiding the counter and exit&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Another idea, suggested by &lt;a href="http://baboon.rce.free.fr/index.php?post/2010/02/09/LFSROFL"&gt;Baboon&lt;/a&gt;, is to replace the counter increment with something more random-looking, such as a &lt;a href="http://en.wikipedia.org/wiki/Linear_feedback_shift_register"&gt;LFSR&lt;/a&gt;, to prevent an easy guess of the required amount of iterations, and at the same time, have the loop exit address updated at each iteration, so that it's only correct at the last iteration:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;lfsr32 edx, 0d0000001h&lt;br /&gt;xor dword [loop_exit], edx  ; exit address is updated blindly&lt;br /&gt;&lt;br /&gt;lfsr16 cx, 0b400h&lt;br /&gt;cmp cx, 0eaa2h   ; this will be true on the 35th iteration&lt;br /&gt;jnz loop_start&lt;br /&gt;&lt;br /&gt;jmp [loop_exit]   ; exit address is jumped to blindly&lt;/blockquote&gt;&lt;br /&gt;Here, both lfsr are independant. It would be worse if the loop exit also depends on the counter lfsr.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/loops.asm?r=122"&gt;Source&lt;/a&gt; and &lt;a href="http://corkami.googlecode.com/files/loops.zip"&gt;binary&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Note that you need to update the last loop_exit variable manually in the source, as YASM doesn't seem to support 'complex' operations such as:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;loop_exit dd loop_end ^ Key&lt;/blockquote&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Bidouiller avec les boucles&lt;/span&gt;&lt;br /&gt;Vous voyez ce que font ces bouts de code ?&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;setz ah            setnz cl&lt;br /&gt;aad 11             xor eax, eax&lt;br /&gt;add eax,04000f3    mov fs:[eax], esp&lt;br /&gt;jmp eax            ror cl, 01&lt;br /&gt;                   into&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;Énoncé du problème&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Quand on analyse un programme, gagner du temps en sautant les boucles est important - personne ne veut faire du pas à pas sur chaque itération. De même, détecter les boucles est important dans les émulateurs, surtout si on a ajouté des boucles superflues pour les faire abandonner.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Prenons un exemple simple :&lt;br /&gt;Si vous voulez mettre ECX à zéro, et créer des cycles d'exécution supplémentaires, vous pouvez utiliser &lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;E2FE loop $&lt;/blockquote&gt;qui décrémente juste ECX jusqu'a ce qu'il soit nul. Cela peut prendre plusieurs secondes (!), même si c'est au final une opération très simple. On comprend qu'il soit critique de détecter et de l'accélérer (émuler tous les cycles d'un coup). Lors d'une analyse manuelle, la sauter est trivial.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Donc, que ce soit pour rendre plus difficile une émulation en temps limité ou une analyse manuelle, on peut rendre une boucle plus difficile à détecter. D'habitude, quand on analyse une boucle, on trouve le saut conditionnel, on identifie le point de sortie, puis on y met un point d'arrêt.&lt;br /&gt;Rendre le saut conditionnel ou le point de sortie plus difficile à trouver est ce qu'on cherchera pour rendre l'analyse ardue.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;pas de Jxx&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Un moyen facile de cacher le saut conditionnel et le point de sortie est de fusionner les deux sauts (vers le début et la fin de la boucle) en un seul, calculé, saut inconditionnel, comme ceci:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;jmp début + (condition) * (fin - début)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Donc, après la condition de la boucle, qui change les drapeaux&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;dec cl&lt;/blockquote&gt;on transforme le drapeau en nombre (0 ou 1, dans ce cas)&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;setz reg16&lt;/blockquote&gt;on multiplie par la distance entre début et fin&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;mov eax, fin - début&lt;br /&gt;mul reg16&lt;br /&gt;&lt;/blockquote&gt;ou, de manière moins répandue, uniquement sur AH&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;aad fin - début&lt;/blockquote&gt;&lt;br /&gt;on ajoute l'adresse de début&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;add eax, début&lt;br /&gt;&lt;/blockquote&gt;maintenant, on peut sauter inconditionnellement&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;jmp eax&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;On obtient une boucle standard mais avec un seul saut pour continuer ou sortir, et on doit fouiller dans le code pour savoir à l'avance le point de sortie. Dissimuler l'information cruciale 'fin - début' rendra les choses encore plus difficiles, particulièrement si la sortie est loin du bloc de la boucle.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;une aiguille dans une botte de foin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Une autre façon est d'ajouter plusieurs sauts conditionnels factices. On les rendra, de même que le vrai saut de sortie, plus compliqués (par exemple, comparer à une valeur genre 05fb4e3 plutôt que 0, avec le compteur caché quelque part), on les fera sauter vers du code en cours de décryptage (pour éviter les points d'arrêt logiciels), on en mettra plus de 4 (pour être à court de points d'arrêt matériels), et on obtient ainsi une boucle dont on ne peut sortir facilement, à part devoir vérifier à chaque itération chacun de ces sauts conditionnels.&lt;br /&gt;J'ai fait un exemple simple, où 4 registres sont influencés par le compteur (laissé volontairement évident dans ce cas), et comparés à des valeurs bizarres, et qui sauteront vers des adresses différentes:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;cmp ax,0cafb&lt;br /&gt;je 00400130&lt;br /&gt;...&lt;br /&gt;cmp bx,0bf21&lt;br /&gt;je 0040012f&lt;br /&gt;...&lt;br /&gt;cmp dx,0c0d1&lt;br /&gt;je 0040012e&lt;br /&gt;...&lt;br /&gt;cmp si,0bab0&lt;br /&gt;je 00400131&lt;/blockquote&gt;Bien sûr, cet exemple est simplifié. Ajoutez du code pourri et aléatoire, et vous aurez ce que font certains packeurs.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;une boucle avec SEH&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://pferrie.tripod.com"&gt;Peter Ferrie&lt;/a&gt; a écrit une forme originale de boucle:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;push 3&lt;br /&gt;pop ecx&lt;br /&gt;call l1&lt;br /&gt;pop eax&lt;br /&gt;pop eax&lt;br /&gt;pop esp&lt;br /&gt;pop ecx&lt;br /&gt;l1:&lt;br /&gt; dec ecx&lt;br /&gt; push ecx&lt;br /&gt; setne cl&lt;br /&gt; xor eax, eax&lt;br /&gt; mov dword ptr fs:[eax], esp&lt;br /&gt; ror cl, 01&lt;br /&gt; into&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Dans ce cas, le compteur est décrémenté via&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;dec ecx&lt;br /&gt;&lt;/blockquote&gt;ce qui modifie ZF.&lt;br /&gt;&lt;br /&gt;le drapeau ZF est copié vers OF par la combinaison de&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;setne cl   ; cl = ZF ? 0 : 1&lt;br /&gt;ror cl, 01 ; cl = ZF ? 0 (OF cleared) : 80 (OF set)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;et le saut conditionnel caché est&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;CE into&lt;/blockquote&gt;qui déclenche l'interruption 4 si OF est défini, et rien sinon.&lt;br /&gt;&lt;br /&gt;En résumé, cette boucle défini un gestionnaire d'exceptions, puis, en fonction de ZF puis OF, déclenche une exception par Int4 (et boucle) ou sort juste de la boucle.&lt;br /&gt;&lt;br /&gt;Cependant, il faut faire attention aux détails :&lt;br /&gt;le PUSH ecx sert à la fois pour sauver le compteur sur la pile, et définir la bonne structure pour le gestionnaire d'exception (même si le gestionnaire suivant sera faux, puisque ça sera le compteur et non le gestionnaire suivant dans la chaîne).&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;00000002  Pointer to next SEH record&lt;br /&gt;004000F8  SE handler&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;De même, pour restaurer ESP à chaque itération, au lieu d'utiliser 4 octets:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;8b642408 mov esp,[esp+8]&lt;/blockquote&gt;c'est implémenté via 2 pop inutiles et un vrai, ce qui fait 3 octets&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;58 pop eax&lt;br /&gt;58 pop eax&lt;br /&gt;5c pop esp&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Voici donc 3 exemples de boucles cachées, dont les 2 premiers sont utilisés dans des packeurs courants (Waledac, PESpin).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Mise à jour&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:x-large;"&gt;cacher le compteur et la sortie&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;une autre idée, suggérée par &lt;a href="http://baboon.rce.free.fr/index.php?post/2010/02/09/LFSROFL"&gt;Baboon&lt;/a&gt;, est de remplacer l'incrément de compteur par quelque chose qui a l'air plus aléatoire, comme un &lt;a href="http://fr.wikipedia.org/wiki/Linear_feedback_shift_register"&gt;LFSR&lt;/a&gt; (registre à décalage à rétroaction linéaire), pour empêcher de deviner facilement le nombre d'itération requis, et en même temps, de modifier l'adresse de sortie de la boucle à chaque itération, pour qu'elle ne soit correcte qu'à la dernière :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;lfsr32 edx, 0d0000001h&lt;br /&gt;xor dword [loop_exit], edx  ; l'adresse de sortie est modifiée aveuglément&lt;br /&gt;&lt;br /&gt;lfsr16 cx, 0b400h&lt;br /&gt;cmp cx, 0eaa2h   ; cela sera vrai à la 35ème itération&lt;br /&gt;jnz loop_start&lt;br /&gt;&lt;br /&gt;jmp [loop_exit]   ; on saute aveuglément à l'adresse de sortie&lt;/blockquote&gt;&lt;br /&gt;Ici, les deux lfsr sont indépendants. Ça serait plus compliqué si l'adresse de sortie dépendait aussi du lfsr du compteur.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/loops.asm?r=122"&gt;Source&lt;/a&gt; et &lt;a href="http://corkami.googlecode.com/files/loops.zip"&gt;binaire&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Notez que vous devez modifier la dernière variable loop_exit manuellement, car YASM n'accepte pas les opérations complexes telles que :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;loop_exit dd loop_end ^ Key&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-6677885551812190058?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/6677885551812190058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/02/if-you-want-to-strike-me-down-in-anger.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6677885551812190058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6677885551812190058'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/02/if-you-want-to-strike-me-down-in-anger.html' title='If you want to strike me down in anger'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-281481907630249973</id><published>2010-02-06T16:19:00.002Z</published><updated>2010-02-06T16:27:25.797Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>You're so fine, lose my mind, and the world seems to...</title><content type='html'>I moved non-technical blog entries &lt;a href="http://corkamisc.blogspot.com"&gt;here&lt;/a&gt; to keep this blog coherent.&lt;br /&gt;&lt;br /&gt;J'ai mis tous les posts non techniques &lt;a href="http://corkamisc.blogspot.com"&gt;ici&lt;/a&gt; pour que ce blog reste cohérent.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-281481907630249973?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/281481907630249973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/02/youre-so-fine-lose-my-mind-and-world.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/281481907630249973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/281481907630249973'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/02/youre-so-fine-lose-my-mind-and-world.html' title='You&apos;re so fine, lose my mind, and the world seems to...'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-3206816173266095272</id><published>2010-02-03T21:08:00.015Z</published><updated>2010-02-04T21:44:03.389Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='anti'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Et puis celles qu'on doit pas...</title><content type='html'>&lt;span style="font-style: italic;"&gt;Undocumented opcodes and behaviors&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Ever seen this before?&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;00400181 0F1F ??? ; Unknown command&lt;/blockquote&gt;&lt;br /&gt;As my &lt;a href="http://corkami.blogspot.com/2010/01/when-cpus-have-too-many-opcodes.html"&gt;opcode file&lt;/a&gt; is now close to completion, I made a &lt;span style="font-weight: bold;"&gt;working&lt;/span&gt; test executable with undocumented or uncommon opcodes, that you could use to test your own emulator or disassembler.&lt;br /&gt;&lt;br /&gt;Note that if you use an older tool, opcodes might not be disassembled at all. If you're using Ollydbg (1.1), get a copy of BeatriX' &lt;a href="http://www.beaengine.org/"&gt;FullDisasm&lt;/a&gt; to add support for the latest opcodes.&lt;br /&gt;Let's start:&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;Setalc (or salc), a.k.a Set al on carry, is an originally undocumented opcode that sets AL to 00 or FF depending on CF state:&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;clc&lt;br /&gt;salc&lt;br /&gt;cmp al, 0&lt;br /&gt;jnz bad&lt;br /&gt;&lt;br /&gt;stc&lt;br /&gt;salc&lt;br /&gt;cmp al, 0ffh&lt;br /&gt;jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;While BSWAP has an expected behavior on 32bits (turns a value of 12345678 into 78563412), it's undefined on 16bits and yet commonly used: It swaps the register contents with a null word, so it just resets it.&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;mov eax, 12345678&lt;br /&gt;bswap ax&lt;br /&gt;cmp eax, 12340000&lt;br /&gt;jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;AAD and AAM don't have officially an operand, but it's just that they had a default operand of Ah, as they were used for BCD arithmetic operations.&lt;br /&gt;Their behavior with a different base is unofficially defined, so they can be used for breaking 'standard' emulators:&lt;br /&gt;AAD X sets AH to 0, and AL to AH * X + AL&lt;br /&gt;AAM X sets AH to AL / X, and AL to AL % X&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;mov ax, 0325h&lt;br /&gt;aad 7&lt;br /&gt;cmp ax, 003Ah&lt;br /&gt;jnz bad&lt;br /&gt;&lt;br /&gt;aam 3&lt;br /&gt;cmp ax, 1301h&lt;br /&gt;jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;This makes AAD the first add and multiply opcode on Intel CPU, on 8 bits only.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I explored SMSW behavior in detail &lt;a href="http://corkami.blogspot.com/2010/01/policeman-got-no-gun-u-dont-have-2-run.html"&gt;already&lt;/a&gt;: on 32 bits, it's supposedly not defined, but it actually just copies CR0 value, which is constant in the usual conditions:&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;smsw eax&lt;br /&gt;cmp eax, 08001003bh&lt;br /&gt;jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;the FPU is full of undocumented aliases (check &lt;a href="http://sandpile.org/ia32/opc_fpu.htm"&gt;Sandpile&lt;/a&gt; for a complete list), I just inserted them as junk, not for their actual operations:&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;ffreep st0&lt;br /&gt;fstp1 st0&lt;br /&gt;fcom2 st0&lt;br /&gt;fcomp3 st0&lt;br /&gt;fxch4 st0&lt;br /&gt;fcomp5 st0&lt;br /&gt;fxch7 st0&lt;br /&gt;fstp8 st0&lt;br /&gt;fstp9 st0&lt;br /&gt;fneni&lt;br /&gt;fndisi&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Group 3 (f6-f7) Opcode 001 is actually an alias of 000 (Test).&lt;br /&gt;This gives you a standard TEST opcode on memory reference that might not be disassembled, thus emulated correctly.&lt;br /&gt;Ex:&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;F70878563412 test dword ptr [eax], 12345678h&lt;br /&gt;&lt;/blockquote&gt;OllyDbg 1.1 says&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;00400155    F7  ???  ; Unknown command&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Similarly, SAL (Shift Arithmetic Left) is functionally identical to SHL. Thus it's commonly assembled as SHL directly, and some disassemblers/emulators might not support it, even though it's a standard SHL.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;NOP is not just 090h anymore. It has taken different forms in modern CPUs, for example, to give hints about the execution. It even has an operand, but you can't trigger an exception with it, hopefully.&lt;br /&gt;So, it still basically does nothing, provided you disassemble it correctly. See for yourself:&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;0F1F00           nop dword ptr [eax]                     &lt;br /&gt;0F1984C000000080 hint_nop dword ptr [eax+eax*8-80000000h]&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;IceBP, aka Int1, is a very famous undocumented opcode that triggers a Single Step exception. Int 1 (CD01) itself would trigger an access violation exception.&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;&lt;br /&gt;F1 IceBP&lt;br /&gt;...&lt;br /&gt;cmp dword ptr [edx] , 80000004h&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On branching instructions (Call/Retn/Jmp/Jxx/Loop), the 66 Operand size prefix makes the opcode work only on the lower word of EIP.&lt;br /&gt;Thus a familiar-looking&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;&lt;br /&gt;50   push eax&lt;br /&gt;66c3 retn&lt;br /&gt;...&lt;br /&gt;cmp dword ptr [edx] , C0000005h&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;will actually jump to AX, which will trigger an Access violation exception - it's not your standard RET here!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CMPS* and MOVS* are the only 2 opcodes that use 2 memory reference operands. However, they're often shown without in their compact form, without their operands at all. If you use them with a segment prefix such as 64 FS, the source is taking the prefix.&lt;br /&gt;Such a hidden FS:[ESI] =&gt; [EDI] could be used to set a SEH.&lt;br /&gt;(For extra SEH tricks, check roy g biv's &lt;a href="http://vx.netlux.org/lib/vrg03.html"&gt;Subtle SEH&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;LOOP is influenced by the Operand size prefix, but also the Address size prefix, in which case only CX is checked (same for Jecxz, but in this case it's written differently, jcxz). Thus with the right value ECX, the 'same' loop might end up in different places:&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;&lt;br /&gt;mov ecx, 0ffff0001h&lt;br /&gt;67&lt;br /&gt;loop bad&lt;br /&gt;loop good&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/undoc.zip"&gt;Source and binary&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Opcodes et comportements non documentés&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Ça vous dit quelque chose ?&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;00400181 0F1F ??? ; Unknown command&lt;/blockquote&gt;&lt;br /&gt;Alors que mon &lt;a href="http://corkami.blogspot.com/2010/01/when-cpus-have-too-many-opcodes.html"&gt;fichier d'opcodes&lt;/a&gt; est bientôt complet, j'ai écrit un exécutable de test &lt;span style="font-weight: bold;"&gt;qui marche correctement&lt;/span&gt; et qui contient des opcodes rares ou non documentés, que vous pourrez utiliser pour tester votre désassembleur ou émulateur perso.&lt;br /&gt;&lt;br /&gt;Il faut noter que si vous utilisez un outil un peu ancien, les opcodes ne seront peut-être pas gérés du tout. Si vous utilisez Ollydbg (1.1), installez &lt;a href="http://www.beaengine.org/"&gt;FullDisasm&lt;/a&gt; de BeatriX pour le mettre à jour.&lt;br /&gt;&lt;!-- more --&gt;&lt;br /&gt;Commençons:&lt;br /&gt;Setalc (or salc), autrement dit &lt;span style="font-style:italic;"&gt;Set al on carry&lt;/span&gt;, est un opcode non documenté au début, qui met AL à 00 ou FF en fonction de l'état de CF :&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;clc&lt;br /&gt;salc&lt;br /&gt;cmp al, 0&lt;br /&gt;jnz bad&lt;br /&gt;&lt;br /&gt;stc&lt;br /&gt;salc&lt;br /&gt;cmp al, 0ffh&lt;br /&gt;jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Alors que BSWAP a un comportement prévisible sur 32 bits (change 12345678 en 78563412), il est non défini sur 16 bits, et pourtant couramment utilisé : il échange le contenu du registre avec un mot nul, donc il le remet à zéro.&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;mov eax, 12345678&lt;br /&gt;bswap ax&lt;br /&gt;cmp eax, 12340000&lt;br /&gt;jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;AAD et AAM n'ont officellement pas d'opérande, mais c'est en fait une opérande par défaut à Ah, puisqu'ils sont utilisés pour les opérations arithmétiques avec des nombres BCD (1020 est stocké sous la forme 1020h, pas 0x3fc).&lt;br /&gt;Leur comportement avec une base autre que décimale est défini officieusement, donc ils peuvent être utilisés pour casser des émulateurs trop standard:&lt;br /&gt;AAD X met AH à 0, et AL à AH * X + AL&lt;br /&gt;AAM X met AH à AL / X, et AL à AL % X&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;mov ax, 0325h&lt;br /&gt;aad 7&lt;br /&gt;cmp ax, 003Ah&lt;br /&gt;jnz bad&lt;br /&gt;&lt;br /&gt;aam 3&lt;br /&gt;cmp ax, 1301h&lt;br /&gt;jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Ce qui fait de AAD le premier opcode d'addition et multiplication combinées sur processeur Intel, mais en 8 bits uniquement.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;J'ai &lt;a href="http://corkami.blogspot.com/2010/01/policeman-got-no-gun-u-dont-have-2-run.html"&gt;déjà&lt;/a&gt; exploré en détail le comportement de SMSW : sur 32 bits, il n'est soit-disant pas défini, mais en fait il copie juste la valeur de CR0, qui est constante dans les conditions normales :&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;smsw eax&lt;br /&gt;cmp eax, 08001003bh&lt;br /&gt;jnz bad&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;La FPU est remplie d'alias non documentés (allez voir &lt;a href="http://sandpile.org/ia32/opc_fpu.htm"&gt;Sandpile&lt;/a&gt; pour une liste complète), j'en ai juste inséré pour remplir, pas pour leurs opérations effectives:&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;ffreep st0&lt;br /&gt;fstp1 st0&lt;br /&gt;fcom2 st0&lt;br /&gt;fcomp3 st0&lt;br /&gt;fxch4 st0&lt;br /&gt;fcomp5 st0&lt;br /&gt;fxch7 st0&lt;br /&gt;fstp8 st0&lt;br /&gt;fstp9 st0&lt;br /&gt;fneni&lt;br /&gt;fndisi&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;dans le groupe 3 (f6-f7), l'opcode 001 est en fait un synonyme du 000 (Test).&lt;br /&gt;Cela vous donne un opcode TEST standard qui pourrait ne pas être désassemblé correctement, donc émulé correctement.&lt;br /&gt;Ex:&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;F70878563412 test dword ptr [eax], 12345678h&lt;br /&gt;&lt;/blockquote&gt;OllyDbg 1.1 donne&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;00400155    F7  ???  ; Unknown command&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;De manière similaire, SAL (Shift Arithmetic Left) est fonctionnellement identique à SHL. Il est en général assemblé en SHL, et certains désassembleurs ou émulateurs peuvent ne pas le gérer, alors qu'il n'est qu'un SHL standard.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;NOP n'est plus uniquement 90h. Il a plusieurs formes sur les processeurs modernes, par exemple, pour donner des indications sur l'exécution. Il a même une opérande, mais heureusement on ne peut pas déclencher d'exception avec.&lt;br /&gt;Donc, il ne fait toujours rien, mais encore faut-il le désassembler correctement. Voyez vous-même:&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;0F1F00           nop dword ptr [eax]                     &lt;br /&gt;0F1984C000000080 hint_nop dword ptr [eax+eax*8-80000000h]&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;IceBP, parfois appelé Int1, est un opcode non documenté très connu qui déclenche une exception &lt;span style="font-style:italic;"&gt;Single Step&lt;/span&gt;. Le vrai Int 1 (CD01) déclenche une exception de type &lt;span style="font-style:italic;"&gt;access violation&lt;/span&gt;.&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;&lt;br /&gt;F1 IceBP&lt;br /&gt;...&lt;br /&gt;cmp dword ptr [edx] , 80000004h&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Devant les instructions de saut (Call/Retn/Jmp/Jxx/Loop), le préfixe de taille d'opérande 66 fait sauter sur le mot faible de EIP.&lt;br /&gt;Donc un innocent&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;&lt;br /&gt;50   push eax&lt;br /&gt;66c3 retn&lt;br /&gt;...&lt;br /&gt;cmp dword ptr [edx] , C0000005h&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;va en fait sauter vers AX, ce qui déclenchera une exception &lt;span style="font-style:italic;"&gt;Access violation&lt;/span&gt; - ce n'est pas votre RET habituel!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CMPS* et MOVS* sont les 2 opcodes qui utilisent 2 opérandes de références mémoires. Ils sont souvent affichés sous leur forme compacte, sans leurs opérandes. Si on les utilise avec un préfixe de segment tel que 64 FS, la source est influencée par ce préfixe.&lt;br /&gt;Ce qui nous donne un FS:[ESI] =&gt; [EDI] caché, qui peut être utiliser pour définir un SEH.&lt;br /&gt;(Pour plus d'astuces de SEH, voir &lt;a href="http://vx.netlux.org/lib/vrg03.html"&gt;Subtle SEH&lt;/a&gt; de roy g biv).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;LOOP est donc influencée par le préfixe de taille d'opérande, mais aussi par celui de taille d'adresse, auquel cas seul CX est contrôlé (de même pour Jecxz, mais dans ce cas, il est écrit différemment, jcxz). Donc, avec une bonne valeur dans ECX, la 'même' LOOP peut donner des résultats différents :&lt;br /&gt;&lt;blockquote style="white-space: pre; font-family: courier new;"&gt;&lt;br /&gt;mov ecx, 0ffff0001h&lt;br /&gt;67&lt;br /&gt;loop bad&lt;br /&gt;loop good&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/undoc.zip"&gt;Source et Binaires&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-3206816173266095272?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/3206816173266095272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/02/et-puis-celles-quon-doit-pas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3206816173266095272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3206816173266095272'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/02/et-puis-celles-quon-doit-pas.html' title='Et puis celles qu&apos;on doit pas...'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-2698494208651093599</id><published>2010-01-29T23:26:00.002Z</published><updated>2010-12-12T20:11:25.987Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>It's just a flesh wound</title><content type='html'>&lt;span style="font-style: italic;"&gt;Section-less PE file (updated)&lt;/span&gt;&lt;br /&gt;You may not expect a PE to be valid without all its standard structure:&lt;br /&gt;&lt;blockquote&gt;Dos Header, Nt Headers, File Header, Optional Header, Data Directories, Section Headers.&lt;br /&gt;&lt;/blockquote&gt;TinyPE already proved that the Data directories are not compulsory, but also sections are not always required.&lt;br /&gt;&lt;br /&gt;If the alignment is smaller than 1000h (800h or less), and the number of section is null, the loader loads the file directly as-is (RVA = Offset). And since the number of section is null, you don't need a section table altogether.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;To use imports, you usually need just to define the Imports directory (VA only). the IAT directory is not required.&lt;br /&gt;However, in this special section-less case, the IAT is required to set correct priorities on the right memory range, so the IAT size is required too.&lt;br /&gt;&lt;br /&gt;To sum up:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;NumberOfSection = 0&lt;/li&gt;&lt;li&gt;Alignment &lt; 1000h&lt;/li&gt;&lt;li&gt;RVA = Offset&lt;/li&gt;&lt;li&gt;IAT RVA and SIZE are compulsory (if you use imports)&lt;/li&gt;&lt;/ul&gt;It makes a working PE that many tools will just handle as corrupted.&lt;br /&gt;&lt;br /&gt;If you don't use imports, you can drop the whole set of data directories altogether. In this case, the header will be REALLY empty.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/sectionless.zip"&gt;Binary&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/sectionless.asm?r=89"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Update:&lt;/span&gt; SizeOfOptionalHeader has a confusing name. It's not the actual size of the optional header, it's just the delta between the start of the optional header and the section table, as it's used to find the locate it:&lt;br /&gt;&lt;blockquote&gt;SizeOfOptionalHeader = @SectionTable - @Optional_Header&lt;/blockquote&gt;&lt;br /&gt;If you move the section table further in the file (even - for example - after the first section), SizeOfOptionalHeader will be huge, much bigger than the whole header itself (as in, SizeOfHeaders).&lt;br /&gt;In this example, on the contrary, there is no (need of) section table, thus SizeOfOptionalHeader can be zero, or anything (even a value bigger than the filesize). But if it's negative, the file won't work. &lt;br /&gt;This confirms that you can't put the section table before the Optional_Header, between the DOS_Header and the NT_Headers.&lt;br /&gt;&lt;br /&gt;Yet another unexpectedly  weird element in the PE headers...&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Fichier PE sans section (mis à jour)&lt;/span&gt;&lt;br /&gt;A priori, on n'imaginerait pas qu'un PE soit valide sans toutes ses structures standards :&lt;br /&gt;&lt;blockquote&gt;Dos Header, Nt Headers, File Header, Optional Header, Data Directories, Section Headers.&lt;br /&gt;&lt;/blockquote&gt;TinyPE a déjà prouvé que les &lt;span style="font-style:italic;"&gt;Data directories&lt;/span&gt; ne sont pas indispensables, mais les sections elles aussi ne sont pas toujours requises.&lt;br /&gt;&lt;br /&gt;Si l'alignement est plus petit que 1000h (800h ou moins), et que le nombre de sections est nul, le &lt;span style="font-style:italic;"&gt;loader&lt;/span&gt; charge le fichier directement tel quel (RVA = &lt;span style="font-style:italic;"&gt;Offset&lt;/span&gt;). Et puisque le nombre de sections est nul, plus besoin de table de sections.&lt;br /&gt;&lt;br /&gt;Pour utiliser les imports, on a d'habitude juste besoin de définir le &lt;span style="font-style:italic;"&gt;Imports directory&lt;/span&gt; (juste son adresse virtuelle). La table d'imports (&lt;span style="font-style:italic;"&gt;IAT directory&lt;/span&gt;) n'est pas obligatoire.&lt;br /&gt;Cependant, dans ce cas particulier, la table d'imports est requise pour définir les priorités correctes sur le bon espace mémoire, donc la taille de la table est requise aussi.&lt;br /&gt;&lt;br /&gt;Pour résumer :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;NumberOfSection = 0&lt;/li&gt;&lt;li&gt;Alignement &lt; 1000h&lt;/li&gt;&lt;li&gt;RVA = Offset&lt;/li&gt;&lt;li&gt;IAT RVA et SIZE obligatoires (si vous utilisez les imports)&lt;/li&gt;&lt;/ul&gt;Cela donne un PE qui marche, que beaucoup d'outils estimeront corrompu.&lt;br /&gt;&lt;br /&gt;Si vous n'utilisez pas les imports, vous pouvez abandonner tous les &lt;span style="font-style:italic;"&gt;data directories&lt;/span&gt;. Dans ce cas, l'en-tête sera VRAIMENT vide.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/sectionless.zip"&gt;Binaire&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/sectionless.asm?r=89"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Mise à jour :&lt;/span&gt; SizeOfOptionalHeader a un nom qui peut prêter à confusion. Ce n'est en fait pas la taille du Optional_Header, c'est juste la différence entre le début du Optional_Header et de la table des sections, puisqu'il est utilisé pour la localiser :&lt;br /&gt;&lt;blockquote&gt;SizeOfOptionalHeader = @SectionTable - @Optional_Header&lt;/blockquote&gt;&lt;br /&gt;Si on met la table plus loin dans le fichier (même - par exemple - après la première section), SizeOfOptionalHeader sera énorme, bien plus que l'en-tête tout entier (tel que défini dans SizeOfHeaders).&lt;br /&gt;Dans cet exemple, au contraire, on n'a pas (besoin) de table de sections, donc SizeOfOptionalHeader peut être nul, ou n'importe quoi (même une valeur plus grande que la taille du fichier). Mais si il est négatif, le fichier ne marchera pas.&lt;br /&gt;Cela concorde avec le fait qu'on ne puisse pas mettre la table avant l'Optional_Header, entre le DOS_Header et les NT_Headers.&lt;br /&gt;&lt;br /&gt;Encore un élément bien flou dans l'en-tête des PE.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-2698494208651093599?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/2698494208651093599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/its-just-flesh-wound.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2698494208651093599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2698494208651093599'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/its-just-flesh-wound.html' title='It&apos;s just a flesh wound'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-7697433843747954887</id><published>2010-01-28T22:56:00.003Z</published><updated>2010-12-12T12:46:47.201Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>din nebunia de culori, vreau sa aleg si alte flori</title><content type='html'>&lt;span style="font-style:italic;"&gt;a PE Headers graph&lt;/span&gt;&lt;br /&gt;If you're looking for a good representation of the PE format, OpenRCE's &lt;a href="http://www.openrce.org/reference_library/files/reference/PE%20Format.pdf"&gt;poster&lt;/a&gt; from Ero Carrera is the standard.&lt;br /&gt;I gave it a try making my own representation, and started a multi-page one, lighter to open, easier to print (A4-formatted), where elements are shown differently depending on their importance.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;The first page is done: the Headers (without the directories).&lt;br /&gt;&lt;br /&gt;the source &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/graphs/pe-headers.svg?r=100"&gt;file&lt;/a&gt;, an Inkscape SVG, is available under the Creative Commons Attribution licence.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/pe.pdf"&gt;PE Format 1 : Headers (PDF)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;span style="font-style:italic;"&gt;un graphe des en-têtes du PE&lt;/span&gt;&lt;br /&gt;Si vous cherchez une bonne représentation du format PE, le &lt;a href="http://www.openrce.org/reference_library/files/reference/PE%20Format.pdf"&gt;poster&lt;/a&gt; d'OpenRCE par Ero Carrera est le standard.&lt;br /&gt;J'ai essayé de faire ma propre représentation, et j'en ai commencé une, multi-pages, plus légère, plus facile à imprimer (format A4), et les éléments sont représentés en fonction de leur importance.&lt;br /&gt;&lt;br /&gt;La première page est finie : les en-têtes (sans les &lt;span style="font-style:italic;"&gt;directories&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;Le &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/graphs/pe-headers.svg?r=100"&gt;fichier&lt;/a&gt; source, un SVG Inkscape, est fourni sous la license Creative Commons Attribution.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/pe"&gt;PE Format 1 : En-têtes (PDF)&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-7697433843747954887?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/7697433843747954887/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/din-nebunia-de-culori-vreau-sa-aleg-si.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7697433843747954887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7697433843747954887'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/din-nebunia-de-culori-vreau-sa-aleg-si.html' title='din nebunia de culori, vreau sa aleg si alte flori'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-7835674245206394273</id><published>2010-01-22T23:39:00.004Z</published><updated>2010-02-06T16:34:04.921Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>On aura plus de pain sur la planche, parce que la planche aura brûlé</title><content type='html'>&lt;span style="font-style:italic;"&gt;messing with sections physical offset&lt;/span&gt;&lt;br /&gt;With a high alignment (&gt;= 1000h), nothing prevents 2 sections to come from the same physical data.&lt;br /&gt;Thus, if 2 sections with different virtual addresses have the same PointerToRawData and SizeOfRawData, their content will be initially the same. Relocations and imports will be applied afterward though.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;SECTION_0:&lt;br /&gt; .VirtualSize      dd Section0Size&lt;br /&gt; .VirtualAddress   dd Section0Start - IMAGEBASE&lt;br /&gt; .SizeOfRawData    dd Section0Size&lt;br /&gt; .PointerToRawData dd Section0Start - IMAGEBASE&lt;br /&gt;...&lt;br /&gt;SECTION_1:&lt;br /&gt; .VirtualSize      dd Section0Size              *same&lt;br /&gt; .VirtualAddress   dd Section1Start - IMAGEBASE&lt;br /&gt; .SizeOfRawData    dd Section0Size              *same&lt;br /&gt; .PointerToRawData dd Section0Start - IMAGEBASE *same&lt;/blockquote&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;A section can be virtually non-empty and physically empty. In this case, it will just be full of zero. It's a common way to create space for uninitialized data, or in packers, to create memory space for the original sections without the need to allocate memory yourself.&lt;br /&gt;&lt;br /&gt;You'd expect a physically empty section to have an empty physical size.&lt;br /&gt;But if only the PointerToRawData is null (and not SizeOfRawData), the section will still be seen as physically empty, thus full of zero.&lt;br /&gt;However, if PointerToRawData is smaller than 0200h (this value is independent of the Section or File Alignment), it will be rounded to 0, without the 'empty zero-ed effect'.&lt;br /&gt;So, with a Section with a PointerToRawData between 1 and 1ffh, and a physical size equal to the PE, you can map the whole PE in a duplicate way.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;whole_pe_offset equ 1; &lt; 200h otherwise not rounded to 0&lt;br /&gt;SECTION_1:&lt;br /&gt; .VirtualSize      dd pe_size&lt;br /&gt; .VirtualAddress   dd pe_size&lt;br /&gt; .SizeOfRawData    dd pe_size - whole_pe_offset&lt;br /&gt; .PointerToRawData dd whole_pe_offset&lt;/blockquote&gt;&lt;br /&gt;In the 2 files, I made the code jump to its copy. Don't set your breakpoints in the wrong parts that are not executed!&lt;br /&gt;&lt;br /&gt;Thanks to Costin Ionescu.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/section_physics-r96.zip"&gt;Sources and binaries&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;span style="font-style:italic;"&gt;faire des misères physiques aux sections&lt;/span&gt;&lt;br /&gt;Dans le cas d'un alignement élevé (&gt;= 1000h), rien n'empêche 2 sections d'être basées sur les mêmes données physiques.&lt;br /&gt;Donc, si 2 sections aux adresses virtuelles différentes ont les mêmes PointerToRawData et SizeOfRawData, leur contenu sera initialement le même. Les relocations et les imports seront pris en compte ensuite, cependant.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;SECTION_0:&lt;br /&gt; .VirtualSize      dd Section0Size&lt;br /&gt; .VirtualAddress   dd Section0Start - IMAGEBASE&lt;br /&gt; .SizeOfRawData    dd Section0Size&lt;br /&gt; .PointerToRawData dd Section0Start - IMAGEBASE&lt;br /&gt;...&lt;br /&gt;SECTION_1:&lt;br /&gt; .VirtualSize      dd Section0Size              *même valeur&lt;br /&gt; .VirtualAddress   dd Section1Start - IMAGEBASE&lt;br /&gt; .SizeOfRawData    dd Section0Size              *même valeur&lt;br /&gt; .PointerToRawData dd Section0Start - IMAGEBASE *même valeur&lt;/blockquote&gt;&lt;!-- more --&gt;&lt;br /&gt;Une section peut être virtuellement non vide, et physiquement vide. Dans ce cas, elle sera juste remplie de zéros. C'est une méthode standard pour créer de l'espace pour les données non initialisées, ou dans les packeurs, pour créer de l'espace mémoire à la place des sections originales, sans avoir à initialiser de la mémoire soi-même.&lt;br /&gt;&lt;br /&gt;On s'attend à ce qu'une section vide physiquement ait une taille physique vide.&lt;br /&gt;Mais si seul le PointerToRawData est nul (et non la SizeOfRawData), la section sera toujours vue comme physiquement vide, donc pleine de zéros.&lt;br /&gt;Cependant, si PointerToRawData est plus petit que 0200h (cette valeur est indépendante des alignements de fichier ou de section), il sera arrondit à zéro, sans l'effet 'rempli de zéro'.&lt;br /&gt;Donc, avec une section avec un PointerToRawData entre 1 et 1ffh, et une taille physique égale au PE, on peut mapper le PE entier dans une copie.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;whole_pe_offset equ 1; &lt; 200h otherwise not rounded to 0&lt;br /&gt;SECTION_1:&lt;br /&gt; .VirtualSize      dd pe_size&lt;br /&gt; .VirtualAddress   dd pe_size&lt;br /&gt; .SizeOfRawData    dd pe_size - whole_pe_offset&lt;br /&gt; .PointerToRawData dd whole_pe_offset&lt;/blockquote&gt;&lt;br /&gt;Dans les 2 fichiers, j'ai fait sauter le code vers sa copie. Ne mettez pas les points d'arrêts sur la partie jamais exécutée!&lt;br /&gt;&lt;br /&gt;Remerciements: Costin Ionescu.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/section_physics-r96.zip"&gt;Sources et binaires&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-7835674245206394273?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/7835674245206394273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/parce-que-la-planche-aura-brule.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7835674245206394273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7835674245206394273'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/parce-que-la-planche-aura-brule.html' title='On aura plus de pain sur la planche, parce que la planche aura brûlé'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-9176950448590031802</id><published>2010-01-21T22:34:00.006Z</published><updated>2010-02-11T17:45:42.867Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='anti'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Policeman got no gun, U don't have 2 run</title><content type='html'>&lt;span style="font-style:italic;"&gt;SMSW based anti-emulator/stepping&lt;/span&gt;&lt;br /&gt;SMSW (store machine status word) stores the 16 lowest bits of cr0 in the operand register. In the case of SMSW with a reg32, the highest word is not defined - it seems to be always 8001h, though.&lt;br /&gt;&lt;br /&gt;It makes it a weird reg32 opcode (why accepting a 32b operand if you undefine the highest bits and if there is a 16b operand counterpart ?) but it definitely changes the highest word (some disassembler show invariably a word operand, which is wrong).&lt;br /&gt;&lt;br /&gt;While 'mov eax, cr0' is a priviledged instruction, SMSW isn't.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;In cr0, bits 1 and 3 are called MP (Monitor Coprocessor) and TS (Task switched). Their state depends on FPU operations. This leads to several anti-* similar to the &lt;a href="http://corkami.blogspot.com/2010/01/hen-never-laid-and-corn-never-growed.html"&gt;GS&lt;/a&gt; one.&lt;br /&gt;&lt;br /&gt;They are usually set. This is no anti-debugger, but it might just be used as an anti-emulator.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;smsw eax&lt;br /&gt;cmp ax, 03bh&lt;br /&gt;jnz bad&lt;/blockquote&gt;&lt;br /&gt;Execute any FPU opcode (even FNOP), then both bits will be cleared. Similarly to the GS trick, if you step, both bits will be in their usual set. To bypass it easily, you have to start running BEFORE the fpu opcode. Starting execution from the fpu opcode will give MP and TS their wrong state.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;fnop&lt;br /&gt;smsw eax&lt;br /&gt;cmp ax, 031h&lt;br /&gt;jnz bad&lt;/blockquote&gt;&lt;br /&gt;But after the FPU opcode, the bits will eventually revert to their set state.&lt;br /&gt;So a wrong emulation might be stuck in an infinite loop.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;_1:&lt;br /&gt;    smsw eax&lt;br /&gt;    cmp ax, 031h&lt;br /&gt;    jz _1&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Another version of that test is to wait for one bit to be set and then check the other is set too.&lt;br /&gt;the Intel docs says:&lt;br /&gt;&lt;blockquote&gt;The SMSW instruction is only useful in operating-system software; however, it is not a privileged instruction and can be used in application programs.&lt;/blockquote&gt;&lt;br /&gt;Now, you know it's also useful as an anti-*.&lt;br /&gt;&lt;br /&gt;In some case (1 out of 20?), execution fails. Likely, the FPU opcode might trigger those bits too late. So double checking will fix this race condition.&lt;br /&gt;&lt;br /&gt;Thanks to Peter Ferrie.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/smsw-antidebug-r95.zip"&gt;Source and binary&lt;/a&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;span style="font-style:italic;"&gt;anti-émulateur/pas à pas basé sur SMSW&lt;/span&gt;&lt;br /&gt;SMSW (store machine status word) met les 16 bits de poids faibles de cr0 dans le registre de l'opérande. Dans le cas de SMSW avec un reg32, le mot de poid fort n'est pas défini - il semble cependant être toujours 8001h.&lt;br /&gt;&lt;br /&gt;Ca donne un opcode bizarre pour reg32 (pourquoi accepter une opérande de 32b si le mot de poids fort n'est pas défini et qu'il existe une version sur 16b ?) mais qui modifie pour sûr le mot de poid fort (certains disassembleurs montrent toujours une opérande sur 16b, ce qui est faux).&lt;br /&gt;&lt;br /&gt;Alors que 'mov eax, cr0' est une instruction privilégiée, SMSW ne l'est pas.&lt;br /&gt;&lt;br /&gt;Dans cr0, les bits 1 et 3 sont appelés MP (Monitor Coprocessor) et TS (Task switched). Leur état dépend des opérations du FPU. Cela donne quelques anti-* similaires à celui de &lt;a href="http://corkami.blogspot.com/2010/01/hen-never-laid-and-corn-never-growed.html"&gt;GS&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Ces bits sont à 1 d'habitude. Ce n'est pas un anti-débogueur, mais ça peut être utilisé simplement comme anti-émulateur.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;smsw eax&lt;br /&gt;cmp ax, 03bh&lt;br /&gt;jnz bad&lt;/blockquote&gt;&lt;br /&gt;Executez n'importe quel opcode FPU (même FNOP), et les 2 bits seront à zéro. De même que pour GS, si on avance en pas à pas, les deux bits seront remis à leur valeur initiale. Pour le passer facilement, il faut commencer l'exécution AVANT l'opcode FPU. Si on démarre à partir de l'opcode FPU, MP et TS auront leur mauvaise valeur.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;fnop&lt;br /&gt;smsw eax&lt;br /&gt;cmp ax, 031h&lt;br /&gt;jnz bad&lt;/blockquote&gt;&lt;br /&gt;Mais après l'opcode FPU, les bits vont finir par revenir à leur état initial. Donc une mauvaise émulation pourrait être bloquée dans une boucle infinie.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;_1:&lt;br /&gt;    smsw eax&lt;br /&gt;    cmp ax, 031h&lt;br /&gt;    jz _1&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Une autre version de ce test revient à attendre qu'un des 2 bits soit redéfini, et ensuite vérifier que le 2ème l'est aussi.&lt;br /&gt;&lt;br /&gt;La documentation Intel dit :&lt;br /&gt;&lt;blockquote&gt;L'instruction SMSW n'est utile que pour le système d'exploitation; quoi qu'il en soit, elle n'est pas privilégiée et peut être utilisé dans des applications.&lt;/blockquote&gt;&lt;br /&gt;Maintenant, vous savez que c'est aussi utile comme anti-*.&lt;br /&gt;&lt;br /&gt;De temps en temps (1 sur 20?), l'exécution échoue: l'opcode FPU change probablement les bits trop tard, auquel cas faire un 2eme test peut s'avérer nécessaire.&lt;br /&gt;&lt;br /&gt;Merci à Peter Ferrie.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/smsw-antidebug-r95.zip"&gt;Source et binaire&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-9176950448590031802?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/9176950448590031802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/policeman-got-no-gun-u-dont-have-2-run.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/9176950448590031802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/9176950448590031802'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/policeman-got-no-gun-u-dont-have-2-run.html' title='Policeman got no gun, U don&apos;t have 2 run'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-7327734761183407208</id><published>2010-01-20T20:09:00.003Z</published><updated>2010-01-23T22:57:19.129Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='anti'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>The hen never laid and the corn never growed</title><content type='html'>&lt;span style="font-style:italic;"&gt;anti-* with the GS register&lt;/span&gt;&lt;br /&gt;On thread switch, the GS register value is not restored (32 bits only).&lt;br /&gt;It's a simple statement that leads to anti-* (debugger/tracing/emulator) that defy common sense. (one of my favorite anti-*, since it doesn't call any API and requires to think out of the box).&lt;br /&gt;&lt;br /&gt;When stepping, threads are switched, so your debugger might lose the right value.&lt;br /&gt;Try it yourself:&lt;ol&gt;&lt;li&gt;open debugger&lt;/li&gt;&lt;li&gt;set GS to a non-zero value&lt;/li&gt;&lt;li&gt;step, even once&lt;/li&gt;&lt;li&gt;GS might be zero already!&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;so it's makes an easy anti-stepping:&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;set GS to a non-zero value&lt;/li&gt;&lt;li&gt;debugger detected if GS is 0&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;On the other hand, after some time of normal execution, thread switch will happen, and GS will be reset.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;set GS to a non-zero value&lt;/li&gt;&lt;li&gt;loop as long as GS is not zero&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;If an emulator is not resetting GS after some time, execution will be stuck in an infinite loop.&lt;br /&gt;&lt;br /&gt;Last, thread switching requires will take some time before it occurs. So, such a 'loop if not zero' used with a timing method can be used to detect a debugging session (with an anti-timer) or an emulator.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;check current time&lt;/li&gt;&lt;li&gt;wait for thread switch with the GS loop trick&lt;/li&gt;&lt;li&gt;check current time again&lt;/li&gt;&lt;li&gt;compare both values, shouldn't be too low&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;There is no 'mov gs, immediate_value' opcode, the only opcodes to modify GS are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;mov gs, reg16&lt;/li&gt;&lt;li&gt;pop gs&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Any code using GS should be taken as suspicious, as it's only used in recent binaries for anti-* purposes, in my opinion.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/gs-anti-debug-r94.zip"&gt;Source and binaries&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;anti-* avec le registre GS&lt;/span&gt;&lt;br /&gt;Au moment du changement de thread, la valeur du registre GS n'est pas restaurée (en 32 bits uniquement).&lt;br /&gt;Cette simple phrase permet des anti-* (débogueur/analyse/émulateur) qui défient le bon sens. (c'est un de mes anti-* favoris, car il ne nécessite aucun appel à API et demande de sortir du cadre).&lt;br /&gt;&lt;br /&gt;Quand on analyse pas à pas, les threads changent, donc votre débogueur peut perdre la bonne valeur.&lt;br /&gt;Essayez vous-même :&lt;ol&gt;&lt;li&gt;ouvrez le débogueur&lt;/li&gt;&lt;li&gt;donnez à GS une valeur non nulle&lt;/li&gt;&lt;li&gt;faites un juste un pas&lt;/li&gt;&lt;li&gt;il est possible que GS soit déjà nul !&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Donc ça fait un anti pas à pas facile:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;mettre à GS une valeur non nulle&lt;/li&gt;&lt;li&gt;vérifier que GS est non nul. Sinon, débogueur détecté !&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;D'autre part, après un certain temps d'exécution normale, le changement de thread va se produire, et GS deviendra nul.&lt;br /&gt;Ce qui nous donne l'anti-émulation suivant:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;mettre à GS une valeur non nulle&lt;/li&gt;&lt;li&gt;attendre que GS ne soit pas nul&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Si l'émulateur ne remet pas à zero GS au bout d'un certain temps, l'exécution sera bloquée dans une boucle infinie.&lt;br /&gt;&lt;br /&gt;Enfin, le changement de thread met un certain temps à se produire. Donc une telle 'attente que GS ne soit pas nul' utilisé avec une méthode de chronométrage peut être utilisée pour trouver un débogueur (avec un anti-timer) ou un émulateur.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;regarder l'heure&lt;/li&gt;&lt;li&gt;attendre le changement de thread via la boucle d'attente de GS&lt;/li&gt;&lt;li&gt;regarder l'heure à nouveau&lt;/li&gt;&lt;li&gt;comparer les deux valeurs, elles ne devraient pas être trop proche&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Il n'y a pas d'opcode 'mov gs, immediate_value', les seuls opcodes pour modifier GS sont :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;mov gs, reg16&lt;/li&gt;&lt;li&gt;pop gs&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Le moindre code utilisant GS devrait vous alerter, car dans des binaires récents, il n'est utilisé que pour les anti-*, à mon avis.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/gs-anti-debug-r94.zip"&gt;Sources et binaires&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-7327734761183407208?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/7327734761183407208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/hen-never-laid-and-corn-never-growed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7327734761183407208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7327734761183407208'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/hen-never-laid-and-corn-never-growed.html' title='The hen never laid and the corn never growed'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-1055957529272678095</id><published>2010-01-19T21:37:00.007Z</published><updated>2010-01-20T09:51:59.458Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>You can rock this land, baby</title><content type='html'>&lt;span style="font-style:italic;"&gt;the other subsystems&lt;/span&gt;&lt;br /&gt;In your Windows directory, most drivers have many sections, including the PAGE and INIT ones, where the EP is. All this is pretty scary, while, in the end, only a very small amount of information (compared to a GUI PE) is necessary to create a working driver:&lt;br /&gt;as expected, the Subsystem has to be set to NATIVE, then relocations are compulsory since you can't tell in advance where the driver will be loaded, and a correct PE checksum is required to have the driver running.&lt;br /&gt;And that's all!&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;at IMAGE_OPTIONAL_HEADER32.Subsystem, dw IMAGE_SUBSYSTEM_NATIVE&lt;br /&gt;...&lt;br /&gt;EntryPoint:&lt;br /&gt;reloc1_1:&lt;br /&gt;    push helloworld     ; PCHAR  Format&lt;br /&gt;    call DbgPrint&lt;br /&gt;    add esp, 4          ; correct the stack&lt;br /&gt;&lt;br /&gt;    mov eax, STATUS_DEVICE_CONFIGURATION_ERROR&lt;br /&gt;    retn 8&lt;br /&gt;&lt;br /&gt;reloc2_2:&lt;br /&gt;;%IMPORT ntoskrnl.exe!DbgPrint&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_qHSztWwiv98/S1YEQi1PrgI/AAAAAAAADjU/ShoJdR26qIc/s1600-h/HelloWorldDriver.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 354px;" src="http://2.bp.blogspot.com/_qHSztWwiv98/S1YEQi1PrgI/AAAAAAAADjU/ShoJdR26qIc/s400/HelloWorldDriver.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428531083116260866" /&gt;&lt;/a&gt;&lt;br /&gt;Similarly, usual console binaries import Msvcrt to deal with the console, which makes them bloated and complex. While in the end, you don't need anything besides changing the subsystem. You can still call GUI APIs the usual way, and writing to console output is just a matter of getting the OUTPUT handle and writing to it.&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;at IMAGE_OPTIONAL_HEADER32.Subsystem, dw IMAGE_SUBSYSTEM_WINDOWS_CUI&lt;br /&gt;...&lt;br /&gt;EntryPoint:&lt;br /&gt;    push STD_OUTPUT_HANDLE  ; DWORD nStdHandle&lt;br /&gt;    call GetStdHandle&lt;br /&gt;    mov [hConsoleOutput], eax&lt;br /&gt;&lt;br /&gt;    push 0                          ; LPVOID lpReserved&lt;br /&gt;    push lpNumbersOfCharsWritten    ; LPWORD lpNumbersOfCharsWritten&lt;br /&gt;    push HELLOWORLD_LEN             ; DWORD nNumbersOfCharsToWrite&lt;br /&gt;    push helloworld                 ; VOID *lpBuffer&lt;br /&gt;    push dword [hConsoleOutput]     ; HANDLE hConsoleOutput&lt;br /&gt;    call WriteConsoleA&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/subsystems-r93.zip"&gt;Sources and binaries&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;span style="font-style:italic;"&gt;les autres subsystems&lt;/span&gt;&lt;br /&gt;Dans votre répertoire Windows, la plupart des drivers ont beaucoup de sections, y compris les sections PAGE and INIT, où se trouve l'EP. Tout cela peut sembler compliquè, alors qu'au final, peu de changements sont nécessaires (par rapport à un PE GUI) pour créer un driver fonctionnel :&lt;br /&gt;comme attendu, le Subsystem doit être NATIVE, ensuite les relocations sont obligatoires puisqu'on ne sait pas à l'avance à quelle adresse le driver sera chargé, et une somme de contrôle correcte est requise pour charger le driver.&lt;br /&gt;Et c'est tout!&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;at IMAGE_OPTIONAL_HEADER32.Subsystem, dw IMAGE_SUBSYSTEM_NATIVE&lt;br /&gt;...&lt;br /&gt;EntryPoint:&lt;br /&gt;reloc1_1:&lt;br /&gt;    push helloworld     ; PCHAR  Format&lt;br /&gt;    call DbgPrint&lt;br /&gt;    add esp, 4          ; corriger la pile&lt;br /&gt;    mov eax, STATUS_DEVICE_CONFIGURATION_ERROR&lt;br /&gt;    retn 8&lt;br /&gt;&lt;br /&gt;reloc2_2:&lt;br /&gt;;%IMPORT ntoskrnl.exe!DbgPrint&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_qHSztWwiv98/S1YEQi1PrgI/AAAAAAAADjU/ShoJdR26qIc/s1600-h/HelloWorldDriver.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 354px;" src="http://2.bp.blogspot.com/_qHSztWwiv98/S1YEQi1PrgI/AAAAAAAADjU/ShoJdR26qIc/s400/HelloWorldDriver.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428531083116260866" /&gt;&lt;/a&gt;&lt;br /&gt;De manière similaire, les binaires console habituels importent Msvcrt pour gérer la console, ce qui les rend gros et complexes. Mais au final, on n'a besoin de rien hormis changer le Subsystem. On peut toujours appeler les APIs graphiques comme d'habitude, et écrire vers la console n'est qu'une affaire d'obtenir le &lt;span style="font-style:italic;"&gt;handle&lt;/span&gt; OUTPUT et d'y écrire.&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;at IMAGE_OPTIONAL_HEADER32.Subsystem, dw IMAGE_SUBSYSTEM_WINDOWS_CUI&lt;br /&gt;...&lt;br /&gt;EntryPoint:&lt;br /&gt;    push STD_OUTPUT_HANDLE  ; DWORD nStdHandle&lt;br /&gt;    call GetStdHandle&lt;br /&gt;    mov [hConsoleOutput], eax&lt;br /&gt;&lt;br /&gt;    push 0                          ; LPVOID lpReserved&lt;br /&gt;    push lpNumbersOfCharsWritten    ; LPWORD lpNumbersOfCharsWritten&lt;br /&gt;    push HELLOWORLD_LEN             ; DWORD nNumbersOfCharsToWrite&lt;br /&gt;    push helloworld                 ; VOID *lpBuffer&lt;br /&gt;    push dword [hConsoleOutput]     ; HANDLE hConsoleOutput&lt;br /&gt;    call WriteConsoleA&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/subsystems-r93.zip"&gt;Sources et binaires&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-1055957529272678095?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/1055957529272678095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/shock-to-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1055957529272678095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/1055957529272678095'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/shock-to-system.html' title='You can rock this land, baby'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_qHSztWwiv98/S1YEQi1PrgI/AAAAAAAADjU/ShoJdR26qIc/s72-c/HelloWorldDriver.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-8833412647165749048</id><published>2010-01-18T22:09:00.011Z</published><updated>2010-01-20T09:45:45.658Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Sail to the edge and I'd be there</title><content type='html'>&lt;span style="font-style:italic;"&gt;Messing with the TLS&lt;/span&gt;&lt;br /&gt;TLS, aka Thread Local Storage, is a way to execute some code before the EntryPoint or after ExitThread/ExitProcess.&lt;br /&gt;the 10th Data Directory points to a structure, and one of the elements (VA, not RVA) points to null-terminated list of callbacks, which will be called one after the other.&lt;br /&gt;This list is stored as VAs (it includes the ImageBase then), which makes it quite uncommon among the PE structures.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;IMAGE_TLS_DIRECTORY32:&lt;br /&gt;...&lt;br /&gt;    AddressOfCallBacks    dd Callbacks ; VA&lt;br /&gt;...&lt;br /&gt;Callbacks:&lt;br /&gt;    dd TLS&lt;br /&gt;    dd 0    ; null-terminated list&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;The size of the Data Directory is not taken into account. Some tool may ignore wrongly the TLS if it's not defined, though.&lt;br /&gt;&lt;br /&gt;Callbacks are executed on (before) thread start and on (after) thread exit. However, (credits goes to Peter Ferrie and Kris Kaspersky &lt;a href="http://nezumi-lab.org/blog/?p=51"&gt;here&lt;/a&gt;), TLS callbacks execution won't happen if no dll importing kernel32 is imported itself. So, if kernel32.dll is the only 'official' import (it doesn't mean it's the only dll in the program space), the callbacks are not executed.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;Nothing happens if there is no (valid) callbacks. It will trigger an exception but it's handled by the system so it doesn't trigger an visible error. After an exception or a null dword is found, the list is not parsed anymore. Tools building the list until a null dword is found can be fooled, which would create bogus entries.&lt;br /&gt;&lt;br /&gt;The list is reloaded between each callback. Callback N might modify the list at position N+1 and that will be taken into account.&lt;br /&gt;Similarly, if the EntryPoint code updates the callbacks' list, it will be taken into account during thread exit.&lt;br /&gt;the 'no callback execution if only Kernel32 is imported' status is updated during the EntryPoint code too: if the EntryPoint code loads, say, user32, the callbacks list will be executed on thread exit. If, at this point, one of the callbacks frees user32, the next callback will still be executed.&lt;br /&gt;&lt;br /&gt;Like EntryPoint values, the Callback address can point outside the PE, similar to my previous post (it's just a VA though, not an RVA), which can make the callbacks list difficult to analyze, but it's not a standard case - even among packers.&lt;br /&gt;&lt;br /&gt;Consequences:&lt;br /&gt;Because some debuggers automatically put a software breakpoint on the EntryPoint, and code at TLS is executed first, the TLS code can detect it (check if it's CC) and act accordingly.&lt;br /&gt;&lt;br /&gt;the 'only kernel32' rule can be used as an anti-emulator.&lt;br /&gt;&lt;br /&gt;Sometimes this rule seems wrong because a debugger plugin loaded another dll itself.&lt;br /&gt;&lt;br /&gt;If a callback on loading calls ExitProcess, the other callbacks (and EP) are never executed. Which makes TLS callbacks another way to ignore the EP value altogether, like mentioned in my previous post.&lt;br /&gt;&lt;br /&gt;Setting a TLS callback from the EntryPoint and exiting can be yet another way to 'Jump'. It's just so unnatural to expect code after the 'final' ExitProcess call. (there IS a life after death!). Same for setting a callback from a previous one, but the 'beyond final' effect is lost.&lt;br /&gt;&lt;br /&gt;To break on TLS callbacks in OllyDbg, using OllyAdvanced is an easy solution. Otherwise, set the 'first pause' on 'System breakpoint'.&lt;br /&gt;&lt;br /&gt;Files:&lt;br /&gt;&lt;span style="font-style:italic;"&gt;tls_standard&lt;/span&gt; just uses standard tls callbacks.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;tls_fake&lt;/span&gt; fills the callbacks list with bogus entries:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;Callbacks:&lt;br /&gt;db 'lets fill the Callbacks...'&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;no_relocs_tls_loader&lt;/span&gt; uses a callback outside the pe&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;;%IMPORT no_relocs.dll!Export&lt;br /&gt;...&lt;br /&gt;Callbacks:&lt;br /&gt;    dd 330200h&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;tls_on_the_fly&lt;/span&gt; shows that modifying the callback list is taken into account&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;TLS0:&lt;br /&gt;    mov dword [Callbacks + 4], TLS&lt;br /&gt;    retn&lt;br /&gt;TLS:&lt;br /&gt;    push MB_ICONINFORMATION ; UINT uType&lt;br /&gt;    push aTls1              ; LPCTSTR lpCaption&lt;br /&gt;...&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;tls_no_user32&lt;/span&gt; shows that just loading kernel32 doesn't enable the usual callbacks behavior, then loading user32 in the EP code re-enables it.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;EntryPoint:&lt;br /&gt;    push aUser32            ; LPCTSTR lpFileName&lt;br /&gt;    call LoadLibraryA&lt;br /&gt;...&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/tls-r92.zip"&gt;Sources and binaries&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Faire des misères au TLS&lt;/span&gt;&lt;br /&gt;Le TLS, autrement dit le Thread Local Storage, permet d'exécuter du code avant l'EntryPoint ou après un appel à ExitThread/ExitProcess.&lt;br /&gt;Le 10ème Data Directory pointe vers une structure, et un des éléments (VA, pas RVA) pointe vers une liste de callbacks terminée par zéro, qui seront&lt;br /&gt;appelés l'un après l'autre.&lt;br /&gt;Cette liste est stockée sous forme de VAs (ImageBase inclue, donc), ce qui est inhabituel dans les strucures du PE.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;IMAGE_TLS_DIRECTORY32:&lt;br /&gt;...&lt;br /&gt;    AddressOfCallBacks    dd Callbacks ; VA&lt;br /&gt;...&lt;br /&gt;Callbacks:&lt;br /&gt;    dd TLS&lt;br /&gt;    dd 0    ; null-terminated list&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;La taille du Data Directory n'est pas prise en compte. Certains outils pourraient ignorer - à tort - le TLS si elle n'est pas définie.&lt;br /&gt;&lt;br /&gt;Les callbacks sont exécutés à l'initialistation (avant) du thread start et après sa fin. Cependant, (l'honneur revient à Peter Ferrie et Kris Kaspersky, &lt;a href="http://nezumi-lab.org/blog/?p=51"&gt;ici&lt;/a&gt;), l'exécution n'aura pas lieu si aucune DLL n'important kernel32 n'est elle-même importée. Donc, si kernel32.dll est le seul import 'officiel' (cela ne veut pas dire que ca soit la seule DLL dans l'espace mémoire), les callbacks ne sont pas exécutés.&lt;br /&gt;&lt;br /&gt;Rien ne se passe si il n'y a pas de callbacks (valide). Ça va déclencher une exception, mais elle sera gérée par le système, donc pas d'erreur visible. Après une exception ou un zéro terminal, la liste n'est plus parcourue. Les outils construisant la liste jusqu'à un zéro terminal peuvent être induit en erreur, ce qui créeraient des entrées factices.&lt;br /&gt;&lt;br /&gt;La liste est rechargée à chaque callback. le N-ème Callback N peut changer la liste à la position N+1, et cela sera pris en compte.&lt;br /&gt;De manière similaire, si l'EntryPoint modifie la liste, cela sera pris en compte lors de la sortie du Thread.&lt;br /&gt;&lt;br /&gt;Le statu de la règle 'pas d'exécution si seule Kernel32 est importée' est mis à jour lors du code de l'EntryPoint également : si l'EntryPoint charge - par exemple - user32, les callbacks seront exécutés lors de la sortie. Si, à ce moment-là, un des callbacks décharge User32, le callback suivant sera toujours exécuté.&lt;br /&gt;&lt;br /&gt;A l'instart des EntryPoint, les callbacks peuvent être en dehors du PE, comme dans mon billet précédent (c'est une juste une VA, pas une RVA), ce qui peut rendre la liste des callbacks difficile à analyser, mais ce n'est pas un cas standard, même dans les packeurs.&lt;br /&gt;&lt;br /&gt;Conséquences:&lt;br /&gt;Puisque certains débogueurs (désinsectiseurs ? :) ) mettent un point d'arrêt logiciel sur l'EntryPoint, et que le code des callbacks est exécuté d'abord, le code du callback peut le détecter (vérifier si c'est CC), et agir en conséquence.&lt;br /&gt;&lt;br /&gt;La règle 'seule Kernel32' peut-être utilisée comme un anti-émulateur.&lt;br /&gt;&lt;br /&gt;Parfois cette règle semble fausse car un plugin du débogueur a lui-même chargé une DLL supplémentaire.&lt;br /&gt;&lt;br /&gt;Si un callback appelle ExitProcess lors de l'initialisation, les callbacks suivent et l'EP ne seront jamais exécutés. Ce qui fait que le TLS est un moyen de plus d'ignorer l'EP, comme dans mon billet précédent.&lt;br /&gt;&lt;br /&gt;Définir un callback de l'EntryPoint et terminer est un moyen de plus de 'sauter'. Mais il est tellement inhabituel d'attendre du code apres l'appel 'final' à Exitprocess. (Il y A donc une vie après la mort !). De même de définir un callback à la suite d'un autre, mais l'effet 'après la mort' est perdu.&lt;br /&gt;&lt;br /&gt;Pour s'arrêter sur les callbacks dans OllyDbg, utiliser OllyAdvanced est une solution simple. Sinon, mettre 'first pause' sur 'System breakpoint'.&lt;br /&gt;&lt;br /&gt;Fichiers:&lt;br /&gt;&lt;span style="font-style:italic;"&gt;tls_standard&lt;/span&gt; utilise le TLS standard.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;tls_fake&lt;/span&gt; remplit la liste d'entrées factices :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;Callbacks:&lt;br /&gt;db 'lets fill the Callbacks...'&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;no_relocs_tls_loader&lt;/span&gt; utilise un callback hors du PE :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;;%IMPORT no_relocs.dll!Export&lt;br /&gt;...&lt;br /&gt;Callbacks:&lt;br /&gt;    dd 330200h&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;tls_on_the_fly&lt;/span&gt; montre les que les changements apportés à la liste sont pris en compte à la volée :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;TLS0:&lt;br /&gt;    mov dword [Callbacks + 4], TLS&lt;br /&gt;    retn&lt;br /&gt;TLS:&lt;br /&gt;    push MB_ICONINFORMATION ; UINT uType&lt;br /&gt;    push aTls1              ; LPCTSTR lpCaption&lt;br /&gt;...&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;tls_no_user32&lt;/span&gt; montre qu'importer uniquement kernel32 n'active pas le comportement habituel, et que charger user32 dans l'EP le rétablit.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;EntryPoint:&lt;br /&gt;    push aUser32            ; LPCTSTR lpFileName&lt;br /&gt;    call LoadLibraryA&lt;br /&gt;...&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/tls-r92.zip"&gt;Sources et binaires&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-8833412647165749048?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/8833412647165749048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/world-before-columbus.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8833412647165749048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8833412647165749048'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/world-before-columbus.html' title='Sail to the edge and I&apos;d be there'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-8405446474698702499</id><published>2010-01-17T19:14:00.019Z</published><updated>2010-12-12T10:23:59.007Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>If you got the money honey, we got your disease</title><content type='html'>&lt;span style="font-style: italic;"&gt;Messing with the EntryPoint&lt;/span&gt;&lt;br /&gt;In most files, the EP is in the first section. In many packers or file infecters, it will be in another section. It's actually common in the header itself (Upack, FSG), and sometimes (like - among others - in &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/collapsed.asm?r=87"&gt;collapsed.asm&lt;/a&gt;), it's at RVA 0, in which case the MZ signature is just interpreted as &lt;span style="font-style: italic;"&gt;dec ebp, pop edx&lt;/span&gt;, which is benign. Many packers just put some trampoline code at RVA 0, then the rest of the code further.&lt;br /&gt;So, usually:&lt;br /&gt;&lt;blockquote&gt;Section0 VA &lt;= EntryPoint &lt;= Section0 VA + Physical Size&lt;/blockquote&gt;and to a general extend: &lt;blockquote&gt;0 &lt;= EntryPoint &lt;= SizeOfImage&lt;br /&gt;&lt;/blockquote&gt;But no check is actually done on the EntryPoint value!&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;If there is no need to execute any code, no problem will occur:&lt;br /&gt;some PE files are just used as resource containers, for example storing images and icons used in several products or softwares. In this case, there is no code whatsoever, thus no expected execution. The only form of interaction with this file is via the resource APIs.&lt;br /&gt;&lt;br /&gt;In a DLL, the code at the EntryPoint (DllMain) is executed on loading and unloading, whether it's loaded normally or via LoadLibraryA/FreeLibrary (&lt;a href="http://msdn.microsoft.com/en-us/library/ms684179%28VS.85%29.aspx"&gt;LoadLibraryEx&lt;/a&gt; is an exception, you can specify it NOT to run DllMain, aka the code at the EP of the DLL).&lt;br /&gt;So, if you always load a DLL with LoadLibraryEx and the right parameters, the EP value will not be used.&lt;br /&gt;&lt;br /&gt;In both cases, the EP value could be bogus.&lt;br /&gt;&lt;br /&gt;Moreover, if the EP is actually executed (which just means, code at EP + IMAGEBASE is executed) and no problem happens, it's still ok!&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Open Notepad in a debugger, check ExitProcess address: 7C81CB12 ExitProcess 8BFF MOV EDI,EDI)&lt;/li&gt;&lt;li&gt;Set the EP to that address (substract IMAGEBASE): 7c81cv12 - 1000000 = 7B81CB12)&lt;/li&gt;&lt;li&gt;Run...execution starts directly at ExitProcess...&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;Even better, if you force your code to be at some address, via, for example, a DLL without relocations, and an executable that imports this DLL, with the right EP value, in the expected DLL code, you can get a working PE , with a huge or a negative EntryPoint...&lt;br /&gt;&lt;br /&gt;In my example, no_relocs.dll:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;IMAGEBASE 330000h, Relocation 0&lt;br /&gt;Section 0 VA 200&lt;br /&gt;    push MB_ICONINFORMATION ; UINT uType&lt;br /&gt;    push tada               ; LPCTSTR lpCaption&lt;br /&gt;...&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;And the loader no_relocs_loader.exe:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;EntryPoint: FFF30200&lt;br /&gt;ImageBase:  00400000&lt;br /&gt;=&gt; Execution at 00330200 = Start of Section 0 of no_relocs.dll&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;So this file, empty with a negative EntryPoint, just runs fine.&lt;br /&gt;&lt;br /&gt;In conclusion, it's difficult to decide in advance if an EntryPoint value is valid or not. It's just possible to say if it's standard or not.&lt;br /&gt;&lt;br /&gt;Original idea from Costin Ionescu.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/no_relocs-r91.zip"&gt;Binaries&lt;/a&gt; Sources: &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/no_relocs.asm?r=91"&gt;dll&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/no_relocs_loader.asm?r=91"&gt;loader&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Faire des misères à l'EntryPoint&lt;/span&gt;&lt;br /&gt;Dans la plupart des fichier, l'EP est dans la première section. Dans beaucoup de packeurs ou d'infecteurs, il sera dans une autre section. C'est aussi courant de le trouver dans l'en-tête lui-même (Upack, FSG), et parfois (comme - entre autres - dans &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/collapsed.asm?r=87"&gt;collapsed.asm&lt;/a&gt;), il est à la RVA 0, auquel cas la signature MZ est juste interprétée comme &lt;span style="font-style: italic;"&gt;dec ebp, pop edx&lt;/span&gt;, ce qui est bénin. Beaucoup de packers mettent just du code 'trampoline' à RVA 0, et le reste du code est ailleurs.&lt;br /&gt;Donc, d'habitude :&lt;br /&gt;&lt;blockquote&gt;Section0 VA &lt;= EntryPoint &lt;= Section0 VA + Physical Size&lt;/blockquote&gt;et de manière générale : &lt;blockquote&gt;0 &lt;= EntryPoint &lt;= SizeOfImage&lt;/blockquote&gt;&lt;br /&gt;Mais en fait, il n'y a aucune vérification sur la valeur de l'EntryPoint !&lt;br /&gt;&lt;br /&gt;Si il n'y a pas besoin d'exécuter du code, aucune erreur ne se produira :&lt;br /&gt;Certains PE sont juste utilisés comme conteneurs de &lt;span style="font-style:italic;"&gt;resources&lt;/span&gt;, par exemple pour stocker les images et les icones utilisées dans plusieurs produits ou programmes. Dans ce cas, il n'y a pas le moindre code, donc pas d'exécution à attendre. L'unique forme d'interaction avec se fichier se fera via les APIs de ressources.&lt;br /&gt;&lt;br /&gt;Dans une DLL, le code à l'EntryPoint (le DllMain) est exécuté au chargement et au déchargement, que ce soit normalement ou via LoadLibraryA/FreeLibrary) (&lt;a href="http://msdn.microsoft.com/en-us/library/ms684179%28VS.85%29.aspx"&gt;LoadLibraryEx&lt;/a&gt; est une exception, on peut spécifier de ne PAS exécuter le DllMain).&lt;br /&gt;Donc, si on charge toujours une DLL avec LoadLibraryEx et les bons paramètres, la valeur de l'EP ne sera pas utilisée.&lt;br /&gt;&lt;br /&gt;In both cases, the EP value could be bogus.&lt;br /&gt;&lt;br /&gt;De plus, si l'EP est executé (ce qui signifie uniquement que l'execution est transférée à EP + IMAGEBASE) et que rien ne se passe de mal, tout va bien !&lt;br /&gt;&lt;br /&gt;Exemple:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Ouvrez Notepad dans un debugger, notez l'adresse d'ExitProcess : 7C81CB12 ExitProcess 8BFF MOV EDI,EDI)&lt;/li&gt;&lt;li&gt;Changez l'EP vers cette adresse (soustraire l'IMAGEBASE): 7c81cv12 - 1000000 = 7B81CB12)&lt;/li&gt;&lt;li&gt;Lancez... l'exécution débute directement à ExitProcess...&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;Encore mieux, si vous forcez l'exécution à une adresse, via par exemple, une DLL sans relocations, et un exécutable importe cette DLL, avec la bonne valeur d'EP, qui pointe sur le code de la DLL, on obtient un PE qui tourne, avec un EP trop haut ou au contraire négatif...&lt;br /&gt;&lt;br /&gt;Dans mon example, no_relocs.dll :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;IMAGEBASE 330000h, Relocation 0&lt;br /&gt;Section 0 VA 200&lt;br /&gt;    push MB_ICONINFORMATION ; UINT uType&lt;br /&gt;    push tada               ; LPCTSTR lpCaption&lt;br /&gt;...&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Et dans le chargeur, no_relocs_loader.exe :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;EntryPoint: FFF30200&lt;br /&gt;ImageBase:  00400000&lt;br /&gt;=&gt; Exécution à 00330200 = Début de la Section 0 de no_relocs.dll&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Donc ce fichier, vide et avec un EntryPoint négatif, fonctionne correctement.&lt;br /&gt;&lt;br /&gt;En conclusion, il est difficile de dire à l'avance si un EntryPoint est correct ou non. Mais il est facile de déterminer s'il est standard ou non.&lt;br /&gt;&lt;br /&gt;Idée originale de Costin Ionescu.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/no_relocs-r91.zip"&gt;Binaires&lt;/a&gt; Sources: &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/no_relocs.asm?r=91"&gt;dll&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/no_relocs_loader.asm?r=91"&gt;loader&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-8405446474698702499?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/8405446474698702499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/welcome-to-jungle.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8405446474698702499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8405446474698702499'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/welcome-to-jungle.html' title='If you got the money honey, we got your disease'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-2486870870995810880</id><published>2010-01-16T23:58:00.007Z</published><updated>2010-12-12T10:20:19.570Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>With a rebel yell! more, more, more!</title><content type='html'>&lt;span style="font-style:italic;"&gt;Description of a compiled PE header&lt;/span&gt;&lt;br /&gt;In my previous posts, I started exploring PE Headers with a minimum amount of information (as opposed to the official specifications). On the other hand, standard compilers like MASM add more elements (not necessarily documented), on top of defining, as you would expect, mosts elements of the structures.&lt;br /&gt;&lt;br /&gt;To understand things correctly, I assembled and linked a simple HelloWorld code &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/helloworld-masm.asm?r=90"&gt;source&lt;/a&gt; in Masm, and reproduce the complete structure of the executable with a YASM &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/compiled.asm?r=90"&gt;source&lt;/a&gt; (that defines every byte of the header manually).&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;Between the DOS header and the FILE Header lies the DOS stub, written in 16 bits. It should be aligned to 16, as its entrypoint is defined by the amount of paragraphs. In short, the DOS code can only start at X0, and the value of DOS_HEADER.e_cparhdr will be X (no zero):&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;DOS_HEADER.e_cparhdr dw (dos_stub - DOS_HEADER) &gt;&gt; 4&lt;br /&gt;...&lt;br /&gt;dos_stub:&lt;br /&gt;bits 16&lt;br /&gt;    push    cs&lt;br /&gt;    pop     ds&lt;br /&gt;    mov     dx, dos_msg - dos_stub&lt;br /&gt;    mov     ah, 9&lt;br /&gt;    int     21h&lt;br /&gt;    mov     ax, 4c01h&lt;br /&gt;    int     21h&lt;br /&gt;dos_msg&lt;br /&gt;    db 'This program cannot be run in DOS mode.', 0dh, 0dh, 0ah, '$'&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Right after this (16-aligned too) lies the 'undocumented' &lt;a href="http://ntcore.com/files/richsign.htm"&gt;Rich Header/Signature&lt;/a&gt;, which is a signature generated by the compiler with the symbols presents in the file, among other things. Even the padding is not constant, and the whole block is xored with the checksum, which makes it quite odd altogether.&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;RichHeader:&lt;br /&gt;RichKey EQU 092033d19h&lt;br /&gt;dd "DanS" ^ RichKey     , 0 ^ RichKey, 0 ^ RichKey       , 0 ^ RichKey&lt;br /&gt;dd 0131f8eh ^ RichKey   , 7 ^ RichKey, 01220fch ^ RichKey, 1 ^ RichKey&lt;br /&gt;dd "Rich", 0 ^ RichKey  , 0, 0&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;The rest of the file is clean (no other extra stuff), and only 2 directories are defined, Imports and Imports Table (Some compiler like OpenWatcom define the Copyright directory, just a pointer to a copyright string).&lt;br /&gt;&lt;br /&gt;After covering such a 'bloated' header, I can go back to unsual PE files again.&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/compiled-r90.zip"&gt;Binaries and Sources&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Description d'un en-tête PE compilé&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Dans mes billets précédents, j'ai commencé à explorer des en-têtes PE avec un minimum d'informations (par rapport aux spécifications officielles). A l'opposé, des compilateurs standards comme MASM rajoutent des éléments (pas forcément documentés), en plus de définir - comme on s'y attend - la plupart des éléments de la structure des en-têtes.&lt;br /&gt;&lt;br /&gt;Pour comprendre correctement, j'ai assemblé et &lt;span style="font-style:italic;"&gt;linké&lt;/span&gt; un code &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/helloworld-masm.asm?r=90"&gt;source&lt;/a&gt; simple de Hello World en Masm, puis reproduit la structure complète de l'exécutable avec un &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/compiled.asm?r=90"&gt;source&lt;/a&gt; YASM (qui définit manuellement chaque octet de l'en-tête).&lt;br /&gt;&lt;br /&gt;Entre les en-têtes DOS et FILE, il y a le code DOS, en 16 bits. Il doit être aligné sur 16 octets, car son &lt;span style="font-style:italic;"&gt;EntryPoint&lt;/span&gt; est défini par le nombre de paragraphe. En gros, le code DOS débute forcement à X0, et la valeur de DOS_HEADER.e_cparhdr sera X (pas de zéro) :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;DOS_HEADER.e_cparhdr dw (dos_stub - DOS_HEADER) &gt;&gt; 4&lt;br /&gt;...&lt;br /&gt;dos_stub:&lt;br /&gt;bits 16&lt;br /&gt;    push    cs&lt;br /&gt;    pop     ds&lt;br /&gt;    mov     dx, dos_msg - dos_stub&lt;br /&gt;    mov     ah, 9&lt;br /&gt;    int     21h&lt;br /&gt;    mov     ax, 4c01h&lt;br /&gt;    int     21h&lt;br /&gt;dos_msg&lt;br /&gt;    db 'This program cannot be run in DOS mode.', 0dh, 0dh, 0ah, '$'&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Juste après (aligne sur 16 octets également) se trouve &lt;a href="http://ntcore.com/files/richsign.htm"&gt;l'en-tête/signature Rich&lt;/a&gt;, qui est une signature générée par le compilateur à partir des symboles présents dans le fichier, entre autres. Même le &lt;span style="font-style:italic;"&gt;padding&lt;/span&gt; n'est pas constant, et le bloc entier est &lt;span style="font-style:italic;"&gt;xore&lt;/span&gt; avec une somme de contrôle, ce qui rend le tout plutôt étrange..&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;RichHeader:&lt;br /&gt;RichKey EQU 092033d19h&lt;br /&gt;dd "DanS" ^ RichKey     , 0 ^ RichKey, 0 ^ RichKey       , 0 ^ RichKey&lt;br /&gt;dd 0131f8eh ^ RichKey   , 7 ^ RichKey, 01220fch ^ RichKey, 1 ^ RichKey&lt;br /&gt;dd "Rich", 0 ^ RichKey  , 0, 0&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Le reste du fichier est propre (plus rien de rajouté), et seul 2 &lt;span style="font-style:italic;"&gt;data directories&lt;/span&gt; sont définis &lt;span style="font-style:italic;"&gt;Imports&lt;/span&gt; et &lt;span style="font-style:italic;"&gt;Imports Table&lt;/span&gt; (des compilateurs comme OpenWatcom définissent le &lt;span style="font-style:italic;"&gt;Copyright directory&lt;/span&gt;, juste un pointeur vers une chaîne de copyright).&lt;br /&gt;&lt;br /&gt;Après avoir couvert un tel en-tête 'superflu', je peux retourner à mes fichiers PE inhabituels.&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/compiled-r90.zip"&gt;Binaires et Sources&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-2486870870995810880?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/2486870870995810880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/with-rebel-yell-more-more-more.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2486870870995810880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2486870870995810880'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/with-rebel-yell-more-more-more.html' title='With a rebel yell! more, more, more!'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-2632614728816038610</id><published>2010-01-14T22:04:00.013Z</published><updated>2010-12-12T10:17:51.267Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Hey, hey, hey, what's in your head?</title><content type='html'>&lt;span style="font-style:italic;"&gt;PE Header holes / filling them&lt;/span&gt;&lt;br /&gt;Since the PE loader in Windows is too flexible, most of the PE Header information can be discarded.&lt;br /&gt;As the &lt;a href="http://www.phreedom.org/solar/code/tinype/"&gt;Tiny PE project&lt;/a&gt; proved, it's possible to get a 97 bytes PE! It also proved a valid PE can't be smaller, as 97 bytes is the minimum size to fit all the structures until OPTIONAL_HEADER.Subsystem, the last compulsory element.&lt;br /&gt;&lt;br /&gt;In my short &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/onesec.hdr?r=80"&gt;one-section file header&lt;/a&gt; (which I use in my helloworld.asm example), I define a minimum (not an absolute minimum, though) amount of elements of the PE structure, to have a file with Imports, Section and EntryPoint (none of them is strictly necessary):&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;IMAGE_DOS_HEADER&lt;br /&gt;    e_magic                 (constant)&lt;br /&gt;    e_lfanew&lt;br /&gt;IMAGE_NT_HEADERS&lt;br /&gt;    Signature               (constant)&lt;br /&gt;IMAGE_FILE_HEADER&lt;br /&gt;    Machine                 (almost constant)&lt;br /&gt;    NumberOfSections        (not strictly necessary)&lt;br /&gt;    SizeOfOptionalHeader&lt;br /&gt;    Characteristics&lt;br /&gt;IMAGE_OPTIONAL_HEADER32&lt;br /&gt;    Magic                   (almost constant)&lt;br /&gt;    AddressOfEntryPoint     (not strictly necessary)&lt;br /&gt;    ImageBase&lt;br /&gt;    SectionAlignment&lt;br /&gt;    FileAlignment&lt;br /&gt;    MajorSubsystemVersion   (almost constant)&lt;br /&gt;    SizeOfImage&lt;br /&gt;    SizeOfHeaders&lt;br /&gt;    Subsystem&lt;br /&gt;    NumberOfRvaAndSizes     (not strictly necessary)&lt;br /&gt;IMAGE_DATA_DIRECTORY&lt;br /&gt;    ImportsVA               (not strictly necessary)&lt;br /&gt;IMAGE_SECTION_HEADER&lt;br /&gt;    VirtualAddress          (not strictly necessary)&lt;br /&gt;    SizeOfRawData           (not strictly necessary)&lt;br /&gt;    PointerToRawData        (not strictly necessary)&lt;br /&gt;&lt;/blockquote&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;So, in total, a PE can be defined by only 16 elements, 6 of which are not strictly necessary, excluding 3 almost constants (always the same under a modern 32 bit windows) and 2 constants signatures.&lt;br /&gt;&lt;br /&gt;Since only a few elements are defined, the file is full of gaps (HelloWorld.exe is made of 67% of 00s). &lt;br /&gt;&lt;br /&gt;...that's a lot of space...let's use it !&lt;br /&gt;&lt;br /&gt;In &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/collapsed.asm?r=87"&gt;collapsed.asm&lt;/a&gt;, all the elements that are not part of the header (code, data, imports) are moved into those gaps.&lt;br /&gt;Among others, even the initial signature is a part of the code:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;IMAGE_DOS_HEADER&lt;br /&gt;e_magic       dw 'MZ'   ; will decode as dec ebp, pop edx&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;and the section name is used as an Import thunk:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;SECTION_0:&lt;br /&gt;kernel32.dll_THUNK:&lt;br /&gt;__imp__ExitProcess:&lt;br /&gt;.AddressOfData&lt;br /&gt;    DD iExitProcess - IMAGEBASE&lt;br /&gt;    DD 0&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;It makes quite an odd PE, but it still works! some tools may crash or fail loading it though: EntryPoint at 0, non-linear import table, etc...&lt;br /&gt;&lt;br /&gt;HelloWorld: &lt;a href="http://corkami.googlecode.com/files/helloworld-r87.zip"&gt;Binary&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/helloworld.asm?r=80"&gt;Source&lt;/a&gt;&lt;br /&gt;Collapsed: &lt;a href="http://corkami.googlecode.com/files/collapsed-r87.zip"&gt;Binary&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/collapsed.asm?r=87"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Les trous des en-têtes PE / les remplir&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Puisque le système de chargement des PE sous Windows est trop flexible, la plupart de l'en-tête PE peut être oubliée.&lt;br /&gt;Comme l'a prouvé le projet &lt;a href="http://www.phreedom.org/solar/code/tinype/"&gt;Tiny PE&lt;/a&gt;, il est possible d'obtenir un PE de 97 octets ! Il a également été prouvé qu'un PE valide ne peut être plus petit, car 97 octets est la taille minimum pour aller jusqu'au OPTIONAL_HEADER.Subsystem, le dernier élément indispensable.&lt;br /&gt;&lt;br /&gt;Dans mon &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/onesec.hdr?r=80"&gt;en-tête&lt;/a&gt; pour fichier à une seule section (que j'utilise dans l'exemple helloworld.asm), je définis un minimum (pas un minimum absolu cependant) d'éléments de la structure du PE, pour avoir un fichier avec Imports, Section et EntryPoint (aucun des trois n'étant indispensable) :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;IMAGE_DOS_HEADER&lt;br /&gt;    e_magic                 (constant)&lt;br /&gt;    e_lfanew&lt;br /&gt;IMAGE_NT_HEADERS&lt;br /&gt;    Signature               (constant)&lt;br /&gt;IMAGE_FILE_HEADER&lt;br /&gt;    Machine                 (quasi constant)&lt;br /&gt;    NumberOfSections        (facultatif)&lt;br /&gt;    SizeOfOptionalHeader&lt;br /&gt;    Characteristics&lt;br /&gt;IMAGE_OPTIONAL_HEADER32&lt;br /&gt;    Magic                   (quasi constant)&lt;br /&gt;    AddressOfEntryPoint     (facultatif)&lt;br /&gt;    ImageBase&lt;br /&gt;    SectionAlignment&lt;br /&gt;    FileAlignment&lt;br /&gt;    MajorSubsystemVersion   (quasi constant)&lt;br /&gt;    SizeOfImage&lt;br /&gt;    SizeOfHeaders&lt;br /&gt;    Subsystem&lt;br /&gt;    NumberOfRvaAndSizes     (facultatif)&lt;br /&gt;IMAGE_DATA_DIRECTORY&lt;br /&gt;    ImportsVA               (facultatif)&lt;br /&gt;IMAGE_SECTION_HEADER&lt;br /&gt;    VirtualAddress          (facultatif)&lt;br /&gt;    SizeOfRawData           (facultatif)&lt;br /&gt;    PointerToRawData        (facultatif)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Donc en tout, un PE peut être défini par 16 éléments uniquement, dont 6 facultatifs, si on exclut les 3 quasi-constants (invariables sous un Windows 32 bits moderne) et 2 signatures constantes.&lt;br /&gt;&lt;br /&gt;Puisque seulement quelques éléments sont définis, le fichier est plein de trous (HelloWorld.exe est vide à 67%). &lt;br /&gt;&lt;br /&gt;...tout cet espace...utilisons-le !&lt;br /&gt;&lt;br /&gt;Dans &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/collapsed.asm?r=87"&gt;collapsed.asm&lt;/a&gt;, tous les éléments qui ne font pas partie de l'en-tête (code, données, imports) ont été déplacés dans ces trous.&lt;br /&gt;Entre autre, même la signature initiale fait partie du code :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;IMAGE_DOS_HEADER&lt;br /&gt;e_magic       dw 'MZ'   ; sera interprété comme dec ebp, pop edx&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;et le nom de section est utilisé comme THUNK d'Import :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;SECTION_0:&lt;br /&gt;kernel32.dll_THUNK:&lt;br /&gt;__imp__ExitProcess:&lt;br /&gt;.AddressOfData&lt;br /&gt;    DD iExitProcess - IMAGEBASE&lt;br /&gt;    DD 0&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Ça donne un binaire bien bizarre, mais ça marche encore ! Cela dit, certains programmes peuvent planter ou refuser de le charger : EntryPoint à 0, table d'imports non linéaire, etc...&lt;br /&gt;&lt;br /&gt;HelloWorld : &lt;a href="http://corkami.googlecode.com/files/helloworld-r87.zip"&gt;Binaire&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/helloworld.asm?r=80"&gt;Source&lt;/a&gt;&lt;br /&gt;Collapsed : &lt;a href="http://corkami.googlecode.com/files/collapsed-r87.zip"&gt;Binaire&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/collapsed.asm?r=87"&gt;Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-2632614728816038610?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/2632614728816038610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/hey-hey-hey-whats-in-your-head.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2632614728816038610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2632614728816038610'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/hey-hey-hey-whats-in-your-head.html' title='Hey, hey, hey, what&apos;s in your head?'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-3216274155918295552</id><published>2010-01-13T22:56:00.009Z</published><updated>2010-12-12T10:13:51.260Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>They say jump, you say how high</title><content type='html'>&lt;span style="font-style:italic;"&gt;Various ways of JMPing&lt;/span&gt;&lt;br /&gt;jumping, aka branching, is one of the most common operations.&lt;br /&gt;&lt;br /&gt;I wrote a file that implements many forms of jumping, whether they are common, obfuscated, or rare. Not everything is detailed in this post, check the source for further information.&lt;br /&gt;&lt;br /&gt;First, Jumps,&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;EB 07            JMP SHORT 004000F9&lt;br /&gt;E9 07000000      JMP 00400105&lt;br /&gt;FFE7             JMP EDI                   ; 00400113&lt;br /&gt;FF25 19014000    JMP DWORD PTR DS:[400119] ; 00400124&lt;br /&gt;EA 32014000 1B00 JMP FAR 001B:00400132&lt;br /&gt;FF2D 38014000    JMP FAR DS:[400138]       ; DS:[00400138]=001B:00400145&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;then CALLs, &lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;E802             CALL 00400103&lt;br /&gt;FF1A             CALL FAR [EDX]&lt;br /&gt;FF12             CALL [EDX]&lt;br /&gt;FFD2             CALL EDX&lt;br /&gt;9A 7C014000 1B00 CALL FAR 001B:0040017C&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;RETurns&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;C3 RETN    ; Return to 004001DE&lt;br /&gt;CB RETF    ; Return to 001B:004001EC&lt;br /&gt;CF IRETD   ; Return to 001B:004001FB, flags = 206&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;loop*.&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then, another way of jumping (unconditionally) is to either fake the condition by assuming a start value, or to force it, by setting a register or a flag (pushf, lahf, stc, SEH, iret).&lt;br /&gt;&lt;br /&gt;Note that all of them (jumps, jxx, calls, return, loops) are influenced by the operand prefix: it turns dword operands in word, of course, but you will jump to the lower bits of EIP. And as expected, CALL WORD will only push a word on the stack.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;004000F0:&lt;br /&gt;    66:EB 00   JMP SHORT 000000F3&lt;br /&gt;    66:E2 00   LOOPD SHORT 000000F6&lt;br /&gt;    66:E8 0000 CALL 000000FA&lt;br /&gt;    66:C3      RETN         ;Return to 00006D4F, [ESP] = 7C816D4F&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Naturally, any of those WORD jumps will be unlikely useful in your code, but it's an unusual way to trigger an exception.&lt;br /&gt;&lt;br /&gt;LOOP and JECXZ are also influenced by the address prefix (like REP), which turns the condition on CX only, as you could expect. But, unlike jcxz, neither 67 Loop* or 67 Rep* have an official name (OllyDbg calls it LOOPW, as opposed to LOOPD, though).&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;With the same ECX value:&lt;br /&gt;67:E2 02   LOOPW SHORT 004001CA  ;Loop is NOT taken, CX=0001&lt;br /&gt;E2 07      LOOPD SHORT 004001D1  ;Loop is taken, ECX=FFFF0001&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;You can also play with the stack, calling code there, pushing then modifying values.&lt;br /&gt;&lt;br /&gt;Next are the unusual (more like anti-emulators) ways: &lt;br /&gt;using an API that expects a callback function, spawning a extra thread, or using exceptions.&lt;br /&gt;&lt;br /&gt;Last is the ability to create your own segment (local descriptor), and jump to it. With the right values (HighWord.Bits.Type), your debugger might not even be able to display the code being executed, which is quite unusual).&lt;br /&gt;&lt;br /&gt;While the rest of the file is pretty easy, the SetLdtEntries parameter are the most difficult part to understand, so I suggest reading Nicolas' &lt;a href="http://0x5a4d.blogspot.com/2009/11/why-are-gdt-descriptors-so-messed-up.html"&gt;explanation&lt;/a&gt; if you're curious.&lt;br /&gt;&lt;br /&gt;Big thanks to Peter Ferrie for his help (66, 67, SetLdtEntries)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/jumps.zip"&gt;Binary&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/jumps.asm?r=86"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Diverses façons de sauter&lt;/span&gt;&lt;br /&gt;Sauter (jump, branch) est une des opérations les plus répandues.&lt;br /&gt;&lt;br /&gt;J'ai écrit un fichier qui implémente plusieurs façons de sauter, qu'elles soient communes, dissimulée ou rare. Tous n'est pas détaillé dans ce billet, allez voir le code source pour plus d'informations.&lt;br /&gt;&lt;br /&gt;Tout d'abord, les JMP&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;EB 07            JMP SHORT 004000F9&lt;br /&gt;E9 07000000      JMP 00400105&lt;br /&gt;FFE7             JMP EDI                   ; 00400113&lt;br /&gt;FF25 19014000    JMP DWORD PTR DS:[400119] ; 00400124&lt;br /&gt;EA 32014000 1B00 JMP FAR 001B:00400132&lt;br /&gt;FF2D 38014000    JMP FAR DS:[400138]       ; DS:[00400138]=001B:00400145&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;puis les CALL, &lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;E802             CALL 00400103&lt;br /&gt;FF1A             CALL FAR [EDX]&lt;br /&gt;FF12             CALL [EDX]&lt;br /&gt;FFD2             CALL EDX&lt;br /&gt;9A 7C014000 1B00 CALL FAR 001B:0040017C&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;les RETours&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;C3 RETN    ; Return to 004001DE&lt;br /&gt;CB RETF    ; Return to 001B:004001EC&lt;br /&gt;CF IRETD   ; Return to 001B:004001FB, flags = 206&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;les boucles (LOOP).&lt;br /&gt;&lt;br /&gt;Ensuite, une autre façon de sauter (inconditionnellement) est de feindre une condition, en assumant une valeur initiale, ou de la forcer, en définissant un registre ou un drapeau (pushf, lahf, stc, SEH, iret).&lt;br /&gt;&lt;br /&gt;Il faut remarquer qu'ils sont tous (jumps, jxx, calls, return, loops) influencés par le préfixe d'opérandes : bien sur ça transforme les opérandes double mots en mot, mais on sautera a IP, les octets supérieurs étant nul. De plus, CALL WORD va simplement mettre un mot sur la pile, comme on s'y attend.&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;004000F0:&lt;br /&gt;    66:EB 00   JMP SHORT 000000F3&lt;br /&gt;    66:E2 00   LOOPD SHORT 000000F6&lt;br /&gt;    66:E8 0000 CALL 000000FA&lt;br /&gt;    66:C3      RETN          ;Return to 00006D4F, [ESP] = 7C816D4F&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Evidemment, aucune de ces sauts sur un mot ne semble utile dans du code normal, mais c'est un moyen inhabituel de déclencher une exception.&lt;br /&gt;&lt;br /&gt;Loop et Jecxz sont aussi influencés par le préfixe d'adresse (comme REP), qui mettra la condition sur CX uniquement. Mais contrairement à jecxz/jcxz, ni Loop ni Rep n'ont de nom officiel sur un mot (OllyDbg les appelle LoopW, par opposition a Loopd)&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;avec la meme valeur pour ECX :&lt;br /&gt;67:E2 02   LOOPW SHORT 004001CA  ;Loop is NOT taken, CX=0001&lt;br /&gt;E2 07      LOOPD SHORT 004001D1  ;Loop is taken, ECX=FFFF0001&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;On peut aussi jouer avec la pile, y exécuter du code, empiler puis modifier des valeurs.&lt;br /&gt;&lt;br /&gt;Ensuite viennent les moyens moins courant (plutôt juste des anti-émulateurs):&lt;br /&gt;appeler une API qui utilise un &lt;span style="font-style:italic;"&gt;callback&lt;/span&gt;, créer un nouveau fil, ou utiliser les exceptions.&lt;br /&gt;&lt;br /&gt;Enfin, la possibilité de créer votre propre segment (descripteur local) et d'y sauter. Avec les bonnes valeurs (HighWord.Bits.Type), on peut même empêcher votre débogueur d'afficher le code en cours d'exécution, ce qui est plutôt inhabituel.&lt;br /&gt;&lt;br /&gt;La majeure partie du code source est plutôt facile à comprendre, mais les paramètres de SetLdtEntries sont bien compliques, donc allez voir l'&lt;a href="http://0x5a4d.blogspot.com/2009/11/why-are-gdt-descriptors-so-messed-up.html"&gt;explication&lt;/a&gt; de Nicolas si vous voulez en savoir plus.&lt;br /&gt;&lt;br /&gt;Un grand merci à Peter Ferrie pour son aide (66, 67, SetLdtEntries)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/jumps.zip"&gt;Binaire&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/jumps.asm?r=86"&gt;Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-3216274155918295552?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/3216274155918295552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/they-say-jump-you-say.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3216274155918295552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3216274155918295552'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/they-say-jump-you-say.html' title='They say jump, you say how high'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-6827542560085282135</id><published>2010-01-12T22:10:00.014Z</published><updated>2010-12-12T10:12:39.509Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='obfuscation'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Storm warning, but there's no fear</title><content type='html'>&lt;span style="font-style:italic;"&gt;relocater &lt; mutater &lt; virtualiser&lt;/span&gt;&lt;br /&gt;I already wrote about a &lt;a href="http://corkami.blogspot.com/2010/01/both-feet-in-same-shoe.html"&gt;relocater&lt;/a&gt; and different kinds of &lt;a href="http://corkami.blogspot.com/2009/12/vm-architectures.html"&gt;virtual machines&lt;/a&gt;. Between the two of them, there is another kind of executable, simpler than virtual machine but particularly suitable for obfuscation:&lt;br /&gt;a mutater, or polymorphic code.&lt;br /&gt;Similar to virtual machines, some data represents the virtual code to execute. However, in this case, the architecture is strictly the same as the cpu. The main point of mutation is randomization. And if you add some junk code in the middle, you get what happens when virii modifies themselves from one file to the other.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;this is indeed simpler than virtualization, yet quite efficient to make reverse engineering (or identification) more difficult. That's why this technique is present in most advanced virii or packers. In packers, code doesn't mutate itself, it's just some part of code that is randomly generated on the fly before being executed, like in the example of this post. &lt;br /&gt;&lt;br /&gt;Here are 2 different executions:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;span&gt;MOV ECX,FC07379C    PUSH 40&lt;/span&gt;&lt;br /&gt;&lt;span&gt;XOR ECX,FC0737DC    PUSH Tada&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH ECX            NOP&lt;/span&gt;&lt;br /&gt;&lt;span&gt;NOP                 PUSH Helloworld&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH Tada           PUSH 0&lt;/span&gt;&lt;br /&gt;&lt;span&gt;NOP                 NOP&lt;/span&gt;&lt;br /&gt;&lt;span&gt;MOV ECX,F8477840    CALL MessageBoxA&lt;/span&gt;&lt;br /&gt;&lt;span&gt;XOR ECX,F80779BC    MOV ECX,0A2EF248&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH ECX            XOR ECX,0A2EF248&lt;/span&gt;&lt;br /&gt;&lt;span&gt;NOP                 PUSH ECX&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH 0              CALL ExitProcess&lt;/span&gt;&lt;br /&gt;&lt;span&gt;CALL MessageBoxA&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH 0&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH 00400136&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH ExitProcess&lt;/span&gt;&lt;br /&gt;&lt;span&gt;CALL $ + 5&lt;/span&gt;&lt;br /&gt;&lt;span&gt;RETN&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Download links: &lt;a href="http://corkami.googlecode.com/files/self_generating.zip"&gt;Binary&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/self_generating.asm?r=85"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;déplaceur &lt; muteur &lt; virtualiseur&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;J'ai déjà parlé d'un &lt;a href="http://corkami.blogspot.com/2010/01/both-feet-in-same-shoe.html"&gt;déplaceur&lt;/a&gt; et de différentes formes de &lt;a href="http://corkami.blogspot.com/2009/12/vm-architectures.html"&gt;machines virtuelles&lt;/a&gt;. Entre les deux, il y a une autre forme d'exécutable, plus simple que les machines virtuelles, mais particulièrement utile pour la dissimulation :&lt;br /&gt;un muteur, autrement dit du code polymorphique.&lt;br /&gt;Comme pour les machines virtuelles, des données représentent le code virtuel à exécuter. Mais dans ce cas, l'architecture est la même que le processeur. Le point important est que le code est généré aléatoirement. Et si on ajoute du code inutile au milieu, on obtient ce qui se produit quand un virus se modifie d'un fichier à l'autre.&lt;br /&gt;&lt;br /&gt;C'est effectivement plus simple que la virtualisation, mais c'est quand même efficace pour rendre l'analyse de code (ou l'identification) plus difficile. C'est pour cela que cette technique existe dans tous les virus ou packeurs avancés : dans un packeur, le code ne mute pas lui-même, c'est juste une partie du code qui est générée à la volée de manière aléatoire avant d'être exécutée, comme dans l'exemple de ce billet.&lt;br /&gt;&lt;br /&gt;Voici deux exécutions consécutives :&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;&lt;br /&gt;&lt;span&gt;MOV ECX,FC07379C    PUSH 40&lt;/span&gt;&lt;br /&gt;&lt;span&gt;XOR ECX,FC0737DC    PUSH Tada&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH ECX            NOP&lt;/span&gt;&lt;br /&gt;&lt;span&gt;NOP                 PUSH Helloworld&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH Tada           PUSH 0&lt;/span&gt;&lt;br /&gt;&lt;span&gt;NOP                 NOP&lt;/span&gt;&lt;br /&gt;&lt;span&gt;MOV ECX,F8477840    CALL MessageBoxA&lt;/span&gt;&lt;br /&gt;&lt;span&gt;XOR ECX,F80779BC    MOV ECX,0A2EF248&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH ECX            XOR ECX,0A2EF248&lt;/span&gt;&lt;br /&gt;&lt;span&gt;NOP                 PUSH ECX&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH 0              CALL ExitProcess&lt;/span&gt;&lt;br /&gt;&lt;span&gt;CALL MessageBoxA&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH 0&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH 00400136&lt;/span&gt;&lt;br /&gt;&lt;span&gt;PUSH ExitProcess&lt;/span&gt;&lt;br /&gt;&lt;span&gt;CALL $ + 5&lt;/span&gt;&lt;br /&gt;&lt;span&gt;RETN&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Télécharger : &lt;a href="http://corkami.googlecode.com/files/self_generating.zip"&gt;Binaire&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/self_generating.asm?r=85"&gt;Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-6827542560085282135?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/6827542560085282135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/between-hammer-and-anvil.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6827542560085282135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6827542560085282135'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/between-hammer-and-anvil.html' title='Storm warning, but there&apos;s no fear'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-114681691603416831</id><published>2010-01-11T23:29:00.008Z</published><updated>2010-01-21T09:50:29.148Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='pe'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>And go where you're going to</title><content type='html'>&lt;span style="font-style:italic;"&gt;DIY PE&lt;/span&gt;&lt;br /&gt;To be able to create custom PEs, I wrote a simple script that helps with simple tasks like generating import structures, PE checksum and default values.&lt;br /&gt;&lt;br /&gt;So, add all &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/consts.asm"&gt;PE structures&lt;/a&gt; manually (or better, use the &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/onesec.hdr"&gt;same one&lt;/a&gt; over and over), generate imports, and voila! you have a handmade PE file in which you control every byte.&lt;br /&gt;&lt;br /&gt;I didn't extend (yet?) that script to Exports/Resource/Relocations/TLS/Sections, because I don't use them so often.&lt;br /&gt;Also, different Section/File alignments are not supported. Once again, I don't really need it (often).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/"&gt;Source directory&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;PE maison&lt;br /&gt;&lt;br /&gt;Pour pouvoir créer des PEs spéciaux, j'ai écrit un script simple, qui permet de faire des petites choses comme générer les structure des imports, calculer la checksum ou mettre des valeurs par défaut.&lt;br /&gt;&lt;br /&gt;Donc, ajoutez les &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/consts.asm"&gt;structures PE&lt;/a&gt; a la main (ou mieux, utilisez toujours &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/onesec.hdr"&gt;le même en-tête&lt;/a&gt;), générez les imports, et voilà! vous avez un PE fait main, dans lequel vous contrôlez chaque octet.&lt;br /&gt;&lt;br /&gt;Je n'ai pas (encore?) ajouté la gestion des Exports/Resource/Relocations/TLS/Sections, car je n'en ai pas besoin si souvent.&lt;br /&gt;De même, les alignements Section/File différents ne sont pas possibles. Là aussi, je n'en ai pas besoin (souvent).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/"&gt;répertoire Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-114681691603416831?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/114681691603416831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/diy-pe.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/114681691603416831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/114681691603416831'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/diy-pe.html' title='And go where you&apos;re going to'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-120906100966807389</id><published>2010-01-11T22:49:00.011Z</published><updated>2010-12-12T10:10:28.685Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='obfuscation'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>Useless but original</title><content type='html'>&lt;span style="font-style:italic;"&gt;An different form of junk code&lt;/span&gt;&lt;br /&gt;You probably know about the overlapping instruction technique used to fool disassemblers:&lt;br /&gt;due to the way x86 CPUs work, jumping over a E8 byte will make a bogus &lt;a href="http://ref.x86asm.net/coder32.html#xE8"&gt;CALL&lt;/a&gt; instruction appear in the code.&lt;br /&gt;&lt;br /&gt;if you use a longer instruction like &lt;a href="http://ref.x86asm.net/coder32.html#x69"&gt;IMUL&lt;/a&gt;, you can fit any instruction, so you can create a blocky piece of code.&lt;br /&gt;So from the outside, whether from hex or from assembly, it looks quite blocky&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;EB 02                     JMP SHORT 004000F4&lt;br /&gt;69846A 40681C01 4000EB02  IMUL EAX,[EDX+EBP*2+11C6840],2EB0040&lt;br /&gt;698468 22014000 9090EB02  IMUL EAX,[EAX+EBP*2+400122],2EB9090&lt;br /&gt;69846A 00E81E00 0000EB02  IMUL EAX,[EDX+EBP*2+1EE800],2EB0000&lt;br /&gt;69846A 00E81900 00005461  IMUL EAX,[EDX+EBP*2+19E800],61540000&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;while the execution trace looks almost normal:&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;EB 02       JMP +4&lt;br /&gt;6A 40       PUSH 40&lt;br /&gt;68 1C014000 PUSH 0040011C&lt;br /&gt;EB 02       JMP +4&lt;br /&gt;68 22014000 PUSH 00400122&lt;br /&gt;90          NOP&lt;br /&gt;90          NOP&lt;br /&gt;EB 02       JMP +4&lt;br /&gt;6A 00       PUSH 0&lt;br /&gt;E8 1E000000 CALL 0040012F&lt;br /&gt;EB 02       JMP +4&lt;br /&gt;6A 00       PUSH 0&lt;br /&gt;E8 19000000 CALL 00400135&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Absolutely useless like any form of junk code, but way more original than E8/E9 :)&lt;br /&gt;&lt;br /&gt;If you have ever seen an unusual form of junk code or obfuscation, let me know.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/block.zip"&gt;Binary&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/block.asm?r=83"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Du code de dissimulation pas comme les autres&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Vous connaissez probablement la technique d'instructions superposées, qui permet de tromper les désassembleurs:&lt;br /&gt;A cause du fonctionnement des processeurs x86, sauter un octet E8 fera apparaître une fausse instruction &lt;a href="http://ref.x86asm.net/coder32.html#xE8"&gt;CALL&lt;/a&gt; dans votre code.&lt;br /&gt;&lt;br /&gt;Si on utilise une instruction plus longue comme &lt;a href="http://ref.x86asm.net/coder32.html#x69"&gt;IMUL&lt;/a&gt;, on peut cacher n'importe quelle autre instruction, et donc créer du code en bloc.&lt;br /&gt;&lt;br /&gt;De l'exterieur, que ce soit en hexadecimal ou en assembleur, le code a l'air plutot carre&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;EB 02                     JMP SHORT 004000F4&lt;br /&gt;69846A 40681C01 4000EB02  IMUL EAX,[EDX+EBP*2+11C6840],2EB0040&lt;br /&gt;698468 22014000 9090EB02  IMUL EAX,[EAX+EBP*2+400122],2EB9090&lt;br /&gt;69846A 00E81E00 0000EB02  IMUL EAX,[EDX+EBP*2+1EE800],2EB0000&lt;br /&gt;69846A 00E81900 00005461  IMUL EAX,[EDX+EBP*2+19E800],61540000&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;alors que la trace d'execution a l'air presque normale:&lt;br /&gt;&lt;blockquote style="white-space: pre;font-family:courier new;"&gt;EB 02       JMP +4&lt;br /&gt;6A 40       PUSH 40&lt;br /&gt;68 1C014000 PUSH 0040011C&lt;br /&gt;EB 02       JMP +4&lt;br /&gt;68 22014000 PUSH 00400122&lt;br /&gt;90          NOP&lt;br /&gt;90          NOP&lt;br /&gt;EB 02       JMP +4&lt;br /&gt;6A 00       PUSH 0&lt;br /&gt;E8 1E000000 CALL 0040012F&lt;br /&gt;EB 02       JMP +4&lt;br /&gt;6A 00       PUSH 0&lt;br /&gt;E8 19000000 CALL 00400135&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C'est aussi inutile que toute forme de code de dissimulation, mais c'est bien plus original que les E8/E9 :)&lt;br /&gt;&lt;br /&gt;Si vous avez vu d'autres formes originales de dissimulations, faites le savoir.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/block.zip"&gt;Binaire&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/block.asm?r=83"&gt;Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-120906100966807389?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/120906100966807389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/useless-but-original.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/120906100966807389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/120906100966807389'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/useless-but-original.html' title='Useless but original'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-335575015476242028</id><published>2010-01-11T21:58:00.012Z</published><updated>2010-12-12T10:09:24.626Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='obfuscation'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>You'll stumble in my footsteps</title><content type='html'>&lt;span style="font-style:italic;"&gt;A different flow obfuscation: a relocater&lt;/span&gt;&lt;br /&gt;I wrote a simple executable, implementing an idea by Piotr Krysiuk, where all routines are made to be executed at the same address. Because of that feature, following the flow is potentially difficult, and creating a direct dump could be annoying as no disassembler allow different pieces of code to be present at the same address.&lt;br /&gt;&lt;br /&gt;To give you an example, here are the 2 functions of that binary upon their execution:&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-size:85%;"&gt;First:&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;004000FA    6A 40           PUSH 40&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;004000FC    68 6E014000     PUSH 0040016E   ; ASCII "Tada!"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;00400101    68 74014000     PUSH 00400174   ; ASCII "Hello World!"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;00400106    6A 00           PUSH 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;00400108    E8 55000000     CALL 00400162   ; MessageBoxA&lt;/span&gt;&lt;br /&gt;Later:&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;004000FA    6A 00           PUSH 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;004000FC    E8 67000000     CALL 00400168   ; ExitProcess&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;As stated before, they are both made to run at the same address. If you want to have a flat file, you will need to relocate some code. &lt;br /&gt;&lt;br /&gt;Such a 'relocater packer' would be the little brother of a mutater or a virtualiser:&lt;br /&gt;in all cases, you'd need to disasm and analyse, but in this case, the only thing you need to identify and relocate are immediate dwords. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/downloads/list"&gt;Binary&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/piotr.asm?r=82"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Une dissimulation de flux différente: un déplaceur&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;J'ai écrit un simple exécutable, d'après une idée de Piotr Krysiuk, où toutes les routines sont faites pour s'exécuter depuis la même adresse. A cause de ce point particulier, suivre le flux de l'exécution peut s'avérer difficile, et créer un &lt;span style="font-style:italic;"&gt;dump&lt;/span&gt; peut être compliqué, puisqu'aucun désassembleur n'autorise des instructions différentes à la même adresse.&lt;br /&gt;&lt;br /&gt;Pour vous donner un exemple, voici les 2 routines du binaire lors de leur exécution:&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-size:85%;"&gt;D'abord:&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;004000FA    6A 40           PUSH 40&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;004000FC    68 6E014000     PUSH 0040016E   ; ASCII "Tada!"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;00400101    68 74014000     PUSH 00400174   ; ASCII "Hello World!"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;00400106    6A 00           PUSH 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;00400108    E8 55000000     CALL 00400162   ; MessageBoxA&lt;/span&gt;&lt;br /&gt;Ensuite:&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;004000FA    6A 00           PUSH 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;004000FC    E8 67000000     CALL 00400168   ; ExitProcess&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Comme mentionné précédemment, elles sont toutes deux faites pour s'exécuter à la même adresse. Pour avoir un fichier à plat, il faut déplacer le code.&lt;br /&gt;&lt;br /&gt;Un tel 'packeur déplaceur' serait le petit frère du muteur ou d'un virtualiseur: on doit dans tous les cas désassembler et analyser, mais à priori, on a ensuite juste besoin d'identifier et de recalculer les constantes en DWORD.&lt;br /&gt; &lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/downloads/list"&gt;Binaire&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/MakePE/examples/piotr.asm?r=82"&gt;Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-335575015476242028?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/335575015476242028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/both-feet-in-same-shoe.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/335575015476242028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/335575015476242028'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/both-feet-in-same-shoe.html' title='You&apos;ll stumble in my footsteps'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-8090274077402629008</id><published>2010-01-02T23:54:00.015Z</published><updated>2010-12-12T10:07:12.207Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>when CPUs have too many opcodes...</title><content type='html'>Back from my last post, to real machines, I decided to release as-is a YASM source that contains most x86 32bits opcodes, including SSE, AVX, FPU,...&lt;br /&gt;&lt;br /&gt;My conclusion is that there are way too many!&lt;br /&gt;&lt;br /&gt;You can use it just for curiosity or testing your favorite disassembler.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/opcodes32.asm?r=73"&gt;Source Code (Yasm)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;the longest opcode (as a word) is&lt;blockquote&gt;vaeskeygenassist xmm0, xmm0, 0&lt;/blockquote&gt; even though the recent &lt;blockquote&gt;vbroadcastf128 ymm0, [0]&lt;/blockquote&gt; is not far behind.&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;and &lt;blockquote&gt;vpermil2pd ymm0, ymm0, ymm0, ymm0, 0&lt;/blockquote&gt; is commented out (removed from the specs), which is a shame, it would be so great to have 5 operands!&lt;br /&gt;&lt;br /&gt;*Update* Thanks to Sebastian Biallas for the correction - btw his &lt;a href="http://hte.sourceforge.net/"&gt;HT Editor&lt;/a&gt; disassemble everything!&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Quand les processeurs ont trop d'instructions...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Retour aux vraies machines après mon billet précèdent, j'ai décidé de rendre public tel quel un fichier source en YASM, qui contient la plupart des instructions x86 32bits, y compris SSE, AVX, FPU...&lt;br /&gt;&lt;br /&gt;Pour résumer, il y en a beaucoup trop!&lt;br /&gt;&lt;br /&gt;Vous pouvez jeter un oeil par curiosité, ou pour tester votre désassembleur favori.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/opcodes32.asm?r=73"&gt;Code Source (Yasm)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;l'instruction la plus longue (en tant que mot) est &lt;blockquote&gt;vaeskeygenassist xmm0, xmm0, 0&lt;/blockquote&gt; même si le récent &lt;blockquote&gt;vbroadcastf128 ymm0, [0]&lt;/blockquote&gt; n'est pas loin derrière.&lt;br /&gt;&lt;br /&gt;et &lt;blockquote&gt;vpermil2pd ymm0, ymm0, ymm0, ymm0, 0&lt;/blockquote&gt; est mis en commentaire (supprimé de l'implémentation officielle), ce qui est dommage, ça serait si génial d'avoir 5 arguments!&lt;br /&gt;&lt;br /&gt;*MAJ* Merci à Sebastian Biallas pour la correction - au fait, son &lt;a href="http://hte.sourceforge.net/"&gt;HT Editor&lt;/a&gt; désassemble tous les opcodes !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-8090274077402629008?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/8090274077402629008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2010/01/when-cpus-have-too-many-opcodes.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8090274077402629008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8090274077402629008'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2010/01/when-cpus-have-too-many-opcodes.html' title='when CPUs have too many opcodes...'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-397476677150081528</id><published>2009-12-24T21:06:00.019Z</published><updated>2010-12-12T10:04:12.244Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='obfuscation'/><category scheme='http://www.blogger.com/atom/ns#' term='français'/><title type='text'>when VMs have only one opcode...</title><content type='html'>VMs are common in advanced packers or virii, but they seem to follow the same architectures (x86 or stack machine).&lt;br /&gt;I was curious, and implemented, around a small fibonacci example, the usual models of course, but as well the &lt;a href="http://en.wikipedia.org/wiki/Transport_triggered_architecture"&gt;TTA&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/One_instruction_set_computer#Subtract_and_branch_if_less_than_or_equal_to_zero"&gt;Subleq&lt;/a&gt; ones, two models of one instruction set architectures.&lt;br /&gt;&lt;br /&gt;Opcode-less VMs are quite small in code, but the virtual code is quite obscure - which makes an easy but annoying challenge:&lt;br /&gt;typically, you would expect that MOV is the most basic opcode, and arithmetic operations tend to be more complex. But in Subleq, a standard MOV is made of 4 lines of code, while SUB+JLE is only 1. &lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;I was quite surprised myself (yet, it works, of course!), which proves I'm too familiar with standard models.&lt;br /&gt;&lt;br /&gt;What about you ?&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/fibo.zip"&gt;Binary&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/fibo/?r=72"&gt;Source (MASM32)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To give you an idea, here is the virtual code in the Subleq example (while on the other hand, the VM code itself is only 14 lines of asm):&lt;br /&gt;&lt;blockquote&gt;000: reg1, reg1, 00C&lt;br /&gt;00C: rom0, reg0, 018&lt;br /&gt;018: reg0, reg1, 024&lt;br /&gt;024: reg0, reg0, 030&lt;br /&gt;030: reg2, reg2, 03C&lt;br /&gt;03C: reg0, reg0, 048&lt;br /&gt;048: reg0, reg2, 054&lt;br /&gt;054: reg0, reg0, 060&lt;br /&gt;060: reg3, reg3, 06C&lt;br /&gt;06C: rom1, reg0, 078&lt;br /&gt;078: reg0, reg3, 084&lt;br /&gt;084: reg0, reg0, 090&lt;br /&gt;090: reg4, reg4, 09C&lt;br /&gt;09C: reg3, reg0, 0A8&lt;br /&gt;0A8: reg0, reg4, 0B4&lt;br /&gt;0B4: reg0, reg0, 0C0&lt;br /&gt;0C0: reg2, reg0, 0CC&lt;br /&gt;0CC: reg0, reg4, 0D8&lt;br /&gt;0D8: reg0, reg0, 0E4&lt;br /&gt;0E4: reg2, reg2, 0F0&lt;br /&gt;0F0: reg3, reg0, 0FC&lt;br /&gt;0FC: reg0, reg2, 108&lt;br /&gt;108: reg0, reg0, 114&lt;br /&gt;114: reg3, reg3, 120&lt;br /&gt;120: reg4, reg0, 12C&lt;br /&gt;12C: reg0, reg3, 138&lt;br /&gt;138: reg0, reg0, 144&lt;br /&gt;144: rom2, reg0, 150&lt;br /&gt;150: reg0, reg1, 15C&lt;br /&gt;15C: reg0, reg0, 168&lt;br /&gt;168: reg1, reg0, 180*&lt;br /&gt;174: reg0, reg0, 090*&lt;br /&gt;180: reg0, reg0, 18C&lt;br /&gt;18C: reg0, reg1, 1A4*&lt;br /&gt;198: reg0, reg0, 090*&lt;br /&gt;1A4: reg1, reg1, 1B0&lt;br /&gt;1B0: reg3, reg0, 1BC&lt;br /&gt;1BC: reg0, reg1, 1C8&lt;br /&gt;1C8: reg0, reg0, 1D4&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;* conditional jumps&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Quand les MVs n'ont qu'une seule instruction...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Les machines virtuelles sont courantes dans les packeurs avancés ou les virus, mais elles semblent toujours faites avec les mêmes architectures (x86 ou a pile). J'étais curieux, et j'ai écrit, autour d'un petit exemple de Fibonacci, les architectures classiques, bien sûr, mais aussi la &lt;a href="http://en.wikipedia.org/wiki/Transport_triggered_architecture"&gt;TTA&lt;/a&gt; et la &lt;a href="http://en.wikipedia.org/wiki/One_instruction_set_computer#Subtract_and_branch_if_less_than_or_equal_to_zero"&gt;Subleq&lt;/a&gt;, qui sont toutes deux des modèles a une seule instruction.&lt;br /&gt;&lt;br /&gt;Une machine virtuelle sans instruction a un code minuscule, mais le code virtuel est plutôt obscur, ce qui en fait un challenge facile laa implémenter mais plutôt casse-pied. D'habitude, on s'attend a ce que MOV soit l'instruction la plus simple, et que les opérations arithmétiques soient plus complexes. Mais dans une machine Subleq, un MOV standard nécessite 4 lignes de code, alors qu'un SUB+JLE, une seule.&lt;br /&gt;J'étais très surpris moi-même (même si ça marche, bien sûr), ce qui prouve que je suis trop habitués aux modèles standards.&lt;br /&gt;&lt;br /&gt;Et vous ?&lt;br /&gt;&lt;br /&gt;&lt;a href="http://corkami.googlecode.com/files/fibo.zip"&gt;Binaire&lt;/a&gt; &lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/fibo/?r=72"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Pour vous donner une idée, voici le code virtuel de l'exemple en Subleq (alors que le code de la machine virtuelle ne fait que 14 lignes d'assembleur):&lt;br /&gt;&lt;blockquote&gt;000: reg1, reg1, 00C&lt;br /&gt;00C: rom0, reg0, 018&lt;br /&gt;018: reg0, reg1, 024&lt;br /&gt;024: reg0, reg0, 030&lt;br /&gt;030: reg2, reg2, 03C&lt;br /&gt;03C: reg0, reg0, 048&lt;br /&gt;048: reg0, reg2, 054&lt;br /&gt;054: reg0, reg0, 060&lt;br /&gt;060: reg3, reg3, 06C&lt;br /&gt;06C: rom1, reg0, 078&lt;br /&gt;078: reg0, reg3, 084&lt;br /&gt;084: reg0, reg0, 090&lt;br /&gt;090: reg4, reg4, 09C&lt;br /&gt;09C: reg3, reg0, 0A8&lt;br /&gt;0A8: reg0, reg4, 0B4&lt;br /&gt;0B4: reg0, reg0, 0C0&lt;br /&gt;0C0: reg2, reg0, 0CC&lt;br /&gt;0CC: reg0, reg4, 0D8&lt;br /&gt;0D8: reg0, reg0, 0E4&lt;br /&gt;0E4: reg2, reg2, 0F0&lt;br /&gt;0F0: reg3, reg0, 0FC&lt;br /&gt;0FC: reg0, reg2, 108&lt;br /&gt;108: reg0, reg0, 114&lt;br /&gt;114: reg3, reg3, 120&lt;br /&gt;120: reg4, reg0, 12C&lt;br /&gt;12C: reg0, reg3, 138&lt;br /&gt;138: reg0, reg0, 144&lt;br /&gt;144: rom2, reg0, 150&lt;br /&gt;150: reg0, reg1, 15C&lt;br /&gt;15C: reg0, reg0, 168&lt;br /&gt;168: reg1, reg0, 180*&lt;br /&gt;174: reg0, reg0, 090*&lt;br /&gt;180: reg0, reg0, 18C&lt;br /&gt;18C: reg0, reg1, 1A4*&lt;br /&gt;198: reg0, reg0, 090*&lt;br /&gt;1A4: reg1, reg1, 1B0&lt;br /&gt;1B0: reg3, reg0, 1BC&lt;br /&gt;1BC: reg0, reg1, 1C8&lt;br /&gt;1C8: reg0, reg0, 1D4&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;* sauts conditionnels&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-397476677150081528?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/397476677150081528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2009/12/vm-architectures.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/397476677150081528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/397476677150081528'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2009/12/vm-architectures.html' title='when VMs have only one opcode...'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-440916052700610659</id><published>2009-12-19T23:27:00.003Z</published><updated>2010-12-12T09:51:12.981Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><title type='text'>This is not a pipe</title><content type='html'>...nor a virus.... just the &lt;a href="http://en.wikipedia.org/wiki/EICAR_test_file"&gt;EICAR test file&lt;/a&gt;.&lt;br /&gt;I never took the time before to look at it in details, so I wrote a commented source to re-create it exactly.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/corkami/source/browse/trunk/misc/eicar.asm?r=71"&gt;Source code&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-440916052700610659?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/440916052700610659/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2009/12/this-is-not-virus.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/440916052700610659'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/440916052700610659'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2009/12/this-is-not-virus.html' title='This is not a pipe'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-3880771683634768755</id><published>2009-05-10T17:20:00.001+01:00</published><updated>2009-05-10T17:24:26.470+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='libdasm'/><title type='text'>a few fixes</title><content type='html'>I created a minimal &lt;a href="http://code.google.com/p/libdasm"&gt;project&lt;/a&gt; to keep libdasm updated.&lt;br /&gt;a few fixes were already submitted, thanks to Silvo Cesare and &lt;span class="content"&gt;&lt;span class="title"&gt;Georg Wicherski, to fix a few FPU, TEST and MOV opcodes.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-3880771683634768755?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/3880771683634768755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2009/05/few-fixes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3880771683634768755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3880771683634768755'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2009/05/few-fixes.html' title='a few fixes'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-6793334237343312525</id><published>2009-04-16T11:42:00.009+01:00</published><updated>2010-01-21T10:05:07.334Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><title type='text'>Stupid sequence of the day</title><content type='html'>Inspired from &lt;a href="http://rewolf.pl/int.2d.antidebug.and.code.obfuscation.txt"&gt; ReWolf&lt;/a&gt;:&lt;br /&gt;9A 69 E8 C8 C2 CD C3&lt;br /&gt;generates instructions that decode correctly at every bytes, independantly of the following bytes...&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;9A 69E8C8C2CDC3 callf 0C3CD:0C2C8E869&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;69 E8C8C2CDC3 imul ebp,eax,0C3CDC2C8&lt;/div&gt;&lt;div&gt;E8 C8C2CDC3 call 0C40E0C36&lt;/div&gt;&lt;div&gt;C8 C2CDC3 enter 0CDC2,0C3&lt;/div&gt;&lt;div&gt;C2 CDC3 retn 0C3CD&lt;/div&gt;&lt;div&gt;CD C3 int 0C3&lt;/div&gt;&lt;div&gt;C3 retn&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;sadly the 69 imul doesn't always decode that way, it's not a generic 5 bytes cloaker.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-6793334237343312525?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/6793334237343312525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2009/04/stupid-sequence-of-day.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6793334237343312525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6793334237343312525'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2009/04/stupid-sequence-of-day.html' title='Stupid sequence of the day'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-8157520745200853246</id><published>2009-02-01T09:32:00.002Z</published><updated>2010-01-21T09:52:07.597Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='kabopan'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>no more hidden progress</title><content type='html'>After having converted several working hashes algorithms to classes, I decided to put everything from my personal wip repository to a branches/wip on the public repository.&lt;br /&gt;&lt;br /&gt;next step : reduce the /wip branch to the minimum.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-8157520745200853246?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/8157520745200853246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2009/02/no-more-hidden-progress.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8157520745200853246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8157520745200853246'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2009/02/no-more-hidden-progress.html' title='no more hidden progress'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-2390559266935327250</id><published>2008-05-19T21:53:00.005+01:00</published><updated>2010-01-21T09:51:27.701Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='puzzle'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>a different challenge</title><content type='html'>A colleague brought an &lt;a href="http://images.google.com/images?q=puzzlomatic%20crisscross"&gt;interesting puzzle&lt;/a&gt; to solve.&lt;br /&gt;I like the fact that you can always remove any part of this puzzle, even the first one you put, it's not stuck under the next ones. It gives you the impression that it's very easy and you can solve it within minutes. err....&lt;br /&gt;Sadly, I realized I wouldn't have enough time IMO, so I went for the bruteforcing - and learned to make shallow copies of lists :)&lt;br /&gt;&lt;br /&gt;codesource (python) &lt;a href="http://docs.google.com/Doc?id=ddpvpd2p_59cng8t2f2"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-2390559266935327250?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2390559266935327250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2390559266935327250'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2008/05/different-challenge.html' title='a different challenge'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-6891459654575676625</id><published>2008-03-02T18:54:00.004Z</published><updated>2008-05-19T22:10:37.847+01:00</updated><title type='text'>changes</title><content type='html'>New job and new family situation made me stop working on challenges as much as I wanted to...&lt;br /&gt;No more teach-me neither, at least for now. Still planning to do many things, but right now everything is on hold.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-6891459654575676625?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6891459654575676625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6891459654575676625'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2008/03/changes.html' title='changes'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-8716664151168669409</id><published>2007-11-11T21:07:00.000Z</published><updated>2007-11-11T23:08:17.701Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>haiklr's &lt;a href="http://crackmes.de/users/haiklr/hysteria_crackme/"&gt;hysteria crackme&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;unusual keyfileme with weaknesses to find. patience &amp; logic&lt;/blockquote&gt;&lt;br /&gt;BlueOwl's &lt;a href="http://crackmes.de/users/blueowl/upxed/"&gt;UpxEd&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;funny hand-crafted upx, simple obfuscation&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-8716664151168669409?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8716664151168669409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8716664151168669409'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/11/done_11.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-7237149273320146033</id><published>2007-11-09T17:59:00.000Z</published><updated>2007-11-10T09:53:10.652Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>imp's &lt;a href="http://crackmes.de/users/imp/simples/"&gt;SimpleS&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;Socket. original &amp; simple. looking forward to a sequel.&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-7237149273320146033?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7237149273320146033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7237149273320146033'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/11/done_09.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-769124451444005531</id><published>2007-11-06T20:57:00.000Z</published><updated>2007-11-09T16:36:58.620Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>Unicorn &lt;a href="http://crackmes.de/users/unicorn/crackme1/"&gt;CrackMe1&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;pure logic, original. Couldn't prove there is only one serial though.&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-769124451444005531?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/769124451444005531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/769124451444005531'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/11/done.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-4829213002001306515</id><published>2007-10-31T21:16:00.000Z</published><updated>2007-11-01T09:20:17.460Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>Palto's &lt;a href="http://crackmes.de/users/palto/crackme_palto/"&gt;Crackme&lt;/a&gt; &lt;blockquote&gt;Custom Upx-based packer, AutoHotKey, XCBC, Tea&lt;/blockquote&gt;&lt;br /&gt;Hmx0101 &lt;a href="http://crackmes.de/users/hmx0101/hmx0101s_crackme_3/"&gt;CrackMe#3&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;NE, 16 bits, Nag, Serial = CleanAlgo(Name). Todo:keygen&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-4829213002001306515?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/4829213002001306515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2007/10/done_31.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4829213002001306515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4829213002001306515'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/done_31.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-8301629437695693264</id><published>2007-10-29T11:37:00.000Z</published><updated>2007-10-29T21:29:54.575Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>dila's Fishing with Dila v0.&lt;a href="http://crackmes.de/users/dila/fishing_with_dila_v0.1/"&gt;1&lt;/a&gt;, &lt;a href="http://crackmes.de/users/dila/fishing_with_dila_v0.2/"&gt;2&lt;/a&gt;, &lt;a href="http://crackmes.de/users/dila/fishing_with_dila_v0.3/"&gt;3&lt;/a&gt;, &lt;a href="http://crackmes.de/users/dila/fishing_with_dila_v0.4/"&gt;4&lt;/a&gt;, &lt;a href="http://crackmes.de/users/dila/fishing_with_dila_v0.5/"&gt;5&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;simply funny.&lt;/blockquote&gt;&lt;br /&gt;Hmx0101's &lt;a href="http://crackmes.de/users/hmx0101/hmx0101s_crackme_8/"&gt;CrackMe8&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;RVA, Upx+Epp, 2 Anti-Olly, serial=CleanAlgo(name)&lt;/blockquote&gt;&lt;br /&gt;Hmx0101's &lt;a href="http://crackmes.de/users/hmx0101/hmx0101s_crackme_7/"&gt;CrackMe7&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;same packing, serial=CleanAlgo(name)&lt;/blockquote&gt;&lt;br /&gt;Hmx0101's &lt;a href="http://crackmes.de/users/hmx0101/hmx0101s_crackme_6/"&gt;CrackMe6&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;packer = custom (junk + xor loop) + UPX, original test,&lt;br /&gt;the check should have been much more complex. very original but disappointing in the end&lt;/blockquote&gt;&lt;br /&gt;Hmx0101's &lt;a href="http://crackmes.de/users/hmx0101/hmx0101s_crackme_5/"&gt;CrackMe5&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;original too. not difficult but entertaining.&lt;/blockquote&gt;&lt;br /&gt;Hmx0101's &lt;a href="http://crackmes.de/users/hmx0101/hmx0101s_crackme_4/"&gt;CrackMe4&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;original again. Anti-debug &amp; unpacking, 3 serials, complex algo&lt;/blockquote&gt;&lt;br /&gt;Hmx0101's &lt;a href="http://crackmes.de/users/hmx0101/hmx0101s_crackme_2/"&gt;CrackMe2&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;hardcoded buggy password&lt;/blockquote&gt;&lt;br /&gt;Hmx0101's &lt;a href="http://crackmes.de/users/hmx0101/secretme_1/"&gt;secretme1&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;Serial=CleanAlgo(CurrentPID, GetComputerName)&lt;br /&gt;I didn't like the mix of patching and keygenning, though.&lt;/blockquote&gt;&lt;br /&gt;Hmx0101's &lt;a href="http://crackmes.de/users/hmx0101/hmx0101s_keyfileme_1/"&gt;KeyFileMe&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;line1 = Name, line2 = Serial, Serial=BloatedAlgo(Name)&lt;/blockquote&gt;&lt;br /&gt;Hmx0101's &lt;a href="http://crackmes.de/users/hmx0101/junky_1/"&gt;junky_1&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;limited junk, hardcoded password, simple decryption&lt;/blockquote&gt;&lt;br /&gt;raven's &lt;a href="http://crackmes.de/users/raven_/no_reason/"&gt;no_reason&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;clean. minimalist anti-debug. serial=GoodAlgo(Name)&lt;/blockquote&gt;&lt;br /&gt;raven's &lt;a href="http://crackmes.de/users/raven_/no_reason2/"&gt;no_reason2&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;original anti-debugs &amp; checks. serial=GoodAlgo(Name). Interesting!&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-8301629437695693264?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8301629437695693264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/8301629437695693264'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/done_29.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-4325108115524157194</id><published>2007-10-27T14:13:00.000+01:00</published><updated>2007-10-28T00:07:25.478+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>Hmx0101's &lt;a href="http://crackmes.de/users/hmx0101/secretme_2/"&gt;SecretMe2&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;if (GetComputerName == HardcodedName)&lt;br /&gt;{HardcodedSerial = CleanAlgo(HardcodedName)}&lt;/blockquote&gt;&lt;br /&gt;haunte's &lt;a href="http://crackmes.de/users/haunte/crachme_1_by_haunted/"&gt;Crachme&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;serial = CleanAlgo(name, GetComputerName)&lt;/blockquote&gt;&lt;br /&gt;n00b's &lt;a href="http://crackmes.de/users/n00b/ckeygenme_1_custom/"&gt;C#KeygenMe1Custom&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;.Net, serial = CleanAlgo(name)&lt;/blockquote&gt;&lt;br /&gt;n00b's &lt;a href="http://crackmes.de/users/n00b/keygenmex/"&gt;KeygenMeX&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;.Net, registry, serial = CleanAlgo(name)&lt;/blockquote&gt;&lt;br /&gt;n00b's &lt;a href="http://crackmes.de/users/n00b/ckeygenme_no.1/"&gt;CKeygenMe1&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;Delphi, Base64, TRegWare... a big mess for a simple serial&lt;/blockquote&gt;&lt;br /&gt;encrypto's &lt;a href="http://crackmes.de/users/encrypto/encryptos_easy_keygen_me_4.0/"&gt;Easy Keygenme 4.0&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;Delphi, MD5, serial = CleanAlgo(GetComputerName, name)&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-4325108115524157194?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4325108115524157194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4325108115524157194'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/done_27.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-2361445567362489268</id><published>2007-10-21T14:58:00.000+01:00</published><updated>2007-10-28T00:09:45.981+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>Adjiang &lt;a href="http://crackmes.de/users/adjiang/keygenme3/"&gt;Keygenme3&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;Annoying wizard, Serial = string + CleanChecksum(string)&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-2361445567362489268?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2361445567362489268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2361445567362489268'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/done_21.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-6097130222523090718</id><published>2007-10-18T20:14:00.000+01:00</published><updated>2010-01-21T09:54:09.589Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>lafarge's crackme 1</title><content type='html'>It's a custom &amp; original packer, FindWindow, ZwQuery, indirect imports. I created an ImpRec &lt;a href="http://corkami.googlecode.com/files/68_dw_e9.bat"&gt;plug-in&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-6097130222523090718?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/6097130222523090718/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2007/10/lafarges-crackme-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6097130222523090718'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6097130222523090718'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/lafarges-crackme-1.html' title='lafarge&apos;s crackme 1'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-170248444347057310</id><published>2007-10-18T20:11:00.000+01:00</published><updated>2010-01-21T10:01:49.951Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>Predator's Pirupiru</title><content type='html'>&lt;a href="http://code.google.com/p/corkami/wiki/PredatorPirupiru"&gt;solution&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-170248444347057310?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/170248444347057310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2007/10/predators-pirupiru.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/170248444347057310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/170248444347057310'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/predators-pirupiru.html' title='Predator&apos;s Pirupiru'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-7125840405176135161</id><published>2007-10-18T20:09:00.000+01:00</published><updated>2007-10-27T16:01:48.460+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>Predator's &lt;a href="http://crackmes.de/users/predator/pirupiru/"&gt;Pirupiru&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;VB, appended data rc4 binder, strlen&lt;/blockquote&gt;&lt;br /&gt;and &lt;a href="http://crackmes.de/users/predator/bastard1/"&gt;Bastard1&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;same binder, serial == CleanAlgo(name)&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-7125840405176135161?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7125840405176135161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7125840405176135161'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/done_18.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-9195043503674003488</id><published>2007-10-17T21:16:00.000+01:00</published><updated>2007-10-27T16:01:53.379+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>&lt;a href="http://crackmes.de/users/lafarge/"&gt;LaFarge's&lt;/a&gt; crackme 0.2 &amp; 1 &amp; 2&lt;br /&gt;&lt;blockquote&gt;serial == CleanAlgo(name)&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-9195043503674003488?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/9195043503674003488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/9195043503674003488'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/done_17.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-6423741757464125850</id><published>2007-10-11T10:51:00.001+01:00</published><updated>2009-03-27T18:27:51.164Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><title type='text'>challenges websites</title><content type='html'>&lt;a href="http://crackmes.de/"&gt;CrackMes DE&lt;/a&gt;&lt;br /&gt;the best and biggest, reviewed solutions. great !&lt;br /&gt;&lt;a href="http://www.tuts4you.com/"&gt;Tuts For You&lt;/a&gt;&lt;br /&gt;Biggest unpackme repository&lt;br /&gt;&lt;br /&gt;In French:&lt;br /&gt;&lt;a href="http://defisfc.free.fr/"&gt;Défis FC&lt;/a&gt;&lt;br /&gt;&lt;a href="http://binary-reverser.org/bigbang"&gt;Le site de BigBang&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-6423741757464125850?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6423741757464125850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/6423741757464125850'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/challenges-websites.html' title='challenges websites'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-2894562846927304185</id><published>2007-10-10T19:01:00.001+01:00</published><updated>2007-10-27T14:24:17.542+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>chaise's &lt;a href="http://crackmes.de/users/chaise/crackmechaise2/"&gt;crackmechaise2&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;Serial == CleanAlgo(ComputerName, Name)&lt;/blockquote&gt;&lt;br /&gt;skapunky's &lt;a href="http://crackmes.de/users/skapunky/skrackme1/"&gt;skrackme1&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;Nag (JMP Table)&lt;br /&gt;Button (__vbasetobj) &lt;br /&gt;Serial (__vbastrcmp)&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-2894562846927304185?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2894562846927304185'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/2894562846927304185'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/done_10.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-7619858002647683489</id><published>2007-10-08T20:12:00.000+01:00</published><updated>2007-10-27T14:25:11.625+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>opcode0x90's &lt;a href="http://crackmes.de/users/opcode0x90/crackme_nop/"&gt;crackme_nop&lt;/a&gt; &lt;blockquote&gt;serial check, but original&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-7619858002647683489?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7619858002647683489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/7619858002647683489'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/done_08.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-4888431277138738223</id><published>2007-10-07T10:52:00.000+01:00</published><updated>2010-01-21T10:01:49.952Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>lilcw's just a simple xor encryption</title><content type='html'>Here is my &lt;a href="http://code.google.com/p/corkami/wiki/LilcwXor"&gt;solution&lt;/a&gt; for this interesting yet not difficult &lt;a href="http://www.crackmes.de/users/lilcw/just_a_simple_xor_encryption/"&gt;challenge&lt;/a&gt;. Enjoyable.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-4888431277138738223?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corkami.blogspot.com/feeds/4888431277138738223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://corkami.blogspot.com/2007/10/finished-lilcws-just-simple-xor.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4888431277138738223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/4888431277138738223'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/finished-lilcws-just-simple-xor.html' title='lilcw&apos;s just a simple xor encryption'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34943364.post-3247621474303726748</id><published>2007-10-07T09:21:00.000+01:00</published><updated>2007-10-27T14:27:03.939+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='challenge'/><category scheme='http://www.blogger.com/atom/ns#' term='done'/><category scheme='http://www.blogger.com/atom/ns#' term='gnireenigne'/><title type='text'>done</title><content type='html'>lilcw's &lt;a href="http://crackmes.de/users/lilcw/just_a_simple_xor_encryption/"&gt;just a simple xor encryption&lt;/a&gt;&lt;blockquote&gt;logic, asm&lt;/blockquote&gt;&lt;br /&gt;chaise's &lt;a href="http://crackmes.de/users/chaise/crackmechaise1/"&gt;crackmechaise1&lt;/a&gt;&lt;br /&gt; &lt;blockquote&gt;basic serial, time&lt;/blockquote&gt;&lt;br /&gt;_khAttAm_'s &lt;a href="http://crackmes.de/users/khattam/khattam_s_unupx_me_v1/"&gt;unUPX me&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;upx, vb, binder&lt;/blockquote&gt;&lt;br /&gt;mucki's &lt;a href="http://crackmes.de/users/mucki/muckis_protector/"&gt;protector&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;simple packer&lt;/blockquote&gt;&lt;br /&gt;thecipher's &lt;a href="http://crackmes.de/users/thecipher/icantdothis/"&gt;IcantDoThis&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;nothing special&lt;/blockquote&gt;&lt;br /&gt;warleyalex's &lt;a href="http://crackmes.de/users/warleyalex/delphi_for_php_crackme/"&gt;Delphi for PHP&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;delphi, javascript&lt;/blockquote&gt;&lt;br /&gt;TiGa's &lt;a href="http://crackmes.de/users/tiga/vista_sidebar_gadget_crackme/"&gt;Vista Sidebar Gadget&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;.gadget, javascript&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/34943364-3247621474303726748?l=corkami.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3247621474303726748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34943364/posts/default/3247621474303726748'/><link rel='alternate' type='text/html' href='http://corkami.blogspot.com/2007/10/done.html' title='done'/><author><name>Ange</name><uri>http://www.blogger.com/profile/17423188298352515655</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_qHSztWwiv98/S2LdEeCx5rI/AAAAAAAADkQ/1KNqdE9Hm_4/S220/avatar.gif'/></author></entry></feed>
