About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
+ m/ Y9 w7 Z4 r( }! C# j" A<TBODY>: G% u4 v7 a4 N0 x, \. q; q
<TR>
# N/ m) K4 j/ E; ]8 H) c1 E% [8 m<TD><PRE>Method 01 ! x+ V6 q1 w: ^5 b* r1 @/ z
=========. |% x8 U. W3 \5 ~5 i

( ^& H' Y1 h) J, |+ |6 @$ ?8 nThis method of detection of SoftICE (as well as the following one) is. F1 @3 q, P7 \, ?5 Q
used by the majority of packers/encryptors found on Internet.
5 P/ d7 }1 z5 mIt seeks the signature of BoundsChecker in SoftICE
8 H, @% o& o2 i: Z3 Y+ j1 Q9 N" e! w) x" d. D
    mov     ebp, 04243484Bh        ; 'BCHK'! {7 T; }/ x; |9 h3 F
    mov     ax, 04h
" c3 E. Y+ Y) p# t6 N* \& E( c* ?    int     3      
" N; a- J" ~' G6 |( _* V    cmp     al,4
0 T3 F* n. p2 a& h    jnz     SoftICE_Detected
9 U+ c/ p+ ]; d
' g9 g+ }& t+ b9 E8 x; U___________________________________________________________________________
) n6 f; o% x; I! U' D6 ~% x* a* [; H" {
Method 026 R; U. h: \) h* i
=========
' u, L- S* m8 p) ^+ ?. r
" s8 d* A$ x" c1 F! e" eStill a method very much used (perhaps the most frequent one).  It is used4 y9 y1 A: S; O+ s
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 w4 L7 u; Y% f9 \or execute SoftICE commands...
; p+ Y9 m3 q* e; v+ C% XIt is also used to crash SoftICE and to force it to execute any commands
2 f) T& U  }  ~8 d4 J( s* _" S(HBOOT...) :-((  ; z" ^8 U5 A" ~" Q+ ^1 b; K: g* z+ t

+ m7 ~" s4 V$ Q% M2 U5 t$ I& NHere is a quick description:
8 e6 ]/ P4 H( W. m* C- r6 s% v-AX = 0910h   (Display string in SIce windows)
8 ]2 W5 B/ V# f+ f3 w-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
; q0 l9 _; Z* m' p-AX = 0912h   (Get breakpoint infos): y/ d* E  B5 u9 ~
-AX = 0913h   (Set Sice breakpoints)7 ~! e5 G8 B& I' I
-AX = 0914h   (Remove SIce breakoints)/ G! ^  g4 P: _/ r3 |0 {

; Q4 a' h& z( n4 zEach time you'll meet this trick, you'll see:
; j- j3 [- k) Y+ p9 S-SI = 4647h! K4 S$ d: k- O
-DI = 4A4Dh
# ]0 H/ D$ o& ^( lWhich are the 'magic values' used by SoftIce.: `! _7 Y! E3 w1 d5 L
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) L' W+ m5 @" M. z/ ^' @' B5 J5 v6 U  k9 K% Q2 N
Here is one example from the file "Haspinst.exe" which is the dongle HASP$ c1 ]' z4 Y6 f6 v
Envelope utility use to protect DOS applications:
! V: S! ^* ^2 g6 j+ ]  U8 F( L+ W/ E" U1 Z7 s/ `5 N' m

2 u7 {+ l: s) N" E6 ^4C19:0095   MOV    AX,0911  ; execute command.& ]! [2 }  I0 L- k, q* n$ Y" z$ k# Z. ?
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# R% C! j% x8 E! `3 g
4C19:009A   MOV    SI,4647  ; 1st magic value.
: e' ?& }% G% x' p# o4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
$ i3 C! A; C5 {8 w4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- t2 A3 }) o0 Q1 l
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
3 w% d9 C8 C4 x8 W- p7 T3 y( t4C19:00A4   INC    CX
- c: E4 c! w2 m4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
  W2 V" Q( i+ Q4C19:00A8   JB     0095     ; 6 different commands.
6 K  l3 a3 Q9 X2 f$ P4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 e) v, h# e: B) p
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
' m+ e  r" R4 @# d+ B, T6 U! I7 K
The program will execute 6 different SIce commands located at ds:dx, which
2 U& ^' k" b/ X$ K7 i& m7 H* s4 I. \are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.2 W( T7 \- I  G6 m/ b! D
! J& N* d' X0 z1 M1 k
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.' [5 h( X1 s5 [7 ]: [6 p
___________________________________________________________________________4 y- a9 L" I. F6 v; k% }
" z  |$ Q$ u) O5 R" P, D

! e0 B9 l. G! ?& c; n4 b6 j# `: xMethod 034 q! \$ f& k  M( T& y! q6 q0 `& b
=========3 d1 x) L' Q# w! A# u' {9 q

: y6 J: I' f/ P0 g8 l7 CLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* s! `- N6 f0 X! A5 v5 \3 @(API Get entry point)& j( d; Z4 {; c9 L% N
        
7 d" L! j; e6 w- y4 m! L# {; Q6 b) C0 c  d% N) U
    xor     di,di$ I% p. ?9 w$ O8 ]
    mov     es,di
% m3 i" w# n: Y7 ^) ]5 J3 w    mov     ax, 1684h      
4 [! k4 K4 J8 U& B1 l5 U0 Y    mov     bx, 0202h       ; VxD ID of winice  m  T/ Z6 q# E
    int     2Fh
. W0 N2 k; E( \8 I5 U+ |, `    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 A7 P! L6 V# ]* }9 O$ H$ F% J* N
    add     ax, di
7 ]! x3 G* a" \" M+ w1 g+ f4 A+ d    test    ax,ax8 z. I' g1 J; d$ Q: [
    jnz     SoftICE_Detected
, @5 r4 q" N0 m8 A' ^' g/ [
% m- C( U' x7 l+ a; R___________________________________________________________________________
: d6 Y& R% S4 m8 o) j' e: Y
) Y0 N0 A  l' {; c4 s" wMethod 04
2 P! D$ }1 c$ ]=========
& n" k* G- O- v: `* C
( t+ t, B- t5 [Method identical to the preceding one except that it seeks the ID of SoftICE5 i$ B; B8 i- ?& g, ?9 s. Q
GFX VxD.) H: A  W' j% A
5 o- R( _" D4 ?8 L
    xor     di,di
2 V5 ~2 w9 w7 n5 [- P1 K$ \% h' F4 v    mov     es,di
9 B  ~( m  q; I: q* `4 K+ j    mov     ax, 1684h      
' W! [- L  Y& f! w1 \% F    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 ]( s2 C+ c8 ^- x
    int     2fh0 ?9 d. l+ ?# s& j; r+ n( s/ T) M
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" Z; }6 J. M  v/ m- K
    add     ax, di
. j4 j! t8 d0 t8 _9 c% D, R% v    test    ax,ax
& Z8 j7 \% Y# F4 ?1 o    jnz     SoftICE_Detected( I" }- f0 m0 F: \, M
5 O2 N8 h% V7 I  i# e" K
__________________________________________________________________________9 N2 Z' V' t$ v1 z

7 Q; f0 ?" c' c, b, @! n
: G* p9 i, P3 Q( cMethod 05
2 s/ I7 `# w3 S  P1 B; w2 Q! x=========
3 z" E8 n! @1 @! z( D2 d4 U5 x# N4 }, ]4 b; q8 {
Method seeking the 'magic number' 0F386h returned (in ax) by all system3 h$ S- u6 ]3 N7 r1 q5 V' L4 r% [
debugger. It calls the int 41h, function 4Fh.! H" I3 p" N* O
There are several alternatives.  
+ ?) F2 R3 X$ v6 o' {5 M; V  {  r! [, C2 b
The following one is the simplest:
! f( q9 X; `4 L1 n- y9 G: t! m$ B) Q. |! V- S
    mov     ax,4fh
  ~" ^- [7 t5 O' w9 {2 o! D1 t    int     41h
( q8 _9 Z/ b: F3 v2 C* ^* T9 x    cmp     ax, 0F386/ x* F' t& a& C1 D6 F4 c
    jz      SoftICE_detected+ \9 w$ T3 L1 x4 Y& Z+ I* K$ J2 q

0 @9 u& d* |. w# u$ t: U! J& g$ ^0 l/ R. s7 {9 {9 b
Next method as well as the following one are 2 examples from Stone's ! `& G0 k/ u* D
"stn-wid.zip" (www.cracking.net):) n- _% a; G; ?6 D9 A

* H5 {& r2 v9 A/ v' {) Y9 Q    mov     bx, cs
/ i8 T+ T3 U. D: l7 `$ Y( F. d4 K    lea     dx, int41handler2
4 s9 P7 \5 E5 s- {: @    xchg    dx, es:[41h*4]
$ T& O0 J4 p7 Z( X6 @7 C    xchg    bx, es:[41h*4+2]
, w3 W8 ?) P! _7 @* a; L    mov     ax,4fh
; Q/ I/ n  F1 i; U4 |0 a1 F" e    int     41h
, [) f5 U% J* E# b1 w    xchg    dx, es:[41h*4]
/ T, Z4 n  ~8 ^) k4 Q( q" B    xchg    bx, es:[41h*4+2]
; w8 c1 r* k$ ]' C6 R    cmp     ax, 0f386h/ L8 k( |% Q' J$ u$ b, C
    jz      SoftICE_detected$ D  G- D0 d# U7 a& p+ ]6 J
1 R! Y  f$ L4 t0 L2 t. l
int41handler2 PROC
, V# c9 a* f3 k* l6 y1 r    iret
8 i, {0 ~0 y0 k+ Kint41handler2 ENDP
/ @$ X. E2 f) M. e! ^/ }4 y5 z+ S: S2 l2 o' `& T+ e
+ \, Y: ]7 F; ]: q
_________________________________________________________________________
1 O$ `1 r, ]$ L9 q/ i" r$ b, \% i2 M
  T  [' L- i- b1 d
2 t# l5 [5 ~  m$ g5 S% lMethod 06% G2 ]  d+ m/ r
=========$ A$ s+ ?$ ?& |. t

( O$ v$ w, }: ?# u  U  E
" {& u. z9 ?4 m  ~* S2nd method similar to the preceding one but more difficult to detect:
. q4 G' I1 Y" m5 D+ H# S3 X
6 b& v" z% c0 q/ h8 R
$ C; ^& i& {4 D, C) y2 Tint41handler PROC% m8 \/ k0 B7 I) J- a. K
    mov     cl,al
" y( S' S5 i& R: e    iret
& a9 Y8 h8 u9 U8 _" uint41handler ENDP* ^) X* f9 X! l% B% m* [

6 k- \* \  r+ B( l0 t7 y1 W* k7 N9 |8 v" @0 g
    xor     ax,ax# u$ `" ?3 I5 L* w! Z
    mov     es,ax
" {8 F) D, H4 H% p, j    mov     bx, cs' }; D9 v8 n8 v
    lea     dx, int41handler0 @) o" ?; c) X6 [3 P% r
    xchg    dx, es:[41h*4]
$ b. t+ N' U) M& P    xchg    bx, es:[41h*4+2]$ X% W  O3 v" g* a( d
    in      al, 40h* p# H6 v. l( u) {- U
    xor     cx,cx
5 k2 }% H) N0 F9 c; Q( }) D! [    int     41h
3 u, R' G$ R) W  z9 O# `    xchg    dx, es:[41h*4]
/ n1 D3 F5 I) k( p; v; v9 T* _1 k9 D( w    xchg    bx, es:[41h*4+2]7 S) {/ F. R( s+ r6 h0 V3 J
    cmp     cl,al' F, m. ?5 X4 `' s
    jnz     SoftICE_detected$ a$ U; d: Z: n3 p, f
8 e7 h- ?  o7 e4 ^! N
_________________________________________________________________________
$ S5 H) J% f1 T6 s& P  J6 T. K$ M/ E% [7 P4 ]( W$ u
Method 07
. X. s' o8 I  _& |, Y+ C$ A=========0 t5 y/ C* B% c9 t

) i2 o7 v! [0 w4 Q7 S: H* jMethod of detection of the WinICE handler in the int68h (V86)
3 V9 S- D- e! _
" Y* o. l! T2 B) f/ H    mov     ah,43h
& b4 M. ?6 ]3 |. j2 Y" ]; y) m    int     68h
( a! ^* Y7 I. `+ D% _( n! m    cmp     ax,0F386h  T  o5 M$ Y/ h9 o; X2 R) t
    jz      SoftICE_Detected
2 U: l; _* C# n. I. L. @3 o( @6 u
. }# p2 i& L; ]1 o
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
; d% P0 h0 \1 Y" w# L3 X, t$ m  ]   app like this:
/ E5 B( |- G0 W7 Z4 A
3 c9 E8 T8 S/ D   BPX exec_int if ax==68) r0 U4 a/ R6 k" a: a
   (function called is located at byte ptr [ebp+1Dh] and client eip is' W, S5 x3 f4 w
   located at [ebp+48h] for 32Bit apps)
9 E2 t2 H) f4 y5 q__________________________________________________________________________
) O, p" V# ?$ S
' ]2 ?& V" _( E2 E3 d6 a
/ Q; _4 J3 |' cMethod 08
1 J1 E5 `; J9 z: W8 R=========
3 @- y/ r) S9 T. [9 T2 ~$ m
# q, l, Z; S+ e* a, R5 B6 xIt is not a method of detection of SoftICE but a possibility to crash the7 f. v' ?  X/ K' g% s# J
system by intercepting int 01h and int 03h and redirecting them to another2 p" Z0 c* C$ s! ]6 L/ H7 u
routine.
& ]- v" Y; }$ vIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' K4 s, S! P& K) S  s) dto the new routine to execute (hangs computer...)
5 a& N2 a: I8 }% Y& L$ B1 \
! v$ |5 o1 a! c% ~! ]2 i0 @    mov     ah, 25h
+ x# H% I! ~. K% v, o! Z: _0 L    mov     al, Int_Number (01h or 03h)3 s$ p% `9 M5 Q3 e
    mov     dx, offset New_Int_Routine
  H$ L: G3 f; S' {/ ]    int     21h8 v3 Q% W2 |4 O8 U) f$ ?) `! g* i
8 D' ?) T/ b1 f/ F0 I
__________________________________________________________________________
% R9 w5 L0 T9 r( V: j# D3 l& o- q  Q% U3 t
Method 098 T% @2 n; }4 n! o3 g0 ^( h+ l
=========$ R! x  o7 T! c5 X: J. m2 U

! M& S! o  ]: ]! h, E# @0 j5 ZThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" s  w, B) x. L  a* w
performed in ring0 (VxD or a ring3 app using the VxdCall)." y0 t' g4 Y& T- _$ S$ _+ O
The Get_DDB service is used to determine whether or not a VxD is installed
' Y% U% m+ f2 u5 hfor the specified device and returns a Device Description Block (in ecx) for
8 G* t, E( b$ k$ @that device if it is installed.  U, K5 F' x7 P0 K6 ?( |  S! Q
& E# p2 N4 d6 V/ c- [
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: m8 e7 g7 `0 j; A+ f% F- Q   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)& \: J2 n& Z' o  Q$ _' U3 b6 `
   VMMCall Get_DDB
& s, s9 g) e* t" @3 I; P   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
% W3 C7 p. P' ]1 s4 f
, k+ c* N1 B1 m7 N6 a0 r% Z2 wNote as well that you can easily detect this method with SoftICE:
: N, _0 W  Q+ `# L: k   bpx Get_DDB if ax==0202 || ax==7a5fh  n8 E  U! T" W7 V/ X* o; p
  S2 S9 M. |+ h7 F
__________________________________________________________________________
/ Q4 F* _+ J2 }# j2 U$ t& ?5 m5 d
% B6 `7 D# r- j) p7 |. i6 k. S9 jMethod 10: u! f' x5 Q) H
=========- C* r2 R* m2 l  @

( J5 A) F+ `4 m9 h=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 m. x+ s8 Z. o  SoftICE while the option is enable!!
  d5 K7 i6 d5 Q% S7 J4 k' E. s0 ]* Q+ k  j2 f! ]/ h
This trick is very efficient:
0 P) T- a1 T9 E' Iby checking the Debug Registers, you can detect if SoftICE is loaded  U# p  r- G: _1 v* n+ ^; S
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if. B* d  `, A- j$ G% I1 i" \. R5 R
there are some memory breakpoints set (dr0 to dr3) simply by reading their0 o8 w# i+ `, m; O5 s
value (in ring0 only). Values can be manipulated and or changed as well
, y& _" k: b, g9 I7 a8 u, D0 v0 q8 F( m4 W(clearing BPMs for instance)+ n" @; P) a9 H- Z4 S

) Z' ^" c, [/ A1 |+ a__________________________________________________________________________) d2 x4 U2 V* t. H2 C3 g8 [
8 I! J4 P7 ?% _/ Y* ^; \1 n* `
Method 117 z& `: E$ [3 Z% S
=========% e& u8 y* W( u# {+ q- [4 h

6 Y4 ~! G) F. T7 w8 S; _, hThis method is most known as 'MeltICE' because it has been freely distributed' i9 n7 _5 F  ?0 {
via www.winfiles.com. However it was first used by NuMega people to allow
" q1 e0 j8 o0 O4 j& ^/ b. P8 u5 lSymbol Loader to check if SoftICE was active or not (the code is located
* C6 \, v2 a" t. W# ?/ f+ J; B5 uinside nmtrans.dll)./ J; h. L1 b- y
9 Z4 `3 W! S; D' p
The way it works is very simple:
- N$ K9 d9 X$ e. u& y/ c5 ]It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; q/ n- k# t, v1 y) O2 a
WinNT) with the CreateFileA API.
& [8 l5 ]* A6 z- {
4 x: G$ a: ^9 o6 Z# B+ FHere is a sample (checking for 'SICE'):
+ O' |: m$ u) f7 w, I1 n( O% z' g
* ~6 I8 }5 ?$ Z# hBOOL IsSoftIce95Loaded()
& I1 x+ }5 p" I8 r9 c) D6 R{
& G$ _$ U9 \+ b, d+ b- }$ S$ Q( B7 r   HANDLE hFile;  - {1 o1 K( c1 V) g1 N1 B8 U4 n
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ b  \4 s: d' }
                      FILE_SHARE_READ | FILE_SHARE_WRITE," Z6 C) c6 b/ S) h$ ]- I2 A
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);# {6 N& z" J6 l- a+ z: }9 y9 w
   if( hFile != INVALID_HANDLE_VALUE )7 Y) t6 e* K# s5 a% ^3 h+ ?, U  N" |
   {
8 {- ?$ }0 u$ p' d& u. O4 p      CloseHandle(hFile);1 j+ A$ ^  D6 u! \
      return TRUE;
+ v. f' j) _5 H" s% U% q5 O   }) K1 I: Q8 _+ {6 _5 I  l/ W  _
   return FALSE;
4 ^7 `1 }6 T5 t9 j: ^5 q}# W7 r& |3 _+ m+ ^# N0 `

4 H/ s* X! N  z" I0 O. |Although this trick calls the CreateFileA function, don't even expect to be
6 b, R6 {1 U' s4 r9 J8 nable to intercept it by installing a IFS hook: it will not work, no way!
% M3 @. L- m6 v. f5 t# w6 tIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
' m3 i. F& F' B5 q! V- T! l7 x" bservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
. g- T1 h. N% q! d6 h3 S9 e) rand then browse the DDB list until it find the VxD and its DDB_Control_Proc# O4 U4 H& o/ n8 t( S4 {: H
field.0 o+ b( b0 M/ T3 W+ }6 b: I3 l  m
In fact, its purpose is not to load/unload VxDs but only to send a
6 P* J% g$ P3 M2 T0 uW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# z! Y/ e! u# f" W1 N% M
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
) C5 D! a- |& K# f6 t  r6 Y# _to load/unload a non-dynamically loadable driver such as SoftICE ;-).
; x  p7 \+ \0 d! |0 i/ A2 wIf the VxD is loaded, it will always clear eax and the Carry flag to allow. t" R7 `1 a. b# K; a1 T  s
its handle to be opened and then, will be detected.
- h, v) M+ O, x6 j0 _You can check that simply by hooking Winice.exe control proc entry point
# G0 r0 W+ Q/ i7 ~9 Xwhile running MeltICE.
% p' v( b9 }1 b$ t1 D
/ T( j/ n& t! m7 L5 i- T( f7 E5 X- s  G, {! N
  00401067:  push      00402025    ; \\.\SICE0 Z- k7 w6 ~2 U) _. O
  0040106C:  call      CreateFileA
) n. P" _; K( A/ x  00401071:  cmp       eax,-001/ i& z2 l+ u9 d+ ]
  00401074:  je        00401091
; T1 e# w! u6 z
0 q& m6 c( G: o% w  e/ h2 H6 y
8 J; }, b" v8 i7 {There could be hundreds of BPX you could use to detect this trick.- A- H- w* V$ U1 D4 t- S
-The most classical one is:
5 {' _& o! M4 F- ?" b3 p' g; o! Y  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||3 T: g: F$ H/ [
    *(esp-&gt;4+4)=='NTIC'
$ t' {3 E! E1 u2 U3 Y3 C8 ~, O. P1 M
-The most exotic ones (could be very slooooow :-(6 ]" O! b; t% ]5 d' k* L2 z
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 m& Z4 K/ a4 z6 u  F$ d4 a3 g     ;will break 3 times :-(
8 P- X& V  P: M% l8 u( ^; q8 m) k
-or (a bit) faster: 0 O0 C1 }8 J4 J
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ l$ R: t9 j3 Q, P* T0 m- @0 W! i; P- ^
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
' C9 A$ Z  O- `( V8 k8 i     ;will break 3 times :-(; y( E& e/ Y! ~0 ]% e7 W
4 X( x2 c2 Z/ U$ s+ J4 i- t' q
-Much faster:7 s  U- b9 X$ P+ g
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'% e( g  V8 F  ]5 L3 r6 Z+ J; \$ |

5 [; c4 K2 V: \/ v! A& dNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
4 V5 U  S+ c+ O0 @- H# G1 Dfunction to do the same job:
$ W7 N+ ]" U0 a0 Y' P! C1 S. L7 I* V' V& P1 ~
   push    00                        ; OF_READ
% w/ @4 ]' o& |" H5 M& R: i: W& d   mov     eax,[00656634]            ; '\\.\SICE',0% G' x8 m0 i0 Q6 }. t% B8 ]
   push    eax! ^! G6 T: {* c. V$ m0 J& L6 x
   call    KERNEL32!_lopen1 f& W" I6 m7 o  b* X/ ~% ^
   inc     eax
- o- j5 q; K$ L7 f   jnz     00650589                  ; detected% E& K/ T' a3 x
   push    00                        ; OF_READ1 K5 Q: N4 w/ Y9 e3 e& H
   mov     eax,[00656638]            ; '\\.\SICE'
, P# `! N7 T9 q9 k# f   push    eax
/ R; z, t! i" p. F& Z$ B   call    KERNEL32!_lopen' M' t% r" [' M! s3 @! p
   inc     eax
$ F# j$ d6 e: _# a* F4 c2 a' j   jz      006505ae                  ; not detected
4 M4 ?6 K! K. j0 k2 Q
% ~8 L  d6 p" f# I% J+ a; N# ~
, E( n+ D' \  {( v: ~3 U+ X) X__________________________________________________________________________
4 r) ]: v( f" `5 [$ z" N
# \, G' M4 x" k! J+ s& Q) R" bMethod 12  Y9 E3 p8 }7 j& c
=========! m. f/ J0 g$ ~: H  Z* o  |
7 E. S; O# k% D$ ]3 N
This trick is similar to int41h/4fh Debugger installation check (code 05
! k2 G$ Y5 N$ V- B' N) w&amp; 06) but very limited because it's only available for Win95/98 (not NT)
1 p; O. v; E( q4 W! m% y5 sas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" T. m" Q9 Z6 A
, |# O. p- o& k   push  0000004fh         ; function 4fh/ C- Q9 o8 K% n) {) c2 F  b" J
   push  002a002ah         ; high word specifies which VxD (VWIN32)
% A9 B. ^6 \. a& o/ A+ `/ a                           ; low word specifies which service
+ |, e; B. [# j2 N                             (VWIN32_Int41Dispatch); ~5 U; |! o5 @! V: r
   call  Kernel32!ORD_001  ; VxdCall
0 h  ~) R. b2 }( D8 @1 y7 l   cmp   ax, 0f386h        ; magic number returned by system debuggers" s2 ^# O/ d4 b1 b8 {5 [+ I* _
   jz    SoftICE_detected
4 U! U7 [; J$ \1 i' k) t7 c  _% P+ u2 l5 Q  M$ D/ n+ [# B
Here again, several ways to detect it:
# |. C: y& l( d! t! t* r7 Y
4 _: r, s5 C# s5 O% Z; O1 c    BPINT 41 if ax==4f
: i5 M; U! s. w$ B3 ]
/ F9 Y9 Z9 d- m3 {    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
1 A9 s" p3 A/ ~' m8 w
" U" L' {; j( @7 b- k* k  D    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A& @: @  z4 W% ~: M
- Z+ {' g; B4 J; b' D  P3 ^3 Z1 v
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
# a4 Y  x  T! _$ M0 A! ^7 }
( T) d; M4 }- t2 w* v__________________________________________________________________________9 t  [4 z  Y4 r/ ]' U
# A  l# V% y7 w
Method 13% ^1 w' Q6 f# C, y& n( T
=========
! j- A" e5 V1 I
% e4 y7 ]6 Q# }! SNot a real method of detection, but a good way to know if SoftICE is
9 d( }: ]9 A% N2 oinstalled on a computer and to locate its installation directory.
# k; `9 i% O0 k" G3 w. dIt is used by few softs which access the following registry keys (usually #2) :
6 K+ T: i& O( |7 C2 ?" g
0 }1 T' e$ b6 ?" M% Y; n-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" o& Z: O6 f, `5 d9 S  z1 B- `\Uninstall\SoftICE
" |( x  R1 N" v-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE. F1 Q- H+ L+ [/ i9 K1 s& q
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 }% h; v, n) [$ ^' n4 L  m\App Paths\Loader32.Exe0 F/ J* }/ X4 j+ f
- Z+ I7 ]) c1 ?4 v; [- F
+ P: U5 L3 M( V% S# n+ q( v
Note that some nasty apps could then erase all files from SoftICE directory! g9 Q6 ?! Y$ x5 J& D0 `' |
(I faced that once :-(
9 b( x( d+ _4 Z9 a. H! k! U0 T
. Q9 q1 K' T0 D8 ?! OUseful breakpoint to detect it:
3 W+ L' J( o, ~, v4 u6 r4 G2 i4 Z" U# N. {$ B
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE': w  W5 E4 W+ p9 |* `& Z
# a" P. r6 f! E3 ~$ n9 @
__________________________________________________________________________" K2 G. J" m: z% j
# S6 y1 r5 g+ C  q# {/ D

" T4 _% X3 u/ {; h4 ZMethod 14
1 ^) I0 y! I. v& U- s=========/ J, h9 e( d/ D6 G7 s0 @

8 h1 a7 Y; J1 ]% ~# qA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 H& C7 P# y8 D5 u  O2 W
is to determines whether a debugger is running on your system (ring0 only).
1 S9 F( {/ U6 G0 Y
( w0 W& l$ R# i1 z! s; l- J3 y4 `   VMMCall Test_Debug_Installed5 c6 H0 V7 N/ v+ \
   je      not_installed2 z7 _3 R1 e  q: _7 H2 P; X

, X1 D- l9 x) |7 T8 FThis service just checks a flag.
! G" m( N. f* c6 o! E4 B</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|鲁ICP备19052200号-1

在本版发帖
关注公众号
QQ客服返回顶部