Repository navigation
Description
Hi, and thanks for VDBackup and the VD modules. I read the VDLU engine (update.sh, vdlu-verify, RELEASE.md in VD-Backup module/vdlu/) before deciding whether to enable auto-update. The design is solid: ed25519-signed manifest, per-blob sha256, downgrade blocked under hardened, unsafe paths rejected, transactional apply with rollback, private key kept off CI. This issue is about one structural weak point plus a few related things.
Context: these are root modules, so whatever VDLU installs runs as root. Trust in the update channel is effectively trust in root on the device.
1. The trust anchor is updatable through the feed itself
vdlu/keyring/vd-2026.pub, vdlu/vdlu-verify, vdlu/verify/<abi>/ed25519-mini and vdlu/update.sh are ordinary manifest entries ("class":"live"). A validly signed manifest can therefore replace the verifier and the keyring. Key rotation is a legitimate use of this, but it also means a single leaked or coerced signing key gives full root on every device with auto-update on, with no second factor and no way for the device to notice.
Possible mitigations (any one helps):
- Key pinning outside the feed: the verifier and keyring are never auto-updated, only changed by a flashed zip (or the root manager), which the user sees and approves.
- Rotation signed by the old key: a manifest that adds or replaces a key must be signed by BOTH the currently trusted key and the new key, so a leaked key alone cannot swap the anchor.
- A separate channel for the verifier/engine: a different, rarely used signing key (ideally offline) for
vdlu/*, distinct from the routine release key. - User confirmation on key change: if a manifest changes the keyring or the verifier, do not apply it silently; show a prompt in the WebUI with the new key fingerprint, even when auto-update is on.
- Publish the key fingerprint out of band (README, release notes) so users can cross-check.
It would also help to document where the private key lives and how it is protected.
2. Bug: boot-time update fails on the bundled curl's CA path
With auto_on_reboot=1, vdlu/boot.log after a reboot shows (3 attempts):
curl: (77) error adding trust anchors from file: /data/data/com.termux/files/usr/etc/tls/cert.pem
VDLU: manifest download failed
The bundled curl falls back to a build-time default CA path (a Termux path that does not exist). update.sh builds a CA bundle and passes --cacert, but at boot it seems that either the bundle ends up empty (the conscrypt APEX store not yet populated) or one call does not get --cacert. It fails closed, which is good, but it means boot-time update did not work for me. Suggestion: wait for the cacerts to be present before the first fetch, always pass --cacert on every curl call, and avoid the dangling default path in the bundled curl.
3. Defaults
- VDBackup
config.default:auto_on_reboot=1. - VD-dropbear
module/vdlu/config.default(master):auto_on_reboot=1andauto_on_webui_open=1, withboot_retry_minutes=1440.
For an updater that runs as root I would expect both to default to off, with an explicit opt-in that explains what it does. Existing installs keep their seeded config, but fresh installs get silent root updates.
4. Applying during a running backup/restore
worker.sh and helper.sh are live class and swapped in place. The rename-based swap leaves an already running worker.sh on its old inode, which is good, but I found no check for an in-flight operation. A new helper.sh can end up talking to an older running worker.sh mid-run. Suggestion: defer the apply while any backup/restore op is active (for example a progress file with "done":false, or a live worker pid) and retry later.
5. Smaller ideas
- A "pin version / do not update past X" option and a dry-run listing the files and sizes that would change.
- A per-update list of changed paths shown in the WebUI before applying.
- A published, append-only list of released manifest sha256 values so users can verify what they received.
Happy to test fixes for 2 and 4. Thanks again.
Activity
Solomag commentedon Nov 20, 2026
Follow-up on point 2 (boot-time CA failure), after reading
update.shmore closely.The code already builds a CA bundle from the Android store and passes
--cacert(lines ~60-74), so the failure at boot most likely means that bundle ends up empty:service.shstarts the update atlate_start, where/apex/com.android.conscrypt/cacertsmay not be mounted yet and/system/etc/security/cacertsis nearly empty on recent Android versions.CACERTthen stays empty, no--cacertis passed, and the bundled curl falls back to its baked-in Termux path (rc 77).Suggested fix (untested on a boot, I only read the code): in the CA setup, wait for the store to be populated before the first fetch, and treat an empty bundle as "not ready" instead of silently continuing:
If the fetch is attempted with no
--cacertand no usable store, it would also be safer to skip it than to let curl fall back to the baked-in path. Users can already work around it via theca_certconfig key, but a default that works at boot would be better. Happy to test a patch.Solomag commentedon Nov 20, 2026
Correction/update to my comment above, after testing on the device (no reboot):
--cacertworks; the signature verifies (vdlu-verify: OK key_id=vd-2026) and the feed advertises v1.14. So the CA/signature path itself is fine after boot.vdlu/boot.log: the failure happened in the boot-time run (3 attempts), and the message is the baked-in Termux CA path being used. A log line printingCACERT/CAPATHand the cert count when the fetch starts would show immediately whether the bundle was empty at that moment.Sorry for the noise if the cause turns out to be elsewhere.
Solomag commentedon Nov 20, 2026
Update after testing on the device with a real reboot (auto_on_reboot=1 set temporarily, then restored): I think I found the actual cause of "boot-time update never runs", and it is not the CA path.
service.shhas a single-instance guard before the scheduler and the VDLU block:scheduler.loop.pidlives in/data/adb/vdbackup/logs/and survives reboots. After a reboot the stored pid is stale, but Android reuses pids quickly: in my test the stored pid (4153) was alive again as an unrelated system app.kill -0succeeded, soservice.shexited at that line, which means the scheduler loop and the VDLU boot update (both below it) were skipped for the whole boot (pid file untouched,boot.logempty, nothing updated after 7+ minutes).Also measured at that boot: all three CA directories already contain 120 certificates from ~19 s uptime, i.e. before
sys.boot_completed, so the "bundle is empty at late_start" theory in my earlier comments is wrong. The earlier curl rc 77 inboot.logtherefore probably comes from a different situation (for example the boot run happening before the network was fully usable, or a curl invocation that did not get--cacert). I can't pin that one down.Suggested fix for the guard: verify that the pid really is the loop, not just alive, for example compare
/proc/<pid>/cmdlinewith the expectedsh -c/scheduler-tick, or write the pid file under a tmpfs path (/devor/data/local/tmp) so it is cleared on reboot, or store the boot id (/proc/sys/kernel/random/boot_id) next to the pid and ignore the file when it differs. Moving the VDLU boot block above the guard would also make it independent of the scheduler.Sorry for the earlier wrong guess on the CA store.
Solomag commentedon Nov 20, 2026
I opened a PR for the stale-pid guard described in the last comment (service.sh and the same pattern in uninstall.sh): VD171/VD-Backup#25. It does not address the other points (trust anchor, defaults, apply during a running backup, curl rc 77 at boot).