Security teams can detect compile after delivery attacks by watching for source code, script templates, or development tools arriving on a host and being compiled locally soon afterwards. Flag unexpected compilers, build chains, or runtime translation steps on endpoints that are not developer systems, especially when they follow download or staging activity.
What compile after delivery attacks look like in practice
compile after delivery attacks sit between delivery and execution: the attacker gets code, scripts, templates, or source-like material onto a host first, then relies on local compilation or runtime translation to turn that material into something executable. That makes the activity look closer to normal file transfer or staging unless teams track the sequence, not just the file type.
The useful detection question is whether a non-development endpoint is suddenly acting like a build environment. If source artifacts arrive and are followed by compilers, script engines, package tooling, or other translation steps soon afterwards, that is materially different from ordinary user activity and should be treated as suspicious.
Signals that should stand out on endpoints
The strongest signals are behavioural combinations, not a single filename. Watch for archive extraction, script drop, template staging, or source-file creation followed by compiler invocation, interpreter execution, or code generation on workstations, servers, or VDI hosts that do not normally build software.
Unexpected parent-child process chains matter here. A downloader, archive tool, browser, office process, or remote administration tool handing off to a compiler or runtime translator is more meaningful than the compiler alone. The same applies when a host that rarely compiles code starts touching language toolchains, SDKs, or build utilities that are not part of its standard role.
How to separate malicious compilation from legitimate software work
Context is the discriminator. Development systems, CI runners, and build servers will naturally compile, transpile, or package code, so the question is whether the host role, user identity, and recent activity support that behaviour. On ordinary endpoints, even a legitimate-looking compile step becomes more suspicious when it follows download, staging, or lateral movement activity.
Teams get better results when they correlate endpoint telemetry with asset inventory and expected software baselines. A compiler on an engineering laptop may be normal, while the same tool appearing on a finance workstation or application server may indicate an intrusion path. This is where allowlists for approved build tools and known developer hosts reduce false positives without hiding the pattern.
Risk and Threat Considerations
Compile after delivery attacks are risky because they blur the line between content delivery and code execution. Attackers can land inert-looking source or template material first, then compile locally to evade simple file-signature controls, delay detection, or adapt payloads to the target host.
Failure mechanism: Security teams miss the attack when they monitor only final executable formats, or when they do not correlate file arrival with subsequent local compilation, script translation, or tooling installation on hosts that should not be building code.
Impact: The attacker can convert delivered source into an executable payload, reducing visibility, bypassing some email and gateway controls, and increasing the chance that endpoint activity is mistaken for normal administration or developer work.
Practitioner Guidance
What to verify: Check whether the endpoint role, user profile, and recent process tree make local compilation plausible. If not, treat the sequence as a detection event and inspect the preceding download, extraction, or staging activity rather than only the compiled artifact.
What to prioritise: Focus first on hosts that are not expected to build software, especially servers and general-purpose user machines. Those systems offer the highest signal when source-like content, compilers, or runtime translation tools appear together.
Practitioner takeaway: The best detection is sequence-based, not file-based, because compile after delivery attacks become visible when you join delivery artefacts to the first local build or translation step.
Related resources from NHI Mgmt Group
- Guide: Malware Guide
- How should security teams detect identity attacks after login when MFA and phishing controls are already in place?
- Why are NHIs a critical concern for security teams?
- What steps should security teams take to prevent Shadow AI risks?
- Why is the abuse of NHIs a priority for security teams?