ब्लॉग पर वापस जाएँतकनीकी

LangChain CVE-2025-68664: आपकी RAG Pipeline से PII कैसे Leak होती है

CVSS 9.3। LangChain के serialization functions environment variables और secrets को attacker-controlled LLMs को उजागर करते हैं। PII leaks detect और fix कैसे करें।

March 16, 20268 मिनट पढ़ें
LangChainRAG pipelineCVEPII leakagedeveloper securityAPI keysLLM security

LangChain CVE-2025-68664: आपकी RAG Pipeline से PII कैसे Leak होती है

2026 के लिए अपडेट किया गया।

LangChain में 2025 के अंत में एक critical flaw मिली। CVE है CVE-2025-68664। CVSS score है 9.3 (Critical)

यह LangChain के serialization code को target करती है।

CVE-2025-68664 क्या करती है

LangChain में दो serialization functions हैं: dumps() और dumpd()। ये Python objects को text में convert करते हैं।

Flaw closure handling में है।

जब LangChain एक callable को serialize करता है, तो यह closure context capture करता है।

एक attacker जो LLM response को नियंत्रित करता है, dumps() को trigger कर सकता है। Function तब Python process से environment variables पढ़ता है।

परिणाम data exposure है। API keys, database strings, JWT secrets, और AWS credentials model output में प्रकट हो सकते हैं।

जो attacker एक RAG source document में text inject करता है वह आपके production secrets पढ़ सकता है।

प्रभावित versions: LangChain 0.3.22 से नीचे (Python)। Version 0.3.22 में fix है।

PyPI data मार्च 2026 तक पुराने versions का व्यापक उपयोग दिखाता है।

RAG Pipelines में PII कैसे Leak होती है

CVE-2025-68664 dramatic है। लेकिन यह एक बड़ी समस्या का सिर्फ एक मामला है।

RAG pipelines से data routinely leak होता है। किसी attacker की जरूरत नहीं।

यहाँ एक standard enterprise RAG setup है।

पहला, ingestion। आप company documents को एक vector store में index करते हैं। Support tickets, customer emails, contracts, और HR records सोचें।

सामान्य vector stores हैं Pinecone, Weaviate, और pgvector।

अगला, retrieval। एक user सवाल पूछता है। System store से पाँच सबसे relevant chunks pull करता है।

फिर, generation। वे chunks एक LLM — GPT-4o, Claude, या Gemini — को context के रूप में जाते हैं।

दूसरा चरण समस्या है। Retrieved chunks में वही है जो source documents में था। इसमें शामिल हैं:

  • Customer names, email addresses, और phone numbers
  • Contract values, account numbers, और tax identifiers
  • Employee salary data और performance review notes
  • Clinical notes में patient names
  • Immigration files में National ID numbers

वह data LLM को as-is जाता है। यह model output में प्रकट हो सकता है।

LLM provider इसे log करता है। यह आपकी conversation history में बैठता है। यह आपके observability stack में flow होता है।

कोई attack नहीं चाहिए। RAG इसी तरह design द्वारा काम करता है। Design real privacy risk पैदा करता है।

Enterprise Document Stores में 68 Secret Patterns

Security tooling 68 ज्ञात secret patterns track करती है। ये उम्मीद से ज़्यादा बार appear होते हैं।

सबसे सामान्य:

  • AWS Access Key IDs (AKIA...)
  • OpenAI API keys (sk-...)
  • Anthropic API keys (sk-ant-...)
  • Database URIs (postgresql://user:password@host/db)
  • JWT tokens (base64-encoded headers)
  • GitHub Personal Access Tokens
  • Stripe secret keys (sk_live_...)
  • SendGrid API keys
  • Twilio account SIDs और auth tokens
  • Private key PEM blocks

एक support ticket में debug session से customer API key हो सकती है।

एक contract में technical handoff से database credentials हो सकती हैं।

गलती से index किया गया config file पूरा secrets store उजागर कर सकता है।

जब ये files sanitization के बिना vector store में जाती हैं, तो हर query secrets LLM को pass कर सकती है।

वे end user तक भी पहुँच सकते हैं।

Fix: Embedding से पहले Anonymize करें

सही approach documents को chunking और embedding से पहले anonymize करती है।

यह step customer data handle करने वाले किसी भी system के लिए अनिवार्य है।

यहाँ anonym.legal API का उपयोग करके एक Python example है:

import requests
import os

ANONYM_API_KEY = os.environ["ANONYM_API_KEY"]
ANONYM_BASE_URL = "https://anonym.legal/api"

def anonymize_before_embedding(text: str) -> tuple[str, dict]:
    """Embedding से पहले PII anonymize करें।"""
    response = requests.post(
        f"{ANONYM_BASE_URL}/presidio/anonymize",
        json={
            "text": text,
            "language": "en",
            "anonymizers": {
                "DEFAULT": {"type": "replace", "new_value": "[REDACTED]"},
                "PERSON": {"type": "mask", "masking_char": "*", "chars_to_mask": 4, "from_end": False},
                "EMAIL_ADDRESS": {"type": "replace", "new_value": "[EMAIL]"},
                "PHONE_NUMBER": {"type": "replace", "new_value": "[PHONE]"},
                "CRYPTO": {"type": "replace", "new_value": "[SECRET]"},
                "URL": {"type": "keep"},
            }
        },
        headers={"Authorization": f"Bearer {ANONYM_API_KEY}"}
    )
    result = response.json()
    return result["text"], result.get("items", [])


def build_rag_index(documents: list[str], vectorstore):
    """केवल clean documents के साथ RAG index बनाएँ।"""
    anonymized_docs = []
    for doc in documents:
        clean_text, entities = anonymize_before_embedding(doc)
        anonymized_docs.append(clean_text)
        print(f"Document से {len(entities)} PII entities हटाई गईं")
    vectorstore.add_texts(anonymized_docs)

anonym.legal API 285+ entity प्रकारों को cover करती है। नाम, emails, phone numbers, national IDs, API keys, और database URIs सभी पकड़े जाते हैं।

कोई भी sensitive चीज़ vector store तक नहीं पहुँचती। इसलिए कुछ भी sensitive users तक leak नहीं हो सकता।

LangChain और LlamaIndex setup patterns के लिए developer guide देखें।

अभी CVE-2025-68664 Fix करें

यदि आप LangChain 0.3.22 से नीचे चला रहे हैं, अभी update करें:

pip install "langchain>=0.3.22" "langchain-core>=0.3.22"

Patching के बाद, injection risk के लिए अपने chain configs जाँचें। तीन steps:

पहला, retrieved chunks validate करें। LLM तक पहुँचने से पहले।

Content को strip करें जो injection patterns से match करे जैसे ignore previous instructions, system:, या <INST>

दूसरा, embedding से पहले anonymize करें। यह attack surface को कम करता है।

यदि injection होती भी है, तो sensitive data वहाँ extract करने के लिए नहीं है।

तीसरा, chain permissions restrict करें। LangChain chains को जरूरत से ज़्यादा environment variables नहीं पढ़ने चाहिए।

Minimal scope वाले service account का उपयोग करें।

Math सरल है

CVSS score 9.3 है। Fix प्रति document एक API call है।

CVE-2025-68664 और general RAG data risk का combination एक real liability है।

समाधान स्पष्ट है: query time पर नहीं, ingestion पर anonymize करें।

Enterprise RAG requirements के लिए security and compliance overview देखें।

स्रोत

  • NVD CVE-2025-68664, CVSS 9.3, LangChain serialization vulnerability
  • LangChain security advisory, langchain-ai/langchain GitHub, 2025
  • OWASP LLM Top 10: LLM01 Prompt Injection, LLM06 Sensitive Information Disclosure
  • anonym.legal entity type documentation — 285+ supported entity types

क्या आप अपने डेटा की सुरक्षा के लिए तैयार हैं?

48 भाषाओं में 285+ संस्थाओं के प्रकारों के साथ PII अनामकरण शुरू करें।

About this page

We update this page when our platform or the law changes.

Read our founder note for how we work.

Each change shows up in the timestamp at the top.

Related reading

We follow these rules

  • GDPR (EU 2016/679).
  • ISO/IEC 27001:2022.
  • NIS2 (EU 2022/2555).
  • HIPAA safe harbor under 45 CFR § 164.514(b)(2).

Our promise

We do not sell your data.

We do not train models on your text.

We store your files in Germany.

You can delete your account at any time.

You own your work.

Where we run

Our servers live in Falkenstein, Germany.

We use Hetzner. They hold ISO 27001 certification.

All data stays in the EU.

Backups run every day.

Need help?

Email support@anonym.legal.

We reply within one business day.

How we test

We run a full check suite on every release.

Each surface gets its own sweep script and report.

Human reviewers spot-check the output each week.

We track recall and precision on a labelled set.

Bad runs block the deploy.

What we never do

  • We never sell your information to third parties.
  • We never train models on what you upload.
  • We never keep your work after you delete it.
  • We never share keys with any outside firm.
  • We never run ads inside the product.

Plans in plain words

We sell credits, not seats.

One credit covers one short job.

Long jobs use a few credits each.

You can top up at any time.

Unused credits roll over each month.

Read the plans page for current rates.

Who built this

A small team of engineers and lawyers built this.

We ship from Europe and work in the open.

Our founder note spells out why we started.

Where to start

How the parts fit

A browser add-on cleans text inside Chrome.

A Word plug-in handles drafts in Office.

A small desktop tool works on whole folders.

An agent protocol link feeds large models safely.

All four share one core engine and one rule set.

Words from our team

We started this work after a lunch about cookies.

One friend kept getting odd ads on her phone.

We asked why a court file leaked through a draft.

We sketched the first build on a napkin that week.

By month three we had a tiny demo for a friend.

She used it on her first case the next day.

Common questions we hear

Can the tool read scanned PDFs? Yes, with OCR.

Does it work on long files? Yes, in small chunks.

Can I roll my own rule set? Yes, save it as a preset.

Does it run offline? The desktop build runs offline.

Do you keep my files? No, the cloud build wipes after each run.

Will it learn from my work? No, we never train on inputs.

A short tour of the workflow

Upload a file or paste a snippet of prose.

Pick the entities you want gone from the draft.

Choose a method: replace, mask, hash, encrypt, or redact.

Press run and watch the side panel show each hit.

Skim the result and tweak any rule that misfired.

Save the cleaned file or send it to a teammate.