Bug #843

Improvements to PHP's mt_rand RNG seeding

Added by Ryan Gordon almost 2 years ago. Updated over 1 year ago.

Status:Closed Start date:04/03/2010
Priority:Normal Due date:
Assignee:Ryan Gordon % Done:

100%

Category:-
Target version:-
Reproducibility:Rarely SQA assignments:
Reported In MyBB Version:1.4.11

Description

All random values generated in MyBB are predictable because PHP's RNG (random number generator) does not generate cryptographically secure random numbers.

For example, new activation code/password is created with mt_rand() and is therefore predictable from the outside (because mt_srand() is also used by MyBB or otherwise seeded internally in PHP)
Because it is predictable an attacker can just reset the password for any account and then login via an aided bruteforce attempt for the password.

Solution is so create our own cryptographically secure random number generator.


Related issues

related to MyBB Merge System - Bug #847: mt_rand to my_rand in Merge System Closed 04/04/2010

Associated revisions

Revision 4851
Added by Ryan Gordon almost 2 years ago

Fixes Improvements to PHP's mt_rand RNG seeding (fixes:843)

Revision 4864
Added by Ryan Gordon almost 2 years ago

Fixes Improvements to PHP's mt_rand RNG seeding (fixes:843)

Revision 4865
Added by Ryan Gordon almost 2 years ago

Fixes Improvements to PHP's mt_rand RNG seeding (fixes:843)

Revision 4868
Added by Ryan Gordon almost 2 years ago

Fixes Improvements to PHP's mt_rand RNG seeding (fixes:843)

Revision 4872
Added by Ryan Gordon almost 2 years ago

Improvements to PHP's mt_rand RNG seeding (improves:843)
Thanks to Stefan Esser for these improvements

Revision 4876
Added by Dennis Tsang almost 2 years ago

Removes PHP4 incompatibility in 1.4 branch from random number generator seed improvements (improves:843)

Revision 4882
Added by Dennis Tsang almost 2 years ago

Suppresses errors from hosts disabling getmypid (improves:843)

Revision 4887
Added by Ryan Gordon almost 2 years ago

Improvements to PHP's mt_rand RNG seeding (improves:843)
Thanks to Stefan Esser and Dennis Tsang for working on fixing the algorithm
Fixes Thread Subscriptions - Invalid Post Code (fixes:880)

Revision 4889
Added by Ryan Gordon almost 2 years ago

Improvements to PHP's mt_rand RNG seeding (improves:843)
openssl method significantly slows down board

Revision 4896
Added by Ryan Gordon almost 2 years ago

Improvements to PHP's mt_rand RNG seeding (improves:843)

History

Updated by Ryan Gordon almost 2 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

Applied in changeset r4851.

Updated by Ryan Gordon almost 2 years ago

Applied in changeset r4864.

Updated by Ryan Gordon almost 2 years ago

Applied in changeset r4865.

Updated by Ryan Gordon almost 2 years ago

Applied in changeset r4868.

Updated by Ryan Gordon almost 2 years ago

  • Target version changed from 1.6.0 Beta to 1.4.12

Updated by Huji Lee almost 2 years ago

  • Status changed from Resolved to Feedback

On my installation of MyBB 1.6 on Windows XP with PHP 5.2.6 on Apache, I get blank pages on newreply.php and some other pages with this error:

PHP Fatal error: Call to undefined method com::GetRandom() in F:\\SVN\\MyBB\\trunk\\inc\\functions.php on line 5905

Interestingly, the try..catch is not helping here either.

Updated by Ryan Gordon almost 2 years ago

  • Status changed from Feedback to Resolved

You're setup is screwed. It's definately a bug in PHP, not MyBB. I'm not going to worry about it here.

Updated by Dennis Tsang almost 2 years ago

  • Status changed from Resolved to Feedback

There are some issues with this fix.

Updated by Ryan Gordon almost 2 years ago

  • Status changed from Feedback to Resolved

Updated by Ryan Gordon almost 2 years ago

  • Project changed from MyBB to Security Issues
  • Category deleted (Other)
  • Target version deleted (1.4.12)

Updated by Ryan Gordon over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF