Skip to content

[Security] Critical validator RCE risk, execSync crashes, and storage race conditions #451

@imxyanua

Description

@imxyanua

Summary

A security and reliability audit identified several high-priority issues across the validator, execution layer, and storage subsystem. These issues may lead to remote code execution (RCE), process crashes, and data corruption.

Shell injection risk in validator (Critical)

File: src/gep/validator/sandboxExecutor.js
Current implementation:

spawn(String(cmd), { shell: true, cwd, env, ... });

Problem:

  • Executes command through system shell
  • Vulnerable to shell injection
  • High-risk attack vector if commands originate from Hub

Recommended fix:

const { executable, args } = parseCommand(cmd);
spawn(executable, args, { shell: false, cwd, env, ... });

Missing maxBuffer in execSync

Files:

  • src/gep/gitOps.js
  • src/gep/signals.js
  • Any usage of execSync

Problem:

  • Default buffer (~1MB) can overflow
  • Causes process crashes (ENOBUFS) on large outputs (e.g. git diff)

Recommended fix:

execSync(cmd, {
maxBuffer: 10 * 1024 * 1024,
timeout: ...,
cwd: ...
});

Race conditions in JSON storage
File: src/gep/assetStore.js
Problem:

  • Concurrent writes (daemon + scripts) without locking
  • Risk of file corruption or data loss
    Recommended fix:

function saveGenes(genes) {
return withFileLock(genesLockPath, () =>
writeJsonAtomic(genesPath, genes)
);
}

Validator behavior not clearly documented

Problem:

  • Validator executes commands from Hub
  • No clear documentation or warning
  • May lead to unintended remote command execution

Recommended actions:

  • Document default value of EVOLVER_VALIDATOR_ENABLED
  • Add startup warning:
    "WARNING: This node will execute commands received from the Hub"
  • Require explicit opt-in instead of implicit enablement

Notes

These issues were identified during a focused audit of execution flow, storage layer, and validator behavior. Fixing them would significantly improve system safety and reliability

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions