NCTF 南京邮电大学网络攻防训练平台 WriteUp

本文是NCTF南京邮电大学网络攻防训练平台的WriteUp,详细解析了Web部分的题目,包括签到题、MD5碰撞、文件包含、PHP解码等,涉及多种攻防技巧和漏洞利用方法,适合网络安全学习者参考。

NCTF 南京邮电大学网络攻防训练平台 WriteUp

不说什么直接上题解

WEB

1.签到题(50)

直接查看网页源码
这里写图片描述
Flag:nctf{flag_admiaanaaaaaaaaaaa}


2.md5 collision(50)

源码如下:

<?php
$md51 = md5('QNKCDZO');
$a = @$_GET['a'];
$md52 = @md5($a);
if(isset($a)){
if ($a != 'QNKCDZO' && $md51 == $md52) {
    echo "nctf{*****************}";
} else {
    echo "false!!!";
}}
else{
   
   echo "please input a";}
?>

重点在这里

if ($a != 'QNKCDZO' && $md51 == $md52) {
    echo "nctf{*****************}";


1.$a不等于'QNKCDZO'$a的MD5等于'QNKCDZO'的MD5
这想想也是不可能的事,此中必有蹊跷
2.观察发现md5('QNKCDZO')='0e830400451993494058024219903391'
3.在php中==号为弱比较'0e'开头剩下的全为数字不管数字是多少==恒成立
因为'0e***'==0

所以下一步的目的很明显制造开头为 ‘0e’ 的MD5字符串
字符串生成
这里将$a=s878926199a
得到flag:nctf{md5_collision_is_easy}


3.签到2(50)

网页源码如下:

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
尚未登录或口令错误<form action="./index.php" method="post">
    <p>输入框:<input type="password" value="" name="text1" maxlength="10"><br>
    请输入口令:zhimakaimen
    <input type="submit" value="开门">
</form>
</html>

重点在这

<p>输入框:<input type="password" value="" name="text1" maxlength="10"><br>
    请输入口令:zhimakaimen

输入的口令长度为11,而他html源码限制的长度为10

处理方法有两种:

  1. 利用浏览器自带插件,我这里用的是Firefox的hackbar插件,直接越过HTML代码直接进行post传递
    这里写图片描述
  2. 利用burpsuit工具直接在http头上稍作修改,只需将text1赋值为zhimakaimen即可
    这里写图片描述
    上述两种方法都能直接得到flag
    flag:nctf{follow_me_to_exploit}

4.这题不是WEB(100)

打开之后有个猫的图片
将猫图片下载至桌面
用txt打开此文档
发现如下:
这里写图片描述
最后为flag:nctf{photo_can_also_hid3_msg}


5.层层递进(100)

最讨厌脑洞题,拿着题不知道如何下手最后看了writeup才知道访问的URL:http://chinalover.sinaapp.com/web3/404.html
进去之后查看源码发现了如下代码:

<!--  
<script src="./js/jquery-n.7.2.min.js"></script>
<script src="./js/jquery-c.7.2.min.js"></script>
<script src="./js/jquery-t.7.2.min.js"></script>
<script src="./js/jquery-f.7.2.min.js"></script>
<script src="./js/jquery-{.7.2.min.js"></script>
<script src="./js/jquery-t.7.2.min.js"></script>
<script src="./js/jquery-h.7.2.min.js"></script>
<script src="./js/jquery-i.7.2.min.js"></script>
<script src="./js/jquery-s.7.2.min.js"></script>
<script src="./js/jquery-_.7.2.min.js"></script>
<script src="./js/jquery-i.7.2.min.js"></script>
<script src="./js/jquery-s.7.2.min.js"></script>
<script src="./js/jquery-_.7.2.min.js"></script>
<script src="./js/jquery-a.7.2.min.js"></script>
<script src="./js/jquery-_.7.2.min.js"></script>
<script src="./js/jquery-f.7.2.min.js"></script>
<script src="./js/jquery-l.7.2.min.js"></script>
<script src="./js/jquery-4.7.2.min.js"></script>
<script src="./js/jquery-g.7.2.min.js"></script>
<script src="./js/jquery-}.7.2.min.js"></script>
-->

这段代码一眼就看出flag的举手 handsup
flag:nctf{this_is_a_fl4g}


6.AAencode(100)

tips:javascript aaencode
aaencode是js加密的一种特别好玩,可以吧文字加密成表情
除了aaencode之外还有几种特别的加密方式

  • Perl的ppencode
  • Ruby的rrencode

编码连接如下:http://www.cnblogs.com/android-html5/archive/2011/02/09/2533784.html

AAencode 可以直接在chrome浏览器 的控制台console直接运行:
运行方式如图:

这里有console的好玩用法:http://www.cnblogs.com/Wayou/p/chrome-console-tips-and-tricks.html
总之console在这了可以执行js AAencode加密过的代码:
得到flag:nctf{javascript_aaencode}


7.单身二十年(100)

题目上说看手速,其实一开始用浏览器查看网络流发现如下:
这里写图片描述
看见了没!!!有个源文件 search_key.php!!!
接下来就是截获这个源文件了。。。。。
直接上burpsuit截获。上图
这里写图片描述
key is : nctf{yougotit_script_now}


8.你从哪里来(100)

are you from google?

一看就知道我要伪造从http://www.google.com/ 那里来
这里有篇博客写的就是http header的字段
这里面有个referer字段:HTTP Referer是header的一部分,当浏览器向web服务器发送请求的时候,一般会带上Referer,告诉服务器我是从哪个页面链接过来的,服务器藉此可以获得一些信息用于处理。
我们另Referer:https://www.google.com/
再burpsuit直接改就行
如下图:
这里写图片描述
拿到flag:nctf{http_referer}


9.php decode(100)

直接让解码,看看代码吧

<?php
function CLsI($ZzvSWE) {
    
    

    $ZzvSWE = gzinflate(base64_decode($ZzvSWE));

    for ($i = 0; $i < strlen($ZzvSWE); $i++) {

        $ZzvSWE[$i] = chr(ord($ZzvSWE[$i]) - 1);

    }

    return $ZzvSWE;

}eval(CLsI("+7DnQGFmYVZ+eoGmlg0fd3puUoZ1fkppek1GdVZhQnJSSZq5aUImGNQBAA=="));?>

eval 是个神奇的函数关于eval的链接在这
eval可以执行php代码所以我直接让他执行并输出修改代码如下:

echo CLsI("+7DnQGFmYVZ+eoGmlg0fd3puUoZ1fkppek1GdVZhQnJSSZq5aUImGNQBAA==");

放在php里直接运行,得出结果
flag:nctf{gzip_base64_hhhhhh}


10.文件包含(150)

这道题非常棒!!!让我学到了一个新的漏洞
文件包含漏洞先了解一下php://filter
php://filter 是一种元封装器, 设计用于数据流打开时的筛选过滤应用。
同时我也借此机会学到了文件读取的相关知识。

  • include “test.php”php文件包含,在执行流中插入写在其他文件中的有用的代码。读取的时候也是数据流形式,因此可以使用php://filter进行过滤,返回值为0,1。
  • readfile(“test.php”)是将文件以数据流的形式读取过来,并不会执行,但会在前台浏览器上进行解析。返回值是字节数多少。
  • file_get_contents(“test.php”)返回值为文本内容

    此题运用的就是关于数据流过滤的文件包含,我们一般在进行文件包含的时候都这么写include “test.php”获得的就是test.php直接解析出来。但如果运用readfile(“test.php”) 就不进行解析,导致无法在浏览器前台进行显示。那么问题来了看题

它让我点击它 我一下子就点了他!!!
出来了个这个URL

http://4.chinalover.sinaapp.com/web7/index.php?file=show.php

一看呵呵哒,典型的文件包含漏洞我们可以通过构造含有漏洞的语句,查看想要看的代码
file=php://filter/read=convert.base64-encode/resource=index.php
这里有个关于漏洞的详解
简单的重复一下他的意思
注解:
1.php://filter/可用于处理打开的数据流,起到过滤作用。如果源文件为.php则很有可能在前台显示不出来。
2.此时我们采用的方法是,先让文件转化为base64格式(convert.base64-encode)然后再输出,这样不论是什么格式的文件都可以在前台输出。
3.再次解码就可得到源代码,怎么样是不是很神奇啊!
看图片:
这里写图片描述
看见了base64编码!!
python解码就行啦,看图
这里写图片描述
flag:nctf{edulcni_elif_lacol_si_siht}


11 .单身一百年也没用(150)

上去直接查看请求头:
这里写图片描述
flag就在眼前nctf{this_is_302_redirect}
最简单的一道题


12 .Download~!(200)

查看页面源码:

    <p><a href="download.php?url=eGluZ3hpbmdkaWFuZGVuZy5tcDM=" target="_blank">星星点灯</a></p>
            <p><a href="download.php?url=YnV4aWFuZ3poYW5nZGEubXAz" target="_blank">不想长大</a></p>
发现了下载文件的URL
download.php?url=base64('文件名')
这里我没想到下载download.php。不过想想也是,这也没有其他文件了吧除了这个。果断转码base64('download.php')=ZG93bmxvYWQucGhw

URL=https://way.nuptzj.cn/web6/download.php?url=ZG93bmxvYWQucGhw

下载得到download.php代码,如下:

<?php
error_reporting(0);
include("hereiskey.php");
$url=base64_decode($_GET[url]);
if( $url=="hereiskey.php" || $url=="buxiangzhangda.mp3" || $url=="xingxingdiandeng.mp3" || $url=="download.php"){
    $file_size = filesize($url);
    header ( "Pragma: public" );
    header ( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
    header ( "Cache-Control: private", false );
    header ( "Content-Transfer-Encoding: binary" );
    header ( "Content-Type:audio/mpeg MP3");
    header ( "Content-Length: " . $file_size);
    header ( "Content-Disposition: attachment; filename=".$url)
### NCTF Web Challenges and Resources NCTF (National Cybersecurity Talent Competition) is a well-known competition that focuses on cybersecurity skills, including web security challenges. These challenges are designed to test participants' abilities in identifying vulnerabilities within web applications and exploiting them ethically. The website mentioned in the reference provides access to various Capture The Flag (CTF) competitions where contestants can engage with different types of challenges, such as web-based ones[^1]. Participants often encounter tasks involving SQL injection, cross-site scripting (XSS), command injection, insecure deserialization, and more advanced techniques like bypassing authentication mechanisms or exploiting server-side request forgery (SSRF). For those interested specifically in NCTF's web-related content, it’s recommended to explore past challenge archives from official sources when available. Additionally, there exist several platforms hosting similar CTF-style exercises which could serve as supplementary material: #### Example Code for Testing XSS Vulnerability Below demonstrates how one might check whether an input field allows reflected Cross-Site Scripting attacks. ```javascript // Simple payload used during testing phase alert('This shows potential vulnerability'); ``` Such scripts should only execute under conditions indicating improper sanitization processes at play—highlighting areas needing remediation efforts before deployment into production environments.
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值