160 - 27 Cosh.1

環境
Windows XP sp3

工具
exeinfope
ollydbg

查殼
無殼的MFC程序

測試

彈出這個:

是一個CD-CHECK保護的程序。

字符串搜索,一下子就能來到這里:

0040121A   .  68 9C304000   push Cosh_1.0040309C                          ;  ASCII "C:\"
0040121F   .  8D4D A4       lea ecx,dword ptr ss:[ebp-0x5C]
00401222   .  E8 79040000   call <jmp.&MFC42.#CString::CString_537>
00401227   .  33DB          xor ebx,ebx
00401229   .  68 98304000   push Cosh_1.00403098                          ;  ASCII "D:\"
0040122E   .  8D4D A8       lea ecx,dword ptr ss:[ebp-0x58]
00401231   .  895D FC       mov dword ptr ss:[ebp-0x4],ebx
00401234   .  E8 67040000   call <jmp.&MFC42.#CString::CString_537>
00401239   .  68 94304000   push Cosh_1.00403094                          ;  ASCII "E:\"
0040123E   .  8D4D AC       lea ecx,dword ptr ss:[ebp-0x54]
00401241   .  C645 FC 01    mov byte ptr ss:[ebp-0x4],0x1
00401245   .  E8 56040000   call <jmp.&MFC42.#CString::CString_537>
0040124A   .  68 90304000   push Cosh_1.00403090                          ;  ASCII "F:\"
0040124F   .  8D4D B0       lea ecx,dword ptr ss:[ebp-0x50]
00401252   .  C645 FC 02    mov byte ptr ss:[ebp-0x4],0x2
00401256   .  E8 45040000   call <jmp.&MFC42.#CString::CString_537>
0040125B   .  68 8C304000   push Cosh_1.0040308C                          ;  ASCII "G:\"
00401260   .  8D4D B4       lea ecx,dword ptr ss:[ebp-0x4C]
00401263   .  C645 FC 03    mov byte ptr ss:[ebp-0x4],0x3
00401267   .  E8 34040000   call <jmp.&MFC42.#CString::CString_537>
0040126C   .  68 88304000   push Cosh_1.00403088                          ;  ASCII "H:\"
00401271   .  8D4D B8       lea ecx,dword ptr ss:[ebp-0x48]
00401274   .  C645 FC 04    mov byte ptr ss:[ebp-0x4],0x4
00401278   .  E8 23040000   call <jmp.&MFC42.#CString::CString_537>
0040127D   .  68 84304000   push Cosh_1.00403084                          ;  ASCII "I:\"
00401282   .  8D4D BC       lea ecx,dword ptr ss:[ebp-0x44]
00401285   .  C645 FC 05    mov byte ptr ss:[ebp-0x4],0x5
00401289   .  E8 12040000   call <jmp.&MFC42.#CString::CString_537>
0040128E   .  68 80304000   push Cosh_1.00403080                          ;  ASCII "J:\"
00401293   .  8D4D C0       lea ecx,dword ptr ss:[ebp-0x40]
00401296   .  C645 FC 06    mov byte ptr ss:[ebp-0x4],0x6
0040129A   .  E8 01040000   call <jmp.&MFC42.#CString::CString_537>
0040129F   .  68 7C304000   push Cosh_1.0040307C                          ;  ASCII "K:\"
004012A4   .  8D4D C4       lea ecx,dword ptr ss:[ebp-0x3C]
004012A7   .  C645 FC 07    mov byte ptr ss:[ebp-0x4],0x7
004012AB   .  E8 F0030000   call <jmp.&MFC42.#CString::CString_537>
004012B0   .  68 78304000   push Cosh_1.00403078                          ;  ASCII "L:\"
004012B5   .  8D4D C8       lea ecx,dword ptr ss:[ebp-0x38]
004012B8   .  C645 FC 08    mov byte ptr ss:[ebp-0x4],0x8
004012BC   .  E8 DF030000   call <jmp.&MFC42.#CString::CString_537>
004012C1   .  68 74304000   push Cosh_1.00403074                          ;  ASCII "M:\"
004012C6   .  8D4D CC       lea ecx,dword ptr ss:[ebp-0x34]
004012C9   .  C645 FC 09    mov byte ptr ss:[ebp-0x4],0x9
004012CD   .  E8 CE030000   call <jmp.&MFC42.#CString::CString_537>
004012D2   .  68 70304000   push Cosh_1.00403070                          ;  ASCII "N:\"
004012D7   .  8D4D D0       lea ecx,dword ptr ss:[ebp-0x30]
004012DA   .  C645 FC 0A    mov byte ptr ss:[ebp-0x4],0xA
004012DE   .  E8 BD030000   call <jmp.&MFC42.#CString::CString_537>
004012E3   .  68 6C304000   push Cosh_1.0040306C                          ;  ASCII "O:\"
004012E8   .  8D4D D4       lea ecx,dword ptr ss:[ebp-0x2C]
004012EB   .  C645 FC 0B    mov byte ptr ss:[ebp-0x4],0xB
004012EF   .  E8 AC030000   call <jmp.&MFC42.#CString::CString_537>
004012F4   .  68 68304000   push Cosh_1.00403068                          ;  ASCII "P:\"
004012F9   .  8D4D D8       lea ecx,dword ptr ss:[ebp-0x28]
004012FC   .  C645 FC 0C    mov byte ptr ss:[ebp-0x4],0xC
00401300   .  E8 9B030000   call <jmp.&MFC42.#CString::CString_537>
00401305   .  BE 9A164000   mov esi,<jmp.&MFC42.#CString::~CString_800>   ;  入口地址
0040130A   .  33C0          xor eax,eax
0040130C   .  8D7D DC       lea edi,dword ptr ss:[ebp-0x24]
0040130F   .  56            push esi
00401310   .  C645 FC 0D    mov byte ptr ss:[ebp-0x4],0xD
00401314   .  68 94164000   push <jmp.&MFC42.#CString::CString_540>       ;  入口地址
00401319   .  AB            stos dword ptr es:[edi]
0040131A   .  6A 01         push 0x1
0040131C   .  8D45 DC       lea eax,dword ptr ss:[ebp-0x24]
0040131F   .  6A 04         push 0x4
00401321   .  50            push eax
00401322   .  E8 C3040000   call Cosh_1.004017EA
00401327   .  8D4D E8       lea ecx,dword ptr ss:[ebp-0x18]
0040132A   .  C645 FC 0E    mov byte ptr ss:[ebp-0x4],0xE
0040132E   .  E8 61030000   call <jmp.&MFC42.#CString::CString_540>
00401333   .  C645 FC 0F    mov byte ptr ss:[ebp-0x4],0xF
00401337   .  895D EC       mov dword ptr ss:[ebp-0x14],ebx
0040133A   .  8D7D A4       lea edi,dword ptr ss:[ebp-0x5C]
0040133D   >  57            push edi
0040133E   .  8D4D E8       lea ecx,dword ptr ss:[ebp-0x18]
00401341   .  E8 48030000   call <jmp.&MFC42.#CString::operator=_858>
00401346   .  FF75 E8       push dword ptr ss:[ebp-0x18]                  ; /RootPathName
00401349   .  FF15 04204000 call dword ptr ds:[<&KERNEL32.GetDriveTypeA>] ; \GetDriveTypeA
0040134F      83F8 03       cmp eax,0x3
00401352   .  74 3E         je XCosh_1.00401392
00401354   .  8D45 E8       lea eax,dword ptr ss:[ebp-0x18]
00401357   .  68 58304000   push Cosh_1.00403058                          ;  ASCII "CD_CHECK.DAT"
0040135C   .  50            push eax
0040135D   .  8D45 E0       lea eax,dword ptr ss:[ebp-0x20]
00401360   .  50            push eax
00401361   .  E8 22030000   call <jmp.&MFC42.#operator+_924>
00401366   .  8B00          mov eax,dword ptr ds:[eax]
00401368   .  53            push ebx                                      ; /hTemplateFile
00401369   .  53            push ebx                                      ; |Attributes
0040136A   .  53            push ebx                                      ; |Mode
0040136B   .  53            push ebx                                      ; |pSecurity
0040136C   .  6A 01         push 0x1                                      ; |ShareMode = FILE_SHARE_READ
0040136E   .  68 00000080   push 0x80000000                               ; |Access = GENERIC_READ
00401373   .  50            push eax                                      ; |FileName
00401374   .  FF15 00204000 call dword ptr ds:[<&KERNEL32.CreateFileA>]   ; \CreateFileA
0040137A   .  83F8 FF       cmp eax,-0x1
0040137D   .  8D4D E0       lea ecx,dword ptr ss:[ebp-0x20]
00401380   .  0F9445 F3     sete byte ptr ss:[ebp-0xD]
00401384   .  E8 11030000   call <jmp.&MFC42.#CString::~CString_800>
00401389   .  385D F3       cmp byte ptr ss:[ebp-0xD],bl
0040138C   .  0F84 F3000000 je Cosh_1.00401485
00401392   >  FF45 EC       inc dword ptr ss:[ebp-0x14]
00401395   .  83C7 04       add edi,0x4
00401398   .  837D EC 07    cmp dword ptr ss:[ebp-0x14],0x7
0040139C   .^ 75 9F         jnz XCosh_1.0040133D
0040139E   .  53            push ebx
0040139F   .  68 4C304000   push Cosh_1.0040304C                          ;  ASCII "Try again"
004013A4   .  68 40304000   push Cosh_1.00403040                          ;  ASCII "You lost"
004013A9   >  8B4D E4       mov ecx,dword ptr ss:[ebp-0x1C]
004013AC   .  E8 D1020000   call <jmp.&MFC42.#CWnd::MessageBoxA_4224>00401485   >  53            push ebx
00401486   .  68 34304000   push Cosh_1.00403034                          ;  ASCII "You did it"
0040148B   .  68 20304000   push Cosh_1.00403020                          ;  ASCII "Well done, Cracker"
00401490   .^ E9 14FFFFFF   jmp Cosh_1.004013A9                           ;  跳回上面去

看看OD給的注釋幾乎就能猜到這個程序保護的思路了。
程序似乎是在檢測每個磁盤分區里是否存在一個叫做“CD_CHECK.DAT”的文件。如果存在就顯示正確,不然的話判斷下一個分區是否存在該文件,總共判斷7次。

00401392   >  FF45 EC       inc dword ptr ss:[ebp-0x14]
00401398   .  837D EC 07    cmp dword ptr ss:[ebp-0x14],0x7
0040139C   .^ 75 9F         jnz XCosh_1.0040133D

然后發現即使是創建了一個叫做“CD_CHECK.DAT”文件在C盤,在調用完CreateFileA后返回值仍然是-1,通過編寫類似的程序,發現是參數錯誤,

    CreateFileA("c:\\CD_CHECK.DAT",GENERIC_READ,FILE_SHARE_READ,NULL,0,0,NULL);int d = GetLastError();printf("%d",d);

結果為:87
查看System Error Codes,得到:

ERROR_INVALID_PARAMETER87 (0x57)The parameter is incorrect.

改為:

    CreateFileA("c:\\CD_CHECK.DAT",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);int d = GetLastError();printf("%d",d);

結果為:0
再查一查CreateFileA函數,并沒有發現dwCreationDisposition形參(即OD里的Mode)可以允許值為0

dwCreationDisposition [in]
An action to take on a file or device that exists or does not exist.
For devices other than files, this parameter is usually set to OPEN_EXISTING.
For more information, see the Remarks section.
This parameter must be one of the following values, which cannot be combined:

ValueMeaning
CREATE_ALWAYS 2Creates a new file, always.If the specified file exists and is writable, the function overwrites the file, the function succeeds, and last-error code is set to ERROR_ALREADY_EXISTS (183). If the specified file does not exist and is a valid path, a new file is created, the function succeeds, and the last-error code is set to zero.For more information, see the Remarks section of this topic.
CREATE_NEW 1Creates a new file, only if it does not already exist.If the specified file exists, the function fails and the last-error code is set to ERROR_FILE_EXISTS (80).If the specified file does not exist and is a valid path to a writable location, a new file is created.
OPEN_ALWAYS 4Opens a file, always.If the specified file exists, the function succeeds and the last-error code is set to ERROR_ALREADY_EXISTS (183).If the specified file does not exist and is a valid path to a writable location, the function creates a file and the last-error code is set to zero.
OPEN_EXISTING 3Opens a file or device, only if it exists.If the specified file or device does not exist, the function fails and the last-error code is set to ERROR_FILE_NOT_FOUND (2).For more information about devices, see the Remarks section.
TRUNCATE_EXISTING 5Opens a file and truncates it so that its size is zero bytes, only if it exists.If the specified file does not exist, the function fails and the last-error code is set to ERROR_FILE_NOT_FOUND (2).The calling process must open the file with the GENERIC_WRITE bit set as part of the dwDesiredAccess parameter.

