mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-12 19:55:14 +02:00
[pitboss/grind] deferred session-0019 (20260522T043516Z-29b8)
This commit is contained in:
parent
41f2a2d7f8
commit
1fad701ded
6 changed files with 273 additions and 22 deletions
|
|
@ -1,10 +1,23 @@
|
|||
# Phase 11 (Track J.9) — Python CRYPTO vuln fixture.
|
||||
#
|
||||
# Uses `random.randint(0, 0xFFFF)` (a non-CSPRNG) to derive a 16-bit
|
||||
# key; the harness's instrumented key path writes a `ProbeKind::WeakKey`
|
||||
# probe and the `WeakKeyEntropy` oracle fires.
|
||||
# Models a config-driven crypto endpoint that picks the RNG based on
|
||||
# the request payload — `*_WEAK` routes through `random.randint(0, 0xFFFF)`
|
||||
# (a non-CSPRNG) and `*_STRONG` routes through `secrets.token_bytes(32)`
|
||||
# (a CSPRNG). This shape is needed by the differential runner: the
|
||||
# vuln-payload attempt and the benign-control attempt both load the same
|
||||
# fixture, and only the payload-routed weak branch trips the
|
||||
# `WeakKeyEntropy` predicate. Real-world analogue: a JWT-signing or
|
||||
# session-token endpoint that exposes an `algorithm`/`key_strength`
|
||||
# knob whose weak setting falls back to a non-CSPRNG seed.
|
||||
import random
|
||||
import secrets
|
||||
|
||||
|
||||
def run(_value):
|
||||
def run(value):
|
||||
if isinstance(value, (bytes, bytearray)):
|
||||
value = value.decode("utf-8", "replace")
|
||||
elif not isinstance(value, str):
|
||||
value = str(value)
|
||||
if "STRONG" in value:
|
||||
return secrets.token_bytes(32)
|
||||
return random.randint(0, 0xFFFF)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue