Skip to content
Tutorials Center
My learning

Topics

Lesson 37 of 37 ยท Projects and Practice

Malware Analysis Practice Questions and Exercises

Test your malware analysis skills with scenario exercises on imports, decoding, YARA, behaviour traces and reports, plus runnable Python checkers and a self-check quiz.

Reading about analysis is not the same as doing it. This lesson gives you practice material for chapters 5 to 8: reading assembly, spotting packing, decoding strings, writing detections and reporting. Each exercise uses invented data and comes with a small Python checker so you can compare your answer with the expected one. Try each exercise before running the solution cell.

Everything is a safe stand-in. No real malware appears here, and the exercises never ask you to run anything dangerous. Real practice continues in your own isolated lab with samples from legitimate training resources, as described in the safe lab chapter of this track.

How to use this lesson

Read the task Predict the answer first.
Run the checker Compare with your prediction.
Modify it Change inputs, retest.

Struggling is the point.

1 / 2

Exercise 1: what does this routine return?

Here is a read-only listing. Work out the value returned in eax before running the check.

TEXT
    mov   ecx, 6
    mov   eax, 1
again:
    imul  eax, ecx
    dec   ecx
    jnz   again
    ret

Hint: follow ecx from 6 down to 1 and track eax. The cell below implements the same logic so you can verify, then change the starting count and see how the result responds. Compare with reading control flow.

Python Check exercise 1

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

You should recognise the pattern as a factorial: a loop that multiplies an accumulator by a descending counter. Naming a routine by its idea (here "factorial") is the habit to build.

Exercise 2: classify the imports

A sample imports the following functions. Decide which capabilities they suggest, then run the classifier. Remember that imports are weak signals alone: they give you questions to answer, not conclusions.

Python Check exercise 2: imports to capabilities

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Expect persistence, networking, file activity, memory tricks, an anti-debugging call and dynamic loading. The combination of LoadLibrary/GetProcAddress with VirtualAlloc/VirtualProtect is a classic unpacking stub signature, so your first follow-up question should be "is it packed?" and the second "what does the decoded payload do?".

Exercise 3: decode the configuration

A made-up sample stores its configuration XOR-encoded with a four-byte key. The key appears in the decoding routine as the constant 0xA1 0xB2 0xC3 0xD4. Decode the blob and answer: what is the server name, and how often does it call home?

Python Check exercise 3: decode the configuration

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

To practise brute force, change the code to use a single-byte key and recover it without knowing it, using the scoring idea from string obfuscation.

Exercise 4: write and test a rule

Given three "family" strings and a few clean files, find a condition that matches every family sample and no clean file. Try each candidate in the cell, then look at the result table and choose.

Python Check exercise 4: choose a condition

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

On this tiny set 2 of 3 happens to be perfect: it catches all four family samples and no clean one, which is why it is a usual starting point, while any triggers on three clean files and mutex and gate misses two family samples. In real life you would collect many more samples and check again, see rule tuning.

Exercise 5: read a trace and map it

Here is a short behaviour trace from a sandbox run. Identify the capabilities and the likely ATT&CK techniques, and decide what you would write in the report as observed versus likely.

Python Check exercise 5: trace to techniques

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice how the long sleep and the file location are classified as likely rather than observed: the trace shows the call, but not the intent. Explaining that difference in your write-up is part of the skill, see writing up your findings and ATT&CK mapping.

Exercise 6: spot the weak statement

Which of the following sentences would you reject in a professional write-up, and why?

  1. "The sample is the work of Group X." (Attribution from a shared string.)
  2. "The sample wrote updater.exe to C:\Users\Public\demo during execution (observed in the process monitor log)."
  3. "The domain is http://update-check.example.invalid." (Live, clickable.)
  4. "Confidence in the verdict is high; the second stage was not recovered."

Statements 1 and 3 should be revised: the first because overlap of a string is weak evidence ("overlaps with" is the honest phrase), the third because network indicators must be defanged. Statements 2 and 4 are good: evidence is named and limits are stated.

Where to practise next

  • Analyse intentionally safe training samples in your lab (benign crackmes and educational binaries) and write full write-ups for them.
  • Take a published, public analysis from a security vendor and try to predict its findings before you read them.
  • Write YARA rules for samples from training datasets, then test them against a goodware set.
  • Revisit the track page to review earlier chapters.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. A routine multiplies an accumulator by a counter that goes from 6 down to 1. What does it return?

    6 x 5 x 4 x 3 x 2 x 1 = 720, a factorial.
  2. 2. Which import combination most strongly suggests an unpacking stub?

    Resolving APIs dynamically and changing memory permissions is typical for stubs that decode and run a payload.
  3. 3. In a report, a long Sleep before network activity is best described as:

    Separate the observed call from the inferred purpose.
  4. 4. What is the best way to mention a malicious domain in a shared document?

    Defanging avoids accidental visits and previews.
  5. 5. Why does a baseline of normal traffic help beacon detection?

    Regularity alone flags benign polling; baselines separate it from rare destinations.

Summary

  • Practise by predicting first, then running a checker, then changing the inputs.
  • Name routines by their idea, classify imports into capabilities and treat them as questions.
  • Decode configuration with a re-implemented decoder rather than manual steps.
  • Test rule conditions against both family and clean sets.
  • Separate observed from likely when mapping behaviour, and defang indicators in written work.
  • Continue with safe training samples in your own isolated lab.

Next: Back to the Malware Analysis track