/_posts/2017-02-09-asm-crash-course-1.md
https://github.com/ckane/CS7038-Malware-Analysis · Markdown · 57 lines · 45 code · 12 blank · 0 comment · 0 complexity · e77eae0df879e7d527744f41ac03b46e MD5 · raw file
- ---
- title: Assembly Language Crash Course (Pt. 1)
- tags:
- - malware
- - lecture
- - C
- - Assembly
- - CFG
- - Decompilation
- ---
- ## {{page.title}}
- This lecture introduces the class to mainstream CPU architecture, the compilation & translation stage,
- and the distinctions between native machine language and more general machine-agnostic programming
- languages, such as C.
- We delve into how a compiler will break up the source code for a program into multiple blocks, to
- construct a *Control Flow Diagram*, that governs execution flow. These blocks are then compiled, and
- subsequently translated, into a native machine language for the target platform (such as x86-64
- machine code).
- The human-readable representation of this is typically referred to as "assembly language".
- Using visual static analysis tools, such as IDA, this CFG is reconstructed from compiled code and
- then presented to an analyst for review.
- Slides: [lecture-w05-2.pdf (PDF)](/lecture-slides/lecture-w05-2.pdf)
- Video: [CS7038: Wk05.2 - Assembly Language Crash Course](https://youtu.be/7sI5JPr8ENU?list=PLFvh_k-n27Cmh2VYc3e24s5_toZbgSPVE)
- <iframe width="560" height="315"
- src="https://www.youtube.com/embed/7sI5JPr8ENU?list=PLFvh_k-n27Cmh2VYc3e24s5_toZbgSPVE"
- frameborder="0" allowfullscreen></iframe>
- Example sources from lecture:
- * [asm-prog.c](/code/asm-prog.c) - Original example C program discussed in class, with comments
- * [asm-prog.s](/code/asm-prog.s) - Compiled code from above, represented in x86-64 assembly using AT&T syntax
- * [asmprog.dot.pdf](/code/asmprog.dot.pdf) - CFG diagram for <tt>asm-prog.s</tt> from slides in PDF format
- * [asmprog-snowman.cpp](/code/asmprog-snowman.cpp) - Decompiled C++ code from the compiled binary <tt>asm-prog</tt>
- Some helpful links to static analysis tools leveraging assembly language:
- * IDA - [https://www.hex-rays.com/](https://www.hex-rays.com/) (closed src)
- * binary ninja - [https://binary.ninja](https://binary.ninja/) (closed src)
- * ROSE - [https://www.rose-compiler.org/](https://www.rose-compiler.org) (semi-open src)
- * radare2 - [http://rada.re/r/](http://rada.re/r/) (open src)
- * snowman - [https://github.com/yegord/snowman](https://github.com/yegord/snowman) (open src)
- Helpful machine-language and assembly references:
- * x86 Instruction reference - simple site - [http://ref.x86asm.net/](http://ref.x86asm.net)
- * AMD64 Programmer’s reference, Vol 3 - [https://support.amd.com/TechDocs/24594.pdf](https://support.amd.com/TechDocs/24594.pdf) (PDF)
- * Sandpile - [http://sandpile.org](http://sandpile.org)
- * Navigable parsed version of Intel 64 reference - [https://github.com/zneak/x86doc](https://github.com/zneak/x86doc)
- ARM Reference, for comparison:
- * ARM Instruction Set - [http://www.peter-cockerell.net/aalp/html/ch-3.html](http://www.peter-cockerell.net/aalp/html/ch-3.html)
- [home](/)