Skip to content
XSS Write-up Intermediate

How to hack a LTE Router? Just text it!

The router's SMS inbox view rendered received message text without escaping, so a text message containing markup would run as script when the owner opened the messages list. Combined with unprotected cookies and an unauthenticated backup/restore function, the author was able to take control of the device, including root shell access.

mateusz-msl-lach Follow

Published on medium.com

The ZTE MF258 router can be taken over by an unauthenticated user through an SMS payload. MF258 is LTE ODU/IDU router.

Mateusz Lach, on medium.com

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 SMS list view inserted message content into the page without HTML escaping, and the admin cookies lacked HttpOnly, Secure and SameSite flags.

Impact

An attacker who knows the router's number could run script in the owner's admin session and, by restoring a modified configuration, take over the device including root shell access; the exploit required the owner to open the SMS view.

What the attacker needed

Router phone number known; victim opens SMS messages view; no authentication needed

The fix

The vendor released patched firmware that began rolling out via FOTA update in January 2024.

How it was found

  1. Obtain the router's phone number and send it text messages containing the payload.
  2. Split the payload across several messages because each displayed message is limited to 35 characters.
  3. Send the messages in reverse order so they appear in the correct sequence in the inbox.
  4. Have the device owner open the SMS messages view, which triggers the stored script.
  5. Download the backup configuration file, which needs no authentication, and extract it as a gzip and tar archive.
  6. Edit the root password hash in the shadow file and the web panel auth file, then restore the modified configuration.

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.

A router that takes a SIM card can receive text messages, and its web admin page shows them in a list. If that page inserts the message text as if it were part of the page itself, a crafted message can make the browser run code written by the sender. Because the admin login cookie was not protected, that code could act as the logged-in owner and change the device settings.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.