بلاگ پر واپس جائیںتکنیکی

LangChain CVE-2025-68664: PII آپ کے RAG پائپ لائن سے کیسے لیک ہوتی ہے

CVSS 9.3۔ LangChain کے serialization فنکشن ماحول کے متغیرات اور رازوں کو حملہ آور کے کنٹرول والے LLMs کے سامنے ظاہر کرتے ہیں۔ PII لیکس کو کیسے پکڑیں اور ٹھیک کریں۔

March 16, 20268 منٹ پڑھیں
LangChainRAG pipelineCVEPII leakagedeveloper securityAPI keysLLM security

LangChain CVE-2025-68664: PII آپ کے RAG پائپ لائن سے کیسے لیک ہوتی ہے

2026 کے لیے اپ ڈیٹ۔

2025 کے اواخر میں LangChain میں ایک اہم خرابی ملی۔ CVE ہے CVE-2025-68664۔ CVSS اسکور ہے 9.3 (تنقیدی)۔

یہ LangChain کے serialization کوڈ کو نشانہ بناتا ہے۔

CVE-2025-68664 کیا کرتا ہے

LangChain کے دو serialization فنکشن ہیں: dumps() اور dumpd()۔ یہ Python آبجیکٹس کو متن میں تبدیل کرتے ہیں۔

خرابی closure ہینڈلنگ میں ہے۔

جب LangChain ایک callable کو serialize کرتا ہے، تو یہ closure سیاق و سباق کو پکڑتا ہے۔

ایک حملہ آور جو LLM جواب کو کنٹرول کرتا ہے dumps() کو متحرک کر سکتا ہے۔ فنکشن پھر Python عمل سے ماحول کے متغیرات پڑھتا ہے۔

nتیجہ ڈیٹا ظاہر ہونا ہے۔ API کلیدیں، ڈیٹا بیس strings، JWT راز، اور AWS اعتبارنامے ماڈل آؤٹ پٹ میں ظاہر ہو سکتے ہیں۔

ایک حملہ آور جو RAG سورس دستاویز میں متن انجیکٹ کرتا ہے آپ کے پروڈکشن راز پڑھ سکتا ہے۔

متاثرہ ورژن: LangChain 0.3.22 سے نیچے (Python)۔ ورژن 0.3.22 میں ٹھیک ہے۔

PyPI ڈیٹا مارچ 2026 تک پرانے ورژنز کے وسیع استعمال کو ظاہر کرتا ہے۔

RAG پائپ لائنوں میں PII کیسے لیک ہوتی ہے

CVE-2025-68664 ڈرامائی ہے۔ لیکن یہ ایک وسیع تر مسئلے کا صرف ایک معاملہ ہے۔

ڈیٹا معمول کے مطابق RAG پائپ لائنوں سے لیک ہوتا ہے۔ کسی حملہ آور کی ضرورت نہیں۔

یہاں ایک معیاری انٹرپرائز RAG سیٹ اپ ہے۔

پہلے، انگسشن۔ آپ کمپنی کی دستاویزات کو ایک vector store میں انڈیکس کرتے ہیں۔ سپورٹ ٹکٹ، کسٹمر ای میل، معاہدے، اور HR ریکارڈ سوچیں۔

عام vector stores Pinecone، Weaviate، اور pgvector ہیں۔

پھر، بازیافت۔ ایک صارف سوال پوچھتا ہے۔ نظام اسٹور سے پانچ سب سے زیادہ متعلقہ ٹکڑے نکالتا ہے۔

پھر، تخلیق۔ وہ ٹکڑے ایک LLM — GPT-4o، Claude، یا Gemini — کو سیاق و سباق کے طور پر جاتے ہیں۔

مرحلہ دو مسئلہ ہے۔ بازیافت کردہ ٹکڑوں میں وہی موجود ہے جو سورس دستاویزات میں تھا۔ اس میں شامل ہیں:

  • کسٹمر نام، ای میل پتے، اور فون نمبر
  • معاہدے کی قدریں، اکاؤنٹ نمبر، اور ٹیکس شناخت کنندگان
  • ملازم تنخواہ کا ڈیٹا اور کارکردگی کے جائزے
  • طبی نوٹ میں مریض کے نام
  • امیگریشن فائلوں میں قومی ID نمبر

وہ ڈیٹا جوں کا توں LLM کو جاتا ہے۔ یہ ماڈل آؤٹ پٹ میں ظاہر ہو سکتا ہے۔

یہ LLM فراہم کنندہ کے ذریعے لاگ ہو جاتا ہے۔ یہ آپ کی گفتگو کی تاریخ میں بیٹھتا ہے۔ یہ آپ کے observability اسٹیک میں بہتا ہے۔

کسی حملے کی ضرورت نہیں۔ RAG اسی طرح ڈیزائن کے ذریعے کام کرتا ہے۔ ڈیزائن حقیقی پرائیویسی خطرہ پیدا کرتا ہے۔

انٹرپرائز دستاویز اسٹورز میں 68 سیکرٹ پیٹرن

سیکیورٹی ٹولنگ 68 معروف سیکرٹ پیٹرن ٹریک کرتی ہے۔ یہ ٹیموں کی توقع سے زیادہ کثرت سے ظاہر ہوتے ہیں۔

یہاں سب سے عام ہیں۔

  • AWS Access Key IDs (AKIA...)
  • OpenAI API کلیدیں (sk-...)
  • Anthropic API کلیدیں (sk-ant-...)
  • ڈیٹا بیس URIs (postgresql://user:password@host/db)
  • JWT ٹوکن (base64-انکوڈڈ ہیڈر)
  • GitHub Personal Access Tokens
  • Stripe سیکرٹ کلیدیں (sk_live_...)
  • SendGrid API کلیدیں
  • Twilio اکاؤنٹ SIDs اور auth ٹوکن
  • Private key PEM بلاکس

ایک سپورٹ ٹکٹ میں ڈیبگ سیشن سے کسٹمر API کلید ہو سکتی ہے۔

ایک معاہدے میں تکنیکی ہینڈ آف سے ڈیٹا بیس اعتبارنامے شامل ہو سکتے ہیں۔

غلطی سے انڈیکس کی گئی config فائل پوری secrets store ظاہر کر سکتی ہے۔

جب یہ فائلیں صفائی کے بغیر vector store میں داخل ہوتی ہیں، ہر query رازوں کو LLM کو پاس کر سکتی ہے۔

وہ آخری صارف تک بھی پہنچ سکتے ہیں۔

اسے ٹھیک کریں: embedding سے پہلے گمنام کریں

صحیح طریقہ دستاویزات کو chunking اور embedding سے پہلے گمنام کرتا ہے۔

یہ مرحلہ کسی بھی نظام کے لیے ضروری ہے جو کسٹمر ڈیٹا سنبھالتا ہے۔

یہاں anonym.legal API استعمال کرتے ہوئے Python مثال ہے:

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 گمنام کریں۔"""
    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):
    """صرف صاف دستاویزات کے ساتھ RAG انڈیکس بنائیں۔"""
    anonymized_docs = []
    for doc in documents:
        clean_text, entities = anonymize_before_embedding(doc)
        anonymized_docs.append(clean_text)
        print(f"دستاویز سے {len(entities)} PII ہستیاں ہٹائی گئیں")
    vectorstore.add_texts(anonymized_docs)

anonym.legal API 285+ ہستی کی اقسام کا احاطہ کرتا ہے۔ نام، ای میل، فون نمبر، قومی IDs، API کلیدیں، اور ڈیٹا بیس URIs سب پکڑے جاتے ہیں۔

کوئی حساس چیز vector store تک نہیں پہنچتی۔ اس لیے کوئی حساس چیز صارفین تک لیک نہیں ہو سکتی۔

LangChain اور LlamaIndex سیٹ اپ پیٹرن کے لیے ڈویلپر گائیڈ دیکھیں۔

CVE-2025-68664 ابھی ٹھیک کریں

اگر آپ 0.3.22 سے نیچے LangChain چلا رہے ہیں، ابھی اپ ڈیٹ کریں:

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

پیچ کرنے کے بعد، انجیکشن خطرے کے لیے اپنی chain configs چیک کریں۔ یہاں تین اقدامات ہیں۔

پہلے، بازیافت کردہ ٹکڑوں کی تصدیق کریں۔ یہ LLM تک پہنچنے سے پہلے کریں۔

وہ مواد ہٹائیں جو انجیکشن پیٹرن سے ملتا ہے جیسے ignore previous instructions، system:، یا <INST>۔

دوسرے، embedding سے پہلے گمنام کریں۔ یہ حملے کی سطح کو کم کرتا ہے۔

اگر انجیکشن ہو بھی جائے، حساس ڈیٹا وہاں نہیں ہے نکالنے کے لیے۔

تیسرے، chain اجازتوں کو محدود کریں۔ LangChain chains کو اپنی ضرورت سے آگے ماحول کے متغیرات نہیں پڑھنے چاہیے۔

کم سے کم دائرہ کار کے ساتھ سروس اکاؤنٹ استعمال کریں۔

ریاضی سادہ ہے

CVSS اسکور 9.3 ہے۔ ٹھیک کرنا فی دستاویز ایک API کال ہے۔

CVE-2025-68664 اور عمومی RAG ڈیٹا خطرے کا مجموعہ ایک حقیقی ذمہ داری ہے۔

حل واضح ہے: query کے وقت نہیں، ingestion پر گمنام کریں۔

انٹرپرائز RAG تقاضوں کے لیے سیکیورٹی اور تعمیل جائزہ چیک کریں۔

ذرائع

  • NVD CVE-2025-68664، CVSS 9.3، LangChain serialization vulnerability
  • LangChain سیکیورٹی advisory، langchain-ai/langchain GitHub، 2025
  • OWASP LLM Top 10: LLM01 Prompt Injection، LLM06 Sensitive Information Disclosure
  • anonym.legal ہستی کی قسم دستاویزات — 285+ سپورٹڈ ہستی کی اقسام

کیا آپ اپنے ڈیٹا کی حفاظت کے لیے تیار ہیں؟

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.