所以可以認為這個CreaterFileA沒有作用
于是可以在此處修改代碼:

0040134F      83F8 03       cmp eax,0x3
00401352   .  74 3E         je XCosh_1.00401392

改為:

0040134F     /E9 31010000   jmp Cosh_1.00401485

出現結果:

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/376416.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/376416.shtml
英文地址,請注明出處:http://en.pswp.cn/news/376416.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

什么時候加上android.intent.category.DEFAULT

1、要弄清楚這個問題&#xff0c;首先需要弄明白什么是implicit(隱藏) intent什么是explicit(明確) intent。 Explicit Intent明確的指定了要啟動的Acitivity &#xff0c;比如以下Java代碼&#xff1a; Intent intent new Intent(this, B.class) Implicit Intent沒有明確的指…

[BZOJ 2165] 大樓 【DP + 倍增 + 二進制】

題目鏈接&#xff1a;BZOJ - 2165 題目分析&#xff1a; 這道題我讀了題之后就想不出來怎么做&#xff0c;題解也找不到&#xff0c;于是就請教了黃學長&#xff0c;黃學長立刻秒掉了這道題&#xff0c;然后我再看他的題解才寫出來。。Orz 使用 DP 倍增 &#xff0c;用狀態 f[…

oracle創建表空間

注意點&#xff1a; 1.如果在PL/SQL 等工具里打開的話&#xff0c;直接修改下面的代碼中[斜體加粗部分]執行 2.確保路徑存在&#xff0c;比如【D:\oracle\oradata\Oracle9i\】也就是你要保存文件的路徑存在 /*分為四步 */ /*第1步&#xff1a;創建臨時表空間 */ create tempor…

160 - 28 CoSH.2

環境 Windows xp sp3 工具 exeinfope ollydbg 查殼 無殼的MFC程序 測試 輸入 Nmae:123456 Serial:12345 點擊“CHECK”后彈出錯誤提示的消息框&#xff0c;然后程序自己結束掉 依然是字符串搜索&#xff1a; 004014DB . 8B1D FC214000 mov ebx,dword ptr ds…

負載均衡情況下獲取真實ip的方法

公司用了硬件負載均衡&#xff0c;最近發現日志中的用戶ip都為負載均衡器的ip&#xff0c;業務需要所以要改為用戶真實ip&#xff0c;下面記錄一下&#xff01; 1、打開文件&#xff1a;/etc/httpd/conf/httd.conf。2、在文件中查找&#xff1a;”CustomLog”,找到如下配置塊: …

ASP.NET MVC5 + EF6 入門教程 (5) Model和Entity Framework

文章來源&#xff1a; Slark.NET-博客園 http://www.cnblogs.com/slark/p/mvc-5-ef-6-get-started-model.html 上一節&#xff1a;ASP.NET MVC 5 入門教程 (4) View和ViewBag 下一節&#xff1a;ASP.NET MVC5 EF6 入門教程 (6) View中的Razor使用 源碼下載&#xff1a;點我下…

160 - 29 cosh.3

環境 Windows xp sp3 工具 exeinfope ollydbg 查殼 無殼的MFC程序 測試 字符串搜索&#xff1a; 004014F5 |. E8 AA030000 call <jmp.&MFC42.#CWnd::GetWindowTextLengthA_> 004014FA |. 8945 EC mov [local.5],eax 004014FD |. 837D EC 0…

hdu--4902--線段樹

題意 前面一段廢話 這題 最有意思的應該是出題人 是clj 這題的時限放的太寬了 給了15s 我也是醉了 區間更新。 1 #include <iostream>2 #include <algorithm>3 using namespace std;4 5 const int size 200010;6 int a[size];7 struct data8 {9 int L , R ,…

(五) 面向對象類設計原則

1. 開閉原則&#xff08;the Open Closed Principle OCP&#xff09; 一個模塊在擴展性方面應該是開放的而在更改性方面應該是封閉的。因此在進行面向對象設計時要盡量考慮接口封裝機制、抽象機制和多態技術。該原則同樣適合于非面向對象設計的方法&#xff0c;是軟件工程 設計…

160 - 30 cracking4all.1

環境 Windows XP sp3 工具 exeinfope ollydbg 查殼 無殼的VB程序 測試 這個serial藏得比較里面&#xff0c;多點幾下才能看到 字符串搜索&#xff1a; 00403338 . 50 push eax ; /var18 00403339 . 51 …

java2s.com

http://www.java2s.com/Code/JavaAPI/CatalogJavaAPI.htm轉載于:https://www.cnblogs.com/reborn2012/p/3326445.html

MVC5 + EF6 入門完整教程

MVC5 EF6 入門完整教程 原文:MVC5 EF6 入門完整教程第0課 從0開始 ASP.NET MVC開發模式和傳統的WebForm開發模式相比&#xff0c;增加了很多"約定"。 直接講這些 "約定" 會讓人困惑&#xff0c;而且東西太多容易忘記。 和微軟官方教程不同&#xff0c…

160 - 31 cracking4all.2

環境 Windows xp sp3 工具 exeinfope ollydbg 查殼 無殼VB程序 測試 輸入1234567 OD載入字符串搜素&#xff0c;往上翻就看到這里&#xff0c;我截取部分片段&#xff1a; 00402C26 . 8D55 98 lea edx,dword ptr ss:[ebp-0x68] ; 取serial長度…

stm32的DFU使用方法

stm32的dfu看上去是個很高級的東西&#xff0c;似乎可以通過USB給內部flash、外部spi flash、外部nor等東西刷寫數據、把數據讀出來&#xff0c;但是用了一下感覺確實有點麻煩。 先不管原理是怎樣的&#xff0c;使用方法是這樣&#xff1a; 1、先下載這個Dfuse&#xff0c;然后…

160 - 32 genocide1

環境 Windows xp sp3 工具 upx exeinfope ollydbg 查殼 發現是upx殼&#xff0c;手脫的話會不干凈&#xff0c;影響OD分析。 所以就直接用 upx -d 脫了 手脫&#xff1a; upx -d: 用upx -d 脫的版本進行分析。 第一次運行時顯示這個&#xff1a; 缺少Reg.dat…

vector function trmplate

/*vectorfunction templateprogrammer:qpz */ #include <iostream> #include <vector> #define MAX 10 using namespace std; class Myclass{ private:vector <int> vel;//可均分的動態數組 public:void Add(int x){vel.push_back(x);}void print(); }; void…

軟件工程個人項目11061180王宇杰

&#xff08;1&#xff09;我完全不知道要花費多少時間&#xff0c;因為從來沒有進行過類似的項目&#xff0c;涉及的很多問題我以前也根本不會。簡單的估計一下&#xff0c;這至少是15小時的工作量。 &#xff08;2&#xff09;前期的準備工作很耗時間&#xff0c;因為一開始根…

160 - 33 Cruehead.1

環境 windows xp sp3 工具 exeinfo pe ollydbg 查殼 無殼的匯編程序&#xff08;OD載入的出來的&#xff09; 測試 當name輸入為數字時&#xff0c;會彈出兩次錯誤框。 OD載入搜字符串&#xff0c;發現有兩個地方&#xff1a; 0040134D /$ 6A 30 push 0x…

mac osx 10.10 pip 安裝問題

在mac osx 升級到 10.10(Yosemite)以后&#xff0c;用pip以及easy_install 安裝python包的時候&#xff0c;如果包需要編譯&#xff0c;就會編譯失敗&#xff0c;錯誤如下&#xff1a; build/temp.macosx-10.10-x86_64-2.7/greenlet.o -o build/lib.macosx-10.10-x86_64-2.7/gr…

英文系統上網頁內容亂碼的解決

今天隨便寫了一段html 代碼示例&#xff0c;代碼如下&#xff1a; <html lang"zh-cn"> <head> </head> <body> <h1>HTML 教程目錄</h1> <ul> <li><a href"#C1">第一章</a></li> <li…