GHSA-h45m-mgcp-q388: openssl-encrypt TOTP Rate Limiter Is In-memory Vulnerability

CRITICAL
CWE-770
Published
Advisory Summary

GHSA-h45m-mgcp-q388 is a CRITICAL totp rate limiter is in-memory vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting openssl-encrypt libraries in the PyPI ecosystem. The issue involves totp rate limiter is in-memory only — not shared across workers, lost on restart. Remediation is available by upgrading affected packages to version 1.4.0.

GHSA-h45m-mgcp-q388 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-h45m-mgcp-q388
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product openssl-encrypt
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix GHSA-h45m-mgcp-q388

To remediate this vulnerability, upgrade all affected openssl-encrypt dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

openssl-encrypt fixed: 1.4.0
pip install openssl-encrypt>=1.4.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show openssl-encrypt

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-h45m-mgcp-q388, inspect your installed packages using pip:

pip show openssl-encrypt

Analyze the terminal output to locate any version of openssl-encrypt in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.0), your application is affected.

Note: The pip show openssl-encrypt command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In openssl-encrypt, 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

## Severity: HIGH ### Summary The TOTP brute-force rate limiter in `openssl_encrypt_server/modules/pepper/totp.py` at **lines 47-98** uses an in-memory `defaultdict(list)` as a class variable. ### Affected Code ```python class TOTPRateLimiter: def __init__(self, ...): self.attempts: Dict[str, List[datetime]] = defaultdict(list) self.lockouts: Dict[str, datetime] = {} class TOTPService: _rate_limiter = TOTPRateLimiter() # Class variable, in-memory only ``` ### Impact 1. Rate limit state is **not shared** across multiple server instances/workers — an attacker can distribute attempts 2. All rate limit state is **lost on server restart** — allows immediate retry 3. In multi-worker deployments, each worker has independent rate limit state ### Recommended Fix - Use Redis or the database for rate limit state storage - Or use a shared-memory approach for multi-worker deployments - At minimum, persist lockout state to survive restarts ### Fix Fixed in commit `2749bc0` on branch `releases/1.4.x` — added abstract RateLimitBackend with InMemoryBackend and DatabaseBackend implementations; defaults to DatabaseBackend when DB available.

GHSA-h45m-mgcp-q388 Affected openssl-encrypt Versions

1 component(s)
Fixed Versions:
1.4.0
Product / Package Ecosystem Affected Versions Fixed Version
openssl-encrypt
PyPI
< 1.4.0
1.4.0

References

Frequently Asked Questions

What is GHSA-h45m-mgcp-q388?
GHSA-h45m-mgcp-q388 is a security vulnerability in openssl-encrypt involving TOTP rate limiter is in-memory only — not shared across workers, lost on restart under CWE-770: Allocation of Resources Without Limits or Throttling.
Which openssl-encrypt versions are affected?
Affected versions include releases prior to 1.4.0 across affected packages: openssl-encrypt.
What version fixes GHSA-h45m-mgcp-q388?
Upgrading to 1.4.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is openssl-encrypt affected?
Yes, openssl-encrypt is affected in releases prior to 1.4.0. Upgrade your dependency to 1.4.0 or later.
What CWE is associated with GHSA-h45m-mgcp-q388?
GHSA-h45m-mgcp-q388 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check PyPI dependencies for GHSA-h45m-mgcp-q388?
Run the dependency tree command: 'pip show openssl-encrypt'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-h45m-mgcp-q388",
  "modified" : "2026-03-31T23:41:26Z",
  "published" : "2026-03-31T23:41:26Z",
  "aliases" : [ ],
  "summary" : "openssl-encrypt: TOTP rate limiter is in-memory only — not shared across workers, lost on restart",
  "details" : "## Severity: HIGH\n\n### Summary\n\nThe TOTP brute-force rate limiter in `openssl_encrypt_server/modules/pepper/totp.py` at **lines 47-98** uses an in-memory `defaultdict(list)` as a class variable.\n\n### Affected Code\n\n```python\nclass TOTPRateLimiter:\n    def __init__(self, ...):\n        self.attempts: Dict[str, List[datetime]] = defaultdict(list)\n        self.lockouts: Dict[str, datetime] = {}\n\nclass TOTPService:\n    _rate_limiter = TOTPRateLimiter()  # Class variable, in-memory only\n```\n\n### Impact\n\n1. Rate limit state is **not shared** across multiple server instances/workers — an attacker can distribute attempts\n2. All rate limit state is **lost on server restart** — allows immediate retry\n3. In multi-worker deployments, each worker has independent rate limit state\n\n### Recommended Fix\n\n- Use Redis or the database for rate limit state storage\n- Or use a shared-memory approach for multi-worker deployments\n- At minimum, persist lockout state to survive restarts\n\n### Fix\n\nFixed in commit `2749bc0` on branch `releases/1.4.x` — added abstract RateLimitBackend with InMemoryBackend and DatabaseBackend implementations; defaults to DatabaseBackend when DB available.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "openssl-encrypt"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.4.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jahlives/openssl_encrypt/security/advisories/GHSA-h45m-mgcp-q388"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jahlives/openssl_encrypt/commit/2749bc0949b34a5921a35fb4a3f1856fc51916de"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jahlives/openssl_encrypt"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-31T23:41:26Z",
    "nvd_published_at" : null
  }
}