Intel

AIKIDO-2024-10231

nats-py is vulnerable to Memory Leak

Memory Leak Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published Aug 27, 2024

30

Low Risk

This Affects:

pythonnats-py
1.0.0 - 2.8.0
Fixed in 2.9.0
Are you affected? Scan for Free

TL;DR

Affected versions of the package are vulnerable to memory leaks. When creating a subscription in ObjectStore.get, two long-running tasks—_hbtask for idle heartbeat and _fctask for ordered consumers—are created. These tasks are not cancelled when sub.unsubscribe() is called, causing them to continue running and holding references to the subscription and other objects. This prevents garbage collection, leading to a growing number of active coroutines (up to 20K observed) and resulting in increased memory usage and potential performance degradation.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range.

Background info

nats-py is vulnerable to Memory Leak in versions 1.0.0 - 2.8.0.

How to fix this

Upgrade the nats-py library to the patch version.