国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
linux下破解實戰(zhàn)
linux的破解(i386)相對于其它unix下的破解自然要容易一些,因為
大家對于8086系列的結構以及匯編多少都有些了解。不過對于第一次做
linux下的破解,還是讓人感到富有挑戰(zhàn)而又令人興奮的.
要動手破解,除了破解本身的樂趣外,動力多半還是來自被破解對象
--應用程序的誘惑, 我就是被mtv player的功能給吸引了,又不滿它每次
只放一小會就靜音了, 于是乎我抄起了家伙---gdb

老實說,原來沒怎么用過gdb, 經常是通過xwpe間接的用,于是當時
就抱了抱佛腳。
gdb主要是針對源程序的調試除錯的,對匯編級的支持的并不好(最
不好的就是沒有類似debug中的a命令,沒法匯編),對于破解,gdb常用的命令
有:
info target 顯示當前目標的一些信息,包括一些分段的信息
info functions 可以列出所有定義的函數名和數據類型,相當有用,
有的程序檢查系列號和License會在一個名稱明確的函數里
info functions REGEXP 可以列出匹配正規(guī)表達表的函數
info registers 列出所有寄存器(除浮點)的值, 這個跟蹤時自然常用到
info all-registers 列出所有寄存器(包括浮點)的值
info registers REGNAME... 列出所指出的所有寄存器的值
info break 列出所有的斷點和觀察點
break *ADDR 在地址ADDR處設置斷點
break FUNCTION 在函數FUNCTION處設置斷點
clear FUNCTION 刪除在函數FUNCTION入口處的斷點
delete BNUMS 刪除BNUMS指定序點的斷點或觀察點
backtrace(bt) 顯示堆棧中的信息,也很有用,可以在調試中搞清楚當前的調用關系
x/NFU ADDR 這個也是常用,N:重復數, F:顯示格式,s字串,i機器碼,
缺省是x十六進制數, U:單元大小,b字節(jié),h半字(兩字節(jié)),w字(四字節(jié),缺省)
ADDR為地址,如 x/3uh 0x54320
set $REGNAME=VALUE 設定寄存器REGNAME的值為VALUE,還可以是
set $sp += 4這樣的讓sp加4
set {TYPE}ADDR=VALUE 將地址ADDR的TYPE類型的值設為VALUE,例
如:set {int}0x83040=4
nexti(ni) 執(zhí)行一行機器碼,如果是函數調用,則執(zhí)行到函數返回
stepi(si) 執(zhí)行一行機器碼,如果是函數調用,則進入函數
disassemble FUNCTION 反匯編FUNCTION函數
disassemble ADDR1 ADDR2 反匯編ADDR1和ADDR2間的機器碼
disassemble ADDR 反匯編ADDR所在的函數
run(r) 開始執(zhí)行程序到第一個斷點或程序結束
continue(c) 繼續(xù)程序的執(zhí)行到下一斷點或程序結束
continue(c) IGNORE-COUNT 繼續(xù)程序的執(zhí)行并忽略掉IGNORE-COUNT個斷
點,在第IGNORE-COUNT+1個斷點停下或程序結束


正式開工了:

運行mtv,首先出現的是對話框,要求"Enter Key"或是"Try it!",選"Enter Key",
填寫了資料后,提示注冊信息不正確, 顯然這其中做了Key的合法性檢查,于時選中這
里做突破口:

$ gdb mtv
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(no debugging symbols found)...
(gdb)

通常第一個斷點可以設在_start函數處,也可以先運行,中途送中斷信號讓它停下來
(一般可以 kill -18 pid, 18是SIGCONT)做這些之前還可以先看看程序中的函數
(包括使用到的共享庫的函數),特別對于Xwindows應用程序,這點十分重要:
(gdb)info functions
All defined functions:

Non-debugging symbols:
08049cf0 _init
08049d34 fl_set_object_lstyle
08049d44 fl_set_object_gravity
08049d54 fl_add_browser
08049d64 waitpid
08049d74 printf
08049d84 __strtod_internal
08049d94 fl_set_slider_bounds
08049da4 fl_set_form_atclose
08049db4 ungetc
08049dc4 sigemptyset
08049dd4 strerror
08049de4 fl_end_group
08049df4 hsearch
08049e04 fl_show_question
08049e14 fl_add_roundbutton
08049e24 XCloseDisplay
08049e34 getenv
08049e44 fl_add_text
08049e54 fl_set_input_filter
08049fd4 fl_hide_object
08049fe4 lseek
08049ff4 abort
0804a004 fl_end_form
0804a014 fl_remove_io_callback
0804a024 pipe
0804a034 fl_set_object_color
0804a044 fl_set_object_posthandler
0804a054 calloc
0804a064 fl_bgn_form
0804a074 rindex
0804a084 write
0804a094 fprintf
0804a0a4 kill
0804a0b4 ctime
0804a0c4 fl_get_menu
0804a0d4 strcat
0804a0e4 fl_bgn_group
0804a0f4 fl_set_atclose
0804a104 chdir
0804a114 fl_invalidate_fselector_cache
0804a124 XCreateBitmapFromData
0804a134 fseek
0804a144 mktime
0804a154 fl_show_fselector
0804a164 __libc_init_first
0804a174 fl_do_forms
0804a184 signal
0804a194 read
0804a1a4 fl_get_fselector_form
0804a1b4 fl_set_form_icon
0804a1c4 fl_set_slider_value
0804a1d4 fl_set_timer
0804a1e4 XParseGeometry
0804a1f4 fl_show_object
0804a204 strncpy
0804a214 unlink
0804a224 strcasecmp
0804a234 fl_set_form_geometry
0804a244 fl_get_menu_item_mode
0804a254 fl_add_input
0804a264 fl_get_input <------------------好顯眼啊..

0804a274 _IO_getc
0804a284 fork
0804a294 sscanf
0804a2a4 fl_hide_oneliner
0804a2b4 sigaction
0804a2c4 fl_set_focus_object
0804a2d4 strdup
0804a2e4 gettimeofday
0804a2f4 fl_add_slider
0804a304 fopen
0804a314 memset
0804a324 ftell
0804a334 fl_set_menu
0804a344 fl_get_pattern
0804a354 fl_set_oneliner_color
0804a364 fclose
0804a374 time
0804a384 fl_add_valslider
0804a394 fl_set_object_lcol
0804a3a4 fl_set_object_label
0804a3b4 fl_set_counter_step
0804a3c4 fl_library_version
0804a3d4 fl_show_oneliner
0804a3e4 sprintf
0804a3f4 fl_set_border_width
0804a404 atexit
0804a414 fl_mapcolor
0804a424 fl_initialize
0804a434 fl_set_menu_item_mode
0804a444 fl_set_input_maxchars
0804a454 fl_set_browser_fontstyle
0804a464 fl_get_button
0804a474 fl_hide_form
0804a484 fl_set_counter_bounds
0804a494 fl_set_object_lsize
0804a4a4 fl_add_checkbutton
0804a4b4 fl_set_object_callback
0804a4c4 fl_add_menu
0804a4d4 fl_use_fselector
0804a4e4 __errno_location
0804a4f4 exit
0804a504 fl_get_filename
0804a514 __fxstat
0804a524 fl_add_timer
0804a534 fl_set_object_resize
0804a544 open
0804a554 fl_set_object_lalign
0804a564 fl_get_directory
0804a574 fl_show_choice
0804a584 fl_set_slider_size
0804a594 fputs
0804a5a4 execvp
0804a5b4 fl_get_counter_value
0804a5c4 close
0804a5d4 XOpenDisplay
0804a5e4 free
0804a604 fl_set_button
0804a614 _start
08052e7c whereError
080583c0 _fini
mtv用到了xforms庫,fl_xxxx都是這個庫里的函數, 其中的哪個fl_get_input是
這么的顯眼, 雖然沒有做過xforms的編程,但是可以大膽設想這個東東會不會類似
windows中的GetDlgItemText(GetDlgItemTextA), 所以不妨試試

