/

CVE-2026-57130

Severity:

HIGH RISK

(8.1)

IMAP Command Injection (CWE-77) in PraisonAI Email Tools

CVE-2026-57130

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-20, CWE-77

Impact:

Mailbox data access, modification, deletion, and connection disruption

Severity:

HIGH RISK

(8.1)

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

A high-severity command injection vulnerability in PraisonAI's email tools allows language-model-controlled values to alter quoted IMAP search criteria. When an exposed agent has configured email credentials, an attacker may access, modify, delete, or disrupt mailbox operations.

Affected context

The issue occurs in PraisonAI email functionality that constructs IMAP SEARCH criteria from language-model-controlled sender, subject, or query values. Deployments become risky when agents can invoke search, reply, or archive operations and have access to configured email credentials. The vulnerability depends on those values being inserted into IMAP criteria without sufficient escaping or validation.

Exploit preconditions

  • Attack surface: PraisonAI email tools that issue IMAP operations
  • Required access: Ability to influence an agent's from_addr, subject, or query values, plus access to an agent configured with email credentials
  • Trigger point: Invocation of search_emails, reply_email, or archive_email
  • Why exploitation is possible: User-controlled values are interpolated directly into quoted IMAP SEARCH criteria, allowing special characters to change the intended operation

Why this happens

The underlying bug is improper neutralization of special elements in an externally influenced command or query. Email tool parameters controlled by an LLM are inserted into IMAP SEARCH criteria without treating them as data separate from the command syntax. Embedded quotes, backslashes, line breaks, or null characters can therefore alter parser interpretation. This maps primarily to CWE-77, Improper Neutralization of Special Elements used in a Command, with CWE-20 reflecting insufficient input validation.

Potential impact

  • An attacker may access mailbox messages or search results
  • An attacker could modify or delete email through available tool operations
  • Mailbox content or metadata may be manipulated
  • IMAP connections or email workflows may be disrupted
  • Compromised mailbox credentials could enable further account abuse

General mitigation guidance

Mitigation generally focuses on keeping LLM-controlled values separate from

IMAP command syntax and reducing trust in agent-generated inputs.

Common defensive patterns include:

  • Using protocol-aware APIs or structured query builders that safely encode IMAP criteria
  • Applying strict allowlist validation for sender, subject, and search parameters
  • Rejecting control characters and unsupported delimiters before request construction
  • Separating read-only search capabilities from message modification or deletion capabilities
  • Limiting mailbox permissions and using dedicated accounts with least privilege
  • Requiring explicit authorization for destructive email actions
  • Treating model output as untrusted input even when generated by an internal agent

How teams detect issues like this

Organizations can identify similar issues through:

  • Static analysis rules for string interpolation into IMAP commands or protocol queries
  • Code review checks for direct concatenation of model output into quoted criteria
  • Tests covering quotes, backslashes, line breaks, null characters, and other control characters
  • Policy enforcement requiring protocol encoders or structured query APIs
  • Runtime monitoring for unusual search criteria, bulk mailbox changes, or repeated failed IMAP commands
  • Automated security review tools that flag command construction from untrusted inputs

Sources

SourceLink
github.comgithub.com/MervinPraison/PraisonAI/commit/b4270173d4123fb1ee8910588f0896668ee21b59
github.comgithub.com/MervinPraison/PraisonAI/releases/tag/v4.6.59
github.comgithub.com/MervinPraison/PraisonAI/security/advisories/GHSA-c969-5x3p-vq3v

Frequently asked

questions

It can be exploitable through an exposed PraisonAI agent when an attacker can

influence the agent's email-tool inputs and the agent has usable email

credentials. Direct network access to the IMAP service alone is not sufficient.

Exploitation generally requires access to an agent workflow that invokes the

affected email tools, along with configured credentials permitting the

resulting mailbox operations.

Treat all model-controlled values as untrusted, encode them with a

protocol-aware IMAP builder, and reject invalid control characters before

constructing search criteria.

Apply least-privilege mailbox permissions, separate read and destructive

capabilities, require confirmation for sensitive actions, and test all

protocol-bound parameters with adversarial input cases.

Find out what's already
exploitable in your codebase.