CVE-2026-40112 PraisonAI has Stored XSS via Unsanitized Agent Output in HTML Rendering (nh3 Not a Required Dependency)

Medium 5.4 Published Updated

Attackers can inject arbitrary JavaScript into PraisonAI agent outputs, leading to stored XSS in browsers viewing the API.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2026-40112?

CVE-2026-40112 is a medium-severity cross-site scripting vulnerability in MervinPraison PraisonAI, published on 9 Apr 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

PraisonAI is a multi-agent teams system. Prior to 4.5.128, the Flask API endpoint in src/praisonai/api.py renders agent output as HTML without effective sanitization. The _sanitize_html function relies on the nh3 library, which is not listed as a required or optional dependency in pyproject.toml. When nh3 is absent (the default installation), the sanitizer is a no-op that returns HTML unchanged. An attacker who can influence agent input (via RAG data poisoning, web scraping results, or prompt injection) can inject arbitrary JavaScript that executes in the browser of anyone viewing the API output. This vulnerability is fixed in 4.5.128.

Weakness: CWE-79

Which versions are affected by CVE-2026-40112?

3 open source packages ship an affected version, including praisonai and PraisonAI. It affects 1 product.

PackageAffectedFixed in
praisonai PyPIAll versions4.5.128
praisonai PyPIAll versions4.5.128
PraisonAI PyPIAll versions4.5.128

Products include Praison Praisonai.

How do I fix CVE-2026-40112?

Upgrade praisonai to 4.5.128 or later.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is CVE-2026-40112 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-40112 exists.

Sources

Also known as GHSA-cfg2-mxfj-j6pw, PYSEC-2026-2910.

Is CVE-2026-40112 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free