# CVE-2023-31135: Dgraph Audit Log Encryption nonce reuse

> Attackers with log access can brute-force decrypt Dgraph audit logs due to nonce reuse in encryption.

- **Severity:** Low 3.3 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 17 May 2023
- **Updated:** 22 Jan 2025
- **Also known as:** GHSA-92wq-q9pq-gw47

## What is CVE-2023-31135?

CVE-2023-31135 is a low-severity vulnerability in dgraph-io dgraph, published on 17 May 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

Dgraph is an open source distributed GraphQL database. Existing Dgraph audit logs are vulnerable to brute force attacks due to nonce collisions. The first 12 bytes come from a baseIv which is initialized when an audit log is created. The last 4 bytes come from the length of the log line being encrypted. This is problematic because two log lines will often have the same length, so due to these collisions we are reusing the same nonce many times. All audit logs generated by versions of Dgraph <v23.0.0 are affected. Attackers must have access to the system the logs are stored on. Dgraph users should upgrade to v23.0.0. Users unable to upgrade should store existing audit logs in a secure location and for extra security, encrypt using an external tool like `gpg`.

Weakness: CWE-326 (Inadequate Encryption Strength)

## Which versions are affected by CVE-2023-31135?

2 open source packages ship an affected version, including github.com/dgraph-io/dgraph. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/dgraph-io/dgraph` | Go | All versions | 23.0.0 |
| `github.com/dgraph-io/dgraph` | Go | All versions | 23.0.0 |

Products: Dgraph Dgraph.

## How do I fix CVE-2023-31135?

Upgrade github.com/dgraph-io/dgraph to 23.0.0 or later.

## Is CVE-2023-31135 being exploited?

There is no known exploitation of CVE-2023-31135 in the wild and no public exploit code.

## Other vulnerabilities in dgraph-io dgraph

- [CVE-2026-34976](https://insights.sbomify.com/CVE-2026-34976/): Dgraph Affected by Pre-Auth Database Overwrite + SSRF + File Read via restoreTenant Missing Authorization (critical 10.0)
- [CVE-2026-41492](https://insights.sbomify.com/CVE-2026-41492/): Unauthenticated Admin Token Disclosure Leading to Authentication Bypass via /debug/vars in Dgraph (critical 9.8)
- [CVE-2026-40173](https://insights.sbomify.com/CVE-2026-40173/): Dgraph: Unauthenticated pprof endpoint leaks admin auth token (critical 9.4)
- [CVE-2026-41327](https://insights.sbomify.com/CVE-2026-41327/): Dgraph: Pre-Auth Full Database Exfiltration via DQL Injection in Upsert Condition Field (critical 9.1)
- [CVE-2026-41328](https://insights.sbomify.com/CVE-2026-41328/): Dgraph: Pre-Auth Full Database Exfiltration via DQL Injection in NQuad Lang Field (critical 9.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-31135 and fix it if it is affected.

What it is: CVE-2023-31135 is a low-severity vulnerability in dgraph-io dgraph, published on 17 May 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-31135 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/dgraph-io/dgraph (Go): affected all versions; fixed in 23.0.0
- github.com/dgraph-io/dgraph (Go): affected all versions; fixed in 23.0.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/CVE-2023-31135/ (Markdown: https://insights.sbomify.com/CVE-2023-31135/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-31135
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-31135
- OSV: https://osv.dev/vulnerability/CVE-2023-31135

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-31135/
Summaries are generated and may contain mistakes; the official description above is the record.
