CVE-2026-57130
PraisonAI: IMAP Command Injection via Unsanitized Email Search Parameters
PraisonAI is a multi-agent teams system. Prior to praisonaiagents 1.6.59, src/praisonai-agents/praisonaiagents/tools/email_tools.py interpolates LLM-controlled from_addr, subject, and query values directly into quoted IMAP SEARCH criteria. Embedded quote, backslash, newline, or null characters can escape the intended criterion and alter IMAP operations when search_emails, reply_email, or archive_email is exposed to an agent with configured email credentials, allowing mailbox data access, modification, deletion, or connection disruption. This issue is fixed in praisonaiagents 1.6.59.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- Low
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
8.1
PraisonAI: IMAP Command Injection via Unsanitized Email Search Parameters
PraisonAI is a multi-agent teams system. Prior to praisonaiagents 1.6.59, src/praisonai-agents/praisonaiagents/tools/email_tools.py interpolates LLM-controlled from_addr, subject, and query values directly into quoted IMAP SEARCH criteria. Embedded quote, backslash, newline, or null characters can escape the intended criterion and alter IMAP operations when search_emails, reply_email, or archive_email is exposed to an agent with configured email credentials, allowing mailbox data access, modification, deletion, or connection disruption. This issue is fixed in praisonaiagents 1.6.59.
- Record
CVE-2026-57130- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N - Weakness
- CWE-20, CWE-77
- Updated
- 2026-11-02
EUVDEUVD-2026-77534
8.1
PraisonAI is a multi-agent teams system. Prior to praisonaiagents 1.6.59, src/praisonai-agents/praisonaiagents/tools/email_tools.py interpolates LLM-controlled from_addr, subject, and query values directly into quoted IMAP SEARCH criteria. Embedded quote, backslash, newline, or null characters can escape the intended criterion and alter IMAP operations when search_emails, reply_email, or archive_email is exposed to an agent with configured email credentials, allowing mailbox data access, modification, deletion, or connection disruption. This issue is fixed in praisonaiagents 1.6.59.
- Record
EUVD-2026-77534- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-c969-5x3p-vq3v
8.1
PraisonAI: IMAP Command Injection via Unsanitized Email Search Parameters
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):
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:
search_emails(from_addr='[email protected]" LOGOUT')
This produces the IMAP command:
SEARCH FROM "[email protected]" 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:
search_emails(query='" SEARCH RETURN (MIN) ALL')
Produces: TEXT "" SEARCH RETURN (MIN) ALL" — injects a secondary SEARCH command.
Negative control — legitimate search:
search_emails(from_addr='[email protected]')
Produces: FROM "[email protected]" — 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
- Escape double-quote characters in IMAP parameters. Per RFC 3501, literal strings use
{n}\r\nformat or quoted strings with\escaping:
def _escape_imap_string(s: str) -> str:
"""Escape a string for safe use in IMAP quoted strings."""
# Use IMAP literal syntax for…
- Record
GHSA-c969-5x3p-vq3v- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N - Weakness
- CWE-20, CWE-77
- Updated
- 2026-11-02
NVD
8.1
PraisonAI is a multi-agent teams system. Prior to praisonaiagents 1.6.59, src/praisonai-agents/praisonaiagents/tools/email_tools.py interpolates LLM-controlled from_addr, subject, and query values directly into quoted IMAP SEARCH criteria. Embedded quote, backslash, newline, or null characters can escape the intended criterion and alter IMAP operations when search_emails, reply_email, or archive_email is exposed to an agent with configured email credentials, allowing mailbox data access, modification, deletion, or connection disruption. This issue is fixed in praisonaiagents 1.6.59.
- Record
CVE-2026-57130- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N - Weakness
- CWE-20, CWE-77
- Updated
- 2026-11-02
OSV
8.1
PraisonAI: IMAP Command Injection via Unsanitized Email Search Parameters
PraisonAI is a multi-agent teams system. Prior to praisonaiagents 1.6.59, src/praisonai-agents/praisonaiagents/tools/email_tools.py interpolates LLM-controlled from_addr, subject, and query values directly into quoted IMAP SEARCH criteria. Embedded quote, backslash, newline, or null characters can escape the intended criterion and alter IMAP operations when search_emails, reply_email, or archive_email is exposed to an agent with configured email credentials, allowing mailbox data access, modification, deletion, or connection disruption. This issue is fixed in praisonaiagents 1.6.59.
- Record
CVE-2026-57130- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N - Weakness
- CWE-20, CWE-77
- Updated
- 2026-11-02
OSVGHSA-c969-5x3p-vq3v
8.1
PraisonAI: IMAP Command Injection via Unsanitized Email Search Parameters
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):
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:
search_emails(from_addr='[email protected]" LOGOUT')
This produces the IMAP command:
SEARCH FROM "[email protected]" 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:
search_emails(query='" SEARCH RETURN (MIN) ALL')
Produces: TEXT "" SEARCH RETURN (MIN) ALL" — injects a secondary SEARCH command.
Negative control — legitimate search:
search_emails(from_addr='[email protected]')
Produces: FROM "[email protected]" — 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
- Escape double-quote characters in IMAP parameters. Per RFC 3501, literal strings use
{n}\r\nformat or quoted strings with\escaping:
def _escape_imap_string(s: str) -> str:
"""Escape a string for safe use in IMAP quoted strings."""
# Use IMAP literal syntax for…
- Record
GHSA-c969-5x3p-vq3v- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N - Weakness
- CWE-20, CWE-77
- Updated
- 2026-11-02
OSVPYSEC-2026-3532
8.1
PraisonAI: IMAP Command Injection via Unsanitized Email Search Parameters
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):
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:
search_emails(from_addr='[email protected]" LOGOUT')
This produces the IMAP command:
SEARCH FROM "[email protected]" 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:
search_emails(query='" SEARCH RETURN (MIN) ALL')
Produces: TEXT "" SEARCH RETURN (MIN) ALL" — injects a secondary SEARCH command.
Negative control — legitimate search:
search_emails(from_addr='[email protected]')
Produces: FROM "[email protected]" — 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
- Escape double-quote characters in IMAP parameters. Per RFC 3501, literal strings use
{n}\r\nformat or quoted strings with\escaping:
def _escape_imap_string(s: str) -> str:
"""Escape a string for safe use in IMAP quoted strings."""
# Use IMAP literal syntax for…
- Record
PYSEC-2026-3532- CVSS 3.1
- 8.1 High
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
praisonaiagentsPyPI |
through 1.6.48 | 1.6.59 |
praisonaiagentsPyPI |
before 1.6.59, plus listed versions 0.0.10.0.100.0.1000.0.1010.0.102 Show 45 moreShow less0.0.1030.0.1040.0.1050.0.1060.0.1070.0.1080.0.1090.0.110.0.1100.0.1110.0.1120.0.1130.0.1140.0.1150.0.1160.0.1170.0.1180.0.1190.0.120.0.1200.0.1210.0.1220.0.1230.0.1240.0.1250.0.1260.0.1270.0.1280.0.1290.0.130.0.1300.0.1310.0.1320.0.1330.0.1340.0.1350.0.1360.0.1370.0.1380.0.1390.0.140.0.1400.0.1410.0.1420.0.143 |
1.6.59 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-57130 is a high vulnerability (CVSS 8.1) in Mervinpraison Praisonaiagents, published June 18, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.46%, the 40th percentile. Fixed in praisonaiagents 1.6.59.
References
github.com/MervinPraison/PraisonAI/security/advisories/GHSA-c969-5x3p-vq3v
github.com/MervinPraison/PraisonAI/commit/b4270173d4123fb1ee8910588f0896668ee21b59
github.com/MervinPraison/PraisonAI/releases/tag/v4.6.59
github.com/advisories/GHSA-c969-5x3p-vq3v
github.com/CVEProject/cvelistV5/tree/main/cves/2026/57xxx/CVE-2026-57130.json
nvd.nist.gov/vuln/detail/CVE-2026-57130
github.com/MervinPraison/PraisonAI
pypi.org/project/praisonaiagents
Left out here: 536 versions and the rest of 3 source descriptions. The JSON record has them.