# GHSA-655h-hg88-5qmf: `xcb::Connection::connect_to_fd*` functions violate I/O safety

> The Rust XCB library violates I/O safety by closing file descriptors it does not own, potentially causing use-after-close errors in applications.

- **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:** 5 Aug 2025
- **Also known as:** RUSTSEC-2025-0051

## What is GHSA-655h-hg88-5qmf?

GHSA-655h-hg88-5qmf is a vulnerability in xcb, published on 5 Aug 2025. 

### Official description

The API of `xcb::Connection` has constructors which allow an arbitrary `RawFd`
to be used as a socket connection. On either failure of these constructors or
on the drop of `Connection`, it closes the associated file descriptor. Thus, a
program which uses an `OwnedFd` (such as a `UnixStream`) as the file descriptor
can close the file descriptor and continue to attempt using it or close an
already-closed file descriptor, violating I/O safety.

Starting in version 1.6.0, `xcb` provides `Connection::connect_with_fd` and
`Connection::connect_with_fd_and_extensions` as safe alternatives and
deprecates the problematic functions.

## Which versions are affected by GHSA-655h-hg88-5qmf?

3 open source packages ship an affected version, including xcb.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `xcb` | crates.io | All versions | 1.6.0 |
| `xcb` | crates.io | All versions | 1.6.0 |
| `xcb` | crates.io | From 0.0.0-0 | 1.6.0 |

## How do I fix GHSA-655h-hg88-5qmf?

Upgrade xcb to 1.6.0 or later.

## Is GHSA-655h-hg88-5qmf being exploited?

There is no known exploitation of GHSA-655h-hg88-5qmf in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-655h-hg88-5qmf and fix it if it is affected.

What it is: GHSA-655h-hg88-5qmf is a vulnerability in xcb, published on 5 Aug 2025. 
Exploitation: There is no known exploitation of GHSA-655h-hg88-5qmf in the wild and no public exploit code.

Affected packages and fixed versions:
- xcb (crates.io): affected all versions; fixed in 1.6.0
- xcb (crates.io): affected all versions; fixed in 1.6.0
- xcb (crates.io): affected from 0.0.0-0; fixed in 1.6.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-655h-hg88-5qmf/ (Markdown: https://insights.sbomify.com/GHSA-655h-hg88-5qmf/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-655h-hg88-5qmf

---
From sbomify Insights: https://insights.sbomify.com/GHSA-655h-hg88-5qmf/
Summaries are generated and may contain mistakes; the official description above is the record.
