About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& e  k# ]1 |( o- f3 j<TBODY>; `$ R! Y! `0 u
<TR>3 U6 w" B+ [' U
<TD><PRE>Method 01 3 Q; f5 K3 h5 k, p. W
=========+ H. `. [6 m1 y
* f$ w" C/ }0 P! G, l
This method of detection of SoftICE (as well as the following one) is& p" P$ B9 Y  P+ P& u6 A
used by the majority of packers/encryptors found on Internet.
+ i1 G2 u: r( LIt seeks the signature of BoundsChecker in SoftICE( `  s7 M$ j5 O* ^3 O8 Q
  E0 L, L/ e4 ]. g
    mov     ebp, 04243484Bh        ; 'BCHK'1 T& c; u# g9 ]: U3 |  F# R: R
    mov     ax, 04h' W! ~, A7 a! d" p1 r% B! W5 B6 K
    int     3      
0 H1 M9 h" p9 L/ ~8 [7 r& M1 \    cmp     al,4+ G7 A, c. ?- _3 q$ X" {- D
    jnz     SoftICE_Detected
1 Z; t+ K* A7 l, _4 x
4 U! h6 t: C1 R$ C___________________________________________________________________________6 L0 u  Y# I( v
: {1 r1 N( R1 A3 |7 x8 b
Method 020 s% g* Q2 g; i- \* l
=========
; l5 S& a9 f/ Z8 i: K+ @% ]8 F0 H
Still a method very much used (perhaps the most frequent one).  It is used
1 g3 n, w7 J1 Z+ eto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 r8 P( [& T( h: uor execute SoftICE commands...0 o9 u1 h" a0 ~( ]8 m% [9 @  E
It is also used to crash SoftICE and to force it to execute any commands( s/ j2 f% t2 O
(HBOOT...) :-((  
5 m  G7 ]. n3 J  [, o' Z1 M/ d* U- ~5 `
Here is a quick description:5 c. w5 Q8 V4 Y
-AX = 0910h   (Display string in SIce windows)- A& W1 F( x5 Y( [
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
- ?  g# y' \: \( }& l8 q-AX = 0912h   (Get breakpoint infos)
" ^* u- N& J% |) y! x4 Q! P-AX = 0913h   (Set Sice breakpoints): r' L* e" z# L2 v* W1 d
-AX = 0914h   (Remove SIce breakoints), D6 A0 S# l' V$ O1 N
( R9 O& D) \/ K) G, e( n
Each time you'll meet this trick, you'll see:) ?5 n+ b, A3 s# y& A
-SI = 4647h
0 {. r* Y) Z1 n' S+ h-DI = 4A4Dh' H( N0 J& N/ |5 Z) E8 Y
Which are the 'magic values' used by SoftIce.0 w" n: F7 m# S6 G2 V7 z
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ l$ P3 u5 B# R  p& x
# m8 I0 F( B( P1 k$ W" }Here is one example from the file "Haspinst.exe" which is the dongle HASP
/ D. l3 X; m* v9 YEnvelope utility use to protect DOS applications:
! n) A! G+ \2 J  {! o9 x( H* j) W9 s. s' C( r$ d- F

0 ?0 ~$ X3 I- w& a# u" c4C19:0095   MOV    AX,0911  ; execute command.
9 F0 p- h) n" l2 U, Y9 \% E9 o4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. }- l- ]& @3 p$ d
4C19:009A   MOV    SI,4647  ; 1st magic value.5 C, x2 A3 k" ~; L% y1 A* `! B, e
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
3 j6 l, m7 M& n3 ?  O4 S- D4 K4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- ?) o/ V, t/ H; S
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute9 w/ Y# @# Q. t
4C19:00A4   INC    CX8 C/ i! ^" Q( g) h1 a8 f
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute# k, v) D' h5 j0 h
4C19:00A8   JB     0095     ; 6 different commands.3 m) C! H; a6 \$ v! E+ C* P+ @; B
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.9 @- {3 {5 \1 s) o5 W/ S* V8 i
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)- S& d7 L6 u8 ^  \5 T( q

! [* v' F& o, D4 |$ hThe program will execute 6 different SIce commands located at ds:dx, which
( `# X% S" ~9 R" D; H8 f( u' uare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& L5 W9 y4 ~3 V. s8 Y/ c5 E
/ Y8 J. b4 a& V  b
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
+ p" D4 g7 S+ W* A! I9 p% e9 t___________________________________________________________________________" g6 ?9 L" J' S0 D7 R5 O

4 ^% Q0 p4 P) L# H3 `5 q
/ T6 b; L. J  Z- H3 b% M; w; fMethod 03* k: t! b  W  T' n; N+ P
=========* l$ n' {$ p. v1 h6 I& T

" t; G/ n1 @; `& QLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
5 l0 n1 b* f' v4 |4 E% G(API Get entry point)
) @/ N: x# E3 x          r1 F8 F& `8 X

+ Q) X8 `. z2 v" |" ?. H0 u    xor     di,di
, J# N9 }' L+ r9 `! W: o    mov     es,di
/ @+ J; k/ c8 T( X    mov     ax, 1684h       : k: L! m1 n, V8 _1 H
    mov     bx, 0202h       ; VxD ID of winice
5 U6 k6 t% r# m: T  H    int     2Fh
- T3 l: S( S8 c. N. p' m    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 n7 ~* t7 |2 w- f  R; L" j
    add     ax, di. ?2 Y/ @# H) r) L2 E" X1 M1 k
    test    ax,ax/ z( u; j: g- J* |6 k
    jnz     SoftICE_Detected
2 d% q, n& V( V* \9 E6 w9 c' i& O) L- c4 O8 P
___________________________________________________________________________) L% o5 ^9 _  P# `- @; l

6 q, K: F# ?7 M! @) @2 LMethod 047 ], b9 }+ q+ u7 q3 Z
=========5 \6 X2 [8 L+ k# W6 }1 R9 P
/ X- K) A! e- p) N
Method identical to the preceding one except that it seeks the ID of SoftICE
0 k4 j+ q: w! \GFX VxD.' f$ i& f8 G4 i9 O: Y! W; _7 j# t6 C

/ ~0 v, v/ i9 S    xor     di,di
8 I0 ?& t& _' x8 M0 T6 J    mov     es,di' M* n' \0 b) O1 ~2 o+ N! ~
    mov     ax, 1684h       ' @0 D  B% f" [
    mov     bx, 7a5Fh       ; VxD ID of SIWVID+ g/ R4 m$ R$ H( g# M
    int     2fh
. s9 m4 s& o7 l: Y, n    mov     ax, es          ; ES:DI -&gt; VxD API entry point( U* x2 u  _& q" h
    add     ax, di
" S. o/ c% I2 h4 Q0 `    test    ax,ax
9 g3 L4 t, `, R# Q3 W( z    jnz     SoftICE_Detected
! W  E) Q, t2 F
4 Z  N& L" X2 m% j__________________________________________________________________________& B% i4 `3 k% S$ }; {$ j

4 ?) {( Q1 \  S+ O: O
- d# Q3 m6 Q& D; d! KMethod 05
2 R- C" W$ H, |# L  c0 `) j. I=========
$ l3 j( X0 w  _: ]6 a
( `7 q. \' \$ E! `4 }4 K2 pMethod seeking the 'magic number' 0F386h returned (in ax) by all system9 `2 `. Y4 Z2 T4 i9 X0 D+ I2 }/ E3 M' e
debugger. It calls the int 41h, function 4Fh.8 A4 \$ W2 h- Z3 E: p4 E  ]+ Q
There are several alternatives.  
# |# k, X2 r8 V) V! c' o7 u) {' f" J5 I. F0 F
The following one is the simplest:
! L. m6 l$ Z) I9 q# ?
/ V( H: G3 `0 a! |    mov     ax,4fh9 L8 y; n  M$ v
    int     41h
5 L6 k* u& y$ T    cmp     ax, 0F386
* X, ], ^8 c0 o& U$ {    jz      SoftICE_detected
- {/ X1 k% p; \6 E( \
% F& C+ h7 ]  j# _+ N, X
" u' `- T- ]) ^: k. I4 }Next method as well as the following one are 2 examples from Stone's % E5 D; S& `: ]
"stn-wid.zip" (www.cracking.net):1 M3 _8 E+ D: h8 h4 x9 o: @0 ]
% ^! H3 ]8 k7 O: K
    mov     bx, cs
0 x1 P7 C* a# s$ w0 `2 r7 n, o    lea     dx, int41handler2
/ J+ F- ^* f: ^1 l    xchg    dx, es:[41h*4]
( G$ q1 ~# R  o    xchg    bx, es:[41h*4+2]; v3 i. C9 \5 N+ _( }! K) H* j
    mov     ax,4fh
  F5 L) c& T' `' q    int     41h
3 ~0 X  u& e# }1 M" O2 E    xchg    dx, es:[41h*4]
" X# P( T8 ]# R3 d, C* t    xchg    bx, es:[41h*4+2]
' w- z+ R7 B) h  o! i    cmp     ax, 0f386h' h  I& ^  S- D; T% q. t. o
    jz      SoftICE_detected0 ?  `2 q# U5 h9 B

9 Z0 r& w$ g5 x4 Dint41handler2 PROC$ }# Y; a1 N+ j0 \
    iret, y% `% z  @# F, o1 Z* _" }; d" f6 ^0 D3 i
int41handler2 ENDP
3 B* [$ A, e$ \$ W3 R& y6 a$ F! y8 E; }3 B  g# N" O! o4 G; z+ o

* H; R3 g! u( }+ __________________________________________________________________________
8 s( n  e1 ^& ^- t( M6 p# _9 N! S+ |" h  G, O+ e2 D# V+ k

' j9 f* T+ p5 Y! kMethod 06! l2 c; C3 ]3 t9 x! I$ J7 |
=========
3 u" |% \+ r1 [1 q; j7 b4 R
  X' h6 _( h6 V- O" d6 x+ K' u! H6 [0 @' \, t3 r, O
2nd method similar to the preceding one but more difficult to detect:/ [  T* c# O6 v) p* d1 E
. G! x! F& F. h' C! t4 t& f" q
0 v8 R1 M- w1 Y6 P* D
int41handler PROC
+ S0 u, O! H& X0 X    mov     cl,al! r) ~/ C. Q# I% |/ P
    iret( m$ X* e1 g. i' `1 t5 s0 n$ _
int41handler ENDP
$ ]% z* Q5 b& ?2 O
: C! q1 n# v# o/ B8 U9 a" [5 m: q2 q; k2 g+ Z
    xor     ax,ax
/ H9 v$ I8 f# ]" R# g9 W    mov     es,ax
/ Y* y2 e1 o/ ]5 u, k    mov     bx, cs6 p8 g. X# P- L- b5 S0 b( f
    lea     dx, int41handler
3 h! {+ M4 H$ y% G& S, ?- z    xchg    dx, es:[41h*4]$ O' b- N" S+ O9 \% [% n
    xchg    bx, es:[41h*4+2]! i8 p1 d/ ^5 x2 q' f
    in      al, 40h  V% q3 K$ {6 ~; @- D2 ?# Q* H
    xor     cx,cx" n+ B( I$ R: Z, a
    int     41h4 C# `  }) q1 U0 j! m  }
    xchg    dx, es:[41h*4]
5 o& ^7 T8 U6 X& e8 y6 V1 E    xchg    bx, es:[41h*4+2]
/ \7 N4 I+ f. |* A! H    cmp     cl,al9 J5 T- D* z2 Y+ V4 T6 Q) Y
    jnz     SoftICE_detected6 s( l$ V- O3 S2 x( b0 T8 G

7 h$ x  D/ ]6 K- k- h9 l_________________________________________________________________________8 g3 T- L$ J5 E" S! u# h
) p1 q/ A: ^  t
Method 07
  `; D) R1 H: K8 o' d8 k/ f  j9 B- q=========
, K$ K: f1 A) ^2 Z' v6 u1 ^/ f/ ]& a- v' `& G2 H2 l1 M" }! P8 l
Method of detection of the WinICE handler in the int68h (V86)% W5 a4 D& a5 F, y' n) H4 Q2 |

4 M# x8 X6 l+ u2 T* k- q    mov     ah,43h" F' n( Z9 Z# R, w9 |; X2 s
    int     68h* Y0 T4 Y1 r# i2 f% l
    cmp     ax,0F386h
4 ?# N! E# g- [; U# Z    jz      SoftICE_Detected
1 S  d) u6 k5 f5 C/ W$ Z* L$ ~. H4 `8 |
  y5 j: B& V/ B5 D8 x; h5 o1 K
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# l' H8 @( D5 Y6 k" g
   app like this:
" K) x; a8 o2 Z3 ~; k5 X# q* y
" f0 Z2 J7 Y- K4 N( l* [9 B   BPX exec_int if ax==682 ^4 c! o1 K) |0 R' |) ~! U
   (function called is located at byte ptr [ebp+1Dh] and client eip is6 s* D* z7 n# Z3 k2 O" Q% Z9 `4 F6 K
   located at [ebp+48h] for 32Bit apps)
5 U5 w: N& @$ b# K! o__________________________________________________________________________
# a. ^/ \3 E; J1 T! x
) ~$ {4 G3 l+ g. i1 @' M# Y6 J4 P# R/ e  v
Method 08/ `4 r& y; r  L. ^
=========
, W, S/ [' x! |4 W( s& Q% t1 _% G+ s1 I" I$ z
It is not a method of detection of SoftICE but a possibility to crash the* A0 q0 ^9 e  G/ g
system by intercepting int 01h and int 03h and redirecting them to another) N) B- A6 v( O' Q$ S
routine.
/ ~) V; W1 e4 [It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points8 W9 c: y" F5 W2 T/ X. z, E! U
to the new routine to execute (hangs computer...)
/ y" H) L) a5 R' H' P
. {7 F: L5 C. L1 q& l( o: F    mov     ah, 25h( o" b0 s; V7 q; g4 E
    mov     al, Int_Number (01h or 03h)
/ w! ^$ z1 v# o2 }    mov     dx, offset New_Int_Routine- N! r' I9 z7 S  x0 B
    int     21h; x% ]' O: e$ b- X
8 p" h* |8 g" b2 `  _6 K$ o7 H, C
__________________________________________________________________________
# l, v1 f  N7 _$ k7 K" I3 j& _- \# {5 ^
Method 09" M0 {2 D" k" R4 D6 A3 k1 i6 D: P- E
=========
9 c% x+ s0 }" A$ x' H+ Q" D! g2 L
0 t* ^; e5 c. B" M- h0 r7 X) s) z, XThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only; m  `2 t6 F' v" h+ f5 z5 w
performed in ring0 (VxD or a ring3 app using the VxdCall).3 L3 i7 b8 @) E7 M) U' h9 i
The Get_DDB service is used to determine whether or not a VxD is installed" ~; Y" m9 B" D4 B2 l
for the specified device and returns a Device Description Block (in ecx) for% j8 m6 |( K' }1 R# G
that device if it is installed.# o, e9 _) K7 J) B5 r8 e
: i/ C; }1 y) w( x+ z
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
. U  v. A+ E- f) G  s( G   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)2 ]4 f( T& i' v0 l) y
   VMMCall Get_DDB
4 R$ a7 o: _' f7 g# J   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
/ f8 h  V( [/ k. H; f/ |! Z8 t9 u2 J* Q8 L6 Z( ]
Note as well that you can easily detect this method with SoftICE:
4 q; S4 |' p4 e9 f9 F. b  A' v+ h   bpx Get_DDB if ax==0202 || ax==7a5fh
- k$ E, ?+ ?! r; p2 a; l) x7 D8 v( j$ F9 X
__________________________________________________________________________
) G" H$ b% B" F
" @) M# p, C3 s) FMethod 10$ j" m. T1 c" w* d
=========
" F; E) p8 ]6 a* Q( D( O5 v) J2 o* u1 G4 A2 c+ o+ Y
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
7 h! t1 J6 M+ f3 p5 f% x9 W  SoftICE while the option is enable!!
0 P1 t3 C) t8 [! @/ o3 i; G( q- T& V1 e+ ?
This trick is very efficient:! O% L. ?% R# M# m
by checking the Debug Registers, you can detect if SoftICE is loaded
% |5 W; c# f. Z# C1 W3 f0 g(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! Z$ d; m+ }( k5 ^; R1 y; c- b7 }
there are some memory breakpoints set (dr0 to dr3) simply by reading their4 `" }/ z! a' ]/ _: k% B" }
value (in ring0 only). Values can be manipulated and or changed as well
7 r( s8 b) w" p/ u* b/ b- `0 `(clearing BPMs for instance)
4 ~% G1 K: A. \: L9 U
/ A2 z. X: }  ]5 Q# |3 m- |__________________________________________________________________________
( k4 R$ O2 b9 X) l. l" ~; y$ L) N6 ]1 _3 h# d; D+ S/ W$ `
Method 11
& Y% k( K0 m4 i. Y, F' e- r=========
$ N+ b: ^, @/ P7 N% C+ Y4 S4 k
9 Y. U2 M# s: j( ~, [8 z; R. ?This method is most known as 'MeltICE' because it has been freely distributed2 F, w# ~" y" Y# P, k& r+ k( W- J
via www.winfiles.com. However it was first used by NuMega people to allow& }  @+ `( a& v
Symbol Loader to check if SoftICE was active or not (the code is located% \8 _( z+ I  q" F1 t% x  J9 W, p" W
inside nmtrans.dll).- I6 U, i2 C( j5 p
0 D& F0 M& y+ A" A! ]% N7 h3 ]
The way it works is very simple:
4 z* H5 z) Y4 X1 @- f( OIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for! }' _$ v+ e1 f9 ~1 F* K0 ]. @! ]9 n% p
WinNT) with the CreateFileA API.
1 K# E' {/ R0 w. h0 r1 U* E% g& W. e' k/ A5 l# s; N
Here is a sample (checking for 'SICE'):
( x9 Y+ R: H5 J9 _) O0 U  Y; t7 p! n8 a8 P, m4 j8 o: h
BOOL IsSoftIce95Loaded()- j, R5 E7 m# r& C1 N
{3 V$ b9 A% x% m0 Y' h1 J
   HANDLE hFile;  $ u$ M0 M7 C$ V: t! l
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,' l- [& ?3 Z. M( c8 B2 s  s, K
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
" T2 n+ O1 }. D/ i5 J1 ~* L                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);) l8 Z* R0 C) P
   if( hFile != INVALID_HANDLE_VALUE )
- `7 y+ A6 ]& ]7 d: l' r; Z   {
' w* l1 U1 V7 c1 u$ S      CloseHandle(hFile);
! B/ x4 e' v* y5 o) R$ F1 Y3 X      return TRUE;
: J. t" b6 m9 ]   }
! l% {/ {* @. i+ w$ A   return FALSE;
( j% K5 j. Z0 [}# F0 U5 E3 D, C6 J
  F& B, t6 b; P0 `! j# [
Although this trick calls the CreateFileA function, don't even expect to be+ P  T' p$ ]$ Y+ B1 F/ d
able to intercept it by installing a IFS hook: it will not work, no way!( V# _, n8 T# H- c
In fact, after the call to CreateFileA it will get through VWIN32 0x001F, ]. H  H6 H* e& H  T) `
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
8 ~& B' u5 ]  D* X$ u3 Hand then browse the DDB list until it find the VxD and its DDB_Control_Proc" W9 H5 j: G' W7 L  v; b) _2 s
field.
3 U; d, ~; ~% x% p: ~In fact, its purpose is not to load/unload VxDs but only to send a
; r% M$ g- H; }' m2 E/ y6 x7 N7 [W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
: k/ P8 A+ g% l, C9 t8 Hto the VxD Control_Dispatch proc (how the hell a shareware soft could try
! f/ C% k! P$ Qto load/unload a non-dynamically loadable driver such as SoftICE ;-).9 H8 e6 X. L# U# t6 v! Z
If the VxD is loaded, it will always clear eax and the Carry flag to allow0 L' I8 {5 B: S5 y' X& m- I7 G* w
its handle to be opened and then, will be detected.
4 n. u* y6 u7 j4 p6 l% G1 `* tYou can check that simply by hooking Winice.exe control proc entry point! N$ c2 g; L& H8 U: d
while running MeltICE.
1 v1 d$ o2 t5 B$ N6 o' k" K, d$ l+ m/ m2 a& \+ t

, x! Q, G  P$ q  00401067:  push      00402025    ; \\.\SICE/ Y0 h; o: P6 c# a0 k1 v5 h
  0040106C:  call      CreateFileA: f, Q& I& ~% b; l& i, f
  00401071:  cmp       eax,-001( D# B+ D: ?: ]8 ]$ \
  00401074:  je        004010918 Q# M) h( a4 d1 i, Y

5 ?2 W+ `2 j; c7 ]" p, r2 ^& W% Q% M1 }+ N
There could be hundreds of BPX you could use to detect this trick.
' ?  D6 M9 f! O4 r; G' ~-The most classical one is:
: H, m# Y5 @7 l, x* ^  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" y; H9 W3 e$ d  P8 M6 J6 P3 J
    *(esp-&gt;4+4)=='NTIC'% Y; D" ?& H+ i. }/ \5 `( r

# m% m6 y5 `4 L) m-The most exotic ones (could be very slooooow :-(- r) b9 D$ ^! D7 l) e% E/ T
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  5 y& @5 y% t6 j1 ^8 {$ N
     ;will break 3 times :-(: r# s: X* s: C: }
9 l+ Z, y4 ~7 K) K, `+ D$ b
-or (a bit) faster:
) K8 L) f/ }9 ^   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')+ K3 `- F8 s+ V7 z5 S7 @4 \

$ f$ X/ C7 w4 I( r$ U6 M   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
( d, W+ P3 ~& R; l% l* E     ;will break 3 times :-(
- n' t" F9 B1 v6 X8 E6 V* r
/ e- z: h* e9 E-Much faster:
) y- |* H& ^" G! _$ Q! F   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
5 z8 U+ O9 C  f
: h' f( L' t7 C/ fNote also that some programs (like AZPR3.00) use de old 16-bit _lopen; {! \4 p% Z% U8 {2 Y- q; k
function to do the same job:: r( R- k7 `5 \6 P% Z" ?& D

& F  c2 I9 {9 k1 _4 m   push    00                        ; OF_READ
9 V" ^$ H! `/ n- M2 }% S8 k: L) Q   mov     eax,[00656634]            ; '\\.\SICE',0. ^4 D6 b" i; _* |. h
   push    eax
. a) M3 [9 q3 z  x& I3 d   call    KERNEL32!_lopen
) k: Z: `) t* @7 y# K5 L   inc     eax6 s& c8 S: T* L: s7 v: o% f
   jnz     00650589                  ; detected) H5 S" s! O4 j8 n
   push    00                        ; OF_READ
. R+ p% E2 e- N) `9 Z5 Y5 M   mov     eax,[00656638]            ; '\\.\SICE'
. M6 v- U1 {$ ^   push    eax$ {& Z8 k5 t% k
   call    KERNEL32!_lopen
6 y5 x& a" W; {, R: w' f; Q: ?   inc     eax
: U! v! Y" G6 ?   jz      006505ae                  ; not detected
' r+ Z3 {5 E* G0 k/ I
: T7 n# C1 q6 R0 g/ H1 V1 t
5 ]% `0 P, E- G- x__________________________________________________________________________
- Y( Y8 ~2 M6 n* y9 z& r0 n7 w  ^/ e' B1 v5 r# Z5 o
Method 12
$ r6 X% _3 V3 v' E% J+ V+ w=========
" d9 z( C- B, j$ g1 n3 V* `; P' [# |; p  u. g% U$ z3 t
This trick is similar to int41h/4fh Debugger installation check (code 05
5 m* j8 R' u8 k2 S8 J  O# q&amp; 06) but very limited because it's only available for Win95/98 (not NT)" H5 |: o# A& C1 }
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
% ?; ^& w6 a2 N" q8 o1 ^; j
  h( n5 @- C4 s+ ]   push  0000004fh         ; function 4fh
/ `  J$ @0 s; H2 K+ x   push  002a002ah         ; high word specifies which VxD (VWIN32)) T2 T% K% Y$ h' X) Z" t5 Y) @
                           ; low word specifies which service4 N1 U( Y0 |0 {
                             (VWIN32_Int41Dispatch)
; D( ]% x: c1 C1 w7 a! r( o  c   call  Kernel32!ORD_001  ; VxdCall
) Z; g2 F+ H- t6 l   cmp   ax, 0f386h        ; magic number returned by system debuggers6 |; H* r+ R( }! M4 j# ?: d0 h
   jz    SoftICE_detected
9 X$ j' q* C# v- F% q1 ^; I
2 a. K4 d- b! _. F& e& MHere again, several ways to detect it:
, {  \" v( ?/ E$ q- f% L5 D% ?* N/ ?- x
    BPINT 41 if ax==4f' h; v% v+ X) Q0 D# \# m
4 k8 K% P# c$ H$ w
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one/ I9 d2 A. ]; d
: I& S# G" d" j, ?7 z0 v6 H1 p
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A" N4 J- Q1 f# z
( z3 @9 i& v& U6 J' x: T: d
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!- ~& k* V- V, n2 B! I

' A8 ?; N2 |- K1 Q& V' g! N9 l* g% s__________________________________________________________________________
/ I4 \9 m7 j9 {# D
+ T  C6 n4 [9 e& I/ Y- g2 h9 c' jMethod 13; e8 |# I2 m1 Z& I8 f7 j# k5 N6 J2 B
=========
$ r' W* t. j5 j" N$ j  {( b( ?* ?) @- Y/ a& E
Not a real method of detection, but a good way to know if SoftICE is) q, U) ]2 q) g
installed on a computer and to locate its installation directory.
' e; ?* r' \3 h5 IIt is used by few softs which access the following registry keys (usually #2) :
# T* T/ k0 D4 p$ t: l
3 g; k: q8 Z: g9 l: b-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 [0 F/ R+ `! R6 J; M! {6 G\Uninstall\SoftICE! ^& q) P0 G9 H. R  T6 c
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE3 ?6 Z8 ~1 t; [5 d2 H/ m
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 ?8 o; x! T0 I$ E! k# i
\App Paths\Loader32.Exe
% g; B# J' p. U  G) ]: B+ ]1 p7 J8 v1 Q/ Z" G
7 [/ u5 t0 h# R. S  I$ {; S" w
Note that some nasty apps could then erase all files from SoftICE directory
. g7 I7 p* ]& m3 u7 S4 p(I faced that once :-(
/ d5 B; O! k) P$ S& u) X; I
' x' F( M# x, D% _$ tUseful breakpoint to detect it:0 k! p2 o/ ~1 s/ v, A
  f  q. o! V; K7 W3 L
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. `0 A: Q( y5 T3 K- P5 i2 x/ I  f

& [1 d4 _# o! g( G__________________________________________________________________________
/ p* R0 b4 K4 y% S/ A0 Q5 l( Z( d$ X' n8 o% {8 t' ~- s

& d7 M6 p8 A% S- Y0 ?+ C0 g, f: A+ ?; ^Method 14 ! _0 e$ M# y3 r$ Y) a+ L( I* c
=========
4 A8 N9 B! `. M' \
0 u$ q- |; Z3 Q" {+ R  j0 p* ?+ o6 }A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose' O3 e3 F$ q& Q% ?$ n9 u, F
is to determines whether a debugger is running on your system (ring0 only).
+ }$ ?" w. }, c" W' K7 z2 h1 r
! a, C0 K; p! w- f  D2 A4 T   VMMCall Test_Debug_Installed0 p3 h5 n$ [  e1 u
   je      not_installed
- I$ a4 p# _# U) K7 g/ ]2 l) W% M2 T
# a, [( k6 p4 k3 [. a+ uThis service just checks a flag.
2 l, p* E7 E* W' c# B</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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