Intro To AL1 - 2023 - Elearn
Intro To AL1 - 2023 - Elearn
Malware
Analysis and Defense
(Additional Material on Assembly Language)
Instructor Contact
Dr Peter Loh [email protected]
1
SIT Internal
Introduction to
Assembly Language 1
Scope of Topic
6
SIT Internal
0 0 0 0 8 1000 10 8
1 1 1 1 9 1001 11 9
2 10 2 2 10 1010 12 A
3 11 3 3 11 1011 13 B
4 100 4 4 12 1100 14 C
5 101 5 5 13 1101 15 D
6 110 6 6 14 1110 16 E
7 111 7 7 15 1111 17 F
Base
Malware Analysis and Defence 8
SIT Internal
http://www.rapidtables.com/convert/number/binary-to-decimal.htm
Malware Analysis and Defence 9
SIT Internal
http://codebeautify.org/all-number-converter
Malware Analysis and Defence 10
SIT Internal
http://codebeautify.org/all-number-converter
Malware Analysis and Defence 11
SIT Internal
http://codebeautify.org/all-number-converter
Malware Analysis and Defence 12
SIT Internal
http://codebeautify.org/all-number-converter
Malware Analysis and Defence 13
SIT Internal
http://codebeautify.org/all-number-converter
OCBC – Malware Analysis and Defence 14
SIT Internal
Overview of
x86 Assembly Language
Flags Register
Hardware – contains
processor status
MOV instructions
Malwaredo not
Analysis affect flags
and Defence 27
SIT Internal
DF ← 0
This instruction has two implicit operands AL/AX/EAX (depending on the size of
arg1) and ZF (zero) flag. The instruction compares arg1 to AL/AX/EAX and if
they are equal sets arg1 to arg2 and sets the zero flag, otherwise it sets
AL/AX/EAX to arg1 and clears the zero flag. Flags Affected: AF, CF, OF, PF, SF, ZF.
String Instructions
Scan word string compares AL with word at ES:(E)DI and sets status flags
When used together with the REPNE prefix (REPeat while Not Equal), SCAS scans the
Malware Analysis and Defence 33
string searching for the first string element equal to the value in the accumulator
SIT Internal
Load word string loads word at address DS:(E)SI into AX. Status flags not
affected.
Load doubleword string loads double word at address DS:(E)SI into EAX.
Status flags not affected.
Arithmetic Instructions
CF not affected. Sets OF, SF, ZF, AF, and PF according to result
Sets ZF if ecx = 0 What does eax and ebx contain after execution?
Malware Analysis and Defence 38
SIT Internal
The above code fragment adds two 8-bit integers (0FFh + 0FFh),
producing a 16-bit sum in DL:AL, which is 01h:FEh;
Malware Analysis and Defence 40
SIT Internal
Exercise
1. Consider the following code segments: