Summary
A logical error in RansomLook's API filtering causes some entries marked as private to remain in API responses, unintentionally exposing non-public location data. When the list of locations is modified while being iterated, private records may not be correctly removed, enabling unauthorized disclosure of sensitive information via the API.
Affected context
This vulnerability appears in RansomLook's web API layer responsible for returning location
entries, implemented in website/web/api/genericapi.py. It affects deployments where the
API exposes location data that can be flagged as private, and where clients are able to
query endpoints that return collections of these locations. The issue manifests when the
server attempts to filter out private entries by mutating the list of entries while
iterating over it, which can cause some private items to slip through the filter and be
included in API responses.
Exploit preconditions
- Attack surface: HTTP(S) API endpoints returning location lists.
- Required access: Ability to call the affected API endpoints; typically the same
level of access needed to use the public-facing RansomLook API (no elevated privileges).
- Trigger point: Any request that retrieves collections of location entries where some
items are marked as private.
- Why exploitation is possible: The filtering logic removes items from the list while
iterating over it, leading to inconsistent traversal and leaving some entries marked
as private in the final result set that is serialized and returned to the client.
Why this happens
The root cause is a logic flaw in how the API filters out private location entries. The
implementation mutates the underlying list (e.g., deleting or popping elements) while it
is being iterated. This pattern can cause the iteration index and the list contents to
become misaligned, meaning some elements that should be removed are skipped entirely.
Conceptually, this maps to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, because data explicitly designated as non-public is still returned to clients.
The insecure pattern is attempting in-place modification of a collection during iteration
instead of constructing a new filtered list or using stable, non-mutating filtering
operations.
Potential impact
- Exposure of location entries that were intended to be private.
- Correlation of private locations with specific ransomware groups or markets that were
meant to be hidden.
- Leakage of sensitive operational intelligence or research sources.
- Potential privacy violations involving organizations or entities tracked by the tool.
- Increased risk of targeted attacks informed by non-public location details.
General mitigation guidance
Effective mitigation centers on correcting the filtering logic and tightening how sensitive
data is handled in server-side code:
- Replace in-place list mutation during iteration with non-mutating patterns such as
list comprehensions, generator expressions, or dedicated filter functions that create
a new collection containing only allowed entries.
- Centralize authorization and visibility checks so that any response serializer or
query helper consistently excludes private or sensitive records, regardless of the
endpoint.
- Treat "private" flags and similar confidentiality markers as hard authorization gates,
not just presentation preferences; ensure that these checks execute on the server
before serialization.
- Apply least-privilege principles to API responses by default, returning only the
minimal fields required, and avoid including extra sensitive attributes that are not
strictly needed.
- Consider adding an explicit, defensive layer that performs a final pass over response
data to verify that private entries are not present before sending them to clients.
How teams detect issues like this
Organizations can detect similar issues through a combination of code-level and
behavioral analysis:
- Static code review: Look for patterns where collections are modified (e.g.,
del,
pop, remove) inside loops that traverse those collections, especially when the
loop is used to filter out items based on access control or sensitivity flags.
- Static analysis rules: Configure linters or SAST tools to flag collection mutation
during iteration, particularly in request handlers, serializers, and authorization
layers.
- Unit and integration tests: Add tests that simulate mixed sets of public and
private entries and assert that private entries never appear in API responses, even
with edge cases (e.g., adjacent private records, boundary indices).
- Runtime monitoring: Introduce logging or sampling of API responses for internal
verification to ensure private-flagged entities are not returned to unauthorized
clients, while ensuring logs themselves don't become a secondary disclosure channel.

