memory-bank
Audited by Socket on Sep 8, 2026
10 alerts found:
Anomalyx9SecurityNo explicit malicious payload or credential-stealing logic is visible in the Python fragment itself. However, the module executes a dynamically resolved command via bash -c based on stdout from an external resolver script, and it forwards the entire process environment (including any secrets) to that command. This creates a significant supply-chain / arbitrary command execution risk depending on the integrity and inputs of the resolver/command resolution flow. Cache persistence is somewhat hardened against path/symlink escapes, and cached outputs undergo shape validation, but these do not mitigate the core execution risk.
No clear evidence of intentional malware (no network calls, no process spawning, no persistence, no credential theft). However, this module can perform sensitive filesystem reads using request-controlled `mb`/`source` values and then directly emits the read content in its rendered stdout, creating a high potential for data disclosure if exposed to untrusted requests. Additionally, its dynamic import mechanism mutates `sys.path` to locate and import `rrf_merge`, introducing a local/supply-chain behavior risk in adversarial filesystem environments.
The provided fragment alleges multiple high-impact supply-chain risk behaviors consistent with malicious capability: manifest-driven recursive deletion (rm -rf), conditional/unconditional execution of a repository-controlled override script via bash, and symlink-related overwrite hazards. It also describes privacy risks from partial secret redaction and retention of sensitive backups/logs. While the exact implementation cannot be verified because the actual code is not included, the described primitives warrant urgent review and hardening (strict path canonicalization/allowlisting, opt-in for override execution, refusal to follow unsafe symlinks, and stronger secret detection/retention controls).
No direct malware/persistence/exfiltration code is visible in this fragment. However, the script contains a high-impact supply-chain control weakness: it executes a caller-controlled command string using `eval` (from TEST_CMD_CLI/MB_TEST_COMMAND). If an attacker can influence those environment variables (common in CI/config poisoning scenarios), they can achieve arbitrary code execution in the repository directory. Additionally, test execution via go test/bats and log parsing can propagate whatever test output is produced into CI artifacts, potentially including sensitive information.
Moderate concern: this module persistently logs user input (truncated) and tool execution outcomes to sessionFile (privacy/data retention risk) and also executes a Bash script on shutdown via detached child_process.spawn. The background script execution behavior is unknown from the fragment and is the main security-relevant sink. Without seeing how sessionFile/mbPath/SKILL_DIR are constructed and whether mbPath can be user-controlled, a supply-chain or argument-injection/backdoor risk cannot be ruled out, though there is no clear evidence of network exfiltration in the provided snippet.
No direct indicators of malware (exfiltration, persistence, credential theft, network activity, or obfuscated payloads) are present in this fragment. However, the function is intrinsically high-privilege because it executes the provided cmd via bash eval with only heuristic preflight checks; if any portion of cmd (or related inputs) can be influenced by an attacker, this becomes a serious RCE risk. Additionally, optional ore is used as an ERE pattern in grep -E, which can introduce performance risk if untrusted. Treat cmd/ore as fully trusted and ensure strict supply-chain integrity for declarations.
This fragment is not evidence of in-line malware; it is primarily a high-control orchestrator that executes many opaque local hook scripts from `~/.claude/...` across a full session lifecycle. It explicitly directs use of sensitive local context (`~/.claude/CLAUDE.md`), and it likely performs logging/sync/autosave operations via external scripts. The concrete threat level depends entirely on the integrity and content of the referenced hook/script files; if they are trusted and integrity-protected, risk is lower, but if tampered with, the execution surface enables arbitrary malicious actions (including possible data exfiltration) and persistence-like behavior.
This module is primarily a metrics collector, but it contains two high-impact execution surfaces that elevate supply-chain risk when used on untrusted repositories: (1) it can execute a repository-local override script (.memory-bank/metrics.sh) when MB_ALLOW_METRICS_OVERRIDE=1, and (2) in --run mode it executes a dynamically derived command via bash -c "$TEST_CMD". The absence of visible exfiltration/backdoors in this fragment suggests it is not clearly malware by itself, but it can readily become an arbitrary code execution vehicle depending on repository contents and—critically—the implementation of _lib.sh command construction and sanitization.
No direct indicators of overt malware (exfiltration, backdoor/persistence, credential theft) are present in the provided fragment. However, it contains a high-impact execution sink: `eval` executes shell code derived from the output of a helper script located in a user home directory. If that helper script or its output can be tampered with, this workflow becomes an arbitrary command execution vector. The remainder of the fragment is mainly read-only tool detection and stated safety requirements, but enforcement and the migration write/apply logic are not included here, limiting verification of the destructive-change safeguards and correct escaping/DDL safety.
The code fragment is an automation workflow for API contract generation/diffing/testing and shows no direct signs of overt malware (no exfiltration/persistence/reverse shell patterns in the provided text). However, it contains a significant execution risk: it uses eval on stdout from a local user-home script (~/.claude/…), which can enable arbitrary command execution if that script or its output is tampered with. Additionally, reliance on npx-run tooling increases general supply-chain/execution exposure unless versions are pinned/locked.