CVE-2021-4240: Phpservermon/phpservermon Insufficient Entropy Vulnerability

MODERATE
Advisory Identifier: GHSA-97w9-gcc7-vr8g
CVSS 5.3
CWE-1241 CWE-331 CWE-330
Published
Advisory Summary

CVE-2021-4240 is a MODERATE (CVSS 5.3) insufficient entropy vulnerability (CWE-1241: Use of Predictable Algorithm in Random Number Generator) affecting Phpservermon/phpservermon libraries in the Packagist ecosystem. The issue involves insufficient entropy in phpservermon prng. Remediation is available by upgrading affected packages to version 3.6.0.

CVE-2021-4240 at a Glance

CVE Identifier CVE-2021-4240
GHSA Identifier GHSA-97w9-gcc7-vr8g
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-1241: Use of Predictable Algorithm in Random Number Generator
Affected Product Phpservermon/phpservermon
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2021-4240

To remediate this vulnerability, upgrade all affected Phpservermon/phpservermon dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

phpservermon/phpservermon fixed: 3.6.0
Upgrade phpservermon/phpservermon to 3.6.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for phpservermon/phpservermon

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-4240, inspect your project dependencies for Phpservermon/phpservermon:

inspect dependencies for phpservermon/phpservermon

Analyze the terminal output to locate any version of Phpservermon/phpservermon in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.6.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1241: Use of Predictable Algorithm in Random Number Generator, where the device uses an algorithm that is predictable and generates a pseudo-random number. In Phpservermon/phpservermon, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

A vulnerability, which was classified as problematic, was found in phpservermon. This affects the function `generatePasswordResetToken` of the file `src/psm/Service/User.php`. The manipulation leads to use of predictable algorithm in random number generator. The exploit has been disclosed to the public and may be used. The name of the patch is 3daa804d5f56c55b3ae13bfac368bb84ec632193. It is recommended to apply a patch to fix this issue. The identifier VDB-213717 was assigned to this vulnerability.

CVE-2021-4240 Affected Phpservermon/phpservermon Versions

1 component(s)
Fixed Versions:
3.6.0
Product / Package Ecosystem Affected Versions Fixed Version
phpservermon/phpservermon
Packagist
< 3.6.0
3.6.0

References

Frequently Asked Questions

What is CVE-2021-4240?
CVE-2021-4240 is a security vulnerability in Phpservermon/phpservermon involving Insufficient Entropy in PHPServerMon PRNG under CWE-1241: Use of Predictable Algorithm in Random Number Generator.
Which Phpservermon/phpservermon versions are affected?
Affected versions include releases prior to 3.6.0 across affected packages: phpservermon/phpservermon.
What version fixes CVE-2021-4240?
Upgrading to 3.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is phpservermon/phpservermon affected?
Yes, phpservermon/phpservermon is affected in releases prior to 3.6.0. Upgrade your dependency to 3.6.0 or later.
What is the CVSS score of CVE-2021-4240?
CVE-2021-4240 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2021-4240?
CVE-2021-4240 is classified under CWE-1241: Use of Predictable Algorithm in Random Number Generator (The device uses an algorithm that is predictable and generates a pseudo-random number.).
How can I check Packagist dependencies for CVE-2021-4240?
Run the dependency tree command: 'inspect dependencies for phpservermon/phpservermon'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-97w9-gcc7-vr8g",
  "modified" : "2023-07-19T19:58:50Z",
  "published" : "2022-11-16T12:00:20Z",
  "aliases" : [ "CVE-2021-4240" ],
  "summary" : "Insufficient Entropy in PHPServerMon PRNG",
  "details" : "A vulnerability, which was classified as problematic, was found in phpservermon. This affects the function `generatePasswordResetToken` of the file `src/psm/Service/User.php`. The manipulation leads to use of predictable algorithm in random number generator. The exploit has been disclosed to the public and may be used. The name of the patch is 3daa804d5f56c55b3ae13bfac368bb84ec632193. It is recommended to apply a patch to fix this issue. The identifier VDB-213717 was assigned to this vulnerability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpservermon/phpservermon"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.6.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-4240"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/phpservermon/phpservermon/commit/3daa804d5f56c55b3ae13bfac368bb84ec632193"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/phpservermon/phpservermon"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.dev/bounties/2-phpservermon/phpservermon"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?id.213717"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1241", "CWE-330", "CWE-331" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-07-07T19:27:56Z",
    "nvd_published_at" : "2022-11-15T23:15:00Z"
  }
}