OAuth library for nim allows insecure generation of state values by generateState - entropy too low and uses regular PRNG instead of CSPRNG
In the OAuth library for nim prior to version 0.11, the `state` values generated by the `generateState` function do not have sufficient entropy. These can be successfully guessed by an attacker allowing them to perform a CSRF vs a user, associating the user's session with the attacker's protected resources. While `state` isn't exactly a cryptographic value, it should be generated in a cryptographically secure way. `generateState` should be using a CSPRNG. Version 0.11 modifies the `generateState` function to generate `state` values of at least 128 bits of entropy while using a CSPRNG.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2024-42475
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 4 Nov 2026, 16:31 UTC · Revision 1
Source evidence
OAuth library for nim allows insecure generation of state values by generateState - entropy too low and uses regular PRNG instead of CSPRNG
core-osv · Original sourcePublished 15 Aug 2024, 18:40 UTC
In the OAuth library for nim prior to version 0.11, the `state` values generated by the `generateState` function do not have sufficient entropy. These can be successfully guessed by an attacker allowing them to perform a CSRF vs a user, associating the user's session with the attacker's protected resources. While `state` isn't exactly a cryptographic value, it should be generated in a cryptographically secure way. `generateState` should be using a CSPRNG. Version 0.11 modifies the `generateState` function to generate `state` values of at least 128 bits of entropy while using a CSPRNG.
osv:CVE-2024-42475
Complete source record
{
"id": "4fc2a0d001184278807e74023c76a8fda28e0f17e7d33d603ab5aa8fe112c978",
"url": "https://osv.dev/vulnerability/CVE-2024-42475",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "OAuth library for nim allows insecure generation of state values by generateState - entropy too low and uses regular PRNG instead of CSPRNG",
"summary": "In the OAuth library for nim prior to version 0.11, the `state` values generated by the `generateState` function do not have sufficient entropy. These can be successfully guessed by an attacker allowing them to perform a CSRF vs a user, associating the user's session with the attacker's protected resources. While `state` isn't exactly a cryptographic value, it should be generated in a cryptographically secure way. `generateState` should be using a CSPRNG. Version 0.11 modifies the `generateState` function to generate `state` values of at least 128 bits of entropy while using a CSPRNG.",
"evidence": "osv:CVE-2024-42475",
"products": [],
"severity": "medium",
"structured": {
"id": "CVE-2024-42475",
"aliases": [
"CVE-2024-42475",
"GHSA-332c-q46h-fg8f"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/cordea/oauth",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "ec2e058fc46f04deaf3cb55eca32b3b83c614953"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "0"
},
{
"fixed": "0.11"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"introduced": "0"
},
{
"fixed": "0.11"
}
],
"source": "DESCRIPTION"
}
]
}
}
],
"versions": [
"v0.10",
"v0.9",
"v0.8",
"v0.7",
"v0.6",
"v0.5",
"v0.4.1",
"v0.4",
"v0.3"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-42475.json"
}
}
],
"modified": "2026-10-28T02:30:37.649980397Z",
"provider": "osv",
"references": [
"https://github.com/CORDEA/oauth/blob/b8c163b0d9cfad6d29ce8c1fb394e5f47182ee1c/src/oauth2.nim#L179",
"https://github.com/CORDEA/oauth/security/advisories/GHSA-332c-q46h-fg8f",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/42xxx/CVE-2024-42475.json",
"https://nvd.nist.gov/vuln/detail/CVE-2024-42475"
],
"provider_metadata": {
"cwe_ids": [
"CWE-330",
"CWE-352"
],
"cna_assigner": "GitHub_M",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/42xxx/CVE-2024-42475.json"
}
},
"related_cves": [
{
"value": "CVE-2024-42475",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 504704,
"published_at": "2024-08-15T18:40:49.75+00:00"
}