CVE-2025-46059

9.8 CRITICAL

📋 TL;DR

LangChain v0.3.51 contains an indirect prompt injection vulnerability in the GmailToolkit component that allows attackers to execute arbitrary code via crafted email messages. This affects applications using LangChain's Gmail integration without proper input validation. The vendor disputes this as a vulnerability, attributing it to improper implementation by users.

💻 Affected Systems

Products:
  • langchain-ai
  • langchain-community
Versions: v0.3.51
Operating Systems: all
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects implementations using GmailToolkit without proper input validation. The vendor disputes this as a vulnerability in their code.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full remote code execution leading to complete system compromise, data exfiltration, and lateral movement within the network.

🟠

Likely Case

Limited code execution within the application context, potentially exposing sensitive data and allowing further exploitation.

🟢

If Mitigated

No impact if proper input validation and sandboxing are implemented per LangChain security guidelines.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending a crafted email to a vulnerable Gmail account integrated with the application.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: N/A

Vendor Advisory: https://python.langchain.com/docs/security/

Restart Required: No

Instructions:

No official patch available. Follow LangChain security practices for input validation and sandboxing.

🔧 Temporary Workarounds

Disable GmailToolkit

all

Remove or disable GmailToolkit integration if not essential

Remove GmailToolkit imports and usage from code

Implement Input Validation

all

Add strict input validation and sanitization for email content

Implement custom validation wrappers around GmailToolkit functions

🧯 If You Can't Patch

  • Implement network segmentation to isolate systems using GmailToolkit
  • Monitor email processing for unusual patterns and implement rate limiting

🔍 How to Verify

Check if Vulnerable:

Check if using langchain v0.3.51 with GmailToolkit without proper input validation

Check Version:

pip show langchain | grep Version

Verify Fix Applied:

Verify that input validation and sandboxing are properly implemented per LangChain security guidelines

📡 Detection & Monitoring

Log Indicators:

  • Unusual email processing patterns
  • Unexpected code execution in LangChain processes

Network Indicators:

  • Suspicious email attachments or content being processed
  • Outbound connections from LangChain to unexpected destinations

SIEM Query:

source="langchain" AND (event="code_execution" OR event="email_processing_error")

🔗 References

📤 Share & Export