# GHSA-4ph2-8337-hm62: Key Caching behavior in the DynamoDB Encryption Client.

> Attackers can bypass key permission revocations in the DynamoDB Encryption Client by exploiting cached key usage, allowing unauthorized data access.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 8 Feb 2021

## What is GHSA-4ph2-8337-hm62?

GHSA-4ph2-8337-hm62 is a vulnerability in dynamodb-encryption-sdk, published on 8 Feb 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact
This advisory concerns users of MostRecentProvider in the DynamoDB Encryption Client with a key provider like AWS Key Management Service that allows for permissions on keys to be modified.

When key usage permissions were changed at the key provider, time-based key reauthorization logic in MostRecentProvider did not reauthorize the use of the key. This created the potential for keys to be used in the DynamoDB Encryption Client after permissions to do so were revoked at the key provider.

### Patches
Fixed as of 1.3.0.  We recommend users to modify their code and adopt `CachingMostRecentProvider`.

### Workarounds
Users who cannot upgrade to use the `CachingMostRecentProvider` can call `clear()` on the cache to manually flush all of its contents. Next use of the key will force a re-validation to occur with the key provider.

## Which versions are affected by GHSA-4ph2-8337-hm62?

2 open source packages ship an affected version, including dynamodb-encryption-sdk.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `dynamodb-encryption-sdk` | PyPI | All versions | 1.3.0 |
| `dynamodb-encryption-sdk` | PyPI | All versions | 1.3.0 |

## How do I fix GHSA-4ph2-8337-hm62?

Upgrade dynamodb-encryption-sdk to 1.3.0 or later.

## Is GHSA-4ph2-8337-hm62 being exploited?

There is no known exploitation of GHSA-4ph2-8337-hm62 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-4ph2-8337-hm62 and fix it if it is affected.

What it is: GHSA-4ph2-8337-hm62 is a vulnerability in dynamodb-encryption-sdk, published on 8 Feb 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-4ph2-8337-hm62 in the wild and no public exploit code.

Affected packages and fixed versions:
- dynamodb-encryption-sdk (PyPI): affected all versions; fixed in 1.3.0
- dynamodb-encryption-sdk (PyPI): affected all versions; fixed in 1.3.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-4ph2-8337-hm62/ (Markdown: https://insights.sbomify.com/GHSA-4ph2-8337-hm62/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-4ph2-8337-hm62

---
From sbomify Insights: https://insights.sbomify.com/GHSA-4ph2-8337-hm62/
Summaries are generated and may contain mistakes; the official description above is the record.
