Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Claude loads one when your task matches it, or you run it by name.
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
A portable tool for detecting timing side-channel vulnerabilities in compiled cryptographic code. Analyzes assembly output from multiple compilers and architectures to detect instructions that could leak secret data through execution timing.
Timing side-channel attacks exploit variations in execution time to extract secret information from cryptographic implementations. Common sources include:
DIV, IDIV): Execution time varies based on operand valuesFDIV, FSQRT): Variable latency based on inputsThe infamous KyberSlash attack demonstrated how division instructions in post-quantum cryptographic implementations could be exploited to recover secret keys.
# Install
uv pip install -e .
# Analyze a C file
ct-analyzer crypto.c
ct-analyzer <source_file>
| Option | Description |
|---|---|
--arch, -a | Target architecture (x86_64, arm64, arm, riscv64, ppc64le, s390x, i386) |
--compiler, -c | Compiler to use (gcc, clang, go, rustc) |
--opt-level, -O | Optimization level (O0, O1, O2, O3, Os, Oz) - default: O2 |
--warnings, -w | Include conditional branch warnings |
--func, -f | Regex pattern to filter functions |
--json | Output JSON format |
--github | Output GitHub Actions annotations |
--list-arch | List supported architectures |
# Test with different optimization levels
ct-analyzer --opt-level O0 crypto.c
ct-analyzer --opt-level O3 crypto.c
# Cross-compile for ARM64
ct-analyzer --arch arm64 crypto.c
# Include conditional branch warnings
ct-analyzer --warnings crypto.c
# Analyze specific functions
ct-analyzer --func 'decompose|sign' crypto.c
# JSON output for CI
ct-analyzer --json crypto.c
# Analyze Go code
ct-analyzer crypto.go
# Analyze Rust code
ct-analyzer crypto.rs
# Analyze PHP code (requires PHP with VLD extension or opcache)
ct-analyzer crypto.php
# Analyze TypeScript (transpiles to JS first)
ct-analyzer crypto.ts
# Analyze JavaScript (uses V8 bytecode analysis)
ct-analyzer crypto.js
# Analyze Python (uses dis module for bytecode disassembly)
ct-analyzer crypto.py
# Analyze Ruby (uses YARV instruction dump)
ct-analyzer crypto.rb
| Category | x86_64 | ARM64 | RISC-V |
|---|---|---|---|
| Integer Division | DIV, IDIV, DIVQ, IDIVQ | UDIV, SDIV | DIV, DIVU, REM, REMU |
| FP Division | DIVSS, DIVSD, DIVPS, DIVPD | FDIV | FDIV.S, FDIV.D |
| Square Root | SQRTSS, SQRTSD, SQRTPS, SQRTPD | FSQRT | FSQRT.S, FSQRT.D |
Conditional branches that may leak timing if condition depends on secret data:
PHP analysis uses either the VLD extension (recommended) or opcache debug output:
Detected PHP Vulnerabilities:
| Category | Pattern | Recommendation |
|---|---|---|
| Division | ZEND_DIV, ZEND_MOD | Use Barrett reduction |
| Cache timing | chr(), ord() | Use pack('C', $int) / unpack('C', $char)[1] |
| Table lookups | bin2hex(), hex2bin(), base64_encode() | Use constant-time alternatives |
| Array access | FETCH_DIM_R (secret index) | Use constant-time table lookup |
| Bit shifts | ZEND_SL, ZEND_SR (secret amount) | Mask shift amount |
| Variable encoding | pack(), serialize(), json_encode() | Use fixed-length output |
| Weak RNG | rand(), mt_rand(), uniqid() | Use random_int() / random_bytes() |
| String comparison | strcmp(), === on secrets | Use hash_equals() |
Installation:
# Install VLD extension (recommended)
# Query latest version from PECL
VLD_VERSION=$(curl -s https://pecl.php.net/package/vld | grep -oP 'vld-\K[0-9.]+(?=\.tgz)' | head -1)
pecl install channel://pecl.php.net/vld-${VLD_VERSION}
# Or build from source (if PECL fails)
git clone https://github.com/derickr/vld.git && cd vld
phpize && ./configure && make && sudo make install
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub fodhol/skills --plugin constant-time-analysisPlugins from other owners that cover similar ground