Expand description
§sidecheck-core
Library crate behind sidecheck, a
remote timing side-channel auditor. If you’re looking for the CLI tool,
see that crate instead — this one is for embedding the same detection
logic in your own Rust code (a custom test harness, a CI check, a
different transport than HTTP, etc.).
§What’s in here
stats— the statistical core.box_testcompares the low percentile of two timing samples (methodology from Crosby, Wallach & Riedi, “Opportunities and Limits of Remote Timing Attacks”, ACM TISSEC 2009), with a bootstrap-resampled confidence interval rather than an assumption of normally-distributed network latency.estimate_jittergives a robust (MAD-based, outlier-resistant) noise estimate, andrequired_samplesdoes the power-analysis math to size a run before you commit to it.sampler(featurehttp, default on) — an HTTP-based sampler:HttpTargetplusrun_interleaved, which measures two classes of request in randomized interleaved blocks (never “all A, then all B”) to avoid confounding the result with time-of-day drift or server warm-up. Requiresreqwest; disable thehttpfeature (default-features = false) if you only need the statistics and want to supply your own timing measurements.doctor— pre-flight network-quality diagnostics (median RTT, jitter classification, packet loss, a recommended sample count) built onstatsalone, with no HTTP dependency of its own.report/export— human-readable and machine-readable (JSON/CSV) report formatting.
§Example: statistics only, your own timing source
use sidecheck_core::stats::box_test;
// two vectors of measured elapsed seconds, however you collected them
let class_a: Vec<f64> = vec![0.001, 0.0011, 0.00105, 0.00098, 0.00102];
let class_b: Vec<f64> = vec![0.0015, 0.0016, 0.00155, 0.00148, 0.00152];
let result = box_test(&class_a, &class_b, /* low_percentile */ 10.0, /* confidence */ 0.95);
if result.is_significant() {
println!("leak: {:.1} us", result.estimated_leak.abs() * 1_000_000.0);
}§Example: HTTP sampling (default http feature)
use sidecheck_core::sampler::{HttpTarget, InjectionPoint, run_interleaved, random_wrong_value};
use rand::{SeedableRng, rngs::StdRng};
let target = HttpTarget::new(
"https://myapp.local/login",
InjectionPoint::Header("X-API-Key".into()),
)?;
let secret = "the-real-secret";
let mut rng = StdRng::seed_from_u64(42);
let wrong = random_wrong_value(secret, &mut rng);
let raw = run_interleaved(&target, &wrong, secret, 5_000, 20, &mut rng, |_, _| {})?;§Limitations
Same as the CLI: this can detect a statistically significant timing difference under the tested conditions. It cannot prove one doesn’t exist. See the main README for the full discussion, including why a real (non-amplified) timing leak is often not reliably detectable over an actual HTTP round-trip even when it’s real at the CPU level.
§License
MIT
Modules§
- doctor
sidecheck doctor— быстрая pre-flight проверка канала до цели, ДО того как тратить время на полноценный тест. Отвечает на вопрос “стоит ли вообще пробовать измерять timing-утечку по этому пути”, а не “есть ли утечка”.- export
- Экспорт результатов — CSV с сырыми измерениями (для независимой перепроверки статистики кем угодно) и JSON-отчёт (для CI/автоматизации).
- report
- Перевод статистики в понятный человеку вердикт. Никаких сырых t-значений наружу — только то, что нужно для решения.
- sampler
- Сбор сырых измерений времени отклика.
- stats
- Статистическое ядро sidecheck.