Executive Summary & Direct Answer

RUSTSEC-2026-0387 identifies timing variability in crypto-bigint operations intended to be constant-time, including subtraction, zero counting, division, Montgomery multiplication, UintRef equality, and BoxedMontyForm::invert. Applications using affected operations on secret integers should upgrade to crypto-bigint 0.7.6 or later, then verify the actual target and compiler configuration they deploy. Constant-time intent in an API is not proof that generated machine code has no secret-dependent branches.

The advisory reports that compiler and CPU behavior can affect whether these operations branch on secrets. The practical risk depends on the downstream algorithm and an attacker’s ability to observe timing or microarchitectural effects. Treat the upgrade as a required mitigation, and use the regression-check workflow and target-specific review described below to reduce the chance of reintroducing the problem.

Environment and baseline

This guide targets Rust 1.82+ (Edition 2021) and crypto-bigint 0.7.6 or later. RUSTSEC-2026-0387 reports 0.7.6 as the patched version. The advisory says that release removes identified branches, updates ctutils to include its constant-time fixes, and adds BINSEC-based regression checks through cargo checkct for arithmetic on multiple targets.

Declare the patched minimum in Cargo.toml:

[dependencies]
crypto-bigint = "0.7.6"

Cargo’s compatible-version requirement allows later compatible 0.7 releases; it does not mean that every dependency resolution will automatically select exactly 0.7.6. Commit Cargo.lock for applications, inspect the resolved version, and check transitive dependencies with:

cargo tree -i crypto-bigint
cargo tree -i ctutils
cargo audit

For a library, state and test the minimum supported version rather than relying on a consumer’s lockfile. Confirm that no direct or transitive dependency brings in an affected version in a separately built cryptographic component.

What the advisory changes in the threat model

The problem is not simply that an operation is “slow.” It is that execution may reveal information correlated with secret values. Timing differences can be measured across repeated operations, and microarchitectural effects can sometimes expose information even when coarse wall-clock measurements look uniform.

RUSTSEC-2026-0387 names several distinct leak surfaces:

  • Subtraction and zero counting: secret-dependent branches can reveal properties of arithmetic intermediates, such as borrow propagation or the number of leading or trailing zero bits.
  • Division and Montgomery multiplication: variable behavior during modular arithmetic may expose relationships between operands and intermediate values.
  • UintRef equality: returning as soon as the first unequal limb is found can reveal how many leading limbs match.
  • BoxedMontyForm::invert: branching on whether an inverse exists reveals invertibility, which may itself be sensitive in a protocol.

These are not interchangeable risks. An equality leak can disclose matching limb structure; an inversion branch can disclose a predicate; arithmetic branches can leak intermediate properties. Whether any particular leak recovers a key depends on how the operation is used, what values an attacker controls, and what observations the attacker can collect. Do not assume that a secret is safe because the final output is correct or because the operation is rarely called.

The vulnerable pattern and its root cause

The most dangerous integration pattern is to trust a crate’s constant-time intent while building against an affected release:

# Vulnerable baseline: do not retain an affected resolution.
[dependencies]
crypto-bigint = "0.7.5"

An application might use subtraction, division, equality, or inversion on a secret and see no functional failure. Yet the advisory describes secret-dependent branches in operations intended to be constant-time. Correct arithmetic results do not establish that execution is independent of secret data.

A second, broader anti-pattern is to implement a “constant-time” wrapper with a normal conditional:

// Do not use this pattern to select based on secret-derived data.
fn choose(secret_condition: bool, a: u64, b: u64) -> u64 {
    if secret_condition { a } else { b }
}

The branch in this example is controlled by the condition. If that condition depends on secret material, the source code itself makes the timing risk visible. Likewise, replacing an affected library operation with a hand-written branchy implementation is not a fix. Rust source-level appearance alone cannot establish how optimized machine code behaves.

Production mitigation: upgrade and keep secrets inside vetted operations

Use the patched crate, remove local forks or copied arithmetic routines based on affected code, and keep secret-dependent arithmetic within reviewed constant-time primitives.

[dependencies]
crypto-bigint = "0.7.6"

Then review the call graph for secret-bearing values. Pay particular attention to calls involving subtraction, zero counts, division, Montgomery multiplication, UintRef equality, and BoxedMontyForm::invert. Ask whether operands, equality results, invertibility, or intermediate values depend on keys, nonces, secret scalars, or attacker-influenced secret state. If a secret-derived predicate controls a Rust if, loop count, early return, allocation size, or error path, treat it as a side-channel review finding.

Do not “fix” equality or inversion by changing only the caller. For example, computing an equality result with a branch-free-looking expression after a limb-by-limb early exit does not undo the early exit. The affected operation must be replaced with the patched implementation or another reviewed constant-time primitive.

A practical upgrade review includes:

  1. Resolve and inspect versions. Confirm cargo tree -i crypto-bigint shows 0.7.6 or later in every relevant build.
  2. Check wrappers and forks. Search application code for copied arithmetic and for wrappers that reintroduce secret-dependent branches around library results.
  3. Keep functional behavior intact. Run existing arithmetic, protocol, and cryptographic tests to catch compatibility regressions.
  4. Verify the supported build matrix. Check the targets and compiler profiles used in production, not just a local debug build.
  5. Track the advisory. Keep dependency auditing and lockfile review in CI so a later resolution does not silently reintroduce an affected version.

