GHSA-c969-5x3p-vq3v: praisonaiagents: IMAP injection via prompt → email exfil

GHSA-c969-5x3p-vq3v HIGH
Published June 18, 2026
CISO Take

PraisonAI Agents interpolates LLM-controlled parameters directly into IMAP protocol strings without sanitization in its email search, reply, and archive tools, allowing an attacker to break out of quoted string context and inject arbitrary IMAP commands against the connected mail server. Any deployment running email-capable agents with EMAIL_ADDRESS and EMAIL_PASSWORD configured is vulnerable, and with 11 downstream dependents and 40 prior CVEs in the same package, this reflects a systemic pattern of inadequate input validation in this agentic framework. No public exploit or EPSS data is available, but exploitation is mechanically straightforward for anyone who can influence agent prompts—including via indirect channels such as malicious email content processed autonomously by the agent—making this particularly dangerous in unattended email-triage pipelines. Upgrade to praisonaiagents >= 1.6.59 immediately; if patching is not feasible, remove EMAIL_ADDRESS and EMAIL_PASSWORD environment variables from all agent runtimes to disable email tool registration.

Sources: GitHub Advisory ATLAS

What is the risk?

CVSS 8.1 (High) with network-accessible vector, low complexity, and low privileges required accurately captures the exploitability—but the effective attack surface may be larger in agentic deployments where the LLM autonomously processes external content (emails, documents), making PR:L an optimistic assumption. The confidentiality and integrity impacts are both High: email exfiltration via injected FETCH commands and permanent deletion via DELETE+EXPUNGE are both reachable. No active exploitation is confirmed and there is no CISA KEV entry, but the attack chain is fully documented in the advisory PoC. The 40+ prior CVEs in praisonaiagents elevate organizational risk—this package has a track record of security issues that should factor into any deployment decision.

How does the attack unfold?

Payload Crafting
Attacker constructs an IMAP injection payload exploiting the double-quote delimiter boundary (e.g., `" FETCH 1:* (BODY[])`) and embeds it in content the agent will ingest—an inbound email subject, body, Message-ID, or direct agent prompt.
AML.T0065
Indirect Prompt Injection
The crafted content is processed by the LLM agent autonomously (e.g., during inbox triage), causing the LLM to decide to call search_emails or reply_email with the attacker-controlled string as a tool argument.
AML.T0051.001
Tool Invocation with Injected Args
The LLM invokes the email tool with the unsanitized payload; Python f-string interpolation embeds it directly into the IMAP SEARCH command string, breaking out of the quoted string context and injecting arbitrary IMAP protocol commands.
AML.T0053
Exfiltration or Destruction
The injected IMAP command executes server-side, exfiltrating full mailbox contents via FETCH, permanently deleting messages via DELETE+EXPUNGE, or terminating the session via LOGOUT depending on the payload chosen by the attacker.
AML.T0086

What systems are affected?

Package Ecosystem Vulnerable Range Patched
PraisonAI Agents pip <= 1.6.48 1.6.59
11 dependents 65% patched ~6d to patch Full package profile →

Do you use PraisonAI Agents? You're affected.

How severe is it?

CVSS 3.1
8.1 / 10
EPSS
N/A
Exploitation Status
No known exploitation
Sophistication
Moderate

What is the attack surface?

AV AC PR UI S C I A
AV Network
AC Low
PR Low
UI None
S Unchanged
C High
I High
A None

What should I do?

6 steps
  1. Patch: Upgrade praisonaiagents to >= 1.6.59 immediately. Verify with pip show praisonaiagents.

  2. Disable email tools if unable to patch: Remove EMAIL_ADDRESS and EMAIL_PASSWORD environment variables from all agent runtimes—tools are only registered when these vars are present.

  3. Audit deployments: Inventory all praisonaiagents instances and flag any with email tools configured. Run grep -r 'search_emails\|reply_email\|archive_email\|archive_email' . across agent configuration files.

  4. Code-level workaround (pre-patch): Wrap all IMAP parameters with RFC 3501 literal syntax ({n}\r\n<data>) instead of quoted strings before calling mail.search().

  5. Detection: Log IMAP search strings at the IMAP client layer—any containing LOGOUT, EXPUNGE, DELETE, SELECT, FETCH, or unmatched double quotes is an injection indicator.

  6. Least privilege: Restrict agent IMAP permissions to read-only unless write access is operationally required; disable IMAP IDLE and destructive commands at the server ACL level.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, robustness and cybersecurity
ISO 42001
8.4 - AI system design and development
NIST AI RMF
MANAGE 2.2 - Mechanisms are in place to respond to AI risks
OWASP LLM Top 10
LLM01:2025 - Prompt Injection LLM06:2025 - Excessive Agency

Frequently Asked Questions

What is GHSA-c969-5x3p-vq3v?

PraisonAI Agents interpolates LLM-controlled parameters directly into IMAP protocol strings without sanitization in its email search, reply, and archive tools, allowing an attacker to break out of quoted string context and inject arbitrary IMAP commands against the connected mail server. Any deployment running email-capable agents with EMAIL_ADDRESS and EMAIL_PASSWORD configured is vulnerable, and with 11 downstream dependents and 40 prior CVEs in the same package, this reflects a systemic pattern of inadequate input validation in this agentic framework. No public exploit or EPSS data is available, but exploitation is mechanically straightforward for anyone who can influence agent prompts—including via indirect channels such as malicious email content processed autonomously by the agent—making this particularly dangerous in unattended email-triage pipelines. Upgrade to praisonaiagents >= 1.6.59 immediately; if patching is not feasible, remove EMAIL_ADDRESS and EMAIL_PASSWORD environment variables from all agent runtimes to disable email tool registration.

Is GHSA-c969-5x3p-vq3v actively exploited?

No confirmed active exploitation of GHSA-c969-5x3p-vq3v has been reported, but organizations should still patch proactively.

How to fix GHSA-c969-5x3p-vq3v?

1. Patch: Upgrade praisonaiagents to >= 1.6.59 immediately. Verify with `pip show praisonaiagents`. 2. Disable email tools if unable to patch: Remove EMAIL_ADDRESS and EMAIL_PASSWORD environment variables from all agent runtimes—tools are only registered when these vars are present. 3. Audit deployments: Inventory all praisonaiagents instances and flag any with email tools configured. Run `grep -r 'search_emails\|reply_email\|archive_email\|archive_email' .` across agent configuration files. 4. Code-level workaround (pre-patch): Wrap all IMAP parameters with RFC 3501 literal syntax (`{n}\r\n<data>`) instead of quoted strings before calling `mail.search()`. 5. Detection: Log IMAP search strings at the IMAP client layer—any containing LOGOUT, EXPUNGE, DELETE, SELECT, FETCH, or unmatched double quotes is an injection indicator. 6. Least privilege: Restrict agent IMAP permissions to read-only unless write access is operationally required; disable IMAP IDLE and destructive commands at the server ACL level.

What systems are affected by GHSA-c969-5x3p-vq3v?

This vulnerability affects the following AI/ML architecture patterns: agent frameworks, email-integrated AI agents, autonomous AI agents.

What is the CVSS score for GHSA-c969-5x3p-vq3v?

GHSA-c969-5x3p-vq3v has a CVSS v3.1 base score of 8.1 (HIGH).

What is the AI security impact?

Affected AI Architectures

agent frameworksemail-integrated AI agentsautonomous AI agents

MITRE ATLAS Techniques

AML.T0051 LLM Prompt Injection
AML.T0051.001 Indirect
AML.T0053 AI Agent Tool Invocation
AML.T0065 LLM Prompt Crafting
AML.T0085.001 AI Agent Tools
AML.T0086 Exfiltration via AI Agent Tool Invocation
AML.T0101 Data Destruction via AI Agent Tool Invocation

Compliance Controls Affected

EU AI Act: Article 15
ISO 42001: 8.4
NIST AI RMF: MANAGE 2.2
OWASP LLM Top 10: LLM01:2025, LLM06:2025

What are the technical details?

Original Advisory

## Summary The email search tool in `src/praisonai-agents/praisonaiagents/tools/email_tools.py` constructs IMAP SEARCH commands by interpolating LLM-controlled parameters (from_addr, subject, query) directly into IMAP protocol strings using f-string formatting with double-quote delimiters. An attacker who can influence the arguments to the `search_emails` or `reply_email` tool (via crafted agent prompts) can inject arbitrary IMAP commands, potentially exfiltrating email data from other folders, deleting emails, or performing other unauthorized IMAP operations. ## Details **Vulnerable code (lines 493–502):** ```python criteria = [] if from_addr: criteria.append(f'FROM "{from_addr}"') if subject: criteria.append(f'SUBJECT "{subject}"') if query: criteria.append(f'TEXT "{query}"') if not criteria: criteria.append("ALL") search_str = " ".join(criteria) status, data = mail.search(None, search_str) ``` The `from_addr`, `subject`, and `query` parameters originate from LLM tool call arguments (the `search_emails` public function at line 665). These values flow through without any sanitization or escaping. The double-quote (`"`) characters in these parameters allow breaking out of the IMAP SEARCH quoted string context. **Additional injection points:** - Line 416: `mail.search(None, f'HEADER Message-ID "{search_id}"')` - Line 447: Same pattern in `_smtp_reply_email` - Line 542: Same pattern in `_smtp_archive_email` The `search_id` / `message_id` parameter in these functions is also LLM-controlled via the `reply_email` and `archive_email` public tool functions. **Reachability:** The `search_emails`, `reply_email`, and `archive_email` functions are exposed as agent tools. They are reachable when an agent is configured with email tools (EMAIL_ADDRESS + EMAIL_PASSWORD environment variables set). This is a documented deployment scenario for email-capable agents. ## PoC **Setup:** Requires an IMAP server (not run here — this is a static proof). The vulnerability is demonstrated by tracing the data flow. **Positive trigger — IMAP injection via `search_emails`:** An LLM agent processing a crafted prompt calls: ```python search_emails(from_addr='user@example.com" LOGOUT') ``` This produces the IMAP command: ``` SEARCH FROM "user@example.com" LOGOUT" ``` The `LOGOUT` command is injected after the prematurely closed quoted string, causing the IMAP connection to be terminated. **More severe injection — exfiltrate emails from another folder:** ```python search_emails(query='" SEARCH RETURN (MIN) ALL') ``` Produces: `TEXT "" SEARCH RETURN (MIN) ALL"` — injects a secondary SEARCH command. **Negative control — legitimate search:** ```python search_emails(from_addr='user@example.com') ``` Produces: `FROM "user@example.com"` — correct, no injection. **Cleanup:** No persistent changes for read-only injection. For destructive injection (DELETE, EXPUNGE), impact persists. ## Impact An attacker who can craft prompts that cause an LLM agent to call `search_emails` with injection payloads can: - **Terminate IMAP connections** (denial of service) - **Inject arbitrary IMAP commands** — including LIST (enumerate folders), SELECT (switch folders), FETCH (read emails from other mailboxes), STORE (modify flags), COPY/MOVE (move emails), DELETE/EXPUNGE (permanently delete emails) - **Exfiltrate email contents** from folders the user did not intend to expose to the agent - **Permanently delete emails** via injected DELETE + EXPUNGE commands The attack requires the IMAP backend to be configured (EMAIL_ADDRESS + EMAIL_PASSWORD env vars), which is a documented and common deployment for email-capable agents. ## Suggested remediation 1. **Escape double-quote characters** in IMAP parameters. Per RFC 3501, literal strings use `{n}\r\n` format or quoted strings with `\` escaping: ```python def _escape_imap_string(s: str) -> str: """Escape a string for safe use in IMAP quoted strings.""" # Use IMAP literal syntax for safety: {length}\r\n<data> encoded = s.encode('utf-8') return f'{{{len(encoded)}}}\r\n{encoded}' ``` 2. Use IMAP literal syntax (`{n}\r\ndata`) instead of quoted strings for all user-controlled parameters. This prevents any injection regardless of content. 3. Apply the escaping to all IMAP search criteria parameters: `from_addr`, `subject`, `query`, and `search_id`/`message_id`.

Exploitation Scenario

An attacker targeting an organization running a praisonaiagents email triage agent sends a crafted inbound email with a subject containing the IMAP injection payload: `legitimate subject" FETCH 1:* (BODY[])`. When the agent autonomously processes the inbox and calls `search_emails(subject='legitimate subject" FETCH 1:* (BODY[])')`, the f-string interpolation produces the IMAP command `SUBJECT "legitimate subject" FETCH 1:* (BODY[])"`. The injected FETCH command retrieves the full body of all messages in the currently selected mailbox, exfiltrating contents including credentials, business communications, and PII. A more destructive variant appends ` UID STORE 1:* +FLAGS (\Deleted)` followed by an EXPUNGE trigger, permanently purging mailbox contents—potentially destroying audit trail evidence before an incident investigation begins.

Weaknesses (CWE)

CWE-20 — Improper Input Validation: The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.

  • [Architecture and Design] Consider using language-theoretic security (LangSec) techniques that characterize inputs using a formal language and build "recognizers" for that language. This effectively requires parsing to be a distinct layer that effectively enforces a boundary between raw input and internal data representations, instead of allowing parser code to be scattered throughout the program, where it could be subject to errors or inconsistencies that create weaknesses. [REF-1109] [REF-1110] [REF-1111]
  • [Architecture and Design] Use an input validation framework such as Struts or the OWASP ESAPI Validation API. Note that using a framework does not automatically address all input validation problems; be mindful of weaknesses that could arise from misusing the framework itself (CWE-1173).

Source: MITRE CWE corpus.

CVSS Vector

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N

Timeline

Published
June 18, 2026
Last Modified
June 18, 2026
First Seen
June 18, 2026

Related Vulnerabilities