# HSEC-2025-0006: Private key leak via inherited file descriptor

> An attacker with local access to spawn child processes can read private keys due to missing close-on-exec flags in the X.509 key reading function.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Not stated
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 17 Nov 2025

## What is HSEC-2025-0006?

HSEC-2025-0006 is a vulnerability in crypton-x509-store, published on 17 Nov 2025. 

### Official description

# Private key leak via inherited file descriptor

The X.509 key reading function `readKeyFile` opened a file
descriptor to the private key without setting the *close-on-exec*
flag. If a child process is `exec`ed at the same time, it would
inherit that file descriptor and could read the private key
material.

Impact is limited to child processes that run untrusted code, but
that do not close inherited file descriptors. (For example, the
`su(1)` command.)

This leak was fixed by setting the *close-on-exec* flag on
unix-based systems.

## Which versions are affected by HSEC-2025-0006?

2 open source packages ship an affected version, including crypton-x509-store and x509-store.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `crypton-x509-store` | Hackage | From 1.6.9 | 1.6.12 |
| `x509-store` | Hackage | From 0.1 | None |

## How do I fix HSEC-2025-0006?

Upgrade crypton-x509-store to 1.6.12 or later.

## Is HSEC-2025-0006 being exploited?

There is no known exploitation of HSEC-2025-0006 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for HSEC-2025-0006 and fix it if it is affected.

What it is: HSEC-2025-0006 is a vulnerability in crypton-x509-store, published on 17 Nov 2025. 
Exploitation: There is no known exploitation of HSEC-2025-0006 in the wild and no public exploit code.

Affected packages and fixed versions:
- crypton-x509-store (Hackage): affected from 1.6.9; fixed in 1.6.12
- x509-store (Hackage): affected from 0.1; no fix listed

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/HSEC-2025-0006/ (Markdown: https://insights.sbomify.com/HSEC-2025-0006/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/HSEC-2025-0006

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