Summary
OpenClaw hook transform loading accepts absolute and traversal-based module paths from configuration, allowing arbitrary JavaScript modules to be loaded.
If an attacker can modify the hooks configuration, they can force OpenClaw to execute malicious code with gateway process privileges.
Affected context
This vulnerability affects OpenClaw deployments using hook transforms where:
- The
hooks.mappings[].transform.moduleparameter is configurable at runtime or via files/remote configuration stores - Module paths are taken directly from configuration and resolved on the filesystem
- The gateway process has access to load JavaScript modules from attacker-controllable locations
Risk is elevated in environments where configuration files, environment-based configuration, or remote config services can be modified by less-trusted users or processes.
Exploit preconditions
- Attack surface: Configuration layer (files, environment variables, or centralized config systems feeding OpenClaw).
- Required access: Ability to write or influence
hooks.mappings[].transform.modulevalues (e.g., modify config files, config database entries, or management UI settings). - Trigger point: The moment the gateway initializes or reloads hooks and attempts to load the specified transform module.
- Why exploitation is possible: The loader:
- Accepts absolute paths and
..traversal sequences intransform.module - Does not constrain module locations to a trusted directory or whitelist
- Executes the loaded JavaScript with the privileges of the gateway process.
Why this happens
The core issue is an insecure module loading design where configuration-supplied paths are treated as trusted code locations.
This maps to CWE-427: Uncontrolled Search Path Element, because the system allows external configuration to influence which code is loaded and executed, without enforcing a safe, fixed search path.
The presence of traversal support (.. segments and absolute paths) also reflects CWE-22: Path Traversal, enabling attackers to reference arbitrary files on the filesystem.
Conceptually, the bug class is:
- Treating configuration as trusted code selectors
- Allowing fully dynamic filesystem paths for executable modules
- Failing to restrict module resolution to a vetted, application-controlled directory or identifier-based registry.
Potential impact
- Execution of arbitrary JavaScript code with gateway process privileges
- Full compromise of the gateway application, including data handled by hooks
- Modification, interception, or exfiltration of traffic processed by OpenClaw hooks
- Lateral movement within the host environment or internal network, depending on gateway permissions
- Tampering with logging, audit trails, or security controls implemented as transforms
General mitigation guidance
Effective mitigation centers on constraining where executable modules may come from and reducing trust in configuration-controlled paths:
- Restrict transform modules to a fixed, application-controlled directory or a registry of allowed module identifiers rather than arbitrary filesystem paths.
- Normalize and validate any path input, explicitly rejecting absolute paths, traversal sequences (
..), and symlink-based escapes from trusted directories. - Use a logical module name or ID in configuration and map it internally to vetted module files or packages.
- Run the gateway process with least privilege, limiting filesystem write access and external network capabilities to reduce the blast radius of code execution.
- Treat configuration as untrusted input: apply strict schema validation, type checking, and allowed-value lists for module-selection fields.
- Consider separate trust domains for configuration management, ensuring only highly trusted roles or services can modify hook module settings.
How teams detect issues like this
Detection generally relies on a combination of code analysis and configuration review:
- Static code analysis: Search for dynamic
require()/import patterns or custom loaders that take module paths directly from configuration and pass them into filesystem or module-loader APIs without restriction. - Code review signals:
- Any use of user or config-supplied strings to construct module paths
- Acceptance of absolute paths or
..segments in config parameters controlling code or plugin loading - Lack of explicit whitelisting or directory constraints in module resolution logic
- Configuration audits: Periodically scan configuration sources (files, config services, environment) for transform module entries that:
- Use absolute paths
- Contain traversal (
../) or unexpected directories - Policy enforcement: Apply CI/CD or configuration validation hooks that reject deployments where module fields are outside a known-safe set of identifiers or directories.
- Automated security review tools can be configured to flag dynamic module loading and filesystem access patterns driven by configuration values.

