Skip to content

Audit & Hardening

1. Security Audit CLI

bash
openclaw security audit          # Basic scan
openclaw security audit --deep   # + live gateway probe + plugin/skill code scanning
openclaw security audit --fix    # Auto-fix footguns
openclaw security audit --json   # Machine-readable output

2. What the Audit Checks

27 collector functions organized by category:

CategoryChecks
OverviewAttack surface summary
StorageSynced folder detection (iCloud, Dropbox, Google Drive, OneDrive)
GatewayBind mode, auth config, Tailscale, trusted proxies, rate limiting
BrowserCDP auth, remote HTTP exposure
LoggingRedaction settings
ElevatedExec allowlists, wildcards
ExecSandbox misconfig (host=sandbox with sandbox off), interpreter safeBins
HooksToken length, token reuse, session key control, prefixes
HTTP APINo-auth endpoints, session key overrides
SandboxDocker noop, dangerous bind mounts
NodesDeny command patterns, dangerous allow commands
ConfigMinimal profile overrides, plaintext secrets, dangerous flags
ModelsLegacy/weak models, small parameter risk
ExposureCombined exposure matrix (open groups + runtime/fs tools)
FilesystemState dir/config permissions, symlinks
PluginsTrust/provenance, code safety (deep only)
SkillsCode safety scanning (deep only)
ChannelsDM/group policies per provider

--deep adds: plugin code scanning, skill code scanning, live gateway probe (WebSocket connect + health check).

--fix applies: redaction on, open group policies to allowlist, file permissions (0o700/0o600).

3. All Security Audit checkId Values

Gateway

checkIdSeverityWhat it catches
gateway.bind_no_authcriticalRemote bind without shared secret
gateway.loopback_no_authcriticalReverse-proxied loopback unauthenticated
gateway.http.no_authwarn/criticalHTTP APIs with auth.mode="none"
gateway.tools_invoke_http.dangerous_allowwarn/criticalRe-enabled dangerous tools over HTTP
gateway.nodes.allow_commands_dangerouswarn/criticalHigh-impact node commands enabled
gateway.tailscale_funnelcriticalPublic internet exposure
gateway.control_ui.insecure_authwarnInsecure-auth compat toggle
gateway.control_ui.device_auth_disabledcriticalDevice identity check disabled
gateway.real_ip_fallback_enabledwarn/criticalX-Real-IP spoofing risk
gateway.token_too_shortwarnGateway token too short
gateway.trusted_proxies_missingwarnNo trusted proxies configured
gateway.trusted_proxy_no_proxiescriticalTrusted-proxy mode without proxies
gateway.trusted_proxy_no_user_headercriticalNo user header configured
gateway.trusted_proxy_no_allowlistwarnNo user allowlist
gateway.auth_no_rate_limitwarnNo auth rate limiting configured
gateway.tailscale_serveinfoTailscale Serve exposure
gateway.trusted_proxy_authcriticalTrusted-proxy auth misconfiguration
gateway.http.session_key_override_enabledinfoHTTP session key override enabled
gateway.probe_failedwarnLive probe failed (--deep)

Discovery

checkIdSeverity
discovery.mdns_full_modewarn/critical

Filesystem

checkIdSeverityAuto-fix
fs.state_dir.perms_world_writablecriticalyes
fs.state_dir.perms_group_writablewarnyes
fs.state_dir.perms_readablewarnyes
fs.state_dir.symlinkwarnno
fs.config.perms_writablecriticalyes
fs.config.perms_world_readablecriticalyes
fs.config.perms_group_readablewarnyes
fs.config.symlinkwarnno
fs.synced_dirwarnno
fs.config_include.perms_writablecriticalyes
fs.config_include.perms_world_readablecriticalyes
fs.config_include.perms_group_readablewarnyes
fs.credentials_dir.perms_writablecriticalyes
fs.credentials_dir.perms_readablewarnyes
fs.auth_profiles.perms_writablecriticalyes
fs.auth_profiles.perms_readablewarnyes
fs.sessions_store.perms_readablewarnyes
fs.log_file.perms_readablewarnyes

Browser

checkIdSeverity
browser.control_invalid_configwarn
browser.control_no_authcritical
browser.remote_cdp_httpwarn

Logging

checkIdSeverityAuto-fix
logging.redact_offwarnyes

Hooks

checkIdSeverity
hooks.token_too_shortwarn
hooks.token_reuse_gateway_tokencritical
hooks.path_rootcritical
hooks.default_session_key_unsetwarn
hooks.request_session_key_enabledwarn/critical
hooks.request_session_key_prefixes_missingwarn/critical

Config

checkIdSeverity
config.insecure_or_dangerous_flagswarn
config.secrets.gateway_password_in_configwarn
config.secrets.hooks_token_in_configinfo

Tools/Exec

checkIdSeverity
tools.exec.host_sandbox_no_sandbox_defaultswarn
tools.exec.host_sandbox_no_sandbox_agentswarn
tools.exec.safe_bins_interpreter_unprofiledwarn
tools.elevated.allowFrom.*.wildcardcritical
tools.elevated.allowFrom.*.largewarn

Sandbox

checkIdSeverity
sandbox.docker_config_mode_offwarn
sandbox.dangerous_bind_mountcritical
sandbox.bind_mount_non_absolutewarn
sandbox.dangerous_network_modecritical
sandbox.dangerous_seccomp_profilecritical
sandbox.dangerous_apparmor_profilecritical
sandbox.browser_cdp_bridge_unrestrictedwarn
sandbox.browser_container.hash_label_missingwarn
sandbox.browser_container.hash_epoch_stalewarn
sandbox.browser_container.non_loopback_publishcritical
tools.profile_minimal_overriddenwarn
plugins.tools_reachable_permissive_policywarn

Exposure

checkIdSeverity
security.exposure.open_groups_with_runtime_or_fscritical/warn
models.small_paramscritical/info

Channels (per provider)

checkIdSeverity
channels.*.dm.opencritical
channels.*.dm.open_invalidwarn
channels.*.dm.disabledinfo
channels.*.dm.scope_main_multiuserwarn
channels.discord.allowFrom.name_based_entrieswarn
channels.discord.commands.native.unrestrictedcritical
channels.discord.commands.native.no_allowlistswarn
channels.slack.commands.slash.useAccessGroups_offcritical
channels.slack.commands.slash.no_allowlistswarn
channels.telegram.allowFrom.invalid_entrieswarn
channels.telegram.groups.allowFrom.wildcardcritical
channels.telegram.groups.allowFrom.missingcritical

Plugins

checkIdSeverity
plugins.extensions_no_allowlistwarn/critical
plugins.installs_unpinned_npm_specswarn
plugins.installs_missing_integritywarn
plugins.installs_version_driftwarn
plugins.code_safetycritical/warn
plugins.code_safety.scan_failedwarn
plugins.code_safety.entry_pathwarn
plugins.code_safety.entry_escapecritical

Skills

checkIdSeverity
skills.code_safetycritical/warn
skills.code_safety.scan_failedwarn

Other

checkIdSeverity
security.exposure.open_groups_with_elevatedcritical
models.legacywarn
models.weak_tierwarn
gateway.nodes.deny_commands_ineffectivewarn
hooks.installs_unpinned_npm_specswarn
hooks.installs_missing_integritywarn
hooks.installs_version_driftwarn
summary.attack_surfaceinfo

4. Dangerous Config Flags

The audit aggregates config.insecure_or_dangerous_flags when any of these are enabled:

  • gateway.controlUi.allowInsecureAuth=true
  • gateway.controlUi.dangerouslyDisableDeviceAuth=true
  • hooks.gmail.allowUnsafeExternalContent=true
  • hooks.mappings[N].allowUnsafeExternalContent=true
  • tools.exec.applyPatch.workspaceOnly=false

5. Hardening Checklist (Priority Order)

  1. Lock down inbound access: DM pairing/allowlists, group requireMention, session isolation (per-channel-peer)
  2. Network exposure: loopback bind, Tailscale Serve (not Funnel), gateway auth token, mDNS minimal/off
  3. Tool policy: messaging profile for untrusted, deny group:automation + group:runtime + group:fs for public agents
  4. Sandboxing: mode=all or mode=non-main, scope=session, workspaceAccess=none
  5. Exec security: security=deny or security=allowlist, ask=always
  6. Elevated: disabled unless needed, tight allowFrom per provider
  7. File permissions: 700 on dirs, 600 on files (run openclaw security audit --fix)
  8. Hooks: long token (>=24 chars), different from gateway token, allowRequestSessionKey=false
  9. Plugins: explicit plugins.allow, review before enabling
  10. Browser: dedicated profile, disable sync/password managers, tailnet-only for remote
  11. Logging: redactSensitive="tools", add custom redactPatterns for your environment
  12. Model choice: latest instruction-hardened model (Opus 4.6), avoid small models for tool-enabled agents

6. Secure Baseline Config (Complete)

json5
{
  gateway: {
    mode: "local",
    bind: "loopback",
    port: 18789,
    auth: { mode: "token", token: "your-long-random-token-here" },
  },
  discovery: {
    mdns: { mode: "minimal" },
  },
  session: {
    dmScope: "per-channel-peer",
  },
  tools: {
    profile: "messaging",
    deny: ["group:automation", "group:runtime", "group:fs", "sessions_spawn", "sessions_send"],
    fs: { workspaceOnly: true },
    exec: { security: "deny", ask: "always" },
    elevated: { enabled: false },
  },
  logging: {
    redactSensitive: "tools",
  },
  channels: {
    whatsapp: {
      dmPolicy: "pairing",
      groups: { "*": { requireMention: true } },
    },
    telegram: {
      dmPolicy: "pairing",
      groups: { "*": { requireMention: true } },
    },
    discord: {
      dmPolicy: "pairing",
    },
  },
  agents: {
    defaults: {
      sandbox: {
        mode: "non-main",
        scope: "session",
        workspaceAccess: "none",
      },
    },
  },
}

7. Per-Agent Profiles

Full access (personal, no sandbox)

json5
{
  agents: {
    list: [{
      id: "personal",
      workspace: "~/.openclaw/workspace-personal",
      sandbox: { mode: "off" },
    }],
  },
}

Read-only (family/work)

json5
{
  agents: {
    list: [{
      id: "family",
      workspace: "~/.openclaw/workspace-family",
      sandbox: { mode: "all", scope: "agent", workspaceAccess: "ro" },
      tools: {
        allow: ["read"],
        deny: ["write", "edit", "apply_patch", "exec", "process", "browser"],
      },
    }],
  },
}

No filesystem (public messaging)

json5
{
  agents: {
    list: [{
      id: "public",
      sandbox: { mode: "all", scope: "agent", workspaceAccess: "none" },
      tools: {
        sessions: { visibility: "tree" },
        allow: ["sessions_list", "sessions_history", "session_status", "message"],
        deny: ["read", "write", "edit", "apply_patch", "exec", "process", "browser", "canvas", "nodes", "cron", "gateway", "image"],
      },
    }],
  },
}

8. Incident Response

Contain

  1. Stop gateway process
  2. Set gateway.bind: "loopback", disable Tailscale Funnel/Serve
  3. Switch risky DMs/groups to disabled/require mentions

Rotate

  1. Gateway auth token/password, then restart
  2. Remote client secrets
  3. Provider/API credentials

Audit

  1. Check logs: /tmp/openclaw/openclaw-YYYY-MM-DD.log
  2. Review transcripts: ~/.openclaw/agents/<agentId>/sessions/*.jsonl
  3. Review recent config changes
  4. Re-run openclaw security audit --deep

Collect for Report

  • Timestamp, OS, OpenClaw version
  • Session transcript(s) + log tail (after redacting)
  • What attacker sent + what agent did
  • Whether gateway was exposed beyond loopback