Improper Neutralization of Special Elements Used in a Template Engine Affecting nonebot2 package, versions [2.0.0a16,2.2.0)


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Not Defined
EPSS
0.09% (39th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-NONEBOT2-6242799
  • published12 Feb 2024
  • disclosed9 Feb 2024
  • creditJohnny Hsieh

Introduced: 9 Feb 2024

CVE-2024-21624  (opens in a new tab)
CWE-1336  (opens in a new tab)

How to fix?

Upgrade nonebot2 to version 2.2.0 or higher.

Overview

nonebot2 is an An asynchronous python bot framework.

Affected versions of this package are vulnerable to Improper Neutralization of Special Elements Used in a Template Engine due to the improper handling of user-provided data in MessageTemplate. An attacker can leak sensitive information, such as environment variables, by injecting malicious input into the message templates.

Note:

This is only exploitable if developers incorporate user-provided data into templates without proper sanitization.

Workaround

This vulnerability can be mitigated by filtering underscores before incorporating user input into the message template.

CVSS Scores

version 3.1