This challenge wasn't solved by me but +winesap during the competition.
I do this challenge off-line and the exploit has been confirmed by +winesap will work.
game
├── binaryData
│ ├── 1__el_-__-_--.bin
│ ├── 2__el_-__--__.bin
│ ├── 3__el_-_-___-.bin
│ ├── 4__el_-__--_-.bin
│ ├── 5__el_-__---_.bin
│ ├── 6__el_-__----.bin
│ ├── 7__el_-___--_.bin
│ └── 8__el_-__-__.bin
├── frames
│ ├── 1.png
│ └── 2.png
├── scripts
│ ├── KCS___Main.as
│ ├── mx
│ │ └── core
│ │ ├── ByteArrayAsset.as
│ │ ├── IFlexAsset.as
│ │ └── mx_internal.as
│ ├── §_el_-----_§.as
│ ├── §_el_--_--_§.as
│ ├── §_el_-_-___-§.as
│ ├── §_el_-_-____§.as
│ ├── §_el_-__----§.as
│ ├── §_el_-__---_§.as
│ ├── §_el_-__--_-§.as
│ ├── §_el_-__--__§.as
│ ├── §_el_-__-_--§.as
│ ├── §_el_-__-__§.as
│ ├── §_el_-__-_§.as
│ ├── §_el_-___--_§.as
│ └── §_el_-____-§.as
└── symbols.csv
package
{
import mx.core.ByteArrayAsset;
public class §_el_-___--_§ extends ByteArrayAsset
{
public function §_el_-___--_§()
{
super();
}
}
}
$ file * 1__el_-__-_--.bin: JPEG image data, JFIF standard 1.01 2__el_-__--__.bin: PNG image data, 50 x 50, 8-bit/color RGBA, non-interlaced 3__el_-_-___-.bin: PNG image data, 50 x 50, 8-bit/color RGBA, non-interlaced 4__el_-__--_-.bin: PNG image data, 50 x 50, 8-bit/color RGBA, non-interlaced 5__el_-__---_.bin: XML document text 6__el_-__----.bin: PNG image data, 50 x 50, 8-bit/color RGBA, non-interlaced 7__el_-___--_.bin: data 8__el_-__-__.bin: data
public function §_el_-_-_-_§(param1:int) : void
{
var _loc2_:int = 0;
while(_loc2_ < param1 && this.§_el_-______§ < this.§_el_-_-__§.length)
{
this.§_el_-_-__§[this.§_el_-______§++] =
this.§_el_-_-__§[this.§_el_-______§++] ^ this.§_el_----_-§();
_loc2_++;
}
}
bin8 ├── binaryData │ ├── 1__e_--_-.bin │ ├── 2__e_-----.bin │ └── 3__e_-_-_--.bin ├── frames │ └── 1.png ├── scripts │ ├── mx │ │ └── core │ │ ├── ByteArrayAsset.as │ │ ├── IFlexAsset.as │ │ └── mx_internal.as │ ├── §'§.as │ ├── §_e_-----_§.as │ ├── §_e_-----§.as │ ├── §_e_--_--§.as │ ├── §_e_--_-_§.as │ ├── §_e_--_-§.as │ ├── §_e_--_§.as │ ├── §_e_-_---_§.as │ ├── §_e_-_--_§.as │ ├── §_e_-_-_--§.as │ ├── §_e_-__-_-§.as │ └── §_e_-____--§.as └── symbols.csv
public function §_e_--___-§() : String
{
return "aes" + 8 * this.§_e_---__§;
}
#!/usr/bin/ruby
#encoding: ascii-8bit
require 'openssl'
$data1 = IO.binread('1__e_--_-.bin')[4..-1]
data2 = IO.binread '2__e_-----.bin'
$bin2_scan_16 = data2[1..-1].chars.each_slice(16).map(&:join)
$decoded = []
def bin2_scan_16;$bin2_scan_16;end
def decode(data, key)
decipher = OpenSSL::Cipher::AES.new(128, :ECB)
decipher.decrypt
decipher.key = key
plain = decipher.update(data) + decipher.final
$decoded.push(plain)
end
def work
data1 = $data1
len = 27
j = 0
while(j < len)
length = data1[0, 4].reverse.unpack("L*")[0]
decode(data1[4, length], bin2_scan_16[j % bin2_scan_16.size])
data1 = data1[(length+4)..-1]
j+=1
end
end
work
puts $decoded
70d4a3aa , Game Over :( http://www.trendmicro.com/us/about-us/careers/portal/index.html 6e415968 , You're too leeeeeeeeet #### 1337 PRESS ANY KEY TO RESTART 1fac0e9c 555555 .... Hey, Welcome, Input Your Name and Have Fun! 417cfdf3 FFFF I think you got the flag :) 33 MMMM 02f02daa center 6962723d YOUR SCORE: ad2a75a9 007 6ee2c371 Sorry, Hope you can join TrendMicro :)
if(this.§?§ >= parseInt("1337"))
{
_loc4_.appendText("Hey, " + this.username + ", You're too leeeeeeeeet\n");
_loc4_.appendText("Hope you can join TrendMicro :)\n");
_loc4_.appendText("http://www.trendmicro.com/us/about-us/careers/portal/index.html\n\n");
_loc5_ = this.§@§(["6e415968","6ee2c371","02f02daa","417cfdf3"]);
_loc6_ = this.§@§(["6962723d","ad2a75a9","70d4a3aa","1fac0e9c"]);
if(Boolean(this.§3§(this.§8§,this.username,_loc5_)) &&
Boolean(this.§3§(this.§7§,this.username,_loc6_)))
{
_loc4_.appendText("I think you got the flag :)\n");
}
}
from z3 import *
def fun_8(s):
_loc4_ = BitVecVal(5592405, 32)
for i in xrange(len(s)):
c = s[i]
_loc4_ = _loc4_ ^ ZeroExt(24, c)
_loc4_ = RotateLeft(_loc4_, 7)
_loc4_ = simplify(_loc4_)
return _loc4_
def fun_7(s):
_loc4_ = BitVecVal(1337, 32)
for i in xrange(len(s)):
c = s[i]
_loc4_ = _loc4_ * 33 + ZeroExt(24, c)
_loc4_ = simplify(_loc4_)
return _loc4_
solver = Solver()
ans1 = [0x6ee2c371, 0x02f02daa, 0x417cfdf3]
ans2 = [0xad2a75a9, 0x70d4a3aa, 0x1fac0e9c]
n = 22
flag = [BitVec('x%d' % i, 8) for i in xrange(n)]
known = 'TMCTF{'
for i in xrange(len(known)):
solver.add(flag[i] == ord(known[i]))
for i in xrange(6, len(flag) - 1):
x = flag[i]
#solver.add(Or(And(48 <= x, x <= 57), And(97 <= x, x <= 122)))
solver.add(And(32 <= x, x <= 126))
for i, val1, val2 in zip(xrange(0, len(flag), 8), ans1, ans2):
s = flag[i:i+8]
res = fun_8(s)
solver.add(res == val1)
res = fun_7(s)
solver.add(res == val2)
print solver.check()
m = solver.model()
s = ''
for x in flag:
if str(m[x]) == 'None': continue
c = chr(int(str(m[x])))
s += c
print c
print s
TMCTF{f1ash_s0_4un!!!}