mkst / zte-config-utility

Scripts for decoding/encoding config.bin for ZTE routers
MIT License
235 stars 77 forks source link

ZXHN H267N router error #18

Closed skorokithakis closed 3 years ago

skorokithakis commented 3 years ago

When trying to decrypt the config.bin for ZXHN H267N, I get the following error:

Traceback (most recent call last):
  File "examples/decode.py", line 75, in <module>
    main()
  File "examples/decode.py", line 63, in main
    infile = zcu.encryption.aes_decrypt(infile, key, is_digi)
  File "/tmp/zte-config-utility/zcu/encryption.py", line 44, in aes_decrypt
    decrypted_data.write(aes_cipher.decrypt(encrypted_data.read()))
  File "/tmp/zte-config-utility/env/lib/python3.8/site-packages/pycryptodomex-3.10.1-py3.8-linux-x86_64.egg/Cryptodome/Cipher/_mode_ecb.py", line 196, in decrypt
    raise ValueError("Data must be aligned to block boundary in ECB mode")

Unfortunately, I'm not sure what could have led to unaligned data. I can send you the config.bin if there's a private way to do that.

811Alex commented 3 years ago

It's always useful to know what command you used, too. If you want me to take a look when I have the time, just tell me where I can contact you. I can't guarantee anything and you should know that config.bin has some sensitive info in it.

skorokithakis commented 3 years ago

I ended up finding the password in a forum, but I'd be glad to send you the config file (I think I still have it). You can contact me hi@stavros.io if you like!

811Alex commented 3 years ago

Is the one you found listed here?

skorokithakis commented 3 years ago

IIRC no, I remember looking. I can get you the password later if you want to add it.

811Alex commented 3 years ago

If it's not there, then that would help, yeah! It would also help if you could provide the exact signature, along with it. You can get that by using:

python3 examples/signature.py <your config.bin>
skorokithakis commented 3 years ago

The signature is:

12:24:29 $ python3 signature.py ~/Downloads/Sync/config.bin 
ZXHN H267N V1.0
skorokithakis commented 3 years ago

So it looks like the password is $Extra,ODP0ptiOns$987%, but this isn't a password issue, it crashes because of an alignment issue. It doesn't proceed past the first password tried.

811Alex commented 3 years ago

I'm fairy certain this is not your config.bin encryption key, but your root user password. If you're using the latest version, it should have said it's the wrong key though, so maybe that's something worth taking a look at. I think I'll just throw you an email for the config.bin, so I can run some tests.

skorokithakis commented 3 years ago

Ah, yes, I thought the two were the same, sorry. I've sent you my config.bin in case it helps, thanks!

811Alex commented 3 years ago

Could you try using your router's serial number instead of a key (with the --serial parameter)? or send it to my email if you want me to try instead