LWN.net Logo

Security

A hole in crypt_blowfish

By Jake Edge
June 22, 2011

A longstanding bug that was recently found in the crypt_blowfish password hashing library highlights the problems that can occur when a bug is found in a widely used low-level library. Because crypt_blowfish has been around for so long (this bug is said to go back to 1998 or possibly 1997), it has been used by various other packages (PHP for example) as well as some Linux distributions. The security impact is not likely to be huge, because it only affects passwords with somewhat uncommon characteristics, but the impact on those who have stored hashed passwords generated using the library may be a bit more painful.

Password hashing is a standard technique that is used by authentication mechanisms (for logging into a system or web application for example), so that the plaintext password does not need to be stored. Instead, something derived from the plaintext password is stored. Typically, one-way cryptographic hash functions like SHA-1 or the Blowfish cipher are used for that purpose. When the user presents the password, the same function is applied to that input and compared to what is stored. The idea is that even if an attacker gets access to the password database, they would need to "crack" the hashed values stored there. As its name implies, crypt_blowfish implements password hashing based on Blowfish.

The bug itself is quite simple, and the change to fix it will likely make the problem obvious to C programmers:

Oops. In BF_std.c: BF_std_set_key(), change:
    tmp |= *ptr;
to:
    tmp |= (unsigned char)*ptr;
Basically, it is a sign-extension bug. For those who aren't C hackers, a bit of explanation may be in order. When the byte value stored at *ptr has its high bit set, it is treated as a negative number. So, before the value gets boolean ORed with tmp (which is an unsigned int), it gets promoted to a 4-byte value and sign-extended, so a byte value like 0x80 becomes 0xffffff80. As one might guess, ORing the latter where the former is expected gives incorrect results.

The problem was actually discovered in the John the Ripper (JtR) password cracking program. As part of creating a test suite, "magnum" was attempting to crack a password that consisted of a single non-ASCII character (£ or 0xa3), which was hashed using a library other than crypt_blowfish. Because JtR and crypt_blowfish share their implementation of the Blowfish encryption algorithm, tests using both would pass, but independent implementations would generate the correct hash, thus failing to match what was generated by JtR.

JtR and crypt_blowfish developer Alexander Peslyak (aka Solar Designer) analyzed the effects of the bug and found that some password pairs would hash to the same value with only minimal differences (e.g. "ab£" hashed to the same value as "£"), which would make password cracking easier. A further analysis shows that some characters appearing just before one with the high bit set may be effectively ignored when calculating the hash. That would mean that a simpler password than that given by the user could be used and would still be considered valid—a significant weakening of the user's password.

It should be noted that Solar Designer has been very forthcoming with details of the problem and its effects. His CVE request is quite detailed, and he takes full responsibility for the error. Other projects who find security holes in their code would do well to follow his lead here.

There is no real problem for JtR, as it can get the updated code so that it can crack passwords with high-bit-set characters in them. In addition, it could continue to use the broken code to crack passwords that were hashed incorrectly. But for applications that use crypt_blowfish, it's a different story. Passwords with the high bit set may be fairly uncommon—at least for sites with typically ASCII-only users—but there is no easy way to determine whether stored hashes are invalid or not.

The safest solution for administrators with potentially bad password hashes (which could include those running Openwall Linux (Owl), SUSE, and ALT Linux which can use crypt_blowfish for hashing the password database) is to invalidate all passwords and have their users input new ones. That could prove to be a logistical nightmare, however, depending on how easily, and securely, users can set new passwords without authenticating with their existing password. Requiring that users change their existing passwords after logging in is an alternative, but one that might give attackers a window in which to operate. It also leaves passwords unchanged for any users that do not log in.

The risks of attackers using this flaw to log in to a site are likely to be fairly small, but they do exist. If a site's login process is susceptible to brute force attacks, this bug makes it somewhat easier to do so, at least for specific password types. On the other hand, if the password database has been exposed, and some passwords were not crackable (at least for attackers using cracking programs other than JtR), this information would give them the means to crack those passwords. In the end analysis, it is an exploitable hole, but not the kind to send administrators into panic mode.

It is somewhat amazing that this bug has existed for 13+ years in a fairly widely used library. Up until now, no one has tested it in this way, at least publicly, which should serve as something of a warning to those who are using well-established software, both free and proprietary. With free software (crypt_blowfish has been placed into the public domain which may be a bit legally murky but is in keeping with free software ideals) there are more and easier opportunities to examine and test the code, but that's only effective if the testing is actually done.

There are, without doubt, bugs still lurking in various security-oriented libraries that we depend on every day, so testing those libraries (as well as code that is not being used for security purposes) regularly and systematically can only help find them. While it took more than a decade for this bug to come to light, it's worth pointing out that it certainly could have been discovered by others in the interim. Attackers clearly do their own testing, and are generally not inclined to release their results. That may not be the case here, but one should always recognize that public disclosure of a vulnerability is not necessarily tied to its discovery.

Comments (54 posted)

Brief items

Security quotes of the week

Firefox 4 should be treated as a member of the new breed in that regard, and have 5 as its security update.

Actually, we are prolonging the security support for 4 and later, it's not just a minimum of six months any more, now it's "forever", just that the security updates always bring features and a new "version" as well. ;-)

-- Robert Kaiser

I drafted a very short message (perhaps the first was too long?) and sent it to the four, once again from their own accounts: Really wasn't kidding about the insecurity thing. I won't send another message after this -- it's up to you to take your security seriously. You're at the [XYZ Street] Starbucks on an insecure connection, and absolutely anyone here can access your account with the right (free) tool.

Twenty minutes passed, and all four were still actively using Facebook.

-- Gary LosHuertos runs an experiment with Firesheep

Having known about this problem since 2003, a "fix" was applied in 2010 for firefox 4 which attempts to identify credit card numbers in forms and not store them in the form history. Great, now what about all the other data it is storing some of which is just as sensitive as credit card numbers, if not more so ? If credit card details get mis-used, liability is usually on the credit card company, but not so for social security numbers, bank account numbers, etc...
-- Daniel P. Berrangé looks into Firefox's form data storage

Bitcoin raises untested legal concerns related to securities law, the Stamp Payments Act, tax evasion, consumer protection and money laundering, among others. And that's just in the U.S. While EFF is often the defender of people ensnared in legal issues arising from new technologies, we try very hard to keep EFF from becoming the actual subject of those fights or issues. Since there is no caselaw on this topic, and the legal implications are still very unclear, we worry that our acceptance of Bitcoins may move us into the possible subject role.
-- EFF stops accepting Bitcoin donations

Yesterday we made a code update at 1:54pm Pacific time that introduced a bug affecting our authentication mechanism. We discovered this at 5:41pm and a fix was live at 5:46pm. A very small number of users (much less than 1 percent) logged in during that period, some of whom could have logged into an account without the correct password. As a precaution, we ended all logged in sessions.
-- Dropbox drops authentication for a few hours

Comments (9 posted)

The story behind the mysterious CyanogenMod update

A group called Lookout Mobile Security has put out an alert regarding malware which is targeting custom Android builds. "The application follows the common pattern of masquerading as a legitimate application, though a few extra permissions have been added. At first glance, it appears like other recent Android Trojans that tries to take control over the mobile phone by rooting the phone (breaking out of the Android security container), but instead jSMSHider exploits a vulnerability found in the way most custom ROMs sign their system images. The issue arises since publicly available private keys in the Android Open Source Project (AOSP) are often used to sign the custom ROM builds. In the Android security model, any application signed with the same platform signer as the system image can request permissions not available to normal applications, including the ability to install or uninstall applications without user intervention." This, it seems, is the vulnerability closed by the May 2011 CyanogenMod security update. (Seen on The H).

Comments (50 posted)

New vulnerabilities

ffmpeg mplayer: arbitrary code execution

Package(s):ffmpeg mplayer CVE #(s):CVE-2011-1931
Created:June 21, 2011 Updated:September 20, 2011
Description: From the Pardus advisory:

A vulnerability has been fixed in ffmpeg, which can be result in an out of array write and potentially arbitrary code execution.

Alerts:
Ubuntu USN-1209-2 2011-09-19
Ubuntu USN-1209-1 2011-09-19
Pardus 2011-87 2011-06-21

Comments (none posted)

groff: insecure tmp file usage

Package(s):groff CVE #(s):CVE-2009-5044
Created:June 16, 2011 Updated:June 8, 2012
Description:

From the openSUSE advisory:

groff created temporary files in an insecure way. Local attackers could potentially exploit that to overwrite files of other users.

Alerts:
openSUSE openSUSE-SU-2011:0642-1 2011-06-16
Fedora FEDORA-2012-8590 2012-06-07
Fedora FEDORA-2012-8596 2012-06-07
Fedora FEDORA-2012-8577 2012-06-07
Mageia MGASA-2012-0164 2012-07-14
Mandriva MDVSA-2013:085 2013-04-09
Mandriva MDVSA-2013:086 2013-04-09

Comments (none posted)

kernel: multiple vulnerabilities

Package(s):kernel CVE #(s):CVE-2011-1768 CVE-2011-2182
Created:June 20, 2011 Updated:March 7, 2012
Description: From the Debian advisory:

CVE-2011-1768: Alexecy Dobriyan reported an issue in the IP tunnels implementation. Remote users can cause a denial of service by sending a packet during module initialization.

CVE-2011-2182: Ben Hutchings reported an issue with the fix for CVE-2011-1017 that made it insufficient to resolve the issue.

Alerts:
Oracle ELSA-2011-2037 2011-12-15
Ubuntu USN-1271-1 2011-11-21
Ubuntu USN-1256-1 2011-11-09
Ubuntu USN-1268-1 2011-11-21
Debian DSA-2310-1 2011-09-22
SUSE SUSE-SU-2011:1058-1 2011-09-21
SUSE SUSE-SA:2011:040 2011-09-20
Red Hat RHSA-2011:1253-01 2011-09-12
Debian DSA-2303-2 2011-09-10
Debian DSA-2303-1 2011-09-08
SUSE SUSE-SU-2011:0899-1 2011-08-12
SUSE SUSE-SA:2011:034 2011-08-12
openSUSE openSUSE-SU-2011:0861-1 2011-08-02
openSUSE openSUSE-SU-2011:0860-1 2011-08-02
SUSE SUSE-SU-2011:0832-1 2011-07-25
SUSE SUSE-SA:2011:031 2011-07-25
Scientific Linux SL-kern-20110712 2011-07-12
Red Hat RHSA-2011:0928-01 2011-07-12
Debian DSA-2264-1 2011-06-18
Ubuntu USN-1383-1 2012-03-06
Ubuntu USN-1390-1 2012-03-06
Ubuntu USN-1392-1 2012-03-07
Ubuntu USN-1394-1 2012-03-07

Comments (none posted)

klibc: command injection

Package(s):klibc CVE #(s):CVE-2011-1930
Created:June 21, 2011 Updated:June 22, 2011
Description: From the Pardus advisory:

A vulnerability has been fixed in klibc, which allows attackers to injection command.

Alerts:
Pardus 2011-86 2011-06-21

Comments (none posted)

libvirt: arbitrary host file access

Package(s):libvirt CVE #(s):CVE-2011-2178
Created:June 16, 2011 Updated:July 12, 2011
Description:

From the openSUSE advisory:

A regression re-introduced automatic disk probing again which potentially allowed to uses to access arbitrary files (CVE-2011-2178).

Alerts:
Fedora FEDORA-2011-9091 2011-07-06
Ubuntu USN-1152-1 2011-06-16
openSUSE openSUSE-SU-2011:0643-1 2011-06-16
Gentoo 201202-07 2012-02-27

Comments (none posted)

libxml2: code execution

Package(s):libxml2 CVE #(s):CVE-2011-1944
Created:June 16, 2011 Updated:March 1, 2013
Description:

From the Ubuntu advisory:

Chris Evans discovered that libxml2 incorrectly handled memory allocation. If an application using libxml2 opened a specially crafted XML file, an attacker could cause a denial of service or possibly execute code as the user invoking the program.

Alerts:
Scientific Linux SL-libx-20111206 2011-12-06
Red Hat RHSA-2011:1749-03 2011-12-06
Gentoo 201110-26 2011-10-26
Mandriva MDVSA-2011:131-1 2011-10-09
Mandriva MDVSA-2011:131 2011-09-05
openSUSE openSUSE-SU-2011:0839-1 2011-07-26
Fedora FEDORA-2011-7856 2011-06-03
Fedora FEDORA-2011-7820 2011-06-03
Ubuntu USN-1153-1 2011-06-16
Red Hat RHSA-2012:0017-01 2012-01-11
CentOS CESA-2012:0017 2012-01-11
Scientific Linux SL-libx-20120112 2012-01-12
Oracle ELSA-2012-0017 2012-01-12
Oracle ELSA-2012-0324 2012-03-09
Oracle ELSA-2012-1288 2012-09-18
Oracle ELSA-2012-1288 2012-09-18
Fedora FEDORA-2012-13820 2012-09-26
Fedora FEDORA-2012-13824 2012-09-27
Red Hat RHSA-2013:0217-01 2013-01-31
CentOS CESA-2013:0217 2013-02-01
Oracle ELSA-2013-0217 2013-02-01
Scientific Linux SL-ming-20130201 2013-02-01
Oracle ELSA-2013-0581 2013-03-01

Comments (none posted)

moodle: multiple vulnerabilities

Package(s):moodle CVE #(s):
Created:June 16, 2011 Updated:June 22, 2011
Description:

From the Debian advisory:

MSA-11-0011 Multiple cross-site scripting problems in media filter

MSA-11-0015 Cross Site Scripting through URL encoding

MSA-11-0013 Group/Quiz permissions issue

Alerts:
Debian DSA-2262-1 2011-06-15

Comments (none posted)

movabletype-opensource: multiple vulnerabilities

Package(s):movabletype-opensource CVE #(s):
Created:June 17, 2011 Updated:December 30, 2011
Description: From the Debian advisory:

It was discovered that Movable Type, a weblog publishing system, contains several security vulnerabilities:

A remote attacker could execute arbitrary code in a logged-in users' web browser.

A remote attacker could read or modify the contents in the system under certain circumstances.

Alerts:
Debian DSA-2263-2 2011-12-30
Debian DSA-2263-1 2011-06-16

Comments (none posted)

Mozilla products: multiple vulnerabilities

Package(s):firefox CVE #(s):CVE-2011-2374 CVE-2011-2375 CVE-2011-2373 CVE-2011-2377 CVE-2011-2371 CVE-2011-2366 CVE-2011-2367 CVE-2011-2368 CVE-2011-2370 CVE-2011-2369 CVE-2011-2364 CVE-2011-0083 CVE-2011-2362 CVE-2011-0085 CVE-2011-2363 CVE-2011-2365 CVE-2011-2376
Created:June 22, 2011 Updated:July 23, 2012
Description: The firefox, thunderbird, and seamonkey teams have issued updated versions of their products to address a long list of "critical" security vulnerabilities. See the firefox 3.6.18, and firefox 5 "fixed vulnerability" lists for more.
Alerts:
CentOS CESA-2011:0888 2011-08-14
CentOS CESA-2011:0887 2011-08-14
CentOS CESA-2011:0885 2011-08-14
Ubuntu USN-1150-1 2011-07-15
Slackware SSA:2011-195-02 2011-07-15
Fedora FEDORA-2011-8647 2011-06-24
Fedora FEDORA-2011-8647 2011-06-24
Fedora FEDORA-2011-8647 2011-06-24
Fedora FEDORA-2011-8647 2011-06-24
Fedora FEDORA-2011-8647 2011-06-24
Fedora FEDORA-2011-8647 2011-06-24
Fedora FEDORA-2011-8647 2011-06-24
Fedora FEDORA-2011-8647 2011-06-24
Debian DSA-2273-1 2011-07-06
SUSE SUSE-SA:2011:028 2011-07-05
Debian DSA-2269-1 2011-07-01
Debian DSA-2268-1 2011-07-01
SUSE SUSE-SU-2011:0727-1 2011-07-01
openSUSE openSUSE-SU-2011:0724-1 2011-07-01
Ubuntu USN-1149-2 2011-06-29
Fedora FEDORA-2011-8627 2011-06-24
Fedora FEDORA-2011-8627 2011-06-24
Fedora FEDORA-2011-8627 2011-06-24
Fedora FEDORA-2011-8627 2011-06-24
Fedora FEDORA-2011-8627 2011-06-24
Fedora FEDORA-2011-8627 2011-06-24
Fedora FEDORA-2011-8627 2011-06-24
Fedora FEDORA-2011-8627 2011-06-24
Slackware SSA:2011-174-01 2011-06-27
Ubuntu USN-1157-3 2011-06-23
CentOS CESA-2011:0887 2011-06-22
CentOS CESA-2011:0885 2011-06-22
Red Hat RHSA-2011:0885-01 2011-06-21
Red Hat RHSA-2011:0886-01 2011-06-21
Red Hat RHSA-2011:0887-01 2011-06-21
Red Hat RHSA-2011:0888-01 2011-06-21
Mandriva MDVSA-2011:111 2011-06-22
Ubuntu USN-1149-1 2011-06-22
Ubuntu USN-1157-2 2011-06-22
Scientific Linux SL-fire-20110621 2011-06-21
Scientific Linux SL-seam-20110621 2011-06-21
Scientific Linux SL-thun-20110621 2011-06-21
Scientific Linux SL-thun-20110621 2011-06-21
Ubuntu USN-1157-1 2011-06-22
Mageia MGASA-2012-0176 2012-07-21
Gentoo 201301-01 2013-01-07

Comments (none posted)

nagios: cross-site scripting

Package(s):nagios3 CVE #(s):CVE-2011-1523 CVE-2011-2179
Created:June 16, 2011 Updated:April 2, 2012
Description:

From the Ubuntu advisory:

Stefan Schurtz discovered than Nagios did not properly sanitize its input when processing certain requests, resulting in cross-site scripting (XSS) vulnerabilities. With cross-site scripting vulnerabilities, if a user were tricked into viewing server output during a crafted server request, a remote attacker could exploit this to modify the contents, or steal confidential data, within the same domain.

Alerts:
openSUSE openSUSE-SU-2011:0836-1 2011-07-25
openSUSE openSUSE-SU-2011:0833-1 2011-07-25
Ubuntu USN-1151-1 2011-06-15
Mandriva MDVSA-2012:049 2012-04-02

Comments (none posted)

pam_ssh: privilege escalation

Package(s):pam_ssh CVE #(s):
Created:June 21, 2011 Updated:June 22, 2011
Description: From the Red Hat bugzilla:

It was found that pam_ssh, PAM module for use with SSH keys and ssh-agent, did not properly drop root SGID privileges prior executing the ssh-agent authentication agent. A local attacker could use this flaw to potentially escalate their privileges.

Alerts:
Fedora FEDORA-2011-8006 2011-06-08
Fedora FEDORA-2011-8036 2011-06-08
Fedora FEDORA-2011-8022 2011-06-08

Comments (none posted)

php: code execution

Package(s):php5 CVE #(s):CVE-2011-1938
Created:June 16, 2011 Updated:August 25, 2011
Description:

From the Novell bug database:

Stack-based buffer overflow in the socket_connect function in ext/sockets/sockets.c in PHP 5.3.3 through 5.3.6 might allow context-dependent attackers to execute arbitrary code via a long pathname for a UNIX socket.

Alerts:
Oracle ELSA-2011-1423 2011-11-03
Oracle ELSA-2011-1423 2011-11-03
Scientific Linux SL-NotF-20111102 2011-11-02
Mandriva MDVSA-2011:165 2011-11-03
CentOS CESA-2011:1423 2011-11-03
Red Hat RHSA-2011:1423-01 2011-11-02
Ubuntu USN-1231-1 2011-10-18
Gentoo 201110-06 2011-10-10
Fedora FEDORA-2011-11537 2011-08-26
Fedora FEDORA-2011-11528 2011-08-26
Fedora FEDORA-2011-11537 2011-08-26
Fedora FEDORA-2011-11528 2011-08-26
Fedora FEDORA-2011-11537 2011-08-26
Fedora FEDORA-2011-11528 2011-08-26
Slackware SSA:2011-237-01 2011-08-25
Pardus 2011-88 2011-06-21
openSUSE openSUSE-SU-2011:0645-1 2011-06-16
Debian DSA-2399-1 2012-01-31
Mandriva MDVSA-2012:071 2012-05-10
Oracle ELSA-2012-1046 2012-06-30

Comments (none posted)

SUSE Manager: multiple vulnerabilities

Package(s):SUSE Manager CVE #(s):CVE-2009-4139 CVE-2011-1594
Created:June 20, 2011 Updated:June 22, 2011
Description: From the SUSE advisory:

CVE-2009-4139: A cross-site request forgery (CSRF) attack can be used to execute web-actions within the SUSE Manager web user interface with the privileges of the attacked user.

CVE-2011-1594: Open Redirect bug at the login page (Phishing)

  • using secure SSL ciphersuites only
  • added a "password strength meter"
Alerts:
SUSE SUSE-SU-2011:0653-1 2011-06-20

Comments (none posted)

SUSE Manager Proxy: insecure SSL settings

Package(s):SUSE Manager Proxy CVE #(s):
Created:June 20, 2011 Updated:June 22, 2011
Description: From the SUSE advisory:

This security update of SUSE Manger Proxy improves the SSL cipher suite setting to only allow secure SSLCipher and SSLProtocols.

Alerts:
SUSE SUSE-SU-2011:0648-1 2011-06-20

Comments (none posted)

torque: remote code execution

Package(s):torque CVE #(s):CVE-2011-2193
Created:June 21, 2011 Updated:September 5, 2012
Description: From the Red Hat bugzilla:

Torque server does not check the length of the "job name" argument before using it - this string is verified only on the client side. It is possible to use a modified Torque client or DRMAA interface to submit a job with an arbitrary chosen job name in terms of length and content. Thus, it is possible for the attacker to overflow buffer and overwrite some Torque server process internal data causing its specific behavior.

Note that this data overwriting could lead to remote code execution.

Alerts:
Debian DSA-2329-1 2011-10-27
Fedora FEDORA-2011-8072 2011-06-10
Fedora FEDORA-2011-8117 2011-06-10
Mageia MGASA-2012-0254 2012-09-04

Comments (none posted)

unixODBC: buffer overflow

Package(s):unixODBC CVE #(s):CVE-2011-1145
Created:June 20, 2011 Updated:June 22, 2011
Description: From the openSUSE advisory:

Specially crafted reply of a malicious server could overflow a buffer in unixODBC

Alerts:
openSUSE openSUSE-SU-2011:0655-1 2011-06-20

Comments (none posted)

Page editor: Jake Edge
Next page: Kernel development>>

Copyright © 2011, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds