Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • fusiondirectory fusiondirectory
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 33
    • Issues 33
    • List
    • Boards
    • Service Desk
    • Milestones
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • fusiondirectoryfusiondirectory
  • fusiondirectoryfusiondirectory
  • Issues
  • #5843
Closed
Open
Issue created Jun 05, 2018 by bmortier@bmortierMaintainer

Security: Insecure Generation of Random Tokens

Description

The random tokens for CSRF protection and password reset are generated by the method standAlonePage::generateRandomHash(). This method uses the insecure function mt_rand(). The output of this function is predictable and therefore not suitable for security purposes.

Instead of the insecure functions, random_bytes(), random_int() or the implementation for older PHP versions should be used.

Code Locations

  • https://gitlab.fusiondirectory.org/fusiondirectory/fd/blob/1.2.1-fixes/html/class_passwordRecovery.inc#L233
  • https://gitlab.fusiondirectory.org/fusiondirectory/fd/blob/1.3-dev/html/class_passwordRecovery.inc#L234
  • https://gitlab.fusiondirectory.org/fusiondirectory/fd/blob/1.4-dev/html/class_passwordRecovery.inc#L233

Distribution Name and Version

Found by source code analysis.

FusionDirectory Version

Identified in all current development and master branch.

PHP version used

Found by source code analysis.

Origin of php packages

Found by source code analysis.

Steps to Reproduce

The vulnerability was discovered by code analysis but not implemented specific for FusionDirectory. Generally, an attacker can predict the tokens when he gathers few tokens or calculates random tokens from known seeds. See this page for details. There's also a tool for exploitation of such issues.

Actual behavior:

Predictable tokens are generated for security purposes.

Reproduces how often: 100%

Additional Information

  • https://stackoverflow.com/questions/17362402/why-is-phps-mt-rand-not-cryptographically-secure
  • https://softwareengineering.stackexchange.com/questions/76229/predicting-the-output-of-phps-rand
Assignee
Assign to
Time tracking