CVE-2025-46726: Langroid Langroid Allows XXE Injection Vulnerability
HIGHCVE-2025-46726 is a HIGH langroid allows xxe injection vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting Langroid libraries in the PyPI ecosystem. The issue involves langroid allows xxe injection via xmltoolmessage. Remediation is available by upgrading affected packages to version 0.53.4.
CVE-2025-46726 at a Glance
How to Fix CVE-2025-46726
To remediate this vulnerability, upgrade all affected Langroid dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install langroid>=0.53.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show langroid
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-46726, inspect your installed packages using pip:
pip show langroid
Analyze the terminal output to locate any version of Langroid in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.53.4), your application is affected.
Note: The pip show langroid command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-611: Improper Restriction of XML External Entity Reference, where the product processes an xml document that can contain xml entities with uris that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. In Langroid, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-46726 Affected Langroid Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
langroid
|
PyPI |
< 0.53.4
|
0.53.4
|
References
Frequently Asked Questions
What is CVE-2025-46726?
Which Langroid versions are affected?
What version fixes CVE-2025-46726?
Is langroid affected?
What CWE is associated with CVE-2025-46726?
How can I check PyPI dependencies for CVE-2025-46726?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-pw95-88fg-3j6f",
"modified" : "2025-05-05T22:07:30Z",
"published" : "2025-05-05T20:40:44Z",
"aliases" : [ "CVE-2025-46726" ],
"summary" : "Langroid Allows XXE Injection via XMLToolMessage",
"details" : "### Summary\nA LLM application leveraging `XMLToolMessage` class may be exposed to untrusted XML input that could result in DoS and/or exposing local files with sensitive information.\n\n### Details\n`XMLToolMessage` uses `lxml` without safeguards:\nhttps://github.com/langroid/langroid/blob/df6227e6c079ec22bb2768498423148d6685acff/langroid/agent/xml_tool_message.py#L51-L52\n`lxml` is vulnerable to quadratic blowup attacks and processes external entity declarations for local files by default. \nCheck here: https://pypi.org/project/defusedxml/#python-xml-libraries\n\n### PoC\nA typical Quadratic blowup XML payload looks like this:\n```xml\n<!DOCTYPE bomb [\n<!ENTITY a \"aaaaaaaaaa\">\n<!ENTITY b \"&a;&a;&a;&a;&a;&a;&a;&a;&a;&a;\">\n<!ENTITY c \"&b;&b;&b;&b;&b;&b;&b;&b;&b;&b;\">\n]>\n<bomb>&c;</bomb>\n```\nHere, &a; expands to 10 characters, &b; expands to 100, and &c; expands to 1000, causing exponential memory usage and potentially crashing the application.\n \n### Fix\nLangroid 0.53.4 initializes `XMLParser` with flags to prevent XML External Entity (XXE), billion laughs, and external DTD attacks by disabling entity resolution, DTD loading, and network access.\nhttps://github.com/langroid/langroid/commit/36e7e7db4dd1636de225c2c66c84052b1e9ac3c3",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:H/SC:N/SI:N/SA:N/E:P"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "langroid"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.53.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/langroid/langroid/security/advisories/GHSA-pw95-88fg-3j6f"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-46726"
}, {
"type" : "WEB",
"url" : "https://github.com/langroid/langroid/commit/36e7e7db4dd1636de225c2c66c84052b1e9ac3c3"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/langroid/langroid"
}, {
"type" : "WEB",
"url" : "https://github.com/langroid/langroid/blob/df6227e6c079ec22bb2768498423148d6685acff/langroid/agent/xml_tool_message.py#L51-L52"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-611" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-05-05T20:40:44Z",
"nvd_published_at" : "2025-05-05T20:15:21Z"
}
}