# GHSA-H6F6-3QFX-P42H: OpenList search API authorization bypass discloses read-restricted directories

- Database: GitHub
- Severity: CVSS 4.3 (Medium)
- Published: 2026-11-21
- Modified: 2026-11-21

## Affected versions

- github.com/OpenListTeam/OpenList/v4 (Go): through 4.2.6

## Description

## Summary

An authenticated OpenList user can enumerate directories that they are explicitly denied read access to by using the file search API (`/api/fs/search`). The search authorization filter resolves each result node's access-control metadata at the wrong scope (the node's parent path rather than the node's own path), so a directory protected by a `ReadUsers` restriction defined at that directory's own path is correctly hidden by the directory listing API but is disclosed by the search API. The attacker only needs a normal (non-privileged) account on an instance where an administrator has enabled and built a search index.

## Root Cause

OpenList enforces per-directory read restrictions through `Meta` records carrying a `ReadUsers` allowlist. The directory listing path (`internal/fs/list.go`, function `filterReadableObjs`) resolves the governing metadata for a directory object using the directory's own path: it computes `objPath = path.Join(reqPath, obj.GetName())` and calls `op.GetNearestMeta(objPath)`, then denies via `common.CanRead`. The search authorization closure instead resolves metadata using the node's parent path. Because `op.GetNearestMeta` (in `internal/op/meta.go`, function `getNearestMeta`) walks strictly upward from the supplied path, starting the walk at the node's parent never inspects a restriction defined at the directory's own path. The result is a scope mismatch: the same directory is governed by its restricting metadata in one code path and by no metadata in the other.

```text
Vulnerable filter closure: server/handles/search.go, function Search
  server/handles/search.go:50  meta, err := op.GetNearestMeta(node.Parent)   // wrong scope (parent)
  server/handles/search.go:54  return common.CanAccess(user, meta, path.Join(node.Parent, node.Name), req.Password)

Correct reference behavior: internal/fs/list.go, function filterReadableObjs
  internal/fs/list.go:55       objPath := path.Join(reqPath, obj.GetName())
  internal/fs/list.go:58       meta, err = op.GetNearestMeta(objPath)         // correct scope (node's own path)

Upward-only lookup: internal/op/meta.go, function getNearestMeta
  internal/op/meta.go:64       path = stdpath.Dir(path)                       // walks upward only
```

For a restricted directory `/private` with a `ReadUsers` meta defined at `/private`, the indexed node has `Parent = "/"`. Search calls `op.GetNearestMeta("/")`, which returns no metadata, so `common.CanAccess` receives a nil meta, short-circuits its read check, and returns `true`, disclosing the node.

## Impact

An authenticated user who is not on a directory's `ReadUsers` allowlist can confirm the existence of that directory and read its name, size, and `is_dir` flag through the search API, even though the directory listing API hides it and a direct listing or access of that directory returns 403. Combined with `scope=1` (directory-only results) and keyword iteration, this becomes a directory name and existence enumeration oracle across the user's base path. The disclosure is limited to directory node metadata (name, size, existence). Directory contents and the files inside a restricted directory remain protected, because a child node's parent path does resolve the restricting metadata. There is no integrity or availability impact. Preconditions: the administrator must have enabled a search index (the `search_index` setting is not `none`) and built it, and the restricted directory's node must be present in the index (for example the restriction meta was created after the index was built, or incremental index updates are enabled, or the administrator is included in the directory's `ReadUsers`).

## Proof of Concept

```text
Setup:
1. Deploy OpenList v4.2.6 with a search index enabled and built
   (set search_index to database, database_non_full_text, bleve, or meilisearch).
2. As admin, create a directory /private and attach a Meta at path /private
   with ReadUsers containing only some other user (not the victim's id).
3. Ensure /private is present in the search index (create the meta after the
   initial build, or enable auto_update_index, or include admin in ReadUsers).
```

```text
As the victim account (authenticated, id not in ReadUsers, base path "/"):

# Directory listing correctly hides /private:
POST /api/fs/list        {"path": "/", "password": ""}
  -> response does not include "private"

# Direct listing of the restricted directory is denied:
POST /api/fs/list        {"path": "/private", "password": ""}
  -> 403 / permission denied

# Search discloses the restricted directory node:
POST /api/fs/search      {"parent": "/", "keyword": "private", "scope": 1}
  -> results include {"parent": "/", "name": "private", "is_dir": true, "size": ...}
```

```text
Observed hand-trace of production authorization functions (Go toolchain unavailable
for live execution; both paths read directly from the pinned v4.2.6 source):

  CanRead(victim, metaAtDir,  "/private")  -> false   (listing hides it)
  CanAccess(victim, nil,      "/private")  -> true    (search discloses it)
  CanAccess(victim, metaAtDir,"/private")  -> false   (control: correct meta denies)
```

## Attack Chain

1. **Exposure:** The route `/api/fs/search` is registered under the authenticated file-system group with `middlewares.Auth(false)`, so any token-bearing user (and, when guest login is enabled, the guest user) can reach it. It is additionally gated by the search-index middleware, which requires that an index has been enabled.
2. **Control:** The attacker controls the `parent`, `keyword`, and `scope` request parameters. `parent` is clamped to the user's base path, which does not help the defense because the target directory lies inside that base path.
3. **Path:** Matching nodes from the configured search backend are passed to the authorization filter closure in `server/handles/search.go`. For a directory node, `node.Parent` is the parent directory path, not the node's own path.
4. **Guard:** The closure calls `op.GetNearestMeta(node.Parent)`. Because the metadata lookup walks upward only, a `ReadUsers` restriction defined at the directory's own path is never consulted, so the closure receives no metadata and `common.CanAccess` returns true. The separator-aware `utils.IsSubPath` check in the same closure passes, because the directory genuinely lies within the user's base path, so it does not block the vector.
5. **Primitive:** The read-authorization decision for the restricted directory node is made against the wrong (empty) metadata scope, granting a disclosure that the listing path denies.
6. **Result:** The restricted directory node (name, size, existence) is returned to a user explicitly denied read access, providing a metadata and existence enumeration oracle bounded to directory nodes.

## Bypass Evidence

The most closely related prior fix is the separator-aware base-path validation added for the Bleve search authorization bypass (GHSA-p6ph-3jx2-3337). That fix replaced a non-separator-aware prefix comparison with `utils.IsSubPath`, so that a requested scope such as `/foo` no longer matches an unrelated `/foobar`. It is present in the analyzed artifact on both the handler closure (`server/handles/search.go:47`) and the Bleve backend, and it is complete for the separator problem it addressed.

That fix does not block this vector, and this finding is a distinct root cause rather than an incomplete fix or a duplicate. The `utils.IsSubPath(user.BasePath, node.Parent)` check evaluates `IsSubPath("/", "/")`, which returns true, so the closure proceeds to the metadata check. The prior fix constrains which `node.Parent` values are permitted; it never changes which metadata scope governs a node. The two concerns are orthogonal. Strongest disproof attempts performed and their outcomes:

- Attempted to show the restricted node is never indexed: the full index build walks the file system with administrator scope through `filterReadableObjs`, which would exclude the directory if the administrator is not in `ReadUsers` and the meta predates the build. This does not comprehensively block the vector, because the node is present in common configurations: the restriction meta is created after the index build, incremental index updates feed raw unfiltered objects, or the administrator is included in `ReadUsers`.
- Attempted to show the prior `IsSubPath` re-check blocks it: it passes, because the directory genuinely lies within the base path.
- Attempted to show `common.CanAccess` itself is faulty: a control trace shows `CanAccess` correctly denies when handed the directory's own metadata, so the defect is the scope of the metadata lookup, not the access check.
- Attempted to show only the Bleve backend applies the filter: the generic `search.SearchFiltered` path applies the same closure to every node for the database, non-full-text database, and Meilisearch backends, so all backends are affected.

## Affected Versions

- `Ecosystem: Go`
- `Package: github.com/OpenListTeam/OpenList/v4`
- `Confirmed affected range: <= 4.2.6`
- `Latest release checked: v4.2.6 (resolved via the Go module proxy; source commit 4580c4db335aa4d163a64416a94731ec89f7b91d)`
- `Fix status: not fixed`

The upper bound v4.2.6 is confirmed vulnerable: the affected files are byte-identical between the v4.2.6 tag and the analyzed commit, and the vulnerable metadata resolution at `server/handles/search.go:50` is present. The introduction boundary is not established, because the available checkout is shallow and the relevant files were not modified within that history window, so the first affected release cannot be pinned from source. No fix exists in any examined revision.

## Suggested Fix

No patch is available.

Enforce that the search authorization filter resolves each directory node's access-control metadata at the node's own path, mirroring the directory listing path. For a directory node, resolve `op.GetNearestMeta(path.Join(node.Parent, node.Name))` rather than `op.GetNearestMeta(node.Parent)`, so that a `ReadUsers` restriction defined at the directory's own path governs that node consistently in both the listing and the search paths. The remediation should cover every search backend that routes through the shared filter closure (database, non-full-text database, Bleve, and Meilisearch), and it should preserve the existing behavior for non-directory nodes, whose parent-scoped metadata resolution is already correct. As an interim mitigation without a code change, operators can disable the search index (`search_index` set to `none`), which removes the search endpoint, at the cost of losing search functionality.

## Credits

Reported by zx (GitHub: `@manus-pi`).

## References

- https://github.com/OpenListTeam/OpenList/security/advisories/GHSA-h6f6-3qfx-p42h

Page: https://cve.now/GHSA-H6F6-3QFX-P42H

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
