CVE-2024-57835
📋 TL;DR
This vulnerability affects Amon2::Auth::Site::LINE authentication modules that use String::Random for nonce generation. The String::Random module defaults to Perl's predictable rand() function, making nonce values predictable and potentially allowing attackers to bypass authentication or hijack sessions. Any application using Amon2::Auth::Site::LINE with default String::Random configuration is affected.
💻 Affected Systems
- Amon2::Auth::Site::LINE
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Attackers could predict nonce values used in OAuth authentication flows, allowing them to hijack user sessions, bypass authentication entirely, or perform account takeover attacks against LINE-integrated applications.
Likely Case
Attackers with network access could intercept and replay authentication requests, potentially gaining unauthorized access to user accounts or performing session fixation attacks.
If Mitigated
With proper cryptographically secure random number generation, nonce values become unpredictable, preventing authentication bypass and maintaining the security of OAuth flows.
🎯 Exploit Status
Exploitation requires understanding of OAuth nonce prediction and ability to intercept authentication traffic. No public exploit code has been identified.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Amon2::Auth::Site::LINE 0.05 or higher (when available) or manual fix by overriding String::Random configuration
Vendor Advisory: https://security.metacpan.org/docs/guides/random-data-for-security.html
Restart Required: Yes
Instructions:
1. Update Amon2::Auth::Site::LINE to patched version when available. 2. Alternatively, modify the module to use cryptographically secure random number generation. 3. Restart the application server after changes.
🔧 Temporary Workarounds
Override String::Random with secure RNG
allConfigure String::Random to use Crypt::URandom or other cryptographically secure random number generator instead of default rand()
use Crypt::URandom;
use String::Random qw(random_string);
local $String::Random::RNG = sub { Crypt::URandom::urandom($_[0]) };
my $nonce = random_string('...');
🧯 If You Can't Patch
- Implement additional authentication validation layers to detect anomalous nonce patterns
- Monitor authentication logs for repeated nonce values or suspicious authentication patterns
🔍 How to Verify
Check if Vulnerable:
Check if application uses Amon2::Auth::Site::LINE and examine the source code to see if String::Random is used with default configuration for nonce generation.
Check Version:
perl -MAmon2::Auth::Site::LINE -e 'print $Amon2::Auth::Site::LINE::VERSION'
Verify Fix Applied:
Verify that String::Random is configured to use a cryptographically secure RNG (like Crypt::URandom) instead of Perl's rand() function.
📡 Detection & Monitoring
Log Indicators:
- Repeated nonce values in authentication logs
- Multiple authentication attempts with similar nonce patterns
- Failed authentication attempts followed by successful ones with predictable nonce increments
Network Indicators:
- Unusual authentication request patterns to LINE OAuth endpoints
- Predictable nonce values in OAuth authorization requests
SIEM Query:
source="auth.log" AND ("nonce" AND (duplicate_values OR predictable_pattern))
🔗 References
- https://metacpan.org/release/SHLOMIF/String-Random-0.32/source/lib/String/Random.pm#L377
- https://metacpan.org/release/TANIGUCHI/Amon2-Auth-Site-LINE-0.04/source/lib/Amon2/Auth/Site/LINE.pm#L235
- https://metacpan.org/release/TANIGUCHI/Amon2-Auth-Site-LINE-0.04/source/lib/Amon2/Auth/Site/LINE.pm#L255
- https://security.metacpan.org/docs/guides/random-data-for-security.html