Skip to content

RFC 9175: prevent unsafe Token reuse and randomize unsecured request tokens #33

Open

Description

@maikebing

Follow-up to #23. The approved option19 migration is independent of header-token generation. At baseline 557b31a, TokenLayer still uses a System.Random-seeded Int32 counter; subsequent tokens are predictable and the counter wraps. RFC7252 §5.3.1 recommends a nontrivial randomized token (at least 32 random bits for Internet-facing NoSec). RFC9175 §4 updates secure response binding and recommends a sequence that avoids unsafe reuse until traffic keys change. Acceptance must cover auto and explicit tokens, UDP versus actual DTLS context, overflow/rekey, Block1/Block2 continuation, Observe registration/reregistration/cancel, concurrent matching and bounded memory. Do not claim cryptographic safety from small-sample randomness tests or introduce an unbounded token-history set/custom cipher. Preserve retransmission identity and fail explicitly rather than silently reusing a secure token. This issue remains separate from optional Echo/Request-Tag in #24.

Activity

  1. maikebing commented on Nov 13, 2026

    @maikebing
    MemberAuthor

    Next-batch candidate: PR #38 at f474675.

    PARTIAL / OPEN. TokenLayer now uses RandomNumberGenerator.GetBytes(8) for automatic tokens; the Int32 counter and wrap path were removed. No custom cryptography or token-history collection was introduced. Explicit empty/1/4/8-byte tokens and existing retransmission, Block1/Block2 and Observe registration/refresh/cancel identities are preserved. UseRandomTokenStart remains an API member but does not make automatic tokens deterministic.

    Original focused baseline: 3 FAIL / 7 PASS; fixed token and existing integration selection: 20/20 PASS with TreatWarningsAsErrors=true. Full Windows candidate: 481/481; COAPALL: 491/491. A 256-request concurrency smoke is a correlation regression, not a proof of entropy or collision-free secure non-reuse.

    RFC 9175 binding remains UNKNOWN: IChannel.Send/DataReceivedEventArgs/Exchange do not expose the actual DTLS session, traffic-key or re-key identity; the provider session objects are private. The Token layer cannot establish which real secure context is in use, and an explicit token can still be reused. The next step needs an explicit transport-to-exchange security-context contract and bounded active-token reservation/reuse policy. A coaps URI is not sufficient evidence. Do not close #33 on this CSPRNG change. Source hashes, original failures and commands: docs/audits/coap-20261113/next-batch-validation.json and next-batch-execution.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions