Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

Application Security

MySQL Authentication Bypass Offers Lesson for Developers

Last month, a spotlight was put on a MySQL authentication bypass vulnerability that gave hackers a one out of 256 chance to gain access to the database regardless of whether or not they entered the wrong password. Versions of MariaDB were also affected by the bug, which Rapid7’s HD Moore at the time called “tragically comedic.” However, application firm Coverity said the situation also presents a learning opportunity for developers.

Last month, a spotlight was put on a MySQL authentication bypass vulnerability that gave hackers a one out of 256 chance to gain access to the database regardless of whether or not they entered the wrong password. Versions of MariaDB were also affected by the bug, which Rapid7’s HD Moore at the time called “tragically comedic.” However, application firm Coverity said the situation also presents a learning opportunity for developers.

According to Coverity CTO Andy Chou, one of the company’s engineers wrote a static analysis checker to find truncation of memcmp, strcmp and stmcmp return values or cases whether the return value was tested against constraints other than zero. After running the checker over 6,286 open source projects totaling more than 330 million lines of code, they found 15 other defects along the same lines of the one found in MySQL.

The packages examined by Coverity were versions of: Nmap, Nawm, Olsrd, Ncbi-tools, OpenBabel, Wine, Yersinia and Gambas. Each of the packages was from a Debian 5.0 distribution, and many of the issues have either been fixed or have a patch on the way. Still, developers can avoid these types of bugs altogether by not truncating the return value when it comes to using comparison functions like memcmp and strcmp, Chou argued in a blog post detailing the findings.

“These bugs are all caused by misunderstanding the behavior of functions that compare memory regions or strings,” he explained to SecurityWeek. “The problem is that the value returned from these comparison functions is sometimes misunderstood by developers, so they make mistakes like thinking these functions can return only -1, 0, or 1.  Or, they might think the return value can be safely cast to a smaller type such as char, but they don’t realize that the truncation of the value might result in two memory regions being considered equal when they aren’t.”

“If these memory regions represent password hashes, this can lead to a vulnerability like the one in MySQL (CVE-2012-2122),” he said.

Some of the bugs could be classified as integer truncation issues that result in authentication bypass, but the effect from a security standpoint depends on where the defect occurs in the code, he said. In most cases, Coverity found potential for program logic errors, but not actual security vulnerabilities.

The good news is these bugs are very rare, he said.

” We only found 16 defect instances in 330 million lines of code – that’s only one bug per 20 million lines of code,” Chou noted. “When they do make mistakes, they often think that these functions might only return -1, 0, or 1 because that’s actually true on some platforms. Unfortunately, it’s not true everywhere.”

Advertisement. Scroll to continue reading.
Written By

Marketing professional with a background in journalism and a focus on IT security.

Click to comment

Trending

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest threats, trends, and technology, along with insightful columns from industry experts.

Join the session as we discuss the challenges and best practices for cybersecurity leaders managing cloud identities.

Register

SecurityWeek’s Ransomware Resilience and Recovery Summit helps businesses to plan, prepare, and recover from a ransomware incident.

Register

Expert Insights

Related Content

Application Security

Cycode, a startup that provides solutions for protecting software source code, emerged from stealth mode on Tuesday with $4.6 million in seed funding.

Application Security

Virtualization technology giant VMware on Tuesday shipped urgent updates to fix a trio of security problems in multiple software products, including a virtual machine...

Application Security

Fortinet on Monday issued an emergency patch to cover a severe vulnerability in its FortiOS SSL-VPN product, warning that hackers have already exploited the...

Application Security

PayPal is alerting roughly 35,000 individuals that their accounts have been targeted in a credential stuffing campaign.

Application Security

GitHub this week announced the revocation of three certificates used for the GitHub Desktop and Atom applications.

Application Security

A CSRF vulnerability in the source control management (SCM) service Kudu could be exploited to achieve remote code execution in multiple Azure services.

Application Security

Drupal released updates that resolve four vulnerabilities in Drupal core and three plugins.