anonym.legal
กลับไปที่บล็อกเทคนิค

LangChain CVE-2025-68664: PII รั่วไหลผ่าน RAG Pipeline ของคุณอย่างไร

CVSS 9.3 ฟังก์ชัน serialization ของ LangChain เปิดเผยตัวแปรสภาพแวดล้อมและความลับให้กับ LLM ที่ถูกควบคุมโดยผู้โจมตี วิธีตรวจจับและแก้ไขการรั่วไหลของ PII

March 16, 20268 อ่านประมาณ
LangChainRAG pipelineCVEPII leakagedeveloper securityAPI keysLLM security

LangChain CVE-2025-68664: PII รั่วไหลผ่าน RAG Pipeline ของคุณอย่างไร

อัปเดตสำหรับปี 2026

พบช่องโหว่ร้ายแรงใน LangChain ในช่วงปลายปี 2025 CVE คือ CVE-2025-68664 คะแนน CVSS คือ 9.3 (Critical)

มันมุ่งเป้าไปที่โค้ด serialization ของ LangChain

CVE-2025-68664 ทำอะไร

LangChain มีสองฟังก์ชัน serialization: dumps() และ dumpd() พวกมันแปลง Python object เป็นข้อความ

ช่องโหว่อยู่ในการจัดการ closure

เมื่อ LangChain ทำ serialize callable มันจะจับบริบท closure

ผู้โจมตีที่ควบคุม LLM response สามารถ trigger dumps() ได้ ฟังก์ชันจะอ่านตัวแปรสภาพแวดล้อมจากกระบวนการ Python

ผลลัพธ์คือการเปิดเผยข้อมูล API keys, database strings, JWT secrets และ AWS credentials อาจปรากฏใน model output

ผู้โจมตีที่ inject ข้อความเข้าไปในเอกสารแหล่ง RAG สามารถอ่านความลับ production ของคุณได้

เวอร์ชันที่ได้รับผลกระทบ: LangChain ต่ำกว่า 0.3.22 (Python) เวอร์ชัน 0.3.22 มีการแก้ไข

ข้อมูล PyPI แสดงให้เห็นว่ายังคงใช้เวอร์ชันเก่าอย่างแพร่หลายจนถึงเดือนมีนาคม 2026

PII รั่วไหลใน RAG Pipeline อย่างไร

CVE-2025-68664 เป็นเรื่องที่น่าตื่นเต้น แต่มันเป็นเพียงกรณีหนึ่งของปัญหาที่กว้างกว่านั้น

ข้อมูลรั่วไหลผ่าน RAG pipeline เป็นประจำ ไม่ต้องการผู้โจมตี

นี่คือการตั้งค่า RAG ขององค์กรมาตรฐาน

ขั้นแรก การ ingest คุณ index เอกสารของบริษัทเข้าไปใน vector store คิดถึง support ticket อีเมลลูกค้า สัญญา และ HR records

Vector store ที่พบบ่อย ได้แก่ Pinecone, Weaviate และ pgvector

ต่อมา การดึงข้อมูล ผู้ใช้ถามคำถาม ระบบดึง chunk ที่เกี่ยวข้องที่สุด 5 อันจาก store

จากนั้น การสร้าง chunk เหล่านั้นไปยัง LLM — GPT-4o, Claude หรือ Gemini — เป็น context

ขั้นตอนที่สองคือปัญหา chunk ที่ดึงมาเก็บสิ่งที่เอกสารแหล่งที่มาเก็บ ซึ่งรวมถึง:

  • ชื่อลูกค้า ที่อยู่อีเมล และหมายเลขโทรศัพท์
  • มูลค่าสัญญา หมายเลขบัญชี และตัวบ่งชี้ทางภาษี
  • ข้อมูลเงินเดือนพนักงานและหมายเหตุการตรวจสอบประสิทธิภาพ
  • ชื่อผู้ป่วยในบันทึกทางคลินิก
  • หมายเลข national ID ในไฟล์อพยพ

ข้อมูลนั้นไปยัง LLM ตามที่เป็น มันอาจปรากฏใน model output

มันถูกบันทึกโดยผู้ให้บริการ LLM มันอยู่ในประวัติการสนทนาของคุณ มันไหลเข้าสู่ observability stack ของคุณ

ไม่ต้องการการโจมตี นี่คือวิธีที่ RAG ทำงานตามการออกแบบ การออกแบบสร้างความเสี่ยงด้านความเป็นส่วนตัวที่แท้จริง

68 รูปแบบความลับใน Enterprise Document Store

เครื่องมือรักษาความปลอดภัยติดตาม 68 รูปแบบความลับที่รู้จัก พวกมันปรากฏบ่อยกว่าที่ทีมคาดหวัง

