Hackcon 2016 Writeup

この大会は2016/8/19 23:30(JST)~2016/8/21 3:30(JST)に開催されました。
今回もチームで参戦。結果は1051点で689チーム中40位でした。
自分で解けた問題をWriteupとして書いておきます。

Welcome to the game (1)

freenodeの##hackconに入る。

13:28 *topic : Hackcon 2016 - hackcon.in. First flag is HACKCON{GLHF}. Pwnie binary changed!
HACKCON{GLHF}

In Rainbows (150)

StegSolveでいろいろ見る。
少し色が違う部分を浮き上がらせる。

++++++++[>++++>++++++>++++++++>++++++++++>++++
++++++++<<<<<-]>
>>>>++++++++++++++++++++.---------------
.<++++++++.>+++++++++++++++.<+++++++.----------.<+++.-
-.>-------.++++++.+++++++++++.>--.<<<+++.+.>>+++++.-----
.>---------.++++++++++.<<<.>>.+++.>-.<-.++++++++.>----.<---
.<<<++++++++++..>>>>---.
[>]<[[-]<]

Brainfuck言語のようだ。
https://sange.fi/esoteric/brainfuck/impl/interp/i.html で実行してみると、フラグが表示された。

teXt_UCANT_r34d_is4_brainf**k

You Can't See Me (150)

apkを解凍し、classes.dexをjarに変換する。

>d2j-dex2jar.bat classes.dex
dex2jar classes.dex -> .\classes-dex2jar.jar

JD-GUIでclasses-dex2jar.jarを開いて、ソースコードを見てみる。

package com.mayank13059.theoracle;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity
{
  private String genLoginForm1()
  {
    Integer localInteger = Integer.valueOf(656);
    return Integer.valueOf(686964656).toString() + "c" + Integer.valueOf(696).toString() + "b" + Integer.valueOf(656163).toString() + Integer.valueOf(68616).toString() + "d" + localInteger.toString() + "c" + localInteger.toString() + "f6e";
  }

  private String genLoginForm2()
  {
    Integer localInteger = Integer.valueOf(696);
    return Integer.valueOf(6265).toString() + Integer.valueOf(66696).toString() + Integer.valueOf(57263656).toString() + "c" + localInteger.toString() + "b" + Integer.valueOf(65616).toString() + "c" + localInteger.toString() + "f6e";
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130968601);
    paramBundle = (TextView)findViewById(2131492970);
    TextView localTextView = (TextView)findViewById(2131492971);
    paramBundle.setText(genLoginForm1());
    localTextView.setText(genLoginForm2());
    setSupportActionBar((Toolbar)findViewById(2131492969));
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    getMenuInflater().inflate(2131558400, paramMenu);
    return true;
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    if (paramMenuItem.getItemId() == 2131492994)
      return true;
    return super.onOptionsItemSelected(paramMenuItem);
  }
}

genLoginForm1()とgenLoginForm2()に注目する。

genLoginForm1(): 686964656c696b65616368616d656c656f6eを返す。
genLoginForm2(): 62656669657263656c696b65616c696f6eを返す。

それぞれhexデコードする。

686964656c696b65616368616d656c656f6e → hidelikeachameleon
62656669657263656c696b65616c696f6e → befiercelikealion

結合した文字列がフラグだった。

hidelikeachameleonbefiercelikealion