(gdb)break fl_get_input
Breakpoint 1 at 0x804a264
(gdb)r
Starting program: /usr/X11R6/bin/mtv
(no debugging symbols found)...Breakpoint 1 at 0x400429e3

出現填寫注冊信息對話框, 我做如下輸入

Name: I007
Order number: B123456789 (有editmask,只能一字母后跟字數)
Key: 87654321 (也有editmask)

按OK鍵后, mtv果然在斷點處停住, 猜得不錯. 如果沒猜中, 只好慢慢跟蹤羅
(no debugging symbols found)...(no debugging symbols found)...
Breakpoint 1, 0x400429e3 in fl_get_input ()
(gdb)

繼續(xù)讓它運行...
(gdb) c
Continuing.

Breakpoint 1, 0x400429e3 in fl_get_input ()
(gdb) c
Continuing.

Breakpoint 1, 0x400429e3 in fl_get_input ()
(gdb) c
Continuing.

它連續(xù)調用了fl_get_input三次, 正好對應三個輸入項, 然后注冊信息錯誤的
對話框就出現了, 看來是沒錯了, 現在關鍵是要看最后一次調用fl_get_input
后的代碼,當然看它每次調用fl_get_input后到取回的字串放到了什么地地方
也很重要.我重新輸入一次注冊信息,然后讓它在三次調用fl_get_input后的
情況:
(gdb) c
Continuing.

Breakpoint 1, 0x400429e3 in fl_get_input ()
(gdb) bt
#0 0x400429e3 in fl_get_input ()
#1 0x804ea96 in _start ()
#2 0x4003b5f5 in fl_do_forms ()
#3 0x8050a59 in _start ()

這是堆棧中的情況, 看來調用完fl_get_input后應返回到_start中的
地址0x804ea96處, 我們來看看這段代碼
(gdb) disass 0x804ea96 0x804ffff
Dump of assembler code from 0x804ea96 to 0x804ffff:
0x804ea96 <_start+17538>: movl %eax,0x806e584
0x804ea9b <_start+17543>: pushl %eax
0x804ea9c <_start+17544>: movl 0x806e9d4,%eax
0x804eaa1 <_start+17549>: movl 0x18(%eax),%ecx
0x804eaa4 <_start+17552>: pushl %ecx
0x804eaa5 <_start+17553>: call 0x804a264 <fl_get_input> <-第二次
0x804eaaa <_start+17558>: movl %eax,%ebp
0x804eaac <_start+17560>: movl 0x806e9d4,%eax
0x804eab1 <_start+17565>: pushl %eax
0x804eab2 <_start+17566>: movl 0x10(%eax),%edx
0x804eab5 <_start+17569>: pushl %edx
0x804eab6 <_start+17570>: call 0x804a264 <fl_get_input> <-第三次
0x804eabb <_start+17575>: movl %eax,%ebx
0x804eabd <_start+17577>: movl %ebp,%edx
0x804eabf <_start+17579>: movl %ebp,%eax
0x804eac1 <_start+17581>: addl $0x18,%esp
0x804eac4 <_start+17584>: andl $0x3,%edx
0x804eac7 <_start+17587>: je 0x804eadf <_start+17611>
0x804eac9 <_start+17589>: jp 0x804eada <_start+17606>
0x804eacb <_start+17591>: cmpl $0x2,%edx
0x804eace <_start+17594>: je 0x804ead5 <_start+17601>
0x804ead0 <_start+17596>: cmpb %dh,(%eax)
....
(gdb) break *0x804ea96
Breakpoint 2 at 0x804ea96
(gdb) c
Continuing.

Breakpoint 2, 0x804ea96 in _start ()
(gdb) info reg eax
eax 0x8083dd0 134757840
(gdb) x/s 0x8083dd0
0x8083dd0: "I007"

看來 "I007" 放在 0x8083dd0, 這個地址還存放到了 0x806e584

(gdb) ni
....

到第三次調用fl_get_input完回到0x804eabb時,我們知道了輸入的信息存在在哪

名稱 值 地址
Name "I007" 0x8083dd0
Order number "B123456789" 0x809e850
Key "87654321" 0x809e880

以下的一些反匯編代碼中會有一些注釋, 主要說明是執(zhí)行到這樣地方時一些情況,
也不一步步的ni了..
(gdb) disass 0x804eabb 0x804ffff
Dump of assembler code from 0x804eabb to 0x804ffff:
0x804eabb <_start+17575>: movl %eax,%ebx (eax: 0x809e880->""87654321")

0x804eabd <_start+17577>: movl %ebp,%edx (ebp: 0x809e850->"B123456789"
)
0x804eabf <_start+17579>: movl %ebp,%eax
0x804eac1 <_start+17581>: addl $0x18,%esp
0x804eac4 <_start+17584>: andl $0x3,%edx
0x804eac7 <_start+17587>: je 0x804eadf <_start+17611> --
0x804eac9 <_start+17589>: jp 0x804eada <_start+17606> |
0x804eacb <_start+17591>: cmpl $0x2,%edx |
0x804eace <_start+17594>: je 0x804ead5 <_start+17601> |
0x804ead0 <_start+17596>: cmpb %dh,(%eax) |
0x804ead2 <_start+17598>: je 0x804eb05 <_start+17649> |
0x804ead4 <_start+17600>: incl %eax |
0x804ead5 <_start+17601>: cmpb %dh,(%eax) |
0x804ead7 <_start+17603>: je 0x804eb05 <_start+17649> |
0x804ead9 <_start+17605>: incl %eax |
0x804eada <_start+17606>: cmpb %dh,(%eax) |
0x804eadc <_start+17608>: je 0x804eb05 <_start+17649> |
0x804eade <_start+17610>: incl %eax |
|
以下檢查Order number長度是否為10: |
0x804eadf <_start+17611>: movl (%eax),%edx <-
0x804eae1 <_start+17613>: testb %dh,%dl
0x804eae3 <_start+17615>: jne 0x804eaed <_start+17625>
0x804eae5 <_start+17617>: testb %dl,%dl
0x804eae7 <_start+17619>: je 0x804eb05 <_start+17649>
0x804eae9 <_start+17621>: testb %dh,%dh
0x804eaeb <_start+17623>: je 0x804eb04 <_start+17648>
0x804eaed <_start+17625>: testl $0xff0000,%edx
0x804eaf3 <_start+17631>: je 0x804eb03 <_start+17647>
0x804eaf5 <_start+17633>: addl $0x4,%eax
0x804eaf8 <_start+17636>: testl $0xff000000,%edx
0x804eafe <_start+17642>: jne 0x804eadf <_start+17611>
0x804eb00 <_start+17644>: subl $0x3,%eax
0x804eb03 <_start+17647>: incl %eax
0x804eb04 <_start+17648>: incl %eax
0x804eb05 <_start+17649>: subl %ebp,%eax
0x804eb07 <_start+17651>: cmpl $0xa,%eax
0x804eb0a <_start+17654>: jne 0x804ebe6 <_start+17874>

以下檢查Key的長度是否為8:
0x804eb10 <_start+17660>: movl %ebx,%edx
0x804eb12 <_start+17662>: movl %ebx,%eax
0x804eb14 <_start+17664>: andl $0x3,%edx
0x804eb17 <_start+17667>: je 0x804eb2f <_start+17691> -
0x804eb19 <_start+17669>: jp 0x804eb2a <_start+17686> |
0x804eb1b <_start+17671>: cmpl $0x2,%edx |
0x804eb1e <_start+17674>: je 0x804eb25 <_start+17681> |
0x804eb20 <_start
本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現有害或侵權內容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
xcode反匯編調試iOS模擬器程序
gdb 逆向分析(轉)
深入理解計算機系統(tǒng)攻擊程序
AT&T匯編語言與GCC內嵌匯編簡介
分享一個有意思的gdb插件
AT&T匯編語法格式簡介
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯系客服!

聯系客服