Ewon Flexy IoT Router. A Deep dive
The Ewon Flexy industrial router stored user passwords and VPN private keys in its configuration using a weak custom XOR-based scheme with a hardcoded key, and the firmware image was encrypted with Blowfish using a key hardcoded in the device binary. An attacker who obtained the encrypted configuration data, for example via cross-site scripting or default credentials, could decrypt other users' passwords and VPN keys and join existing VPN connections.
pentestpartners.com
Published on pentestpartners.com
First off I would like to thank the techs at PTP for their insights and help during this process. I know what I know, and I don’t know what I don’t know, so I asked for help sometimes.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the device used a home-grown, reversible obfuscation scheme (XOR with a hardcoded key) for stored secrets and a hardcoded Blowfish key for firmware, rather than proper key management.
Impact
An attacker with access to the encrypted configuration data could recover other users' passwords and VPN private keys and use them to join existing VPN connections; the vendor argued authentication was required, but the device also used default credentials and plain HTTP with XSS.
What the attacker needed
Access to encrypted config data; or default adm:adm credentials; or XSS to steal credentials
The fix
The device should use proper encryption with keys not stored on the device, enforce HTTPS, and prevent default credentials from being accepted.
How it was found
- Add a test user with a short password and observe the stored encrypted value
- Change the password character by character and compare the encrypted outputs to see the pattern
- Guess that the scheme is per-character XOR and brute-force the key with CyberChef and then a Python script
- Apply the recovered key to the original admin password and to the stored VPN private certificate data
- Configure a VPN connection using the recovered private key and password to confirm it works
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This router keeps sensitive things like passwords and VPN keys in its settings files, but scrambles them first so they look unreadable. The researcher found that the scrambling was very weak and the secret needed to unscramble it was built into the device itself, so anyone who got hold of the scrambled data could turn it back into readable secrets. Separately, the router's web login used a basic scheme over plain unencrypted HTTP, so credentials could be captured in transit.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.