/

CVE-2026-30309

Severity:

HIGH RISK

(7.8)

OS Command Injection / Improper Input Neutralization

CVE-2026-30309

Analyzed

Vulnerability type

Category:

OS Command Injection / Improper Input Neutralization

CWE:

CWE-78

Impact:

Arbitrary Command Execution and Data Exfiltration

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

InfCode's terminal auto-execution module uses a fragile blacklist-based filter that fails to detect high-risk PowerShell commands and simple syntax obfuscation, allowing malicious commands to pass through.

If a user opens a crafted file inside the IDE, the Agent may automatically execute dangerous PowerShell commands without confirmation, leading to arbitrary command execution or sensitive data exposure.

Affected context

This vulnerability affects environments where:

  • InfCode's terminal auto-execution module is enabled in the IDE
  • The Agent reads and auto-runs commands derived from imported or opened files
  • Command safety is enforced primarily through a blacklist of prohibited terms
  • Users regularly open untrusted or semi-trusted project files, scripts, or configuration snippets

The risk is highest when the IDE is used to inspect files originating from external repositories, shared archives, or third-party contributors.

Exploit preconditions

  • Attack surface: IDE feature that auto-executes or prepares commands from files (e.g., project configuration, task scripts).
  • Required access: Ability to supply or modify files that the IDE user will open or import (e.g., via cloned repositories, shared project files, or attachments).
  • Trigger point: User imports, opens, or views the malicious file in InfCode; the terminal auto-execution module processes embedded instructions.
  • Why exploitation is possible:
  • The blacklist does not cover core PowerShell invocation patterns (e.g., powershell, pwsh, or function aliases).
  • The matching algorithm lacks semantic understanding of shell syntax and does not account for:
  • String concatenation
  • Variable-based command assembly
  • Double-quoted string interpolation
  • As a result, obfuscated or dynamically constructed commands bypass the blacklist and are executed without explicit user consent.

Why this happens

The core issue is reliance on naive blacklist-based command filtering as a primary security control for executing shell commands.

This maps directly to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where user-controlled inputs are insufficiently sanitized before being passed to a command interpreter.

Instead of enforcing a strict allowlist of safe operations or using structured APIs, the module attempts to block "dangerous" commands by matching literal substrings.

Because shell and PowerShell syntax support concatenation, variable expansion, aliases, and quoting variants, attackers can easily construct semantically equivalent commands that evade literal pattern matches.

The auto-execution behavior, combined with incomplete filtering and lack of semantic parsing, creates an environment where untrusted content is effectively treated as trusted terminal instructions.

Potential impact

  • Execution of arbitrary PowerShell commands under the IDE user's security context
  • Exfiltration of sensitive data such as source code, credentials, or configuration secrets
  • Installation of malware, persistence mechanisms, or backdoors on the developer workstation
  • Lateral movement from a compromised development environment into connected infrastructure or services
  • Tampering with source code, build artifacts, or CI/CD configurations, enabling supply-chain attacks

General mitigation guidance

Mitigation should focus on eliminating auto-execution of untrusted commands and replacing blacklist-based checks with stricter, explicit controls:

  • Prefer a default-deny model:
  • Execute only a tightly scoped allowlist of known-safe operations instead of attempting to block dangerous ones.
  • Limit execution to predefined, parameterized tasks or commands rather than arbitrary shell strings.
  • Reduce trust in file-derived instructions:
  • Treat any command or script content sourced from user-editable or project files as untrusted.
  • Require explicit user confirmation before running commands derived from project content, especially when they involve external processes or network access.
  • Use structured execution APIs:
  • Where possible, invoke platform-specific APIs (e.g., for file operations, version control, or build steps) instead of generic shell execution.
  • Avoid passing assembled command strings directly to shells or PowerShell; use parameterized execution primitives and avoid shell parsing.
  • Harden parsing and filtering patterns:
  • If dynamic execution is necessary, adopt semantic parsing with a constrained grammar for what constitutes a valid command.
  • Normalize and canonicalize command representations before validation to reduce bypasses via syntax variations.
  • Limit privileges and side effects:
  • Run the Agent with least privilege and minimize access to sensitive directories, secrets, and system resources.
  • Segment terminal execution contexts from critical configuration or credential stores to reduce the impact of a compromise.

How teams detect issues like this

Detection efforts can focus on both code-level patterns and runtime behaviors:

  • Static analysis and code review:
  • Flag any component that:
  • Constructs shell or PowerShell commands from file contents or user-controlled input.
  • Uses string concatenation, interpolation, or template expansion to build commands.
  • Relies on blacklist-based checks (e.g., if "powershell" not in cmd:) instead of structured validation.
  • Look for generic execution methods (system, exec, spawn, Start-Process, Invoke-Expression, etc.) where arguments are not strictly controlled.
  • Enforce secure coding guidelines that disallow auto-execution of project-derived commands.
  • Policy and automated tooling:
  • Introduce static analysis rules (e.g., in linters or SAST tools) to detect:
  • Blacklist-style filters around command execution.
  • Direct invocation of shell interpreters from UI or file-handling code paths.
  • Integrate pre-merge checks that highlight new usage of command interpreters or PowerShell APIs in IDE/Agent components.
  • Runtime monitoring:
  • Instrument the Agent to log and optionally block command invocations triggered by file open/import events.
  • Monitor for anomalous PowerShell executions originating from the IDE process, using endpoint security or EDR solutions to detect suspicious activity.

Sources

SourceLink
github.comgithub.com/Secsys-FDU/LLM-Tool-Calling-CVEs/issues/11
tokfinity.comtokfinity.com/infcode

Frequently asked

questions

It typically requires an attacker to deliver a crafted file that the victim opens in InfCode.

In practice, this can be achieved remotely through shared repositories, emailed project bundles, or other file-sharing channels, but the actual execution occurs on the developer's machine when they interact with the file.

The attacker needs the ability to influence or provide files that the IDE user will open, import, or inspect.

They do not need local system access if they can distribute malicious project content that is later opened in the vulnerable environment.

The most robust approach is to remove or strictly constrain auto-execution of commands derived from file content, replace blacklist-based filters with a minimal allowlist of supported actions, and use structured APIs rather than free-form shell execution.

All potentially dangerous operations should require explicit user consent and be validated against a clearly defined, limited command grammar.

Design execution features under the assumption that file content is untrusted, avoid relying on blacklists or pattern-matching to block dangerous commands, and adopt secure design principles such as least privilege, explicit user confirmation, and strong separation between viewing/editing content and executing actions.

Enforce these principles through coding standards, automated static analysis rules, and regular security-focused code reviews for any component that interacts with shells or interpreters.

Find out what's already
exploitable in your codebase.