Skip to content

OTP generated with insecure math/rand #478

@lakhansamani

Description

@lakhansamani

Bug Description

In internal/utils/generate_otp.go, OTPs are generated using math/rand seeded with time.Now().UnixNano(). This is not cryptographically secure and the seed is re-initialized on every call, meaning concurrent calls at the same nanosecond produce identical OTPs.

Impact

HIGH — OTPs are predictable. An attacker who knows the approximate time of OTP generation can guess the OTP.

Fix

Replace math/rand with crypto/rand for cryptographically secure OTP generation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions