Issue and Steps to Reproduce
Hello,
During internal security testing at our company, a potential security issue was reported in our usage of @axa-fr/react-oidc.
We are currently using @axa-fr/react-oidc version 7.27.19.
The report points to the guid function in the OIDC Service Worker, which seems to generate UUID v4 values using Math.random(). As far as we understand, Math.random() is not considered cryptographically secure and should generally be avoided for values that may be used in authentication-related flows.
Since this Service Worker is involved in OIDC authentication and may handle sensitive values such as access tokens, refresh tokens, session-related identifiers, state values, or nonces, we wanted to report this so you can confirm whether this UUID generation is security-sensitive in this context.
Steps to reproduce:
- Check the OIDC Service Worker implementation.
- Locate the
guid function used to generate UUID v4 values.
- Notice that the UUID randomness appears to be based on
Math.random().
- Review whether these generated UUIDs can be used as nonces, state values, session identifiers, or other authentication-related values.
Versions
We are currently using:
@axa-fr/react-oidc: 7.27.19
Screenshots
N/A
Expected
For authentication-related values, we would expect UUIDs or random identifiers to be generated with a cryptographically secure source, for example:
or, if a custom UUID implementation is needed:
Actual
The current implementation appears to use Math.random() when generating UUID v4 values in the OIDC Service Worker.
Even though this may not be directly exploitable depending on how these UUIDs are used, Math.random() is generally not suitable for security-sensitive randomness because its output is not designed to be unpredictable for cryptographic or authentication use cases.
Additional Details
This was flagged by our internal security checks, so we wanted to raise it here rather than assume whether the impact is real or only theoretical.
Could you please confirm whether these UUIDs are used in any security-sensitive part of the OIDC flow, such as nonce, state, session correlation, or token-related handling?
If they are, replacing Math.random() with crypto.randomUUID() or crypto.getRandomValues() would probably be a safer approach.
Installed packages
@axa-fr/react-oidc: 7.27.19
Issue and Steps to Reproduce
Hello,
During internal security testing at our company, a potential security issue was reported in our usage of
@axa-fr/react-oidc.We are currently using
@axa-fr/react-oidcversion7.27.19.The report points to the
guidfunction in the OIDC Service Worker, which seems to generate UUID v4 values usingMath.random(). As far as we understand,Math.random()is not considered cryptographically secure and should generally be avoided for values that may be used in authentication-related flows.Since this Service Worker is involved in OIDC authentication and may handle sensitive values such as access tokens, refresh tokens, session-related identifiers, state values, or nonces, we wanted to report this so you can confirm whether this UUID generation is security-sensitive in this context.
Steps to reproduce:
guidfunction used to generate UUID v4 values.Math.random().Versions
We are currently using:
Screenshots
N/A
Expected
For authentication-related values, we would expect UUIDs or random identifiers to be generated with a cryptographically secure source, for example:
or, if a custom UUID implementation is needed:
Actual
The current implementation appears to use
Math.random()when generating UUID v4 values in the OIDC Service Worker.Even though this may not be directly exploitable depending on how these UUIDs are used,
Math.random()is generally not suitable for security-sensitive randomness because its output is not designed to be unpredictable for cryptographic or authentication use cases.Additional Details
This was flagged by our internal security checks, so we wanted to raise it here rather than assume whether the impact is real or only theoretical.
Could you please confirm whether these UUIDs are used in any security-sensitive part of the OIDC flow, such as nonce, state, session correlation, or token-related handling?
If they are, replacing
Math.random()withcrypto.randomUUID()orcrypto.getRandomValues()would probably be a safer approach.Installed packages