# GO-2026-5051: Out-of-bounds read and panic in ReadDir in github.com/cloudsoda/go-smb2 and github.com/hirochachacha/go-smb2

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **Published:** 2026-07-27T16:16:22.000Z
- **Modified:** 2026-07-27T17:00:19.805Z

## Who should check

- Projects that depend on Go package github.com/cloudsoda/go-smb2 (\< 0.0.0-20260609183447-7b96c35f5f4b)
- Projects that depend on Go package github.com/hirochachacha/go-smb2

## Description

ReadDir and ReadDirPlus parse the QUERY\_DIRECTORY SMB response by advancing through entries using the server-supplied NextEntryOffset field. The pre-fix code does not bound next against the remaining buffer before re-slicing, and the entry decoder IsInvalid check performs length arithmetic in int after narrowing from uint16.

A guest or anonymous directory listing against an attacker-controlled or man-in-the-middle SMB server crashes the Go client process with a runtime panic when the response contains an entry whose NextEntryOffset is larger than the remaining buffer, or whose declared FileNameLength produces a length that does not match the actual buffer size.

## Affected and fixed versions

- Go `github.com/cloudsoda/go-smb2`: affected \< 0.0.0-20260609183447-7b96c35f5f4b; fixed 0.0.0-20260609183447-7b96c35f5f4b (osv)
- Go `github.com/hirochachacha/go-smb2`: affected see advisory; fixed no fix listed yet (osv)

## Mitigation

- Upgrade github.com/cloudsoda/go-smb2 to 0.0.0-20260609183447-7b96c35f5f4b or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by GO-2026-5051. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/GO-2026-5051.md
Affected: github.com/cloudsoda/go-smb2 < 0.0.0-20260609183447-7b96c35f5f4b; github.com/hirochachacha/go-smb2
Fixed in: 0.0.0-20260609183447-7b96c35f5f4b

Steps:
1. Search this machine and project for github.com/cloudsoda/go-smb2 (Go), github.com/hirochachacha/go-smb2 (Go): dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is GO-2026-5051 being exploited?

There is no confirmed exploitation: GO-2026-5051 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known.

### How serious is GO-2026-5051?

It has no CVSS score yet. Unknown.

### Which versions are affected by GO-2026-5051?

github.com/cloudsoda/go-smb2 \< 0.0.0-20260609183447-7b96c35f5f4b; github.com/hirochachacha/go-smb2.

### Is there a fix for GO-2026-5051?

Yes. Fixed in 0.0.0-20260609183447-7b96c35f5f4b. Upgrade github.com/cloudsoda/go-smb2 to 0.0.0-20260609183447-7b96c35f5f4b or later.

### How do I check if I'm affected by GO-2026-5051?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://github.com/cloudsoda/go-smb2/commit/7b96c35f5f4babfc9d68a60baf5e85f2303d4a4b>
- other: <https://github.com/golang/vulndb/issues/5051>

## Attribution

- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GO-2026-5051> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/GO-2026-5051> · JSON: <https://flawdb.com/api/v1/entries/GO-2026-5051>
