2 | #include "hexdump.h"
3 |
4 | int main(int argc, char*argv[]){
5 | char buf[0x200];
6 | char result[0x200];
7 | char v3[0x10];
8 | MHASH thread; // v5
9 | int v2;
10 |
11 | if(argc <= 1){
12 | puts("no args!");
13 | return;
14 | }
15 |
16 | if(strlen(argv[1])<100){
17 | printf("[?] maybe i need %d chars more\n", 100-strlen(argv[1]));
18 | }
19 |
20 | bzero(buf,sizeof(buf));
21 | bzero(result,sizeof(result));
22 | bzero(v3,sizeof(v3));
23 |
24 | memcpy(buf,argv[1],100);
25 | memset(v3,0,5);
26 | strncpy(v3,argv[1],4);
27 |
28 | printf("[.] v3 = %s\n",v3);
29 |
30 | thread = mhash_init(1);
31 | if(!thread) exit(1);
32 | v2 = strlen(v3);
33 | printf("[.] updating hash with %d bytes of data\n",v2);
34 | mhash(thread, v3, v2);
35 | mhash_deinit(thread, result);
36 |
37 | hexdump(result,16);
38 |
39 | // call result
40 |
41 | return 0;
42 | }
43 |
--------------------------------------------------------------------------------
/2011.hacklu/200.simplexor+/solve.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'open-uri'
3 |
4 | URL = 'http://insecure.org/stf/smashstack.html'
5 |
6 | class String
7 | def xor x
8 | if x.is_a?(String)
9 | r = ''
10 | j = 0
11 | 0.upto(self.size-1) do |i|
12 | r << (self[i].ord^x[j].ord).chr
13 | j+=1
14 | j=0 if j>= x.size
15 | end
16 | r
17 | else
18 | r = ''
19 | 0.upto(self.size-1) do |i|
20 | r << (self[i].ord^x).chr
21 | end
22 | r
23 | end
24 | end
25 | end
26 |
27 | data1 = File.read('simplexor.txt').unpack('m*')[0]
28 | data2 = open(URL).read.force_encoding('binary')[/.+<\/pre>/mi].
29 | sub(//i,'').
30 | sub(/<\/pre>/i,'').
31 | strip
32 |
33 | puts data1[0,64].xor(data2)
34 |
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/0_8c4f14e28155a2c3cf4b2538c1e0958b.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/200.unknown.planet+/0_8c4f14e28155a2c3cf4b2538c1e0958b.jpg
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/1_analyze_jpeg:
--------------------------------------------------------------------------------
1 | look for "0xFF 0xD9" JPEG EOF mark
2 | => found data after mark
3 | => unzip filename.jpg
4 | => got 9 chunks (see chunks subdir)
5 |
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/2_manually_guess_chunk_order.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | STDOUT.sync = true
3 |
4 | if ARGV.size == 0
5 | raise "gimme at least one chunk filename"
6 | end
7 |
8 | b0 = "\x80"*8
9 | b1 = "\x27\x01\x27\x80\xd9\xff\xd9\x80"
10 |
11 | data = ARGV.map{ |x| File.read(x) }.join.force_encoding('binary')
12 | if data[0,4] == 'RIFF'
13 | data = data[44..-1]
14 | end
15 |
16 | N=120
17 |
18 | b0 = b0*N
19 | b1 = b1*N
20 |
21 | r = ''
22 | 0.step(data.size-1,b0.size) do |i|
23 | case (d=data[i,b0.size])
24 | when b0
25 | print "."
26 | r << '0'
27 | when b1
28 | print "#"
29 | r << '1'
30 | else
31 | raise "SYNC ERROR" if d.size == b0.size
32 | raise "NOT ENOUGH DATA #{d.size}/#{b0.size}"
33 | raise "unknown #{d.size} (normal: #{b0.size}) bytes of data #{d.split('').map{|x| "%02x " % x.ord}.join}"
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/3_decode.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | STDOUT.sync = true
4 |
5 | b0 = "\x80"*8
6 | b1 = "\x27\x01\x27\x80\xd9\xff\xd9\x80"
7 |
8 | data = Dir['chunks/chunk*'].sort.map{ |x| File.read(x).force_encoding('binary') }.join
9 | if data[0,4] == 'RIFF'
10 | data = data[44..-1]
11 | end
12 |
13 | N=120
14 |
15 | b0 = b0*N
16 | b1 = b1*N
17 |
18 | r = ''
19 | n = 0
20 | 0.step(data.size-1, b0.size) do |i|
21 | case (d=data[i,b0.size])
22 | when b0
23 | print "."
24 | r << '.'
25 | when b1
26 | print "#"
27 | r << '#'
28 | else
29 | raise "SYNC ERROR" if d.size == b0.size
30 | raise "NOT ENOUGH DATA #{d.size}/#{b0.size}"
31 | raise "unknown #{d.size} (normal: #{b0.size}) bytes of data #{d.split('').map{|x| "%02x " % x.ord}.join}"
32 | end
33 | n += 1
34 | # puts if n%24==0
35 | end
36 |
37 | require 'morse'
38 |
39 | puts
40 | puts Morse.decode(r.gsub('......'," ").gsub('######','-').gsub('.','').gsub('##','.'))
41 |
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/ANSWER:
--------------------------------------------------------------------------------
1 | Pheikyos
2 |
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/chunks/chunk.0.uvlSlG3Tgow:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/200.unknown.planet+/chunks/chunk.0.uvlSlG3Tgow
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/chunks/chunk.1.5IIUED7GheR:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/200.unknown.planet+/chunks/chunk.1.5IIUED7GheR
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/chunks/chunk.2.rySOWi4fZkA:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/200.unknown.planet+/chunks/chunk.2.rySOWi4fZkA
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/chunks/chunk.3.87F1s5POUJc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/200.unknown.planet+/chunks/chunk.3.87F1s5POUJc
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/chunks/chunk.4.6JXtwsTTh9k:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/200.unknown.planet+/chunks/chunk.4.6JXtwsTTh9k
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/chunks/chunk.5.Uw105aD3qYh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/200.unknown.planet+/chunks/chunk.5.Uw105aD3qYh
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/chunks/chunk.6.BPiIOASG_Z6:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/200.unknown.planet+/chunks/chunk.6.BPiIOASG_Z6
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/chunks/chunk.7.Yui5oq58hlx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/200.unknown.planet+/chunks/chunk.7.Yui5oq58hlx
--------------------------------------------------------------------------------
/2011.hacklu/200.unknown.planet+/chunks/chunk.8.nLPA8X0UJqf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/200.unknown.planet+/chunks/chunk.8.nLPA8X0UJqf
--------------------------------------------------------------------------------
/2011.hacklu/250.romulan.business.network/Gwl4U5fqQZlJxEpPlgFL0hRNQrG4mmhg.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/250.romulan.business.network/Gwl4U5fqQZlJxEpPlgFL0hRNQrG4mmhg.pdf
--------------------------------------------------------------------------------
/2011.hacklu/300.antique.space.shuttle+/exploit_sources.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/300.antique.space.shuttle+/exploit_sources.zip
--------------------------------------------------------------------------------
/2011.hacklu/300.antique.space.shuttle+/remote_homedir/auth:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/300.antique.space.shuttle+/remote_homedir/auth
--------------------------------------------------------------------------------
/2011.hacklu/300.antique.space.shuttle+/remote_homedir/info:
--------------------------------------------------------------------------------
1 | Ok so you got access, now try to get more privileges by exploiting
2 | the auth protocol. you can login to ssh at port 2004
3 | with user:user4422
4 |
--------------------------------------------------------------------------------
/2011.hacklu/300.deathstar.escape+/sample.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.hacklu/300.deathstar.escape+/sample.mp3
--------------------------------------------------------------------------------
/2011.hacklu/300.deathstar.escape+/save_mp3.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'open-uri'
3 |
4 | while true do
5 | r = `echo foo | nc ctf.hack.lu 2007`
6 | r.force_encoding 'binary'
7 | r.sub!(/010 Welcome, stranger\. Please prove that you are human\s*/m,'')
8 | puts r.size
9 | tags = r.scan(/tag[a-z0-9]*/i)
10 | p tags
11 |
12 | File.open 'data.mp3','w' do |f|
13 | f<
5 | decode it with Ascii85 => I_L0v3_D0kdo
6 |
--------------------------------------------------------------------------------
/2011.isec/q02+/dokdo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.isec/q02+/dokdo.png
--------------------------------------------------------------------------------
/2011.isec/q02+/time_machine.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | :1
3 | time 19:00:00
4 | goto 1
--------------------------------------------------------------------------------
/2011.isec/q06+/answer:
--------------------------------------------------------------------------------
1 | IsEC3352217852
2 | pAsswOrD Is : w0wH5C6Er
3 |
--------------------------------------------------------------------------------
/2011.isec/q09+/README:
--------------------------------------------------------------------------------
1 | 1. Открываем lol.pcap в wireshark
2 | 2. follow UDP stream
3 | 3. важно выбрать только одно направление потока! иначе будет треск
4 | 4. save to file
5 | 5. audacious -> import raw file -> a-Law 8000 Hz
6 |
--------------------------------------------------------------------------------
/2011.isec/q09+/del.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | data = File.read(ARGV[0]).force_encoding('binary')
3 |
4 | File.open(ARGV[1],'w') do |f|
5 | f << data.
6 | gsub(/\x80[\x08\x88]..../m,'').
7 | gsub(/\x00+/m,'').
8 | gsub(/...bC/m,'').
9 | gsub(/..2x../m,'').
10 | # gsub(/\xd5/m,'').
11 | gsub(/\x00/m,'')
12 | end
13 |
--------------------------------------------------------------------------------
/2011.isec/q09+/dump.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | puts ""
4 | puts ""
5 |
6 | data = File.read(ARGV[0]).force_encoding('binary')
7 | (0..10000).each do |i|
8 | puts ""
9 | end
10 |
--------------------------------------------------------------------------------
/2011.isec/q09+/lol.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.isec/q09+/lol.pcap
--------------------------------------------------------------------------------
/2011.isec/q09+/repl.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | data = File.read ARGV[0]
3 | data.force_encoding 'binary'
4 |
5 | s1 = "\xd5".force_encoding('binary')
6 | s2 = "\x00".force_encoding('binary')
7 |
8 | data.tr! s1,s2
9 | #data.tr! "\x55",""
10 |
11 | File.open(ARGV[1],'w'){ |f| f << data }
12 |
--------------------------------------------------------------------------------
/2011.isec/q09+/result.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.isec/q09+/result.wav
--------------------------------------------------------------------------------
/2011.isec/q09+/s1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.isec/q09+/s1
--------------------------------------------------------------------------------
/2011.isec/q09+/s1.del:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.isec/q09+/s1.del
--------------------------------------------------------------------------------
/2011.isec/q09+/s2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.isec/q09+/s2
--------------------------------------------------------------------------------
/2011.isec/q09+/s2.del:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.isec/q09+/s2.del
--------------------------------------------------------------------------------
/2011.isec/q09+/test2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.isec/q09+/test2
--------------------------------------------------------------------------------
/2011.ructf-quals/cry300/0_cry300.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf-quals/cry300/0_cry300.png
--------------------------------------------------------------------------------
/2011.ructf-quals/cry300/1_cry300_deblock_rgb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf-quals/cry300/1_cry300_deblock_rgb.png
--------------------------------------------------------------------------------
/2011.ructf-quals/cry300/4_b64_to_spl.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | class String
4 | def revert2!
5 | 0.step(self.size-2,2) do |i|
6 | self[i+1],self[i] = self[i],self[i+1]
7 | end
8 | self
9 | end
10 | end
11 |
12 | puts File.read(ARGV[0]).unpack('m*')[0].revert2!
13 |
--------------------------------------------------------------------------------
/2011.ructf-quals/cry300/7_after_spl2c.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf-quals/cry300/7_after_spl2c.c
--------------------------------------------------------------------------------
/2011.ructf-quals/cry300/8_ANSWER:
--------------------------------------------------------------------------------
1 | 11O2FTC
2 |
--------------------------------------------------------------------------------
/2011.ructf-quals/cry300/spl-1.2.1.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf-quals/cry300/spl-1.2.1.tar.gz
--------------------------------------------------------------------------------
/2011.ructf-quals/rev200/README:
--------------------------------------------------------------------------------
1 | образ прошивки для AVR который на LCD дисплей неизвестной марки выводит код
2 | дизасмится IDA'ой, находится знакогенератор (см. key.txt в конце), и вывод символов
3 | можно эмулировать через avrsimulatoridesetup151.exe
4 |
--------------------------------------------------------------------------------
/2011.ructf-quals/rev200/avrsimulatoridesetup151.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf-quals/rev200/avrsimulatoridesetup151.exe
--------------------------------------------------------------------------------
/2011.ructf-quals/rev200/bin2font.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/ruby
2 | data = File.read('key.bin')
3 | i=1
4 | data.each_byte do |b|
5 | s = "%08b" % b
6 | puts s.tr('01','.#')
7 | if i==8
8 | #puts
9 | i=0
10 | end
11 | i+=1
12 | end
13 |
--------------------------------------------------------------------------------
/2011.ructf-quals/rev200/fc.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/ruby
2 | # simple binary file compare (c) http://zed.0xff.me
3 | # like good old DOS "fc /b"
4 |
5 | if ARGV.size < 2
6 | puts("[!] gimme at least two filenames")
7 | exit
8 | end
9 |
10 | handles = ARGV.map{ |fname| open(fname) }
11 |
12 | while !handles.any?(&:eof)
13 | bytes = handles.map(&:readbyte)
14 | if bytes.uniq.size > 1
15 | @diff = true
16 | printf "%08x:"+" %02x"*handles.size+"\n", handles[0].pos-1, *bytes
17 | end
18 | end
19 |
20 | unless handles.all?(&:eof)
21 | @diff = true
22 | puts
23 | ARGV.each do |fname|
24 | printf "[!] %20s is %8d bytes long\n", fname, File.size(fname)
25 | end
26 | end
27 |
28 | puts "[.] all files are identical" unless @diff
29 |
--------------------------------------------------------------------------------
/2011.ructf-quals/rev200/hex2bin.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/ruby
2 | data = File.read(ARGV.first)
3 | a = ''
4 | data.strip.split("\n").each do |l|
5 | l.strip!
6 | if l =~ /^:100/
7 | else
8 | $stderr.puts "[?] #{l}"
9 | next
10 | end
11 | l.sub! /^:100...../,''
12 | l = l[0..-3]
13 | (0..15).each do |i|
14 | a << l[i*2,2].to_i(16).chr
15 | end
16 | end
17 | $stdout << a
18 |
--------------------------------------------------------------------------------
/2011.ructf-quals/rev200/key.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf-quals/rev200/key.bin
--------------------------------------------------------------------------------
/2011.ructf-quals/rev200/mem.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf-quals/rev200/mem.bin
--------------------------------------------------------------------------------
/2011.ructf-quals/rev300/README:
--------------------------------------------------------------------------------
1 | что-то как-то считается, надо получить 89.5% (примерно, точно уже не вспомню)
2 | брутом подобралось удачно
3 |
--------------------------------------------------------------------------------
/2011.ructf-quals/rev300/brute.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/ruby
2 | @chars = "23456789TJQKAhscd "
3 |
4 | def check c
5 | system "echo #{c}44444 | wine pe1.exe"
6 | r = $?.exitstatus
7 | printf "[.] %10s : %d %s\n", c, r, "*"*r if r>6
8 | r
9 | end
10 |
11 | def loop s0=""
12 | @chars.each_char do |c|
13 | s = s0 + c
14 | r = check s
15 | if r >= s.size
16 | print "\r#{s}: #{r}"
17 | loop s
18 | end
19 | end
20 | end
21 |
22 | loop
23 |
--------------------------------------------------------------------------------
/2011.ructf-quals/rev300/pe.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf-quals/rev300/pe.exe
--------------------------------------------------------------------------------
/2011.ructf-quals/rev300/pe1.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf-quals/rev300/pe1.exe
--------------------------------------------------------------------------------
/2011.ructf-quals/rev300/shuffle.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/ruby
2 | @chars = "23456789TJQKAhscd "
3 |
4 | def check c
5 | system "echo #{c}44444 | wine pe1.exe"
6 | r = $?.exitstatus
7 | printf "[.] %10s : %d %s\n", c, r, "*"*r if r>6
8 | r
9 | end
10 |
11 | def loop s0=""
12 | @chars.each_char do |c|
13 | s = s0 + c
14 | r = check s
15 | if r >= s.size
16 | print "\r#{s}: #{r}"
17 | loop s
18 | end
19 | end
20 | end
21 |
22 | ac = @chars.split('')
23 | while true do
24 | s = ac.shuffle.join
25 | r = check s
26 | print "\r#{s}: #{r}" if r > 2
27 | end
28 |
--------------------------------------------------------------------------------
/2011.ructf/rev200/README:
--------------------------------------------------------------------------------
1 | key.hex is AVR AtMega64 (or 128) code
2 |
3 | 1. look at key.txt at end
4 | 2. look at key.bin in hex after substring "key:"
5 | 3. look into key.idb to calls to CreateChar function
6 |
--------------------------------------------------------------------------------
/2011.ructf/rev200/avrsimulatoridesetup151.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf/rev200/avrsimulatoridesetup151.exe
--------------------------------------------------------------------------------
/2011.ructf/rev200/bin2font.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/ruby
2 | data = File.read('key.bin')
3 | i=1
4 | data.each_byte do |b|
5 | s = "%08b" % b
6 | puts s.tr('01','.#')
7 | if i==8
8 | #puts
9 | i=0
10 | end
11 | i+=1
12 | end
13 |
--------------------------------------------------------------------------------
/2011.ructf/rev200/fc.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/ruby
2 | # simple binary file compare (c) http://zed.0xff.me
3 | # like good old DOS "fc /b"
4 |
5 | if ARGV.size < 2
6 | puts("[!] gimme at least two filenames")
7 | exit
8 | end
9 |
10 | handles = ARGV.map{ |fname| open(fname) }
11 |
12 | while !handles.any?(&:eof)
13 | bytes = handles.map(&:readbyte)
14 | if bytes.uniq.size > 1
15 | @diff = true
16 | printf "%08x:"+" %02x"*handles.size+"\n", handles[0].pos-1, *bytes
17 | end
18 | end
19 |
20 | unless handles.all?(&:eof)
21 | @diff = true
22 | puts
23 | ARGV.each do |fname|
24 | printf "[!] %20s is %8d bytes long\n", fname, File.size(fname)
25 | end
26 | end
27 |
28 | puts "[.] all files are identical" unless @diff
29 |
--------------------------------------------------------------------------------
/2011.ructf/rev200/hex2bin.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/ruby
2 | data = File.read(ARGV.first)
3 | a = ''
4 | data.strip.split("\n").each do |l|
5 | l.strip!
6 | if l =~ /^:100/
7 | else
8 | $stderr.puts "[?] #{l}"
9 | next
10 | end
11 | l.sub! /^:100...../,''
12 | l = l[0..-3]
13 | (0..15).each do |i|
14 | a << l[i*2,2].to_i(16).chr
15 | end
16 | end
17 | $stdout << a
18 |
--------------------------------------------------------------------------------
/2011.ructf/rev200/key.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf/rev200/key.bin
--------------------------------------------------------------------------------
/2011.ructf/rev200/key.idb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf/rev200/key.idb
--------------------------------------------------------------------------------
/2011.ructf/rev300/README:
--------------------------------------------------------------------------------
1 | program must output 94.35%
2 | found with tbl_shuffle.rb after some launches and 1-2 hours
3 |
--------------------------------------------------------------------------------
/2011.ructf/rev300/brute.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/ruby
2 | @chars = "23456789TJQKAhscd "
3 |
4 | def check c
5 | system "echo #{c}44444 | wine pe1.exe"
6 | r = $?.exitstatus
7 | printf "[.] %10s : %d %s\n", c, r, "*"*r if r>6
8 | r
9 | end
10 |
11 | def loop s0=""
12 | @chars.each_char do |c|
13 | s = s0 + c
14 | r = check s
15 | if r >= s.size
16 | print "\r#{s}: #{r}"
17 | loop s
18 | end
19 | end
20 | end
21 |
22 | loop
23 |
--------------------------------------------------------------------------------
/2011.ructf/rev300/pe.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf/rev300/pe.exe
--------------------------------------------------------------------------------
/2011.ructf/rev300/pe1.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.ructf/rev300/pe1.exe
--------------------------------------------------------------------------------
/2011.ructf/rev300/shuffle.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/ruby
2 | @chars = "23456789TJQKAhscd "
3 |
4 | def check c
5 | system "echo #{c}44444 | wine pe1.exe"
6 | r = $?.exitstatus
7 | printf "[.] %10s : %d %s\n", c, r, "*"*r if r>6
8 | r
9 | end
10 |
11 | def loop s0=""
12 | @chars.each_char do |c|
13 | s = s0 + c
14 | r = check s
15 | if r >= s.size
16 | print "\r#{s}: #{r}"
17 | loop s
18 | end
19 | end
20 | end
21 |
22 | ac = @chars.split('')
23 | while true do
24 | s = ac.shuffle.join
25 | r = check s
26 | print "\r#{s}: #{r}" if r > 2
27 | end
28 |
--------------------------------------------------------------------------------
/2011.rwth/__info/client.conf:
--------------------------------------------------------------------------------
1 | client
2 | dev tun
3 |
4 | ca rwthctfca.pem
5 | cert team77.cert
6 | key team77.key
7 |
8 | remote 137.226.161.5 1194
9 |
10 | tls-auth ta.key 1
11 | tls-remote vpn
12 | cipher none
13 |
14 | persist-key
15 | persist-tun
16 |
17 | verb 3
18 | mute 10
19 | nobind
20 |
21 |
22 |
--------------------------------------------------------------------------------
/2011.rwth/__info/extract.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | boundaries = `grep boundary *.uncrypt`.strip.split("\n")
3 | boundaries.each do |b|
4 | fname = b.split(':').first
5 | bound = b.split('"')[-1]
6 | # p [fname,bound]
7 | File.binread(fname).split(bound).each do |part|
8 | if part['MIME'] && part =~ /filename="(.*)"/
9 | fname = $1
10 | p fname
11 | data= part.split("\n\n",2)[1]
12 | File.open(fname,'w'){ |f| f<< data.unpack('m*').first }
13 | else
14 | #p part
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/2011.rwth/__info/network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.rwth/__info/network.png
--------------------------------------------------------------------------------
/2011.rwth/__info/secret.txt:
--------------------------------------------------------------------------------
1 | unoopehaihaebaig
2 |
--------------------------------------------------------------------------------
/2011.rwth/__info/ta.key:
--------------------------------------------------------------------------------
1 | #
2 | # 2048 bit OpenVPN static key
3 | #
4 | -----BEGIN OpenVPN Static key V1-----
5 | 52bf822947d57fd57f71e68bdc41bd91
6 | 870d0ec6409e365bdcc32fe5946057e7
7 | 986243a280906cdb01c9f1083b2bf687
8 | 1092f027c850eb1259e9c9e68f9b4a7f
9 | accf3428edfb83ad8d3cd7b14ce04844
10 | 1c72a07dc9d16b0aa6ff9764a91ee1fb
11 | 01ae3dec12b31054a2093264e490005f
12 | bb7a63d319575541e281eb689842d058
13 | 60da9d5b99f55efbddb30463d242a1a6
14 | 5b62d749100bf6af1ff1620e72f1f2fc
15 | f98ca977942dbf80ae2f559b87b00204
16 | c513e9c4d45f140442ecf59d613941bf
17 | e02ef24db77883a10dcdf4e1240c782c
18 | 094be6a1e0cb7cf9d7bb9d7a1fa433f6
19 | b2384900614eb745717a7d185316ba39
20 | 6a2e10c180f9d1aefff56af57305b3f7
21 | -----END OpenVPN Static key V1-----
22 |
--------------------------------------------------------------------------------
/2011.rwth/forum/README:
--------------------------------------------------------------------------------
1 | do not change/comment out parts of the service functions. functions like file
2 | uploads, account creation and message exchange are used to deposit flags on
3 | the system.
4 |
--------------------------------------------------------------------------------
/2011.rwth/forum/admin/addcats.php:
--------------------------------------------------------------------------------
1 |
2 | chdir('../');
3 | require_once('includes/header.inc.php');
4 | require_once('includes/admin.inc.php');
5 | require_once('admin/isadmin.php');
6 |
7 |
8 | if (!empty($_POST)) {
9 |
10 | } else {
11 | form_dump(array(
12 | 'title' => array('text','','*'),
13 | 'gids' => array('text','','*'),
14 | 'add' => array('submit','add category')
15 | ));
16 | }
17 |
18 | require_once('includes/footer.inc.php');
19 | ?>
20 |
--------------------------------------------------------------------------------
/2011.rwth/forum/admin/addgroups.php:
--------------------------------------------------------------------------------
1 |
2 | chdir('../');
3 | require_once('includes/header.inc.php');
4 | require_once('includes/admin.inc.php');
5 | require_once('admin/isadmin.php');
6 |
7 | form_dump(array(
8 | 'name' => array('text','','*'),
9 | 'add' => array('submit','add group')
10 | ));
11 |
12 | require_once('includes/footer.inc.php');
13 |
14 | ?>
15 |
--------------------------------------------------------------------------------
/2011.rwth/forum/admin/adminsql.php:
--------------------------------------------------------------------------------
1 |
2 | chdir('../');
3 | require_once('includes/header.inc.php');
4 |
5 | if (!$isadmin) {
6 | die('no admin rights buddy:)');
7 | }
8 |
9 | form_dump(array(
10 | 'query' => array('text','','*'),
11 | 'execute' => array('submit','execute')
12 | ));
13 |
14 | require_once('includes/footer.inc.php');
15 |
16 | ?>
17 |
--------------------------------------------------------------------------------
/2011.rwth/forum/admin/isadmin.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | require_once('includes/admin.inc.php');
4 | require_once('includes/vars.inc.php');
5 |
6 | function is_admin_group($user) {
7 | $res = db_fetch_array($db_query("SELECT uid FROM users WHERE user='".sqlite_escape_string($user)."'"));
8 | $q = "SELECT COUNT(*) FROM groups WHERE (belongsto='".$res['0'].",%' OR belongsto='%,".$res['0'].",%' OR belongsto='%,".$res['0']."') AND group='admin'";
9 |
10 | $chk_admin = db_fetch_array(db_query($q));
11 | if ($chk_admin && $chk_admin['0'] == 1) {
12 | return true;
13 | } else {
14 | return false;
15 | }
16 | }
17 |
18 |
19 | if ((empty($_SESSION) || !isset($_SESSION['loggedin']) || $_SESSION['user'] != 'admin' || !in_admin_group($_SESSION['user'])) && $isadmin) {
20 | echo 'You have to login first buddy or you don\'t have admin rights:)';
21 | header('Location: '.$_SERVER['HTTP_HOST'].'/forum/login.php');
22 | sleep(2);
23 | }
24 | ?>
25 |
--------------------------------------------------------------------------------
/2011.rwth/forum/admin/manage.php:
--------------------------------------------------------------------------------
1 |
2 | chdir('../');
3 | require_once('includes/header.inc.php');
4 | require_once('includes/admin.inc.php');
5 | require_once('admin/isadmin.php');
6 |
7 | if (!empty($_POST)) {
8 | form_dump(array(
9 | 'Edit' => array('select','SELECT * FROM '.sqlite_escape_string($_POST['edit']).';'),
10 | 'table' => array('hidden', $_POST['table']),
11 | 'change' => array('submit','manage selected')
12 | ));
13 | } else {
14 | form_dump(array(
15 | 'edit' => array('select','SELECT name FROM sqlite_master WHERE type="table";'),
16 | 'change' => array('submit','manage selected')
17 | ));
18 | }
19 |
20 | require_once('includes/footer.inc.php');
21 |
22 | ?>
23 |
--------------------------------------------------------------------------------
/2011.rwth/forum/dbs/psn.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zed-0xff/ctf/45f027427b65c9b3b2be1e2a05b2cf86f6f9c446/2011.rwth/forum/dbs/psn.sqlite
--------------------------------------------------------------------------------
/2011.rwth/forum/fileoverview.php:
--------------------------------------------------------------------------------
1 |
2 | require_once('includes/header.inc.php');
3 | require_once('includes/user.inc.php');
4 |
5 | $q = "SELECT * FROM files WHERE up_user_id='".get_login_id()."'";
6 | $res = db_fetch_array(db_query($q), SQLITE_ASSOC);
7 |
8 | $keys = array_keys($res['0']);
9 | echo '';
10 | foreach ($keys as $k) {
11 | echo "\t".''.$k.' | '."\n";
12 | }
13 | echo '
'."\n";
14 | foreach ($res as $r) {
15 | echo ''."\n";
16 | foreach ($r as $k=>$rt) {
17 | echo "\t".'';
18 | if ($k == 'file') {
19 | echo '';
20 | }
21 | echo $rt;
22 | if ($k == 'file') {
23 | echo '';
24 | }
25 | echo ' | '."\n";
26 | }
27 | echo '
'."\n";
28 | }
29 | echo '
';
30 | echo '
'."\n";
31 |
32 | echo 'Back' ;
33 | require_once('includes/footer.inc.php');
34 | ?>
35 |
--------------------------------------------------------------------------------
/2011.rwth/forum/includes/admin.inc.php:
--------------------------------------------------------------------------------
1 |
2 | $url = $_SERVER['REQUEST_URI'];
3 | $turl = basename(substr($url, strrpos($url, '/')));
4 | $num = strpos($turl, '?');
5 | if ($num > 0) {
6 | $pname = substr($turl, 0, $num);
7 | } else {
8 | $pname = $turl;
9 | }
10 | var_dump($pname);
11 |
12 | $res = @db_fetch_array(@db_query("SELECT name FROM admin WHERE name='".$pname."'"), SQLITE_NUM);
13 | if (count($res) > 0) {
14 | foreach ($res['0'] as $r) {
15 | echo implode(';', $r)."
\n";
16 | }
17 | }
18 | ?>
19 |
--------------------------------------------------------------------------------
/2011.rwth/forum/includes/cats.inc.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | function cat_add($title, $gids) {
4 | $q = "INSERT INTO categories (NULL,'".sqlite_escape_string($title)."','".sqlite_escape_string($gids)."')";
5 | if (db_query($q)) {
6 | return TRUE;
7 | } else {
8 | return FALSE;
9 | }
10 | }
11 |
12 | function cat_del($name) {
13 | $q = "DELETE FROM cats WHERE title='".sqlite_escape_string($name)."'";
14 | return db_query($q);
15 | }
16 |
17 | function cat_exists($name) {
18 | $q = "SELECT COUNT(*) FROM cats WHERE title='".sqlite_escape_string($name)."'";
19 |
20 | $res = db_fetch_array(db_query($q));
21 | return $res;
22 | }
23 |
24 | function cat_list($gid=NULL) {
25 | $q = "SELECT cid, title FROM categories";
26 | if ($gid != NULL) {
27 | $q .= "WHERE gids LIKE '%".$gid."%'";
28 | }
29 |
30 | $res = db_fetch_array(db_query($q), SQLITE_ASSOC);
31 |
32 | if ($res) {
33 | return $res;
34 | } else {
35 | return array();
36 | }
37 | }
38 |
39 | extract($_POST);
40 | extract($_GET);
41 |
42 | ?>
43 |
--------------------------------------------------------------------------------
/2011.rwth/forum/includes/fileups.inc.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | function form_show() {
4 | ?>
5 |
13 |
14 | }
15 |
16 |
17 | function form_check($_FILES) {
18 | if (trim($_FILES['fname']['type']) == 'text/plain' &&
19 | $_FILES['fname']['error'] == 0 &&
20 | $_FILES['fname']['size'] < 3000
21 | ) {
22 | if (form_copy_file($_FILES['fname']['tmp_name'], $_FILES['fname']['name'])) {
23 | file_input_parse($_FILES['fname']['name']);
24 | }
25 | } else {
26 | die('False mime type supplied!');
27 | }
28 | }
29 |
30 |
31 | function form_copy_file($tmpname, $fname) {
32 | return move_uploaded_file($tmpname, $fname)
33 | }
34 |
35 |
36 | function file_input_parse($fname) {
37 |
38 | }
39 |
40 |
41 | ?>
42 |
--------------------------------------------------------------------------------
/2011.rwth/forum/includes/footer.inc.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | require_once(TPLDIR.'templatef.inc.php');
4 |
5 | ?>
6 |
--------------------------------------------------------------------------------
/2011.rwth/forum/includes/navi.inc.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | if ($_SESSION['islogged']) {
9 | ?>
10 |
11 |
12 |
13 | }
14 | ?>
15 |
16 |
17 | if (!$_SESSION['islogged']) {
18 | ?>
19 |
20 |
21 |
22 | } else {
23 | ?>
24 |
25 |
26 | }
27 | ?>
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/2011.rwth/forum/includes/posts.inc.php:
--------------------------------------------------------------------------------
1 |
2 | function post_check() {
3 | return;
4 | }
5 |
6 | function post_save($fromu, $tou, $msg, $files=array()) {
7 | if (db_query("INSERT INTO msgs VALUES (NULL,'".sqlite_escape_string($fromu)."','".sqlite_escape_string($tou)."','".sqlite_escape_string($msg)."','".sqlite_escape_string(implode(';',$files))."')")) {
8 | return TRUE;
9 | } else {
10 | return FALSE;
11 | }
12 | }
13 |
14 | ?>
15 |
--------------------------------------------------------------------------------
/2011.rwth/forum/includes/vars.inc.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | define(INCDIR, 'includes/');
4 |
5 | define(DBFILE, 'dbs/psn.sqlite');
6 |
7 | define(TPLDIR, 'tpls/');
8 |
9 |
10 | define(SRVDOM, 'http://binaryrebels.org');
11 | define(SRVPATH, '/php-service/');
12 |
13 | extract($_GET);
14 | ?>
15 |
--------------------------------------------------------------------------------
/2011.rwth/forum/index.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | Welcome to the forum of the Prank Scammers Nigeria (PSN)!
7 |
8 |
9 | Feel free to use out tricks, to buy/sell CCs and post exploits. We are really happy to widen our influence and get more profit on the back of the stupid bastards not caring about security or not knowing how to secure their systems.
10 |
11 |
12 | w3 4r3 th3 l33t h4x0rs, l34rn fr0m u5!!!
13 |
14 |
15 |
18 |
--------------------------------------------------------------------------------
/2011.rwth/forum/init.php:
--------------------------------------------------------------------------------
1 |
2 | require_once('includes/sqlite.inc.php');
3 |
4 | $db = db_generate('dbs/psn.sqlite', $dbh);
5 |
6 | ?>
7 |
--------------------------------------------------------------------------------
/2011.rwth/forum/logout.php:
--------------------------------------------------------------------------------
1 |
2 | require_once('includes/header.inc.php');
3 |
4 | $_SESSION = array();
5 | if (ini_get("session.use_cookies")) {
6 | $params = session_get_cookie_params();
7 | var_dump($params);
8 | setcookie(session_name(), '', time() - 42000,
9 | $params["path"], $params["domain"],
10 | $params["secure"], $params["httponly"]
11 | );
12 | }
13 |
14 | session_destroy();
15 |
16 | header('Location: '.preg_replace('/logout/', 'index',$_SERVER['PHP_SELF']));
17 |
18 | require_once('includes/footer.inc.php');
19 | ?>
20 |
--------------------------------------------------------------------------------
/2011.rwth/forum/new_post.php:
--------------------------------------------------------------------------------
1 |
2 | require_once('includes/header.inc.php');
3 | require_once('includes/posts.inc.php');
4 |
5 | var_dump($_SESSION);
6 |
7 | if (!isset($_POST)) {
8 | form_dump(array('user'=>array('text',"$user"),
9 | 'title'=>array('text','','*'),
10 | 'message'=>array('textarea',''),
11 | 'submit'=>array('submit', 'Save post')
12 | ));
13 | } else {
14 |
15 | }
16 |
17 | require_once('includes/footer.inc.php');
18 | ?>
19 |
--------------------------------------------------------------------------------
/2011.rwth/forum/news.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | /*
4 | * fetch news from external server (rwthctf news distribution system)
5 | */
6 |
7 | require_once('includes/header.inc.php');
8 | require_once('includes/news.inc.php');
9 |
10 |
11 | $news = news_fetch_all('http://localhost/newstest.txt');
12 |
13 | $id = news_check_last_id();
14 |
15 | $items = count($news);
16 |
17 | while ($id < $items) {
18 | if (isset($news[$id])) {
19 | news_add_one($news[$id]);
20 | }
21 | ++$id;
22 | }
23 |
24 | if (isset($_GET['all'])) {
25 | $dbnews = news_get_all();
26 | } else {
27 | $dbnews = news_get_last_five();
28 | }
29 |
30 | echo ''."\n";
31 | echo 'time: | news: |
'."\n";
32 | foreach ($dbnews as $d) {
33 | echo '';
34 | echo @date("d.m.Y H:i", $d['ts']);
35 | echo ' | ';
36 | echo $d['content'];
37 | echo ' |
'."\n";
38 | }
39 | echo '
'."\n";
40 |
41 | require_once('includes/footer.inc.php');
42 | ?>
43 |
--------------------------------------------------------------------------------
/2011.rwth/forum/overview.php:
--------------------------------------------------------------------------------
1 |
2 | require_once('includes/header.inc.php');
3 |
4 | echo 'welcome to your, user '.$_SESSION['user']."!
\n
\n";
5 | ?>
6 |
7 |
12 |
13 |
14 | require_once('includes/footer.inc.php');
15 | ?>
16 |
--------------------------------------------------------------------------------
/2011.rwth/forum/tpls/templatef.inc.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |