Atpakaļ uz BloguTehniskā

LangChain CVE-2025-68664: ka PII notec caur jusu RAG konveijeru

CVSS 9,3. LangChain serializacijas funkcijas paklauj vides mainigosanos un noslēpumus uzbruceja kontroletiem LLM. Ka detektēt un labot PII noteces.

March 16, 20268 min lasīšanai
LangChainRAG pipelineCVEPII leakagedeveloper securityAPI keysLLM security

LangChain CVE-2025-68664: kā PII notec caur jusu RAG konveijeru

Atjaunots 2026. gadam.

  1. gada beigas LangChain tika atklata kritiska klude. CVE ir CVE-2025-68664. CVSS vertejums ir 9,3 (Kritisks).

Tā vēršas pret LangChain serializacijas kodu.

Ko dara CVE-2025-68664

LangChain ir divas serializacijas funkcijas: dumps() un dumpd(). Tas konvertē Python objektus tekstā.

Klüda ir notures apstradē.

Kad LangChain serializē izsaucamo, tas notver notures kontekstu.

Uzbrucējs, kas kontrolē LLM atbildi, var izraisit dumps(). Funkcija tad nolasa vides mainigosanos no Python procesa.

Rezultāts ir datu atklasana. API atslēgas, datu bazu virknes, JWT noslēpumi un AWS akreditācijas dati var paraditais modeļa izvadē.

Uzbrucējs, kas injice tekstu RAG avota dokumenta, var izlasit jusu ražošanas noslēpumus.

Skartās versijas: LangChain zem 0.3.22 (Python). Versija 0.3.22 ir ar labojumu.

PyPI dati paradā plasu vecāku versiju izmantojumu lidzī 2026. gada martam.

Kā PII notec RAG konvejeros

CVE-2025-68664 ir dramatisks. Bet tas ir tikai viens gadijums no platasas problemas.

Dati notec caur RAG konvejeriem parasti. Nav nepieciesams uzbrucējs.

Lūk, standarta uznemumu RAG iestatijums.

Pirmkārt, uznemšana. Jūs indeksejiet uznemuma dokumentus vektoru krātuvē. Pienemiet atbalsta biļetes, klientu e-pastus, liigumus un HR ierakstus.

Parasti vektoru krätuves ir Pinecone, Weaviate un pgvector.

Talak, atgüšana. Lietotājs uzdod jautājumu. Sistema izvelk pieckus visatbilstosakas gabalinas no krätuves.

Tad, generešana. Šie gabali iet uz LLM - GPT-4o, Claude vai Gemini - ka konteksts.

Otrkārt, ir problēma. Izgüto gabali satur to, ko avota dokumenti satureja. Tas ietver:

  • Klientu vardus, e-pasta adreses un telefona numerus
  • Lguma vertibas, konta numerus un nodokļu identifikatorus
  • Darbinieku algu datus un darba izpildes vērtejumu piezīmes
  • Pacienu vardus klīniskajos piezīmes
  • Nacionalas ID numerus imigrācijas failos

Sie dati iet uz LLM ta, ka ir. Tie var paraditais modeļa izvadē.

Tie tiek reģistrēti ar LLM pakalpojumu sniedzeju. Tie atrodas jusu sarunas vesture. Tie plust jusu noverojamibas kaudze.

Nav vajadzīgs uzbrukums. Tā RAG darbojas pēc izveides. Izveide rada realu privatuma risku.

68 slepenie modeļi uznemumu dokumentu krätuves

Drošibas rieki seko 68 zinamus slēpeno modelu. Tie parādās biežāk, neka komandas gaida.

Lūk, visizplatitakie.

  • AWS piekļuves atslegu ID (AKIA...)
  • OpenAI API atslegas (sk-...)
  • Anthropic API atslegas (sk-ant-...)
  • Datu bazu URI (postgresql://lietotajs:parole@viesotajs/db)
  • JWT tokeni (base64 kodetiem galvenēm)
  • GitHub Personas piekluves tokeni
  • Stripe slepenas atslegas (sk_live_...)
  • SendGrid API atslegas
  • Twilio kontu SID un autentifikacijas tokeni
  • Privatas atslegas PEM bloki

Atbalsta bilete varetu saturet klienta API atsleegu no atklādīšanas sesijas.

Ligums varetu ieklaujt datu bāzu akreditacijas datus no tehniska nodoŝanas.

Konfigurācijas fails, kas klusas kluda indeksēts, var atklat veselu noslēpumu krätuvi.

Kad šie faili ienāk vektoru krātuvē bez sanitizacijas, katrs vaicajums var nosutit noslēpumus uz LLM.

Tie var sasniegt galīgo lietotaju arī.

Labot: anonimizēt pirms ievietošanas

Pareizā pieeja anonimizē dokumentus pirms sagriešanas un ievietošanas.

Šis solis ir obligats jebkurai sistēmai, kas apstrada klientu datus.

Lūk, Python piemers, izmantojot 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]:
    """Anonimizēt PII pirms ievietošanas."""
    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):
    """Izveidot RAG indeksu tikai ar tīriem dokumentiem."""
    anonymized_docs = []
    for doc in documents:
        clean_text, entities = anonymize_before_embedding(doc)
        anonymized_docs.append(clean_text)
        print(f"Nonemtas {len(entities)} PII entitijas no dokumenta")
    vectorstore.add_texts(anonymized_docs)

anonym.legal API aptver 285+ entitiju tipus. Vardi, e-pasta adreses, telefona numeri, nacionalas ID, API atslegas un datu bazu URI tiek visi uztverts.

Nekas jutigs nesasniedz vektoru krätuvi. Tātad nekas jutigs nevar noplust uz lietotajiem.

Skatiet izstradataju rokasgramatu LangChain un LlamaIndex iestatisanas modeļiem.

Labot CVE-2025-68664 tūlīt

Ja jus darbina LangChain zem 0.3.22, atjauniniet tagad:

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

Pec lāpišanas parbauidet jusu ķēdes konfigurācijas injekciju riskam. Lūk, tris soļi, kas javert.

Pirmkārt, validēt izgūtos gabalus. Dariet to pirms tie sasniedz LLM.

Atstrīpojiet saturu, kas atbilst injekciju modeļiem, piemēram, ignore previous instructions, system: vai <INST>.

Otrkārt, anonimizēt pirms ievietošanas. Tas mazina uzbrukuma virsmu.

Ja injekcija tomēr notiek, jutīgajiem datiem tur nav kur noplust.

Treshkārt, ierobezot ķēdes atlaūjas. LangChain ķēdēm nevajadzētu lasīt vides mainīgos arpos to vajadzibam.

Izmantojiet pakalpojuma kontu ar minimālu darbibas jomu.

Matemātika ir vienkārša

CVSS vertejums ir 9,3. Labojums ir viens API izsaukums uz dokumentu.

CVE-2025-68664 un visparejas RAG datu riska kombinacija ir reala atbildiba.

Risinajums ir skaidrs: anonimizejiet uznemšanas laika, nevis vaicajuma laika.

Parbauidet drosibas un atbilstibas parskatijumu uznemumu RAG prasibam.

Avoti

  • NVD CVE-2025-68664, CVSS 9,3, LangChain serializacijas ievainojamiba
  • LangChain drosibas pazinojums, langchain-ai/langchain GitHub, 2025
  • OWASP LLM Top 10: LLM01 Uzvednes injekcija, LLM06 Jutīgas informacijas atklasana
  • anonym.legal entitiju tipu dokumentacija - 285+ atbalstiti entitiju tipi

Vai esat gatavi aizsargāt savus datus?

Sāciet PII anonimizāciju ar 285+ entitāšu veidiem 48 valodās.

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.