Comments
PHP Hash Comparison Weakness A Threat To Websites, Researcher Says
Newest First  |  Oldest First  |  Threaded View
KGutzmann201
50%
50%
KGutzmann201,
User Rank: Apprentice
5/14/2015 | 11:35:37 AM
Re: One of These Things (Is Not Like the Others)
PHP programmers may want to consider using hexadecimal representations of the hashes [0-0a-f] and for comparison the PHP operator 'strcmp' or 'strcasecmp'.  These are 'binary-safe comparison' operators for string equality.  Return value is 0 for equal, and a negative or positive integer otherwise (indicating the less-than or greater-than relationship of the strings).
Christian Bryant
50%
50%
Christian Bryant,
User Rank: Ninja
5/9/2015 | 6:26:29 PM
One of These Things (Is Not Like the Others)
Josh Wright over at SANS pen-testing blog talked about this not long ago.  His assessment was that since SHA1 hashes are longer than MD5 hashes, the first step is to stop using MD5:  

"Since SHA1 hashes are longer than MD5 hashes, it is less likely that a randomly selected value will meet the 0 + e + digits rule for PHP to evaluate it as an exponential value. "  

Also, as noted here, PHP programmers may want to review their comparison operators tables and choose wisely, especially, as Josh notes, understanding the distinction between "==" and "===" in PHP; according to his sources as well, Josh notes the issue is not inherent in "===".

Now the question is, how many PHP have this issue buried in their code.  Getting some practical code examples of solid alternatives in PHP and some Python scripting to help find instances in your PHP where this is an issue would be great to share.

 


Register for Dark Reading Newsletters
Dark Reading Live EVENTS
INsecurity - For the Defenders of Enterprise Security
A Dark Reading Conference
While red team conferences focus primarily on new vulnerabilities and security researchers, INsecurity puts security execution, protection, and operations center stage. The primary speakers will be CISOs and leaders in security defense; the blue team will be the focus.
White Papers
Video
Cartoon Contest
Write a Caption, Win a Starbucks Card! Click Here
Latest Comment: No, no, no! Have a Unix CRON do the pop-up reminders!
Current Issue
Security Vulnerabilities: The Next Wave
Just when you thought it was safe, researchers have unveiled a new round of IT security flaws. Is your enterprise ready?
Flash Poll
The Impact of a Security Breach 2017
The Impact of a Security Breach 2017
Despite the escalation of cybersecurity staffing and technology, enterprises continue to suffer data breaches and compromises at an alarming rate. How do these breaches occur? How are enterprises responding, and what is the impact of these compromises on the business? This report offers new data on the frequency of data breaches, the losses they cause, and the steps that organizations are taking to prevent them in the future.
Slideshows
Twitter Feed
Dark Reading - Bug Report
Bug Report
Enterprise Vulnerabilities
From DHS/US-CERT's National Vulnerability Database
CVE-2017-0290
Published: 2017-05-09
NScript in mpengine in Microsoft Malware Protection Engine with Engine Version before 1.1.13704.0, as used in Windows Defender and other products, allows remote attackers to execute arbitrary code or cause a denial of service (type confusion and application crash) via crafted JavaScript code within ...

CVE-2016-10369
Published: 2017-05-08
unixsocket.c in lxterminal through 0.3.0 insecurely uses /tmp for a socket file, allowing a local user to cause a denial of service (preventing terminal launch), or possibly have other impact (bypassing terminal access control).

CVE-2016-8202
Published: 2017-05-08
A privilege escalation vulnerability in Brocade Fibre Channel SAN products running Brocade Fabric OS (FOS) releases earlier than v7.4.1d and v8.0.1b could allow an authenticated attacker to elevate the privileges of user accounts accessing the system via command line interface. With affected version...

CVE-2016-8209
Published: 2017-05-08
Improper checks for unusual or exceptional conditions in Brocade NetIron 05.8.00 and later releases up to and including 06.1.00, when the Management Module is continuously scanned on port 22, may allow attackers to cause a denial of service (crash and reload) of the management module.

CVE-2017-0890
Published: 2017-05-08
Nextcloud Server before 11.0.3 is vulnerable to an inadequate escaping leading to a XSS vulnerability in the search module. To be exploitable a user has to write or paste malicious content into the search dialogue.