Use of mt_rand means there’s free .flac for those who crack
WAHckon Users of popular audiophile torrent site What.CD can make themselves administrators to completely compromise the private music site and bypass its notorious download ratio limits.
What.CD is the world’s most popular high quality music private torrent site that requires its users to pass an interview testing their knowledge of audio matters before they are granted an account. Users must maintain a high upload to download ratio to continue to download from the site.
A Wellington-New-Zelaand-based independent security researcher known as ss23 (@ss2342) says the site is using the mt_rand insecure random number generator in its otherwise secure and well-crafted Gazelle open source content management system.
The function has long been known as unfit for secure operations, and is indeed listed as such in PHP documentation, yet many sites still use mt_rand for creating user password reset tokens.
ss23 tested mt_rand and found What.CD uses the function for password resets.
He disclosed the vulnerability to the site administrators 12 months ago and was told it would be fixed soon.
ss23 gains offline access to a What.CD admin account.
Image Darren Pauli / The Register.
“They are using mt_rand straight into its password reset which is a textbook example of how not to use it,” the researcher told The Register at the WAHckon security conference in Perth, Saturday.
“I reported it a year ago, and they acknowledged it but said ‘don’t worry about it’.”
“If you have a user account, you could do all sorts of things as a What.CD admin if you wanted to; you could reset your ratios, assign and close accounts, or replace the whole site with d*cks.”
The researcher demonstrated in an offline replica of the What.CD site how a user could use existing mt_rand crackers to easily gain access to a password reset link for any user within minutes.
Attackers need to use a new PHP worker which can be obtained after the target site deploys a patch or reboots, or by sending a large number of requests.
The latter is preferred and is possible on large sites like What.CD and easy on small sites, ss23 says.
He said it was the only exploit he found in the Gazelle content management system which was otherwise secure.
He found content management systems Joomla and Silverstripe used secure functions in place of mt_rand, while WordPress fixed its layered but still insecure use of mt_rand last December, some 18 months after flaws in the code were first reported.
Attacking the latter system required more time but was possible since the layered security over the top of mt_rand were still each insecure.
Site admins can easily replace the function with a secure one in what is a 10-or-20-line fix. ®
Rise of the machines