reverse-easyGo(新手向)

2019信安國賽初賽reverse-easyGo

記錄解題思路,不一定做得出來!
我現在能做了!(2019-09-08)


ELF格式程序,利用kali試着運行一下:
在這裏插入圖片描述
應該只是一個簡單的判斷而已。
使用gdb看看有沒有調試的信息,gdb之前沒有用過,這裏只能硬上弓了:
在這裏插入圖片描述
是說因爲沒有發現調試符號(debug symbols),所以就直接完成了。
使用ida打開來看也只是一大堆函數符號,從字符串窗口也得不到任何信息,根據短時間內解出來的隊伍數來看,我想這道題的解法應該挺簡單的。用OD?行嗎?試試。


之前寫夭折了,菜雞的成長之路真是曲折!

下面是詳細的writeup


Go語言逆向,去掉了符號,導致很多函數都不能識別出來,然後使用網上的腳本可以對其進行處理,“https://raw.githubusercontent.com/strazzere/golang_loader_assist/master/golang_loader_assist.py”,這裏直接在idaFile->Scritpt File(Alt + F7)加載該腳本文件就可以識別了:
在這裏插入圖片描述
然後看到的結果是這樣的:
在這裏插入圖片描述
Go語言實際的主函數是main_main,現在我看彙編還是看得挺懂的,Go語言的參數傳遞也是通過棧的,和一般的64位程序通過寄存器傳參是不一樣的。
然後發現了這裏:
在這裏插入圖片描述
這裏是在main函數中,通過調用這個函數解密程序中的真正的flag字符串,解密後就得到了flag。所以使用gdb調試在這裏下斷點就可以了,不過需要注意要使用單步進入線程,不然可能會一直停在主函數開頭。下面是詳細的調試過程:

root@kali:~/文檔# gdb easyGo
GNU gdb (Debian 8.1-4) 8.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from easyGo...(no debugging symbols found)...done.
(gdb) b *0x4952eb  //設置斷點
Breakpoint 1 at 0x4952eb
(gdb) r	//運行
Starting program: /root/文檔/easyGo 
[New LWP 51769]
[New LWP 51770]
[New LWP 51771]
[New LWP 51772]
Please input you flag like flag{123} to judge:
flag{        //這裏隨便輸入

Thread 1 "easyGo" hit Breakpoint 1, 0x00000000004952eb in ?? ()
(gdb) info reg        //查看寄存器信息
rax            0xc00008a580	824634287488
rbx            0x38	56
rcx            0xc00009c040	824634359872
rdx            0x38	56
rsi            0xc00009c000	824634359808   
rdi            0xc00009c040	824634359872
rbp            0xc000086f88	0xc000086f88
rsp            0xc000086e90	0xc000086e90
r8             0x1	1
r9             0x0	0
r10            0xc00009c040	824634359872
r11            0x0	0
r12            0xffffffffffffffff	-1
r13            0x2	2
r14            0x1	1
r15            0x80	128
rip            0x4952eb	0x4952eb
eflags         0x206	[ PF IF ]
cs             0x33	51
ss             0x2b	43
ds             0x0	0
es             0x0	0
fs             0x0	0
---Type <return> to continue, or q <return> to quit---
gs             0x0	0
(gdb) ni     //單步步過
0x00000000004952f0 in ?? ()
(gdb) x/1s $rsi               //查看解密後將要對比的真正flag,x/1s 表示顯示該地址處的1個字符串(string)
0xc00008c060:	"flag{92094daf-33c9-431e-a85a-8bfbd5df98ad}"
(gdb) 

這樣就得到flag了,後面的程序邏輯就是將這個flag和你輸入的flag對比,如果相等則輸出提示Congratulation...:
在這裏插入圖片描述
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章