当前位置: 首页 > news >正文

PHP反序列化的CTF题目环境和做题复现第1集

1 通过post参数提交反序列信息

2 题目

http://192.168.1.8/fxl1/fxl1.php

<?php
highlight_file(__FILE__);class ezUnserialize{public $key;public function __destruct(){if($this->key == "FLAG"){include('flag.php');echo $flag;}}
}
unserialize($_POST['a']);
?>

3 EXP

<?php
<?php
class ezUnserialize{public $key;public function __construct($a){$this->key = $a;}
}
$obj = new ezUnserialize("FLAG");
echo serialize($obj);
?>

4 解题过程

4.0.1 在wsl的ubuntu上安装php环境

Step 1: Remove Existing PHP Versions
First, let’s clean up any existing PHP 7.x installations:sudo apt-get purge php7.*
sudo apt-get autoclean
sudo apt-get autoremove
Note about these commands:autoclean removes obsolete package files from your cache
autoremove removes dependencies that are no longer needed
Using purge removes both packages and their configuration files
Step 2: Add the PHP Repository
Ondřej Surý maintains up-to-date PHP packages for Ubuntu:sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
Step 3: Install PHP 7.3
Now install PHP 7.3 and common extensions:sudo apt-get install php7.3
Step 4: Configure Apache (if using Apache)
If you’re using Apache as your web server:# Disable old PHP module (if any)
sudo a2dismod php7.0  # or whatever version you had before# Enable PHP 7.3
sudo a2enmod php7.3
sudo systemctl restart apache2

4.0.2 /var/www/html配置普通账户可读可写可执行权限

(base) gpu3090@DESKTOP-8IU6393:~$ chown  gpu3090 /var/www/html
chown: changing ownership of '/var/www/html': Operation not permitted
(base) gpu3090@DESKTOP-8IU6393:~$ sudo chown  gpu3090 /var/www/html
(base) gpu3090@DESKTOP-8IU6393:~$ ls
M5-应用集成  anaconda3  cookies.txt  downloads  snap  summaries  tmpg00x95ve.mp3
(base) gpu3090@DESKTOP-8IU6393:~$

4.0.3 将题目代码和flag存放到/var/www/html/相应的位置

在这里插入图片描述

4.1 在vscode上运行上面的exp的php脚本

需要安装插件php debug 和php Server

在这里插入图片描述

4.2 vscode运行exp 的php脚本

在这里插入图片描述

4.3 通过hackbar的post功能提交

在这里插入图片描述

4.得到flag

flag{EzUns3ri4liZe_1s_g00d}

http://www.dtcms.com/a/334884.html

相关文章:

  • lesson40:PyMySQL完全指南:从基础到高级的Python MySQL交互
  • 【大语言模型 00】导读
  • 【Docker】Ubuntu上安装Docker(网络版)
  • 双指针和codetop复习
  • Hexo 双分支部署指南:从原理到 Netlify 实战
  • 【遥感图像技术系列】遥感图像风格迁移的研究进展一览
  • SymPy 矩阵到 NumPy 数组的全面转换指南
  • Redis 04 Reactor
  • eChart饼环pie中间显示总数_2个以上0值不挤掉
  • 【集合框架List进阶】
  • 【UHD】vivado 2021.1 编译
  • 选择式与生成式超启发算法总结
  • 模型训练监控:TensorBoard与Weights Biases (WB) 使用详解
  • CVE-2024-28752漏洞复现
  • 电子电气架构 --- 软件项目配置管理
  • 序列晋升7:架构原则三十诫
  • 内网穿透实战笔记 1panel 面板部署 frps,Windows 部署 frpc
  • 程序设计|C语言教学——C语言基础3:函数、数组、指针
  • Python虚拟环境与包管理工具(uv、Conda)
  • 一汽红旗7月销量37324辆 同比增长21.1%
  • B站 韩顺平 笔记 (Day 20)
  • P2169 正则表达式
  • 如何运用好DeepSeek为自己服务:智能增强的范式革命 1.1 认知增强的三次浪潮
  • 项目管理进阶——解读大型IT系统集成项目实施要点培训【附全文阅读】
  • GLM-4-Flash:智谱AI推出的首个免费API服务,支持128K上下文
  • 制作 Windows 11 启动U盘
  • Redis缓存
  • Win11和Win10共享打印机提示709用添加Windows凭据来解决的小方法
  • select、poll 和 epoll
  • Python入门第5课:如何定义和使用函数,提升代码复用性