By NHI Mgmt Group Editorial TeamBased on Ethiack: “Write Once, Shell Everywhere: Turning Arbitrary File Writes into RCE” (August 7, 2026)

TL;DR: Arbitrary file writes are often treated as low severity, but Ethiack shows that exploitability depends on path control, content control, and knowledge of what the target will later execute. The security gap is reconnaissance, because once the runtime and filesystem are profiled, a write primitive can become code execution.


At a glance

What this is: This analysis explains why arbitrary file writes are only as dangerous as the execution context behind them, and shows how predictable runtime paths can turn a write primitive into RCE.

Why it matters: It matters because IAM, platform, and application teams need to understand that filesystem write bugs often become identity-adjacent execution paths once runtime files, configs, or worker entrypoints are predictable.


Context

Arbitrary file write is a filesystem control problem, but exploitability depends on whether the written path is later consumed by a runtime, loader, or supervisor. The core governance gap is that many reviews stop at "can the attacker write a file" instead of asking what the target will read, reload, or execute after the write lands.

That distinction matters in modern container and cloud-native deployments because traditional execution assumptions, like cron, SSH, shell login, or a full init system, are often absent. Where identity and access control intersect, the issue is not human login but runtime trust in writable paths, worker entrypoints, and configuration files that act like implicit execution surfaces.

The article argues that this is typical of contemporary exploitation work: the write primitive is real, but the impact depends on profiling the environment first.


Key questions

Q: What breaks when arbitrary file writes reach reloadable runtime paths?

A: A file write becomes far more dangerous when the target process later reads the file as code or configuration. In that case, the attacker is no longer storing data on disk. They are shaping future execution. The break occurs at the trust boundary between writable storage and executable runtime state, especially when service accounts can write into package or config directories.

Q: Why do filesystem write errors help attackers profile the target?

A: Because different error codes can reveal whether a path exists, whether a component is a file or directory, and whether the attacker can traverse or write there. That turns a failed write into an oracle that narrows the runtime environment before the attacker attempts a more reliable payload.

Q: What are the signs that a write primitive is close to RCE?

A: Look for deterministic reload behaviour, writable worker or template directories, and files that are re-read by a service without a restart. If the application regularly spawns new workers or recompiles from disk, a writable path inside that flow is much closer to execution than a generic upload location.

Q: Should teams prioritise filesystem hardening over payload filtering for AFW issues?

A: Yes, because payload filtering does not fix the core problem when a writable path is later executed or reloaded. Read-only roots, non-root runtime users, separated data and code paths, and consistent error handling reduce the exploitability of the primitive itself, which is the real control objective.


Technical breakdown

Why arbitrary file write is only a primitive, not an exploit

An arbitrary file write gives an attacker two things: destination control and content control. That does not automatically equal code execution because most written paths are never read by a runtime that will execute them. The actual exploitability depends on path semantics, ownership, reload behaviour, and whether the target is a shell, interpreter, supervisor, or template engine. In practice, the same write can be harmless file corruption, delayed configuration abuse, or immediate RCE depending on what process later consumes the file. The technical mistake is treating the write as the end state rather than the start of an execution chain.

Practical implication: review writable paths for later execution or reload paths, not just for write permission.

How environment fingerprinting turns writes into reconnaissance

A write attempt can act as a path-probe oracle because filesystem errors reveal whether a component exists, whether it is a directory, and whether it is writable or traversable. By deliberately provoking different errors, an attacker can infer runtime details such as containerisation, distro layout, language runtime, and path structure. This is especially valuable in black-box testing, where guessing a target path is noisy and unreliable. The important point is that exploitability often comes from this profiling step, not from any single clever payload. Once the attacker knows where execution is likely to happen, the write primitive becomes far more dangerous.

Practical implication: treat inconsistent filesystem error handling as an exposure signal and normalise responses where possible.

Why predictable worker and template paths create execution sinks

Modern applications often load worker scripts, template caches, or configuration files from deterministic locations under their own package directories. If those locations are writable, an attacker does not need to guess application internals, only the library or framework layout. Node worker pools are a strong example because a new worker reloads code from disk, so overwriting the worker entrypoint can convert a future spawn into execution. Similar patterns appear in template engines and framework reload paths. The key weakness is not the framework itself, but the combination of predictable path resolution and repeated runtime reloads.

Practical implication: separate writable application data from any path that a runtime, worker, or template engine may later reload.


Threat narrative

Attacker objective: The attacker wants to turn a low-signal write primitive into reliable remote code execution by forcing the target runtime to load attacker-controlled content.

  1. Entry begins with an arbitrary file write that lets the attacker choose both the destination path and the file content.
  2. Credential or access escalation comes from using filesystem error responses and overwrite behaviour to infer runtime layout, file existence, and writable execution paths.
  3. Impact occurs when a predictable runtime path, such as a worker entrypoint or reloadable config, is overwritten and later executed by the application.
  • ASP.NET machine key attacks 2025: Developers copied ASP.NET machine keys from public sources; attackers used one to run Godzilla via ViewState. Microsoft found 3,000+ such keys.

Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.


NHI Mgmt Group analysis

