BUUCTF 2018 Online Tool

本文介绍了在BUUCTF 2018 Online Tool挑战中,如何利用PHP的escapeshellarg()和escapeshellcmd()函数存在的问题进行命令注入,并详细阐述了攻击过程。作者通过分析代码,发现可以逃脱单引号的限制,结合nmap的-oG参数实现文件写入,最终成功找到flag。文章提醒读者重视命令行注入的练习和理解。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

BUUCTF 2018 Online Tool

前言

继续刷题,学习,为了成为黑岛的一名工具人而努力!

感谢大佬提供的环境:https://github.com/glzjin/buuctf_2018_online_tool

过程

搭好环境,打开网页,出现一堆代码

1
OK,首先代码审计…又是php,头大…

remote_addr和x_forwarded_for这两个是见的比较多的,服务器获取ip用的,这里没什么用

escapeshellarg()和escapeshellcmd() 没见过,百度

PHP escapeshellarg()+escapeshellcmd() 之殇

直接找到了上面这篇文章,这两个函数在一起用会有些问题

  1. 传入的参数是:172.17.0.2' -v -d a=1
  2. 经过escapeshellarg处理后变成了'172.17.0.2'\'' -v -d a=1',即先对单引号转义,再用单引号将左右两部分括起来从而起到连接的作用。
  3. 经过escapeshellcmd
### BUUCTF QR Challenge Overview BUUCTF is a Capture the Flag competition that includes various challenges, including those involving QR codes. For participants interested in engaging with BUUCTF's QR-related content, understanding both theoretical and practical aspects of QR code scanning and decoding can be beneficial. A useful resource for online QR code scanning is provided by an external website where users can upload images containing QR codes to extract their embedded information[^1]. This tool simplifies the process of interpreting encoded data within QR codes without requiring specialized software installation on local devices. In one specific instance from past competitions labeled as "BUUCTF qr 1," competitors were tasked with scanning a given QR code which revealed a cryptographic string upon successful interpretation. The solution format followed standard CTF conventions denoted as `flag{...}` encapsulating what appears to be either MD5 hash output or another form of obfuscated message representation depending on event rules at time of creation[^2]. For aspiring individuals looking forward towards participating similarly themed puzzles during future iterations; familiarity not only limited but extended beyond mere technical skills such areas like pattern recognition might prove advantageous when encountering more complex encryptions hidden inside these seemingly simple squares patterns we call Quick Response Codes today! ```python import qrcode def generate_qr(data="flag{878865ce73370a4ce607d21ca01b5e59}", filename='qr_code.png'): qr = qrcode.QRCode( version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=10, border=4, ) qr.add_data(data) qr.make(fit=True) img = qr.make_image(fill_color="black", back_color="white") img.save(filename) generate_qr() ```
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值