Skip to content

security: replace java.util.Random with SecureRandom (5 sites)#17

Merged
QuickMythril merged 1 commit into
QuickMythril:qortium-6.1.5from
7r15bot:fix/q4-q5-securerandom-prng
May 28, 2026
Merged

security: replace java.util.Random with SecureRandom (5 sites)#17
QuickMythril merged 1 commit into
QuickMythril:qortium-6.1.5from
7r15bot:fix/q4-q5-securerandom-prng

Conversation

@7r15bot
Copy link
Copy Markdown
Contributor

@7r15bot 7r15bot commented May 26, 2026

Summary

Five call sites used non-cryptographic java.util.Random (seeded from system time) in places where unpredictability matters.

Q4 - P2P request IDs (3 sites)

ArbitraryDataFileListManager (x2) and ArbitraryMetadataManager (x1) generated request IDs with new Random().nextInt(). These IDs are broadcast to all peers. A malicious peer who can observe network timing can predict upcoming IDs and preemptively send spoofed responses, causing the node to accept fabricated file-list or metadata replies.

Q5 - Online account / block minting nonces (2 sites)

OnlineAccountsManager and Block generated MemPoW nonces with new Random().nextInt(500000). Seeding from a predictable RNG reduces the effective entropy of the starting nonce.

Changes

  • ArbitraryDataFileListManager.java: swap import Random -> SecureRandom, replace both new Random() calls
  • ArbitraryMetadataManager.java: add import SecureRandom, replace new Random() call
  • OnlineAccountsManager.java: add import SecureRandom, replace new Random() call
  • Block.java: add import SecureRandom, replace new Random() call

No functional behaviour changes - only the RNG source is upgraded.

u{1F916} Security fix identified and patched by Claude Code (https://claude.ai/claude-code)

Five call sites used the non-cryptographic java.util.Random:

Q4 - P2P request IDs (ArbitraryDataFileListManager x2, ArbitraryMetadataManager):
  Predictable IDs allow a malicious peer to preemptively spoof responses
  to in-flight QDN file-list and metadata requests.

Q5 - Online account / block minting nonces (OnlineAccountsManager, Block):
  new Random() nonces are seeded from system time, making the 500 000-
  element nonce space partially predictable by an observer.

Replace all five sites with SecureRandom. Add explicit
java.security.SecureRandom imports where the wildcard java.util.*
import did not cover it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@QuickMythril QuickMythril force-pushed the fix/q4-q5-securerandom-prng branch from e3a8009 to 882b98d Compare May 28, 2026 05:55
@QuickMythril QuickMythril merged commit 58b76ce into QuickMythril:qortium-6.1.5 May 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants