CtrlAltNotesDocs Website

Penetration test report

Findings, fixes and controls that held in the red-team pass.

4 min read

Scope: vault format and crypto handling, sync (folder and bundle), password policy, quick unlock (WebAuthn PRF), the local web host, the Markdown renderer / UI, the Tauri desktop shell configuration. Method: an independent red-team agent plus manual checks, with proof-of-concept scripts and a Rust PoC binary against the real code.

Important limit. The sandbox had no internet access, so the test ran against stand-in crypto crates (real SHA-256 / HKDF / HMAC, but a FAKE cipher and FAKE Argon2). It covers logic, file format, protocol handling, HTTP and UI. It does not assess the strength of the real ChaCha20-Poly1305 / Argon2id implementations (those are audited RustCrypto crates) and it was not run on Windows or inside the Tauri window. Not an independent third-party audit.

Findings and status

ID Sev. Finding Status
F-01 Medium Cloud attacker plants vault.json with a huge header_rev and a 1 GiB / t=20 KDF; sync staged it as vault.json.pending, blocking password-change propagation and making every unlock run Argon2 on it first Fixed: a staged header must be the same vault, at most +1000 revisions, and no costlier than max(local, default); otherwise the remote is repaired from the local header. Same check in unlock. Test: hostile_remote_header_is_never_staged
F-02 Medium Replaying an old valid object version resurrected deleted notes or created fake conflict copies Fixed: a side older than the last synced clock never wins. Test: replayed_old_version_does_not_resurrect_deleted_note
F-03 Medium A FIFO / device file in the sync folder blocked a read forever, wedging the service lock Fixed: only regular files are read (symlink_metadata). Test: fifo_in_sync_folder_does_not_hang
F-04 Medium Launch token appeared in the argv of open / xdg-open / rundll32 (visible to other local users) Fixed: opener gets a private 0600 temp page that redirects; deleted after 30 s. Test: launch_page_keeps_the_token_off_the_command_line
F-05 Medium localhost can resolve to ::1; another process could squat [::1]:PORT and receive the token Fixed (best effort): the server also binds [::1]:PORT. Test: ipv6_loopback_port_is_held_too. Windows exclusive bind not done
F-06 Low-Med change_password and quick_enroll were a password-guess oracle without throttling Fixed: input validated first, then the shared unlock throttle. Test: change_password_and_quick_enroll_cannot_be_used_as_password_oracles
F-07 Low Slowloris: the timeout was per read Fixed: overall request deadline. Test: slowloris_is_cut_off_by_the_overall_deadline
F-08 Medium (UI availability) ReDoS / stack overflow in md.js (cubic heading regex, quadratic backticks, blockquote recursion at ~4000 >) Fixed: no regex heading trim, bounded chunks, line / size / depth / work caps, paint() guarded. Test: tests/md_robustness.py (14 adversarial notes)
F-09 Medium Concurrent folder moves create cycles; very deep trees hide content Fixed: cycles / deep chains are repaired for display (link treated as root), nesting capped at 64 on create/move. Tests: folder_cycles_from_concurrent_moves_never_hide_content, nesting_depth_is_capped_on_create
F-10 Low Settings file is unauthenticated; its sync path bypassed the path checks Fixed: stored target gets the same checks as a chosen one, or is dropped. Test: stored_sync_target_inside_vault_dir_is_ignored
F-11 Low Plaintext can persist in process memory after lock Documented
F-12 Low Export silently overwrote files; folder x.md + note x collided Fixed: one case-insensitive namespace including extensions, names already on disk count as taken. Test: export_never_overwrites_and_names_never_collide
F-13 Low A corrupt remote file / garbage remote header blocks sync until repaired Partly mitigated (F-01), otherwise documented
F-14 Low-Med Policy accepted weak 15+ character passwords (Summer2024Summer, Passw0rd!Passw0rd!, 1357924680135792, zaq12wsxcde34rfv) Fixed: leetspeak folding, repeated-block detection, digits-only, keyboard / alphabet walks, "common words + digits" residue rule. Test: password_policy_follows_nist_800_63b
F-15 Low A symlinked objects/ directory in the sync folder made the app write outside it Fixed. Test: symlinked_remote_objects_dir_is_refused
F-16 Low (plausible) Tauri opener:default is broader than needed Changed to opener:allow-open-url limited to http, https, mailto. Not verified (Tauri never built here)
F-17 Info mailto: links kept ?cc=&bcc=&body= Fixed (query stripped). Covered in tests/md_robustness.py
F-18 / F-19 Low Quick slot survives a password change on another device; shared localhost rp_id; ~4 MiB body can fail to save; losing state.can creates spurious conflict copies Documented

Design-level weaknesses (documented, not fixed)

No whole-vault rollback detection; a password change does not rotate the master key; metadata leakage (counts, rounded sizes, times); sync ordering relies on wall clocks (hybrid logical clock bounds the damage); the web token is the only credential once unlocked; the idle lock shares the service mutex with sync I/O; no mlock / core-dump suppression.

Controls that held

About 38 XSS payloads against the renderer; HTTP request smuggling and framing attacks; Host / Origin pinning (DNS rebinding); constant-time token comparison; the parallel-unlock throttle race; path handling (no API accepts a path); KDF downgrade and header swap (header is AAD of the key wraps); hostile bundles; quick-slot binding to vault / credential / rp_id; file permissions; object substitution between files and types; multi-key and partitioning-oracle attacks (not exploitable here).

Re-test result

After the fixes: 91 backend tests (core, service, server), clippy with -D warnings clean, 45 browser checks against the real server binary, and the Markdown robustness check all pass, with stand-in crypto. The real-crypto tests (known-answer, NFKC), the Tauri build, Windows, and the new UI inside the Tauri window remain unverified until you run them.