นี่คือรูปแบบที่พบบ่อยที่สุด

  • AWS Access Key ID (AKIA...)
  • OpenAI API keys (sk-...)
  • Anthropic API keys (sk-ant-...)
  • Database URI (postgresql://user:password@host/db)
  • JWT token (headers ที่เข้ารหัส base64)
  • GitHub Personal Access Token
  • Stripe secret key (sk_live_...)
  • SendGrid API key
  • Twilio account SID และ auth token
  • Private key PEM blocks

ตั๋ว support อาจเก็บ customer API key จาก debug session

สัญญาอาจมี database credentials จากการส่งมอบทางเทคนิค

ไฟล์ config ที่ index โดยไม่ตั้งใจสามารถเปิดเผย secrets store ทั้งหมด

เมื่อไฟล์เหล่านี้เข้าสู่ vector store โดยไม่มีการทำความสะอาด ทุก query สามารถส่งความลับไปยัง LLM

พวกมันอาจถึงผู้ใช้ปลายทางด้วย

แก้ไข: Anonymize ก่อน Embedding

แนวทางที่ถูกต้องคือ anonymize เอกสาร ก่อน การแบ่ง chunk และ embedding

ขั้นตอนนี้จำเป็นสำหรับระบบใดๆ ที่จัดการข้อมูลลูกค้า

นี่คือตัวอย่าง Python โดยใช้ anonym.legal API:

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]:
    """Anonymize PII before embedding."""
    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):
    """Build a RAG index with clean documents only."""
    anonymized_docs = []
    for doc in documents:
        clean_text, entities = anonymize_before_embedding(doc)
        anonymized_docs.append(clean_text)
        print(f"Removed {len(entities)} PII entities from document")
    vectorstore.add_texts(anonymized_docs)

anonym.legal API ครอบคลุม 285+ ประเภทข้อมูล ชื่อ อีเมล หมายเลขโทรศัพท์ national ID, API key และ database URI ทั้งหมดถูกตรวจจับ

ไม่มีอะไรที่สำคัญถึง vector store ดังนั้นจึงไม่มีอะไรที่สำคัญรั่วไหลไปยังผู้ใช้

ดู คู่มือนักพัฒนา สำหรับรูปแบบการตั้งค่า LangChain และ LlamaIndex

แก้ไข CVE-2025-68664 ทันที

หากคุณรัน LangChain ต่ำกว่า 0.3.22 อัปเดตทันที:

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

หลังจาก patch แล้ว ตรวจสอบ chain config ของคุณสำหรับความเสี่ยง injection นี่คือสามขั้นตอนที่ต้องทำ

ขั้นแรก ตรวจสอบ chunk ที่ดึงมา ทำสิ่งนี้ก่อนที่จะถึง LLM

ลบเนื้อหาที่ตรงกับรูปแบบ injection เช่น ignore previous instructions, system: หรือ <INST>

ขั้นที่สอง anonymize ก่อน embedding สิ่งนี้ลด attack surface

หาก injection เกิดขึ้น ข้อมูลสำคัญไม่อยู่ที่นั่นให้ดึงออกมา

ขั้นที่สาม จำกัดสิทธิ์ chain LangChain chain ไม่ควรอ่านตัวแปรสภาพแวดล้อมนอกเหนือจากที่ต้องการ

ใช้ service account ที่มี scope น้อยที่สุด

คณิตศาสตร์นั้นง่าย

คะแนน CVSS คือ 9.3 การแก้ไขคือการเรียก API หนึ่งครั้งต่อเอกสาร

การรวมกันของ CVE-2025-68664 และความเสี่ยงข้อมูล RAG ทั่วไปเป็นความรับผิดชอบที่แท้จริง

โซลูชันชัดเจน: anonymize ที่การ ingest ไม่ใช่ที่เวลา query

ตรวจสอบ ภาพรวมความปลอดภัยและการปฏิบัติตามกฎหมาย สำหรับข้อกำหนด RAG ขององค์กร

แหล่งอ้างอิง

  • NVD CVE-2025-68664, CVSS 9.3, ช่องโหว่ LangChain serialization
  • LangChain security advisory, langchain-ai/langchain GitHub, 2025
  • OWASP LLM Top 10: LLM01 Prompt Injection, LLM06 Sensitive Information Disclosure
  • เอกสารประเภท entity ของ anonym.legal — 285+ ประเภทที่รองรับ

พร้อมที่จะปกป้องข้อมูลของคุณหรือยัง?

เริ่มทำให้ PII เป็นนิรนามด้วยประเภทเอนทิตีมากกว่า 285 ประเภทใน 48 ภาษา.

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.