Path predictability is the real control failure: arbitrary file write becomes materially dangerous when the attacker can map a writable path to a later execution path. The vulnerability is not the write alone, but the combination of predictable runtime layout and a process that re-reads files from disk. Practitioners should treat deterministic path resolution as part of the attack surface, not an implementation detail.

Filesystem errors can become an information leak: distinct errno behaviour turns failed writes into a profiling channel. That means the defender is not only exposed to file corruption, but also to iterative reconnaissance that narrows the target environment until a reliable execution sink appears. The named concept here is path-to-execution convergence, where discovery and execution collapse into the same workflow. Practitioners should close the oracle, not just the sink.

Cloud-native assumptions reduce the usefulness of legacy escalation tricks: cron, SSH, shell login, and init-based techniques often disappear in containers, but that does not eliminate AFW-to-RCE risk. It shifts the focus toward reloadable workers, interpreters, and framework caches that are more common in modern deployments. Practitioners should review container images and application packaging for writable paths that double as runtime inputs.

Identity governance still matters here because execution depends on trust in service paths, not human users: the article shows how runtime files, worker entries, and configuration artefacts become implicit privileges when a service process trusts them. That is an NHI governance problem in practice, because non-human processes are consuming and executing content from writable locations. Practitioners should map those paths as privileged machine-identity dependencies and protect them accordingly.

What this signals

Path-to-execution convergence: the practical risk in arbitrary file write findings is not the file drop itself, but the moment a writable path and an execution path overlap. Once that overlap exists, exploitability becomes a function of runtime behaviour, not bug class labels.

For practitioners, the right question is whether any service-owned path can later be re-read as code, config, or worker input. If the answer is yes, the control boundary is too loose and the bug should be treated as an execution-risk issue, not a storage issue.


For practitioners

  • Separate writable data from executable paths Keep uploads, caches, and runtime scratch spaces outside any directory that a process, worker, or template engine may later execute or reload.
  • Normalise filesystem failure responses Return a generic error for write failures so attackers cannot use errno differences to infer path existence, directory structure, or permission boundaries.
  • Harden container and process startup Run non-root, avoid shell-based entrypoints, and make the root filesystem read-only so common AFW-to-RCE destinations disappear.
  • Review reloadable worker and template paths Audit library-managed worker entrypoints, template caches, and framework reload files for write access because these deterministic paths often become execution sinks.

Key takeaways

  • Arbitrary file write findings become materially more severe when the written path is later consumed by a runtime, worker, or template engine.
  • Filesystem error handling can leak enough detail to help an attacker map the environment and locate a viable execution sink.
  • The most effective mitigation is to separate writable data from executable paths and remove runtime trust in attacker-controlled files.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

MITRE ATT&CK addresses the attack surface, NIST CSF 2.0, CIS Controls v8 and NIST SP 800-53 Rev 5 set the technical controls, and ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
MITRE ATT&CKTA0007;TA0006;TA0008 — Discovery; Credential Access; Lateral MovementThe article centres on profiling paths and abusing execution sinks through write primitives.
Recommendation — Map AFW-to-RCE chains to TA0007 and TA0006, then hunt for writable paths that lead into executable reload flows.
NIST CSF 2.0PR.AA-05 — Access Permissions, Entitlements and AuthorizationsWritable execution paths are an authorization boundary problem inside service and container workloads.
Recommendation — Use PR.AA-05 to keep writable data paths separate from service-owned code, config, and worker inputs.
CIS Controls v8CIS-5 — Account ManagementThe article recommends non-root execution and tighter service ownership of filesystem paths.
Recommendation — Apply CIS-5 to reduce service privilege and remove account access that can write into executable paths.
NIST SP 800-53 Rev 5AC-6 — Least PrivilegeLeast privilege limits which processes can write to paths later consumed by loaders or runtimes.
Recommendation — Enforce AC-6 so application accounts cannot write into runtime directories that may later execute content.
ISO/IEC 27001:2022A.8.2 — Privileged Access RightsPrivileged access rights govern who can modify configuration and runtime files that become execution sinks.
Recommendation — Use A.8.2 to restrict write access to files that a service may re-read or execute.

Key terms

  • Arbitrary File Read: An arbitrary file read is a flaw that lets an attacker read files they should not access on the target system. In NHI environments, the impact often goes beyond information disclosure because the files may contain session secrets, database contents, or keys that enable impersonation or escalation.
  • Path Traversal: A bug where crafted path segments such as ../ allow input to escape an intended directory boundary. In practice, it turns a normal file operation into a boundary break, which is especially dangerous when the affected service runs with non-human identity privileges and touches production data or secrets.
  • Predictable Runtime Path: A file location that a service or library resolves deterministically at runtime, such as a worker entrypoint, template cache, or config file. If attackers can write there, a later reload or spawn can turn the write into code execution.
  • Output Sink: An output sink is any downstream destination where an agent's response can cause a real effect, such as a rendered UI element, webhook, message queue, or database write. In agentic systems, sinks are often more important than the text response itself because they are where model output becomes action.

Deepen your knowledge

The NHI Foundation Level course covers NHI governance, machine identity security, and secrets management as part of the industry's only accredited NHI security programme. It helps security practitioners connect identity controls to the wider runtime and access risks that shape modern environments.
NHIMG Editorial Note
Published by the NHIMG editorial team on August 18, 2026.
Updated on October 12, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org