This is a narrow mitigation for the advisory, not a general guarantee that every use of crypto-bigint is constant-time. Protocol-level control flow, error handling, and surrounding code still require review. For an adjacent class of security failures, see Preventing Timing Attacks in Rust: Constant-Time Comparisons and Secure Verification—if that path is not available in your documentation set, use the project’s verified timing-attack reference instead. (Do not publish an unverified URL.)

Verification: test behavior, then inspect generated execution

The advisory identifies BINSEC-based regression checks through cargo checkct as part of the 0.7.6 resolution. Run the project’s configured check on the relevant crate and targets, following the workflow in the upstream change:

cargo checkct

Treat this as a regression check, not a universal proof. A clean result is meaningful only for the code, configuration, and targets analyzed. Confirm the command’s coverage in the crate or tool documentation, and retain the CI output for supported target configurations. The advisory’s source change is RustCrypto/crypto-bigint pull request 1365.

Also run ordinary build and test checks in both profiles:

cargo test --locked
cargo test --release --locked
cargo clippy --all-targets --all-features -- -D warnings

Where supported by the project’s setup, compare builds for each deployed target and toolchain version. Record the compiler, target triple, features, and optimization profile; differences in those inputs can affect generated execution. Do not infer that a debug test covers release code or that one CPU target covers another.

Timing benchmarks can help detect regressions, but they are not a proof of constant-time behavior: noise, frequency scaling, scheduling, and measurement strategy can hide differences. Use them as supporting evidence alongside static analysis, source review, and generated-code inspection. When inspecting assembly or intermediate representation, focus on whether branches, memory accesses, loop counts, or early exits depend on secret-derived values. A branch that is present is not automatically a vulnerability; its control dependency matters.

For integer boundary assumptions in surrounding code, review Preventing Unsafe Integer Conversions in Rust: Avoiding Truncation, Overflow, and Signedness Bugs. If secret-dependent execution can trigger an error or panic boundary, also consider Preventing Panic-Induced Denial of Service in Rust: Designing Resilient Error Boundaries. These are complementary concerns, not substitutes for upgrading the arithmetic implementation.

Quantitative trade-offs

The advisory does not publish numeric timing deltas, benchmark results, or a complete affected-version range beyond identifying 0.7.6 as patched. Avoid inventing performance numbers or claiming a measured speedup. The actionable comparison is the security guarantee and the verification scope:

ApproachVersion or conditionSecurity implicationVerification scope
Affected implementationEarlier than 0.7.6, as applicable to the advisoryIdentified operations may branch on secret-dependent valuesExisting functional tests do not detect this reliably
Patched dependency0.7.6 or laterIncludes the advisory’s fixes and updated ctutilsConfirm resolved version and target coverage
cargo checkct regression checkConfigured analysis and supported targetsChecks constant-time properties within its analysis scopeNot a proof for unanalysed code or configurations
Timing benchmark onlyAny versionMay reveal measurable differences but can miss leakageSensitive to noise, hardware, and test design

The patched release may have different performance characteristics from an affected release; the advisory does not quantify them. If performance is critical, benchmark the real workload on representative hardware after upgrading, but do not trade away the security fix based on a microbenchmark alone.

Production pitfalls and edge cases

A lockfile does not secure every build. Applications using --locked can verify a committed resolution, but libraries do not control downstream lockfiles. Document the minimum patched version and check the actual graph in release CI.

Target coverage matters. The advisory explicitly notes compiler and target CPU dependence. A check on one architecture or compiler configuration cannot establish behavior for every supported deployment. Align verification targets with the production matrix and investigate any untested target.

Secret-derived results can leak outside arithmetic. A patched equality operation does not help if a caller branches on the result and exposes the branch through response timing. Review the entire secret-dependent path, including errors, retries, serialization, and early returns.

Availability can be secret-sensitive. BoxedMontyForm::invert is specifically called out for branching on whether an inverse exists. Consider whether the input or invertibility predicate is sensitive in the application’s protocol, even if the operation is mathematically correct.

Do not treat constant-time as a Rust language guarantee. The type system prevents many memory-safety errors, but it does not promise that compiled code has constant timing. Preserve toolchain and target metadata for the checks you rely on, and repeat verification when either changes.

Frequently Asked Questions (FAQ)

Which crypto-bigint version fixes RUSTSEC-2026-0387?

The advisory lists crypto-bigint 0.7.6 and later as patched. Verify the resolved version with cargo tree -i crypto-bigint, because a manifest requirement alone does not show which version a particular build selected.

Which operations does RUSTSEC-2026-0387 identify?

The advisory names subtraction, zero counting, division, and Montgomery multiplication, along with UintRef equality and BoxedMontyForm::invert. The reported issues include secret-dependent branches and early termination at the first unequal limb.

Does cargo checkct prove that Rust cryptographic code is constant-time?

No. The advisory describes BINSEC-based regression checks through cargo checkct on multiple targets, but an analysis only covers the code and configurations it actually checks. Combine it with version verification, target-aware review, functional tests, and investigation of secret-dependent behavior in surrounding code.

Learn more with useful resources