南邮CTF自练

小白自练南邮平台的CTF, 借鉴了好多其他的writeup QAQ

W...Web

一、md5 collision

源代码

<?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";}
?>
1.MD5值的作用是防止伪造,对字符串的改动会引起MD5值的变化


$md51 = md5('QNKCDZO')的结果为0e830400451993494058024219903391
$md52的结果为a的md5值


2.php中==的弱类型,使其只要保证md52与md51匹配开头的0e即可

二、这题不是WEB

打开连接后保存gif图片,用IDA或txt打开,转化成二进制形式,在末尾找到flag,所以这是一道图片隐写题

三、层层递进

way1:用brupsuite截断,在httphistory中找到一个状态码为200(成功状态码)但链接中显示web/404.html的叛徒(这个得等很久。。),打开后查看源代码,看到竖着的flag

way2:右键看源代码,在<body>中找到

src="SO.html",点进去有出现一样的,再点进去(所谓层层递进),直到出现

src="404.html",点开后到一个瞎讲故事的网页,看源代码即可。


四、单身二十年

用brupsuite截断,在httphistory中找到search_key.php,在这个http页面的响应(response)中找到flag.

打开后查看源代码,看到


五、单身100年也没用

用火狐右键查看元素,在网络中打开状态为302的http包,在响应头中找到flag


六、phpdecode

把最后的eval改成echo运行一下,,,就出来了


七、文件包含

参考php中的文件包含漏洞

1.php://filter/可用于处理打开的数据流,起到过滤作用。如果源文件为.php则很有可能在前台显示不出来。 
2.先让文件转化为base64格式(convert.base64-encode)然后再输出,这样不论是什么格式的文件都可以在前台输出。 
3.再次解码就可得到源代码

通过构造含有漏洞的语句:file=php://filter/read=convert.base64-encode/resource=index.php 查看想看的代码(http://4.chinalover.sinaapp.com/web7/index.php?file=php://filter/read=convert.base64-encode/resource=index.php)

得到经过base64加密后的字符串去解密即可~)


八、Download~

查看页面源代码,看到

<p><a href="download.php?url=eGluZ3hpbmdkaWFuZGVuZy5tcDM=" target="_blank">星星点灯</a></p>
<p><a href="download.php?url=YnV4aWFuZ3poYW5nZGEubXAz" target="_blank">不想长大</a></p>
发现在下载链接中有一个download.php的东西,结合url后面的字符串是下载文件的base64加密字符串(可以试着将eGluZ3hpbmdkaWFuZGVuZy5tcDM= 解码,结果为xingxingdiandeng.mp3

因此,将download.php也用base64加密,得到的结果构造出一个下载链接   

http://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);
	echo(file_get_contents($url));
	exit;
}
else {
	echo "Access Forbidden!";
}
?>

在其中看到一个hereiskey.php的文件,用同样的方法将hereiskey.php用base64加密,构造下载链接                                        http://way.nuptzj.cn/web6/download.php?url=aGVyZWlza2V5LnBocA==,下载的php文件用记事本打开既得flag

九、COOKIE

用火狐的查看元素分析http,将里面的cookie=0改成=1再发送即可



十、Mysql

在url中打开robots.txt文件:http://chinalover.sinaapp.com/web11/robots.txt,看到一段php代码,发现其中需要进行sql注入,http://chinalover.sinaapp.com/web11/sql.php?id=1024.1



密码学

一、KeyBoard

奇奇怪怪的脑洞题,居然是根据字母在键盘上敲出的轨迹来得到结果,开始还一直在想置换。。。

ytfvbhn tgbgy hjuygbn yhnmki tgvhn uygbn uygbn yhnijm
a       r     e       u      h     a     c     k


二、base64全家桶

print (base64.b16decode(base64.b32decode(base64.b64decode('R1pDVE1NWlhHUTNETU4yQ0dZWkRNTUpYR00zREtNWldHTTJES1JSV0dJM0RDTlpUR1kyVEdNWlRHSTJVTU5SUkdaQ1RNTkJWSVkzREVOUlJHNFpUTU5KVEdFWlRNTjJF'))))

三、n次base64

说了用pyhton,就写一个循环不停解下去吧

s = '''#题目中的密文#'''
while True:
    s = base64.b64decode(s)
    print(s)







  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
sha碰撞,MD5碰撞实现,#!/usr/local/bin/perl # It was noted that Intel IA-32 C compiler generates code which # performs ~30% *faster* on P4 CPU than original *hand-coded* # SHA1 assembler implementation. To address this problem (and # prove that humans are still better than machines:-), the # original code was overhauled, which resulted in following # performance changes: # # compared with original compared with Intel cc # assembler impl. generated code # Pentium -25% +37% # PIII/AMD +8% +16% # P4 +85%(!) +45% # # As you can see Pentium came out as looser:-( Yet I reckoned that # improvement on P4 outweights the loss and incorporate this # re-tuned code to 0.9.7 and later. # ---------------------------------------------------------------- # Those who for any particular reason absolutely must score on # Pentium can replace this module with one from 0.9.6 distribution. # This "offer" shall be revoked the moment programming interface to # this module is changed, in which case this paragraph should be # removed. # ---------------------------------------------------------------- # $normal=0; push(@INC,"perlasm","../../perlasm"); require "x86asm.pl"; &asm_init($ARGV[0],"sha1-586.pl",$ARGV[$#ARGV] eq "386"); $A="eax"; $B="ecx"; $C="ebx"; $D="edx"; $E="edi"; $T="esi"; $tmp1="ebp"; $off=9*4; @K=(0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6); &sha1_block_data("sha1_block_asm_data_order"); &asm_finish(); sub Nn { local($p)=@_; local(%n)=($A,$T,$B,$A,$C,$B,$D,$C,$E,$D,$T,$E); return($n{$p}); } sub Np { local($p)=@_; local(%n)=($A,$T,$B,$A,$C,$B,$D,$C,$E,$D,$T,$E); local(%n)=($A,$B,$B,$C,$C,$D,$D,$E,$E,$T,$T,$A); return($n{$p}); } sub Na { local($n)=@_; return( (($n )&0x0f), (($n+ 2)&0x0f), (($n+ 8)&0x0f), (($n+13)&0x0f), (($n+ 1)&0x0f)); } sub X_expand { local($in)=@_; &comment("First, load the words onto the stack in network byte order"); for ($i=0; $i<16; $i+=2) { &mov($A,&DWP(($i+0)*4,$in,"",0));# unless $i == 0; &mov($B,&DWP(($i+1)*4,$in,"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值