About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
$ ~! `1 u% j$ K* L2 ~' u7 ]( r" M<TBODY># C! W  H, b  p8 C! I0 j+ ?" m
<TR>
9 f4 y% i( \9 R1 X<TD><PRE>Method 01
6 {- q. Z. k: @! d. x) K3 }=========* ^1 H5 y' v6 H

. a% W/ _' T1 ]" r9 Y& IThis method of detection of SoftICE (as well as the following one) is6 q3 |; s8 _3 ^& [  A
used by the majority of packers/encryptors found on Internet.
* g2 G( W2 f: J5 c9 xIt seeks the signature of BoundsChecker in SoftICE# w5 x$ C4 l  ]7 @. d
8 L1 u% I. [" D1 K: K- g* E" ~
    mov     ebp, 04243484Bh        ; 'BCHK'
* d) d" a6 Z7 u2 m! C# N    mov     ax, 04h( k! n0 U3 q' |) T
    int     3       ) D1 S; Q$ w. q1 o) j4 P0 }
    cmp     al,4" W- Z5 u& J2 I. L! t& M6 M+ ?
    jnz     SoftICE_Detected7 r- n- `# o' W% z
& K- i) Y" g3 M
___________________________________________________________________________
2 ^* e1 g& X3 [' P* ]4 m+ r! O  L0 r1 C3 b3 m2 S
Method 02
  u, D: I' ?) t=========
; J+ r$ s' B/ F" |! i# u8 b0 O# N( ^4 @0 `# Y7 G
Still a method very much used (perhaps the most frequent one).  It is used% e1 O+ A+ f+ z* F7 q( i
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 T0 l+ P5 D. i& L$ d; E) H
or execute SoftICE commands...
, U: s7 n7 O  H$ s& l8 U1 i, O. K7 AIt is also used to crash SoftICE and to force it to execute any commands
8 k: `+ \& t$ |8 J(HBOOT...) :-((  
4 L) E5 G+ K  ?$ H) x
9 Y& K) d" l' U% eHere is a quick description:
& U% N  v7 L8 D7 O, f" b" Y& M-AX = 0910h   (Display string in SIce windows)
! ~3 z' `9 T& M" d-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! o& ~2 O0 I0 q, v1 E0 h) Z-AX = 0912h   (Get breakpoint infos)
4 z' z1 ]% `# X8 f-AX = 0913h   (Set Sice breakpoints)
& Y7 D+ D2 p- v# m-AX = 0914h   (Remove SIce breakoints)6 Y% m, K( X1 _3 R

5 r' V4 l8 C2 M1 lEach time you'll meet this trick, you'll see:
' j$ \4 m% w* s* d-SI = 4647h
" f5 M) L* A4 |- r$ N% p1 S-DI = 4A4Dh
4 I% D# z% z$ [' b/ DWhich are the 'magic values' used by SoftIce.1 Y% w6 }' x, j/ A8 L% {
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
1 q+ V6 v9 i! c# B& X( l$ m2 E
5 u" F5 Z, I+ B" HHere is one example from the file "Haspinst.exe" which is the dongle HASP. D" p0 V% [" g* m+ n
Envelope utility use to protect DOS applications:/ |% L* C& ?" |* x+ O0 p9 x
+ F: j3 E1 U2 n) w  j2 K. C/ q
0 j+ Y" e5 r2 X0 E% n, b) L2 E
4C19:0095   MOV    AX,0911  ; execute command.
  O) Z+ r) |3 p8 E0 O4 _4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 K2 ^0 _% @0 w5 w; m
4C19:009A   MOV    SI,4647  ; 1st magic value.
5 `4 y9 M. a. r: C2 @/ ?5 T* C2 {/ L4C19:009D   MOV    DI,4A4D  ; 2nd magic value.  I+ O* s) h9 U+ O5 o+ \& w2 P
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)6 {6 _% c% i% X) ^* v8 X
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute2 r( J- X1 `0 o, q: P& M2 D8 @' Z
4C19:00A4   INC    CX3 M$ b3 r- Q/ D- I: @. }" R& ]3 K' z
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 t5 t8 ^4 E5 b0 m" K6 ]+ p7 Z4C19:00A8   JB     0095     ; 6 different commands.# q; }) P& [) A- f# m% S
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.: @( y' n  F$ i0 ?6 }
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)( v+ S8 v# @3 B/ W! H$ T2 [! m9 @: m
% N3 ], Y3 r. X' ]
The program will execute 6 different SIce commands located at ds:dx, which
6 x5 L( M+ K8 Eare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% J8 w1 J6 r2 ^5 K. ?, P, S' W1 Q9 B1 m  z
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
% C: ~0 i& r3 Q1 J___________________________________________________________________________
3 V1 ~! z9 v+ z! O3 c: P
9 C4 K; p+ `3 F  E
/ b  h0 Q6 i* i  DMethod 03
- U- ^- I- O/ N/ Z=========; q. r3 p; K& s9 S$ g5 Z0 h

8 |$ _5 G" i3 X: X% G# g' a+ bLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h6 M- d# x' g+ O6 t8 t
(API Get entry point)
& M* z' o# f8 l3 L9 G( F        . D0 f6 I2 U+ K' k7 u, I' v2 l

; e4 a' H7 O# E5 r8 i; J+ m# s" Q    xor     di,di9 U. ?2 [1 c7 ~& T
    mov     es,di
3 s' O6 B- J7 Z+ m" f    mov     ax, 1684h       6 A- C1 T$ T* x0 K  `  t3 k: X( w
    mov     bx, 0202h       ; VxD ID of winice2 ^4 e5 ~5 @5 a( Q, w6 o
    int     2Fh  W, P7 }0 d( `( w6 Z+ `
    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 O) R) @, q9 ~  K
    add     ax, di
4 |1 ?2 E% K3 W' R% L    test    ax,ax3 W5 i+ |- |2 B2 v' F
    jnz     SoftICE_Detected  w, ~  n; y3 T

4 _8 f5 a/ _9 E# B. Q___________________________________________________________________________. S$ E& I5 i# u% `" P, g" q: ]/ L- E% e: V
5 W8 Z* \6 S. o3 h: F. x. v) M
Method 04
1 K' r- O6 l/ [3 O( H=========1 J5 j1 f" }: r' w

2 L7 M) w: ]) D/ j# T* iMethod identical to the preceding one except that it seeks the ID of SoftICE4 _: N5 N- s8 n6 U( |8 {
GFX VxD.% D& g# ~( a# e, T  L
1 ~/ }  N; F, d$ _
    xor     di,di, u. J) P) v% f2 y
    mov     es,di
9 Z0 B% U, F- @' {4 i* z% L    mov     ax, 1684h      
. l( e$ E0 G7 z    mov     bx, 7a5Fh       ; VxD ID of SIWVID
; U$ a0 g, y/ J- ?) r# p    int     2fh
/ r( ~' C% }6 k    mov     ax, es          ; ES:DI -&gt; VxD API entry point% W% K, r" M( Z$ S9 h
    add     ax, di
! I; S0 Q4 K& t    test    ax,ax7 E3 P& U' F/ m. ]3 p. D
    jnz     SoftICE_Detected% H; V- T9 Q3 s, n

" |* q% @9 {) v0 c, L# z__________________________________________________________________________2 r, g4 E; b! n  q

( u" P' n& ^" f
+ V8 k+ X) x) F/ Z% {) Z2 ?Method 05
( b' T7 }9 ~4 R' @=========0 m, Z  q/ ^9 T! h$ v7 ~9 N# y4 r

+ L$ z( W  M' e7 Q6 `Method seeking the 'magic number' 0F386h returned (in ax) by all system2 \2 z: v- e) M! _- v
debugger. It calls the int 41h, function 4Fh.' y3 V7 c2 p  u! c3 I
There are several alternatives.  
# d6 G( o7 R0 f, R# w0 R1 I* {" @6 L' ^7 I2 O
The following one is the simplest:6 d# |: z* b; k& @
6 o4 |4 V3 J) T2 l0 v
    mov     ax,4fh
( S* d& ?* @8 G2 b6 V7 s# ^# n  ?    int     41h
+ p& z$ e; |8 g3 ~: d    cmp     ax, 0F3865 I5 m/ [" }& B* D2 L) N
    jz      SoftICE_detected8 |; B3 L! R" a" ~

7 J. {3 _: t+ [1 Y8 ?4 y! B' F/ X: J( u5 {+ q% T3 _  t* d
Next method as well as the following one are 2 examples from Stone's
; ^7 N/ c# u' n/ `. H"stn-wid.zip" (www.cracking.net):+ g0 d& X9 }7 w3 F' b  A3 R3 a

1 B- d( f! t' D) w4 O0 T; R    mov     bx, cs6 V7 l- L7 K4 }3 Y! v: ^; `2 N0 q
    lea     dx, int41handler2
" T0 r% H; {! {8 [6 b+ l) O! a    xchg    dx, es:[41h*4]
' P  \# e0 a! ]7 p) q+ E% T0 P6 p    xchg    bx, es:[41h*4+2]
# E/ N/ p7 I$ W' C    mov     ax,4fh/ h0 `2 ]/ L5 }6 ~( O0 _; U
    int     41h
6 @" E$ Q" c4 W8 l2 |% s3 t+ w    xchg    dx, es:[41h*4]4 b2 Q( z) H2 [
    xchg    bx, es:[41h*4+2]
) j3 Y* V2 c5 R9 N8 _/ @+ a( t- p3 e    cmp     ax, 0f386h# ^1 E+ \4 d! P1 `. \$ O
    jz      SoftICE_detected8 ~* o4 C* S( s
1 X0 e7 l/ {$ p4 ~
int41handler2 PROC; [  }, v  r( S# G
    iret
. ]2 `7 X  v4 q7 r3 F, K6 D* A8 vint41handler2 ENDP) T! X- j+ s# }

7 y% p) C3 p$ r; V8 V/ C# V
3 N! e& R' g' R6 o4 V8 H_________________________________________________________________________) Y) `* W7 Y# y7 Z9 N/ D2 ~/ J

9 r1 ?6 y* C, N. S/ q  g6 N. `: v4 b( [
Method 06
3 c" l0 _  K* }=========
( U. \' w2 U2 u/ A8 u0 X2 @/ d' w) {/ r7 |; t6 r! N; U, A
1 A! l$ q3 d/ B, ]
2nd method similar to the preceding one but more difficult to detect:! S* P0 G! _* y1 o; H4 U

$ h2 p3 V! i9 T) r9 m* T0 l7 L2 C) W+ P$ v
int41handler PROC
* J; T! L0 Q+ ?    mov     cl,al4 W: S2 `+ J6 a
    iret
& y% ^( K" \5 U6 U$ X' @int41handler ENDP) b3 i. h# x7 a- _% f
3 a: U, S, p% e0 `0 G1 n: N
) D% R3 q2 M: p$ X3 |, f
    xor     ax,ax
7 L" \5 @6 a7 y    mov     es,ax# @2 \! ^$ C1 U
    mov     bx, cs
4 Q) C; m; A  v5 \    lea     dx, int41handler, }7 f( g1 D, P/ q" F- t
    xchg    dx, es:[41h*4]3 s" g5 x) d' R2 X
    xchg    bx, es:[41h*4+2]# V( \- x, Z* m4 A6 u# I! P
    in      al, 40h  V7 l; b, g+ D% S! E
    xor     cx,cx! {9 P5 e0 @- W* z5 P1 n( b
    int     41h
8 ^  [, c& ~3 L# z+ d    xchg    dx, es:[41h*4]
& d5 J# W- W, T+ b1 N$ R    xchg    bx, es:[41h*4+2]( v( A  x# e; G' {! E2 d" d' i
    cmp     cl,al
/ n% j/ S# X' w    jnz     SoftICE_detected
# w* X8 i+ N: G$ h  b1 L  O( Y) T! v8 G9 M/ C
_________________________________________________________________________
3 n$ T) s( `7 R" N, D3 w" M) h) o, |: t
Method 07
5 z) Z# F' @  A# E( }* g=========4 z& Y% K/ F  J* _. A/ P) G
# N* }1 u( S/ _3 \
Method of detection of the WinICE handler in the int68h (V86)1 ^* \" k6 L6 R' M0 G2 ?

& f0 N& }7 j: |" U) @3 n) ?    mov     ah,43h# j; t7 V4 Q1 J) p- T
    int     68h8 Q* K5 P/ E) f9 h
    cmp     ax,0F386h, y$ W2 q% v- X# ]0 k
    jz      SoftICE_Detected  e  o5 \$ u' N1 q$ a% E! q9 ~
; d4 O; Z0 \' P7 u2 A6 _5 B

- x( }8 n) ?9 {7 K& ?& C& n=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
$ v$ h0 `6 e* y   app like this:
, ?, `& {3 r  M# X$ K# ?  o! `( t1 S3 J' U% ?! c/ _# p2 q, d9 p
   BPX exec_int if ax==681 N6 \* {6 U4 D& j% B" d
   (function called is located at byte ptr [ebp+1Dh] and client eip is
, U" m2 F. I4 J( q9 r5 Y5 M( r& [! y   located at [ebp+48h] for 32Bit apps)
  D' q6 ~2 t+ h5 ~__________________________________________________________________________6 Y4 h# ~2 B1 d1 A
9 N9 t* \. }3 A" x, H; d
* x/ B! b% h. X5 r, M5 R
Method 08+ b) j) W0 |8 M, ^: S
=========
: \- @. [0 G: I, x+ _9 @" S- w: |! [. r8 I. X- S
It is not a method of detection of SoftICE but a possibility to crash the
1 ~. b' r+ L, Xsystem by intercepting int 01h and int 03h and redirecting them to another+ p" j0 C5 ~0 z* }( `. z; j+ p
routine.
( \& n: i6 m  g* @9 PIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points. r, O2 u8 w' A& I7 v) T4 a
to the new routine to execute (hangs computer...)
6 v: _1 v  k# e" s0 t8 d* q; r6 D0 S" K2 b5 \3 n3 q
    mov     ah, 25h
# U" X% p' D2 G    mov     al, Int_Number (01h or 03h)( }4 ~0 L" @( [2 H9 c# e
    mov     dx, offset New_Int_Routine- @" B5 g# C* z3 x+ P9 H" ?6 k
    int     21h) k' ]4 p1 K! r  v  \) _
3 `1 v5 e7 i5 x
__________________________________________________________________________
1 u" l( m8 y& @5 N0 @% T
4 U3 ^! A7 f& H6 U2 a4 `Method 09$ o) @6 J- x! k5 ^1 H
=========
9 v$ N$ c8 d6 o0 w: j) o% S3 D7 e$ a6 b3 a' c$ y: k0 x
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only* J) e% M4 M& L# Z2 p9 R+ U
performed in ring0 (VxD or a ring3 app using the VxdCall).
2 ^% Z0 J6 A" n; n0 A! K& v( HThe Get_DDB service is used to determine whether or not a VxD is installed
  m" \/ B" X) v  p0 q. c: r0 tfor the specified device and returns a Device Description Block (in ecx) for8 |2 o$ F. L. ?/ v) `9 W
that device if it is installed.
# N. M9 h6 @0 e, t5 I0 j/ i
5 H5 X$ Z2 u4 x8 X6 w) y   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID5 o6 `: _. B: T. V8 P& P
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 D! O& w& Q( K% r% |# [4 j( ~
   VMMCall Get_DDB
" S1 \. p5 t2 W. M4 _; k   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( W5 ~# }# }1 a' _6 S  L* I! B' Y& Q6 {' H
Note as well that you can easily detect this method with SoftICE:- F' J* i, v) U# K
   bpx Get_DDB if ax==0202 || ax==7a5fh5 i. ~+ x( {( R: T. ~, \9 {' k# H
% E  b6 D* ~% F
__________________________________________________________________________6 f0 Z3 k9 y/ H# y1 p, s
* s$ G+ l7 o" R& r
Method 10
. ?% _1 w% D5 v% I=========& v: r$ U) [8 M" O4 j. ~7 R
& s- p6 C" {# g1 R) V
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with1 ]4 d0 a( `$ b3 T) _# m! g
  SoftICE while the option is enable!!" n, G" o9 P$ y: t6 D1 Q: n
) E4 a6 o0 B4 a; @+ e
This trick is very efficient:: E5 Z9 p; j6 E6 R  Z  q
by checking the Debug Registers, you can detect if SoftICE is loaded3 [! u9 o0 p7 t4 @
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: z( g1 y! G/ ~* c0 othere are some memory breakpoints set (dr0 to dr3) simply by reading their
! ~4 S; h/ ^% |1 a( o2 f8 [' Bvalue (in ring0 only). Values can be manipulated and or changed as well4 s3 s1 X9 y) u5 l/ r+ m0 k
(clearing BPMs for instance)
) `& u7 J6 o" W! b0 z2 `) K( J2 E, b; S  p
__________________________________________________________________________5 u/ l. h0 ^. r/ k: k+ A$ y, v
! i% A/ a9 c: C1 U" G) D3 G$ d
Method 117 U$ Z- j' Q8 c8 L2 P( }
=========
* U5 K0 _& j& x1 x# T+ g5 p# J. h8 o+ X* l7 J. ^4 K1 r, X% n$ x
This method is most known as 'MeltICE' because it has been freely distributed
2 Z1 K# X" U9 K. Y. Mvia www.winfiles.com. However it was first used by NuMega people to allow
- K" z5 A* Z+ Y/ Y6 z9 C2 VSymbol Loader to check if SoftICE was active or not (the code is located2 M) u8 O% ~5 X# w! h" X
inside nmtrans.dll).% ?* s; h% g4 d- H' v4 m: F

2 S' b/ A- Q6 _' ]1 g8 ]The way it works is very simple:$ B: U9 @, L; S$ C4 O3 x
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
0 c2 \( v. A3 d( [, P$ N& nWinNT) with the CreateFileA API.# k! `" `4 S: ?
% C& G# s$ K( ~
Here is a sample (checking for 'SICE'):
! B! Q$ j) p* a) w
, ~( R  J8 G+ PBOOL IsSoftIce95Loaded()
/ e4 F7 H* C/ R' r7 o' a{' S! j' ]8 o. n4 n  t
   HANDLE hFile;  
( S. y6 s$ a( }. @$ r4 ^- i   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
! b( j- {# B( H, B                      FILE_SHARE_READ | FILE_SHARE_WRITE,
9 W! b$ n, |- f9 J' I  M$ @& P                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" E; `" {  |, r5 }( q   if( hFile != INVALID_HANDLE_VALUE )$ Q1 c9 z8 K& `8 ]# b4 F: }
   {
) L7 w% A! I9 n5 [7 m5 v5 t      CloseHandle(hFile);8 `8 S+ W& m. o9 X: G* o) e
      return TRUE;( C+ R. h, ?6 ^# [' \
   }
: x$ q  q( B, K  e. p   return FALSE;
) B, T1 ?+ C# x}& d, }; N* x3 n6 L2 d, Y

$ M  h+ n8 S# p3 i+ {; u" gAlthough this trick calls the CreateFileA function, don't even expect to be! z3 D" `. j4 h) U7 Y
able to intercept it by installing a IFS hook: it will not work, no way!
* c$ f7 d: h) x2 i5 vIn fact, after the call to CreateFileA it will get through VWIN32 0x001F9 j8 F! l8 M" l( |' |- q
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( ]) s( |! n4 K
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
  j; o9 R% J2 o! |- ~field.
5 z# j: x% M  f- H% GIn fact, its purpose is not to load/unload VxDs but only to send a
; G1 D) h4 Q* }2 W/ pW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)* m3 t6 F6 |8 E2 y9 J/ x
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
  @* [% J4 C+ `to load/unload a non-dynamically loadable driver such as SoftICE ;-).  }4 g1 k* C8 g' c$ H  P
If the VxD is loaded, it will always clear eax and the Carry flag to allow
# J% i) ~5 r9 Oits handle to be opened and then, will be detected.
; K: ~7 b% T, M/ i1 EYou can check that simply by hooking Winice.exe control proc entry point
6 H# W6 F9 b/ F4 _' z9 M$ }# mwhile running MeltICE.) C: w, |* `* C
  P5 D7 f' o1 V; A; I( }( J8 p

! H5 G6 n& K# x6 N4 u  00401067:  push      00402025    ; \\.\SICE
& W8 l+ k4 u. e  W  0040106C:  call      CreateFileA
4 Z3 R- J% Y" ]3 R( @  00401071:  cmp       eax,-001' O6 J, H; g, A3 p; X- m# h
  00401074:  je        00401091( C8 ~' m" O+ f% F- `. M9 [

8 I: W" y0 f7 n) m' s" P: |( R
" s) o6 M( v' W( P0 x2 ~7 CThere could be hundreds of BPX you could use to detect this trick.+ |9 V' i5 d4 k4 O
-The most classical one is:
$ ~/ c- Z$ C0 Y8 Z  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||- m9 x9 }- X% H4 L+ Y& v8 K' T% O" M
    *(esp-&gt;4+4)=='NTIC'
% v2 O! `! U/ @/ Z1 O' e/ h& B* [/ `
-The most exotic ones (could be very slooooow :-(
% m" l5 D' A. v/ m; U1 Y   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 A/ \9 U8 J  ~& U8 H: ~3 _     ;will break 3 times :-(7 X7 A, |! A6 D* Q% }' R
) |* n4 N' m/ y+ ]. q) j3 Q
-or (a bit) faster:
8 G, e3 [6 N( \3 x; p' \   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')* a  k# h. T( |9 V
. a  n3 i; x/ P" w9 p7 c8 F/ F4 p
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( P7 e" j/ l: b
     ;will break 3 times :-(
) T$ b1 n+ H' y& X, y+ K3 L' K2 Q# T
7 ]; ]7 X. s; [/ Q; |-Much faster:% O) ^4 R4 O( D% R! ]& E
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'% t0 x2 T7 Y0 U7 G+ K& S2 w: ]0 P

3 F; q" @1 M' r3 n3 \2 f$ B+ @0 tNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
+ J5 {# u+ G) Cfunction to do the same job:: f7 U, {/ C3 a; R5 f
: f2 x& L7 T5 M* A$ A, p2 ]
   push    00                        ; OF_READ& b: ]1 `/ u' }& V: J# Q( e) L
   mov     eax,[00656634]            ; '\\.\SICE',0
& i3 H8 R& q4 t" I; |7 |* M   push    eax5 z( v1 {+ m8 A
   call    KERNEL32!_lopen4 E+ @5 w0 _: O/ L5 K
   inc     eax7 S2 N" i# J% A+ J) H2 i
   jnz     00650589                  ; detected
& V7 X# I7 X; X. E3 M- E" }5 y  e   push    00                        ; OF_READ- p4 ?( ?0 F( C. m4 n
   mov     eax,[00656638]            ; '\\.\SICE'
2 b6 g& b/ `2 ]! o$ J9 c; x6 ]   push    eax* t; L9 g# d- n; y  J5 c# B
   call    KERNEL32!_lopen+ v. d/ Q9 o& V% U. J
   inc     eax& q6 {1 }# n% ?6 W
   jz      006505ae                  ; not detected7 ~7 ?# a8 z% v4 f6 v4 r

' T6 b8 l, G% S% l# w1 z
# w1 B+ T3 u" h/ z9 U4 ^4 M__________________________________________________________________________# I" I4 E- Y% }& |* ^- c3 {, V. i
% S$ u* m9 ]2 g$ Y
Method 125 @" {# j% Q. J5 }  {- f/ h
=========
, {; ~* J: i, Q) _7 }4 u+ M5 u* b( ]  m/ F- P* c) W7 E( D
This trick is similar to int41h/4fh Debugger installation check (code 05! h8 {$ M8 o* Q& O8 E# \) Z4 d! P
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
! ~3 Y0 p& }% j& R# L2 Jas it uses the VxDCall backdoor. This detection was found in Bleem Demo.  s$ c0 }  d( }; s+ w7 L1 n

7 i! a) h  A# s   push  0000004fh         ; function 4fh
5 {- M; N' k! x. e; ^  X% O* u# E   push  002a002ah         ; high word specifies which VxD (VWIN32)# i* f& `7 T8 \: U4 m
                           ; low word specifies which service
4 l6 c2 L" O# ^                             (VWIN32_Int41Dispatch)1 n9 Z6 c$ N2 l' z5 h
   call  Kernel32!ORD_001  ; VxdCall& y7 L, W% B3 s4 g$ P
   cmp   ax, 0f386h        ; magic number returned by system debuggers
$ p2 }0 h) K& d8 \, E' Z   jz    SoftICE_detected
9 r$ V1 \; W$ I3 l( r" g: F8 n2 N3 i$ j- v
Here again, several ways to detect it:
5 H8 b4 t( ~2 D( ^: n
0 K. R+ ]* b' e- L% i    BPINT 41 if ax==4f
4 n4 A+ j! s; `8 f- Q
- v2 ~  E8 U% e7 D    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 k1 s! {% Y. |* O3 W3 C) b
+ h0 Z8 |8 K! Z' L6 @/ N    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 d( y. |' D: N  h8 k8 H5 J- M
8 t4 [3 ]3 c+ |! D6 ]! B
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!% x  L7 ]8 c. E0 O; K

' j. [2 C9 r- \1 J( b__________________________________________________________________________% P* z4 [+ F) N. }

* n9 z! U/ u$ w4 d5 QMethod 13
3 r# W3 M- y% N* b1 z=========5 `& T3 O" z$ O

/ K1 L" ]) p% h( q  g/ o1 SNot a real method of detection, but a good way to know if SoftICE is
$ x' u+ [$ Z6 m( b! k: k' Z" N8 winstalled on a computer and to locate its installation directory.+ g2 a4 z) U/ D& r) W% X6 v
It is used by few softs which access the following registry keys (usually #2) :
' V# i* j$ k' a+ {
3 k; t* N! F1 S% m. [& D-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 {' c+ m6 X# X" v; i$ F. r
\Uninstall\SoftICE5 @& O: T! A- l" \
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE% e" ?* y0 f+ F8 ~- T
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 C0 \' n! U& k\App Paths\Loader32.Exe
8 M; O! V  V$ }9 ]! v; }+ h  z2 p& r
% c% o- F0 t  ]) Y
Note that some nasty apps could then erase all files from SoftICE directory
. [0 p% g/ Q2 q1 h(I faced that once :-(3 H2 u1 d. P  o8 f% J4 I: t3 H
( I2 S* T0 D! t- a7 J
Useful breakpoint to detect it:
: `: s: L0 \5 @" `0 ^3 P, G  z7 Y, n( h* X. y" m
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 @* i! y& _( n# s0 Y0 G" |* S8 {$ f% o2 V9 y2 ]8 Z% ~
__________________________________________________________________________
0 f5 T! O1 j  [- k( h7 u2 ^7 B( J
0 m" W# P: A% D0 e( Y
: I% v: m( \  P2 ~* u+ RMethod 14 & l  X& ?. y1 F4 p* h/ V
=========& @4 A* x. N5 M- K+ w, }6 ?4 ]5 W
; b( Y0 ^/ `. P' S8 y
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose" `$ [; [$ K% p& S9 y3 Y9 s
is to determines whether a debugger is running on your system (ring0 only).8 e( w/ |! n& \$ c7 [" f( o

) ]* `% g7 s# Q9 c% R; ]   VMMCall Test_Debug_Installed& W! O% z  k2 R9 p
   je      not_installed5 i8 q4 C2 V. x7 U) a

8 |1 Z$ h3 V7 C# ^* cThis service just checks a flag.
# G+ R0 h2 J. R% G0 Z; R</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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