Skip to main content

Crate ms_fve

Crate ms_fve 

Source
Expand description

ms-fve — BitLocker (msFVE-RecoveryInformation) primitives in pure Rust.

§What ships in AD

When a domain-joined machine has BitLocker enabled with the “back up recovery info to AD DS” policy, Windows creates a child object under the computer account:

CN=<datetime>{<guid>},CN=<COMPUTER>,OU=…,DC=corp,DC=local
  objectClass: msFVE-RecoveryInformation
  msFVE-RecoveryPassword: 123456-234567-345678-456789-567890-678901-789012-890123
  msFVE-RecoveryGuid:     <16 raw bytes>
  msFVE-VolumeGuid:       <16 raw bytes>
  msFVE-KeyPackage:       <opaque BEK/FVEK export blob>

Any principal with RIGHT_DS_READ_PROPERTY on that leaf can read the plaintext recovery password. Historically this defaulted to Domain Admins

  • Backup Operators, but delegation on the parent computer OU can silently grant it to help-desk groups — an under-audited privilege because the attribute isn’t in the default LDAP filter set.

§What this crate does

  • RecoveryPassword — parse a 48-digit / 55-char BitLocker recovery password and validate its per-block divisibility checksum (each 6-digit block must be divisible by 11; the mid-block value / 11 encodes the key material). Rejects typos, OCR errors, and pasted-with-noise strings without hitting a DC.
  • RecoveryInformation — a decoded msFVE-RecoveryInformation object (recovery_guid, volume_guid, password, optional key_package).
  • ldap_filter_recovery_info_all / ldap_filter_recovery_info_for — ready-to-use LDAP filters for enumeration and per-computer lookup.
  • is_bitlocker_leaf_dn — cheap DN-shape check for iterating a subtree without an extra objectClass roundtrip.

§What this crate does not do

  • No LDAP transport. Callers wire whatever LDAP client they already have (ldap3, adhammer’s raw LDAP, msldap-ext).
  • No key-package decryption. The msFVE-KeyPackage blob is a proprietary BEK/FVEK export that the OS re-parses to unlock the volume; unlock is done by the Windows FVE stack, not by AD tooling.

§Example

use ms_fve::RecoveryPassword;
let pw = RecoveryPassword::parse("135795-258016-380237-502458-132000-122221-244442-366663")
    .expect("well-formed recovery password");
assert_eq!(pw.blocks().len(), 8);
// Round-trip the canonical hyphenated form.
assert_eq!(
    pw.to_string(),
    "135795-258016-380237-502458-132000-122221-244442-366663"
);

Structs§

RecoveryInformation
A decoded msFVE-RecoveryInformation object. Field names match the attribute names on the AD leaf so bindings from ldap3 / raw LDAP are mechanical.
RecoveryPassword
A BitLocker recovery password — eight 6-digit blocks, hyphen-separated.

Enums§

ObjectError
Errors returned by RecoveryInformation::from_ldap_attrs.
PasswordError
Errors returned by RecoveryPassword::parse.

Constants§

RECOVERY_INFO_ATTRS
Attribute names commonly requested when enumerating BitLocker leaves. Passing this to the LDAP search’s attrs parameter yields exactly what RecoveryInformation::from_ldap_attrs needs.

Functions§

is_bitlocker_leaf_dn
Cheap shape check: does dn look like a msFVE-RecoveryInformation leaf? Windows names these CN=<UTC-datetime>{<guid>},.... Useful when iterating a subtree without an extra per-object objectClass fetch.
ldap_filter_recovery_info_all
LDAP filter matching every BitLocker recovery leaf across the directory. Pair with a subtree search under DC=corp,DC=local to enumerate.
ldap_filter_recovery_info_for
LDAP filter matching every recovery leaf for a specific computer, given its DN. Use with a one-level search under computer_dn.