About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
! G2 u0 P0 L3 {$ b3 s& f<TBODY>" j* u' O3 C2 K, @  h' Q
<TR>
; }. ]- g4 S7 M. q<TD><PRE>Method 01
7 `% ^0 e! c" Y/ @* S=========5 J4 d& [) B8 Q# I" g
+ f9 ~6 Z8 ]$ h1 C8 ~) L
This method of detection of SoftICE (as well as the following one) is
& ^1 m* Y% [! P; }8 n! h0 ^used by the majority of packers/encryptors found on Internet.
1 f3 O  c0 D6 ~It seeks the signature of BoundsChecker in SoftICE
5 {/ a3 {0 Y' r8 n; L+ w0 Q
. P+ j( ?" K+ Z' K- c, e# z( j, v    mov     ebp, 04243484Bh        ; 'BCHK'7 }/ R2 q4 X8 I3 I
    mov     ax, 04h
$ Y( h* d; X7 l! h0 Z    int     3       * {" R% i, S4 H
    cmp     al,4
- Y; A* [! L- B. L# k0 y8 H    jnz     SoftICE_Detected
. n/ r, H; M5 x+ n, _  O) @, E. a
; H  a" P2 O, ~- t; n1 }, y# c1 s___________________________________________________________________________
) c) z* z, d3 {! X9 c! @- |0 A8 j. [' s! v0 d& L, _" @
Method 02
0 d) b, i9 k" v: n=========
" u% J& W) @- {3 b- X5 L% }1 j9 L1 I& L; ^* \" j( T
Still a method very much used (perhaps the most frequent one).  It is used' s6 ?6 p2 G% i. @
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,; t5 `* }5 l% r& o& k1 T
or execute SoftICE commands...
6 d* ~+ `* \' W# p7 M$ c2 ~It is also used to crash SoftICE and to force it to execute any commands
( c& |+ H8 W/ j( B+ d(HBOOT...) :-((  
1 M8 R0 z% `/ i% B* L% a. ]" O! Y3 ^
Here is a quick description:
- Z+ l" ~8 ]$ ]-AX = 0910h   (Display string in SIce windows)
3 [; J( t, ]& b: s# q/ I-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)" k5 l# d! }1 ^. @' s
-AX = 0912h   (Get breakpoint infos)& m7 m% Z3 J1 j* w5 j1 Y/ ^
-AX = 0913h   (Set Sice breakpoints)/ [1 \: P. ?/ B. w7 `9 C
-AX = 0914h   (Remove SIce breakoints)# N, s0 s0 w% z3 {3 J" U& A

, w2 w& t. I3 s) i7 N6 UEach time you'll meet this trick, you'll see:, h' c! @+ w0 N9 W. u( D
-SI = 4647h
! N8 q( Z) |4 t: {2 ]& ?$ }-DI = 4A4Dh
* _) b/ b5 ]" X* ^+ TWhich are the 'magic values' used by SoftIce.
$ w6 N: @. ~1 Z$ y! [& QFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ J' C, v. U( j
% Z! f( g$ H  p  ]  SHere is one example from the file "Haspinst.exe" which is the dongle HASP
4 h/ j1 k# x% ^Envelope utility use to protect DOS applications:
( F3 b. W& C. ^( @. l
3 e  {( h: G4 m9 ^: v' g/ u* H$ T' N/ [& z9 O+ p' l  a; m
4C19:0095   MOV    AX,0911  ; execute command.$ l; S" ^4 y& {: r; Y8 E
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
* b9 }3 q1 W" m) }  T. O6 \/ _4C19:009A   MOV    SI,4647  ; 1st magic value.) `  F7 w9 M* b( n. e4 G
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
& P' O* T+ k' A! `' a4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 R5 t5 K* d% R+ h* ?- O/ n; [
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
' k" ~4 Q: S& I; l5 {$ \4C19:00A4   INC    CX! e2 Q1 |0 v5 U: K8 @# l0 Q; r3 T
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
  d7 |# }  @& N( Z8 X4C19:00A8   JB     0095     ; 6 different commands.; I6 Y8 N; h/ y6 [/ b. A
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
; ^# y! {4 ?4 g: A0 ^4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
# [( d- t4 {0 V$ J! I: ]5 p. _4 A% q. W$ G0 e4 S
The program will execute 6 different SIce commands located at ds:dx, which
$ K( h8 s7 h; l+ oare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.* {3 ]7 ?& H( N, g! F: _7 y

+ l3 i, f2 G: i, `+ o5 {8 P8 {* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
% l+ F, v& g: P' c3 ~) Z+ ^___________________________________________________________________________
; C$ b! H- y' F& @. u+ K  u# p4 C- w+ k6 b. S( }, a4 @3 s! Z

- U# [$ p! F7 T7 rMethod 03
, S' {' Y' v, j, @=========
: ^# c" V1 }+ ?; ]
& W( g7 z1 |/ rLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
9 S% Q/ r: c# l, u(API Get entry point)6 P6 _( H5 a. e. }% F9 y" g
        
" Q$ _2 j4 e7 z7 S6 q0 Q* e7 v1 o" r
    xor     di,di
2 L! u, I4 Q* f( y9 U2 b# v8 n    mov     es,di
+ q6 s7 e+ z% I* d; i8 J    mov     ax, 1684h       # l5 y. m% u  v6 s: I
    mov     bx, 0202h       ; VxD ID of winice) z. M- Q3 x+ Q6 |+ N
    int     2Fh* V$ ^8 h" {+ L8 Y2 ~. T
    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ i7 y/ b2 d5 N! k8 g- ~
    add     ax, di
  Q& t( [( s( n$ Z5 x. j    test    ax,ax/ w' B8 J, h4 Z. }: A. d; k* R4 `
    jnz     SoftICE_Detected
9 o# ]  V# s, y  ^, s) `# K! V6 T7 z0 k) A  y
___________________________________________________________________________  P- f: Q) H$ K

3 C4 D* B) w$ x+ jMethod 04
$ V7 f' c/ g) S; p=========. x% B- s5 R% `/ i! m9 Q) Y
9 x+ x# P0 v" W1 Y* N) I
Method identical to the preceding one except that it seeks the ID of SoftICE& `) N0 H/ a# z5 I
GFX VxD.
: U- _0 A# u7 g0 v) q: a% @; x
) G* O6 s3 q5 N0 N    xor     di,di/ [, b1 m+ F9 x* Y, J8 }
    mov     es,di
$ T% Y$ S% Z0 q; a9 x+ @    mov     ax, 1684h       ( y2 A+ K% r6 B! a
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 e( G6 u* g1 B2 A    int     2fh- ?( [' ^9 a3 Y0 B1 L7 J
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 Q' P% a* Q4 H+ C) y& \    add     ax, di
8 c0 E0 A( Z# ?) `6 Z3 R    test    ax,ax& k: D' `5 a" p+ M; b
    jnz     SoftICE_Detected, r) k- Q$ G/ q3 D: n2 j

4 @# m) [: l+ o' j__________________________________________________________________________2 b# y- ~/ A! }6 X% G0 W

+ t! `0 U, I7 k2 E5 X( Z0 x# ^8 I6 n* ^* |2 U
Method 05
3 g( ^3 s* n+ R- \6 |: [) |( c=========1 A- h# w. e" M2 [
3 m# L! r/ a1 Y* d; T: f9 D
Method seeking the 'magic number' 0F386h returned (in ax) by all system. |3 O+ a) j( b; d( _9 A
debugger. It calls the int 41h, function 4Fh.
+ e8 I: H% \/ H8 ZThere are several alternatives.  , A+ U- i8 o, ]7 E  B2 c

* `6 b& W$ i4 T; s! B. P. K/ }( MThe following one is the simplest:5 B: h* G8 B( N
* r- h$ k4 a" K5 N+ Z
    mov     ax,4fh
, A& S/ d8 @* g% L9 t    int     41h) F4 K6 w5 n" A. M- R( X
    cmp     ax, 0F3866 z% Z; P: ?3 N+ J
    jz      SoftICE_detected
% G4 T5 }( y1 C+ P4 \1 p, r8 h( F0 v' q9 I5 S

: }  m4 y6 j( h  C0 w4 X' i" kNext method as well as the following one are 2 examples from Stone's
2 e: r5 }3 `5 ^# w7 ?"stn-wid.zip" (www.cracking.net):
0 f& ~& a4 q5 Q, {$ y5 l2 e- n7 O2 E2 D2 a1 v& b: a
    mov     bx, cs
# e2 y/ F. {. c% x8 Y% z# r    lea     dx, int41handler2$ \, h9 w; R- O* g3 g3 [& l. d
    xchg    dx, es:[41h*4]
" E" B* i& \8 r* j    xchg    bx, es:[41h*4+2]
3 {4 W( h; W1 S1 l! Q  `( S    mov     ax,4fh& W/ z$ g7 @3 T. l/ s$ x
    int     41h
! z! j- M! a( c" d9 ^1 p8 P) x+ U/ d    xchg    dx, es:[41h*4]
; ]  u6 I+ x, V* Q- C, R; G1 [# `    xchg    bx, es:[41h*4+2]8 D" ^* @. F# E  \8 T
    cmp     ax, 0f386h
2 S: N6 n1 P( _- X    jz      SoftICE_detected! t3 f( G0 T& E9 L8 e9 V
1 f" e1 _# z! o4 C
int41handler2 PROC% I1 f7 m$ Y' M' b' i
    iret0 f+ W' N7 }9 r: Q2 Q) E+ s1 m4 V
int41handler2 ENDP
* C0 |9 L3 `1 {5 e; v4 W% u  o" g/ _& o1 R. t

# w) \* Y; X, r$ T3 @; y_________________________________________________________________________% z% h9 p/ X9 J3 h7 I, ?1 X
0 T- H9 p7 S" o' V* N8 ~" z
: r$ D2 r5 e$ ]# M1 G
Method 06
0 r8 z5 b; f1 C=========
( J0 x+ |, r$ r9 o
  n4 }3 Z7 [/ \% C* g
6 C1 y/ G) y+ z6 V8 c/ {. Q9 X- e2nd method similar to the preceding one but more difficult to detect:# k7 Z, f" g/ ?! L

: @3 F2 n* D- R: N' H$ i$ X8 s2 B( k/ v0 u8 c3 ]$ H
int41handler PROC0 [5 e* |* P1 D& Z/ g( R
    mov     cl,al, ^; R  A+ y8 N/ x$ V( Q
    iret
1 H4 x, F8 D' u5 j& Q9 B" u- nint41handler ENDP
, }5 O3 K! ~9 Z& Q) m% z; \" E% m) D+ v+ J% ~1 u' }" A
6 C: S! @( |" c+ ?. f' P% o
    xor     ax,ax
' C- v6 m. v' m  }    mov     es,ax
$ L9 m* ~* j! W+ g    mov     bx, cs  u# U/ e; d) O1 E
    lea     dx, int41handler
2 J/ S7 H! r* G2 p- \    xchg    dx, es:[41h*4]- W- ?; X% S% H, D. ]
    xchg    bx, es:[41h*4+2]$ K# R% ]& r( g
    in      al, 40h: |1 I( Q2 R6 u) M! Q: _* C% A
    xor     cx,cx
% \* n: ?3 y8 s: B6 g5 P    int     41h& d  t9 ^. k% m. k. _6 G' {
    xchg    dx, es:[41h*4]1 O" n! v  v% @& I' N2 j
    xchg    bx, es:[41h*4+2]4 U  _$ f0 J  L3 w9 y9 q/ o" F
    cmp     cl,al
$ m! Q, P2 i5 k- R5 H3 `    jnz     SoftICE_detected/ C8 d: M' T9 P2 a) ?

4 b) E$ _$ A- T4 ~* n_________________________________________________________________________
/ P$ K. a* s. f: V* \
9 l7 R2 O' v' E. K% Y& C, r9 {Method 07
, z1 X; f& m& K# I$ X=========
, r9 Y1 G- T2 X( e% C! j! B1 _' q0 h, d- D4 o8 B$ p; ]. P
Method of detection of the WinICE handler in the int68h (V86). [3 u8 G, b1 O+ g1 U

) O; L, p) B$ }    mov     ah,43h
, W0 s& a7 u: J5 c& j5 y+ N% {    int     68h
$ C, t) @, {& x& h    cmp     ax,0F386h
1 Y% O- L! `* u& p+ ~' l    jz      SoftICE_Detected  H2 a& L3 |  f5 Q

* ~+ u% {/ Y/ l; p$ |; [/ F
7 c6 |$ i: m% k2 P8 h) P/ N=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ O  C% A. G/ J7 C- u* W; _
   app like this:
5 O+ b& u7 T8 ]1 I2 ~( q5 s3 n0 A8 A5 ]
   BPX exec_int if ax==68
! S9 s+ z3 N, ?! Y   (function called is located at byte ptr [ebp+1Dh] and client eip is0 o4 E! m; T5 C
   located at [ebp+48h] for 32Bit apps)& W' s! X7 u" `. g8 h
__________________________________________________________________________, g+ R* \  m" z# o( @3 l
4 V0 J4 F! A+ c) c3 l3 }

7 j' ?! y5 A0 }/ g7 P; @$ uMethod 08
) i* Z  N: Z. j1 F$ B% V=========
, Y2 x  v* D: f+ W. c3 z
5 E- b% b3 a5 Q# pIt is not a method of detection of SoftICE but a possibility to crash the" C" |7 H+ ~- R, e) H. V: h
system by intercepting int 01h and int 03h and redirecting them to another4 K8 j, R) d$ u% ?/ ~
routine.
" N" X" u: X& S" B0 ], M$ D, OIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' d2 W3 d1 A, d0 vto the new routine to execute (hangs computer...): g% I! L8 O% P9 h1 ^( \! v3 A3 d

' N) b# c- u' [! ]8 l/ x5 c3 `* D6 a5 @    mov     ah, 25h) f9 d: F" K( B/ H
    mov     al, Int_Number (01h or 03h)2 h- k5 J5 z3 C1 H% K8 M
    mov     dx, offset New_Int_Routine' p) W! c, n9 Q
    int     21h6 c( i; D  |. n+ h1 Q8 \  }
6 d' s7 y" g7 U: C1 Q2 q" O
__________________________________________________________________________
; ^, F* M: J1 m- ^9 {. S8 U! x! o8 J3 `) y  y) s% o
Method 099 n; a) S* X- n4 J& Z; g. L% r' ?
=========
: h2 {* L( t" N- p, S" X* ^/ j& w- v2 M$ f
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only5 t$ H/ @) Y/ w6 Y
performed in ring0 (VxD or a ring3 app using the VxdCall).  t- |$ W* e  i3 V/ y
The Get_DDB service is used to determine whether or not a VxD is installed. r5 M9 |' a5 \3 x' N
for the specified device and returns a Device Description Block (in ecx) for3 p* _9 C# U4 l9 L0 {
that device if it is installed.  {$ `8 ^5 U- U, L9 |# G+ p" F
- }4 g/ p5 K6 i- S0 C' F3 w
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID% Z- O. v$ m. Z$ N+ O5 g5 E8 V; z
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
- A- K" W6 m' w: X- Y' k   VMMCall Get_DDB
6 F$ `$ q4 k) Z0 d5 A   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
' y$ m- S+ a% ^& t$ P2 d3 i
, {. l. G5 q/ g. iNote as well that you can easily detect this method with SoftICE:
" M9 ]+ X+ Y5 b% u6 v& h   bpx Get_DDB if ax==0202 || ax==7a5fh
$ F/ @$ J. p: y" L: F
7 D1 C' ?# Q* f9 Q__________________________________________________________________________1 W  f* \/ v' ?& u- ^

* L' [  Z& ^5 |, f$ E" \. LMethod 101 c3 w; D/ B) V" v* I' F9 T  T
=========  o2 t0 {8 o9 [8 C+ }

# U- J( y* B- v$ r=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
2 d( {5 X" S' r/ T  SoftICE while the option is enable!!5 X3 B' U( x! m0 y$ l
8 D3 J/ N. Y7 I. n+ F
This trick is very efficient:
4 ^3 g8 p3 {$ N; k* L( G5 y/ D4 Nby checking the Debug Registers, you can detect if SoftICE is loaded+ I$ J; H% h5 k% D6 X7 ]
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if- w0 Q. I0 P; p& R) ]5 ?* b
there are some memory breakpoints set (dr0 to dr3) simply by reading their- ?2 f! a! X( D0 Y. T  e
value (in ring0 only). Values can be manipulated and or changed as well
" }$ c& ^& `" Z7 g6 ~5 E$ z(clearing BPMs for instance)
2 _, B) n7 M: ~, C2 I9 y- |. G9 K; N" N* B  Z/ i$ k
__________________________________________________________________________
8 n9 z  ^- r/ g
9 [9 o1 `' t- vMethod 11
! x. e3 m8 P; R; s=========
% Y( Z  s/ f0 n$ ~; j
; i3 Q! `/ D8 h4 G# S6 YThis method is most known as 'MeltICE' because it has been freely distributed
1 g, j( M% K5 B/ vvia www.winfiles.com. However it was first used by NuMega people to allow% ~2 k! Q) r/ b' @
Symbol Loader to check if SoftICE was active or not (the code is located  D( E9 p/ Y. `1 c, V
inside nmtrans.dll).3 ]  S/ J+ }* g6 G- V3 O4 `& z
6 q! w' x" {& u$ z4 `) d2 e- N
The way it works is very simple:  j  Z* n5 c/ M$ b, Q. g
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 n! w0 c6 N4 w+ A! Z, O7 _- G
WinNT) with the CreateFileA API.
  d+ F6 G: I9 z) m) e7 J  _$ t) b
Here is a sample (checking for 'SICE'):4 C9 r) U6 @7 x9 F9 }& j

+ b5 P7 U. O4 [8 gBOOL IsSoftIce95Loaded()7 f& \6 F1 c9 Y, t" C+ h, G" a
{+ I/ r6 B1 y# v& A. x  x% ]
   HANDLE hFile;  
' Q- D8 x* C0 D2 Q   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
& F) B6 D$ u1 Z% d. p                      FILE_SHARE_READ | FILE_SHARE_WRITE,8 a2 a$ q" y0 t
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 t: K- I) V8 ]* v$ `* ?& T- s7 E   if( hFile != INVALID_HANDLE_VALUE )/ J$ D4 q' c* q. L- g7 _& H9 u+ \  r) O
   {
& U# h/ s( N1 L      CloseHandle(hFile);
3 P; \( i( |( p& b8 r/ [3 s      return TRUE;( G5 l/ A7 }% M; y  S1 `
   }) m% T8 W$ T% N) U, N2 A+ _* Z
   return FALSE;
" u/ e) B/ S; @4 N  K}. }0 C$ h8 C3 R/ T0 Q

$ O; b  T3 ^8 RAlthough this trick calls the CreateFileA function, don't even expect to be. X6 r( K5 g6 `/ Y
able to intercept it by installing a IFS hook: it will not work, no way!0 w' C9 h" `: H4 F8 m0 k# o
In fact, after the call to CreateFileA it will get through VWIN32 0x001F9 F% c6 _% C; Z9 O$ N/ ?. V0 E
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
- h! s3 h! F+ X$ h$ i+ U! qand then browse the DDB list until it find the VxD and its DDB_Control_Proc
! L* O7 J( h7 s9 I0 hfield.
" J, K, u- y9 Z. ]+ R4 XIn fact, its purpose is not to load/unload VxDs but only to send a
1 M- M' r- S" H2 D6 o! b0 nW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE). B0 `9 m' i: u/ A
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
  G% p/ B: v0 Q8 O# [to load/unload a non-dynamically loadable driver such as SoftICE ;-)./ h6 W7 d& ~, x4 w7 m- p) T
If the VxD is loaded, it will always clear eax and the Carry flag to allow
3 `  s! Y6 l; E4 d/ L, y$ kits handle to be opened and then, will be detected.% g, A9 y: |9 i' s
You can check that simply by hooking Winice.exe control proc entry point2 ]( Y. E# {3 b5 t
while running MeltICE.' j; ^) h3 ^  \/ m5 T- L

1 w1 L; Q* R* m0 w4 n
2 O8 h0 N+ `$ [' N% f6 @: V  00401067:  push      00402025    ; \\.\SICE
8 o6 T9 a$ F5 w# O" E  0040106C:  call      CreateFileA
0 ]4 a; G, x$ {% A, i  00401071:  cmp       eax,-001
. B& d/ D) C+ A  00401074:  je        00401091
5 n$ v7 ~* a9 ]9 p) H# D8 v9 k- H$ ]- z- K# \8 \% ^; V

! O8 U. c2 y$ {) D5 [9 h" T  wThere could be hundreds of BPX you could use to detect this trick.0 A  i5 ?& y# u: V/ f$ {3 k
-The most classical one is:0 m4 W6 I  {, @; q/ U( d; U
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
) z: c& g5 l0 o) I+ h/ x4 |    *(esp-&gt;4+4)=='NTIC'
0 j- K" @" o+ |3 T8 [: ~8 s4 O  w5 l' J& E& G+ r/ b8 Q$ A
-The most exotic ones (could be very slooooow :-(
; R9 T0 I4 N, [. A0 z+ v   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  * x; s# ^( ~* V$ f
     ;will break 3 times :-(" ^& Q% p3 n9 t) }2 D

; k2 ]( F3 b4 n7 u2 P-or (a bit) faster:
$ G, \0 @* t1 X3 z, N7 W' Q   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
3 K% ?+ ~. s8 O! m: I2 ~4 u4 c4 t
% g  ^( W9 T9 ]; H& Y# \/ s. x+ o) g   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
% ~2 B4 H8 z' B& j* I     ;will break 3 times :-(
: @& W( @8 h$ ?1 M' K. p7 [: p! {& r  f( a$ S
-Much faster:2 K7 q: [+ {+ Y8 k& V. ^9 P. ^  y
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
2 O( i4 y- V( r' n6 g2 O; R3 V8 u! r( ^
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen" {1 }0 g& u9 b0 R# j2 ?% Z
function to do the same job:
0 A+ E" @% M6 i3 u5 @3 t: T' \+ Y2 q3 g5 `& o2 I5 m
   push    00                        ; OF_READ
, t  S/ {. @$ ~3 j& D2 j" p   mov     eax,[00656634]            ; '\\.\SICE',0
) m7 I6 l- c3 _5 q   push    eax
. B. |, @; Z# s8 m. C+ L( s   call    KERNEL32!_lopen( B; l  b9 Y) l- P+ _1 I
   inc     eax
+ y& g* v$ g; Y1 R8 n   jnz     00650589                  ; detected
9 Z6 }1 b# r( U" v' C   push    00                        ; OF_READ
: B( f8 J& ?; N! G   mov     eax,[00656638]            ; '\\.\SICE'3 T+ j. B! X0 n% G) K. i
   push    eax
5 h9 k0 ?& }8 v6 h* p3 o: [   call    KERNEL32!_lopen# K: R7 U( g  t! r
   inc     eax
  g# Z1 J8 a6 g3 c+ ~   jz      006505ae                  ; not detected0 m- A1 G) ]. b) d7 R

+ `! b% z: t9 W' L- A9 k6 b1 e8 v9 }# P; e8 G
__________________________________________________________________________# \* @9 H+ P  v8 e! |
/ ]0 V* h( {' v$ @5 k$ I
Method 126 @8 p' g/ ?- w7 D3 U6 u! S+ Q  |
=========
, j- E6 M* ~' ]# l7 v
3 B! A7 M+ U  {* UThis trick is similar to int41h/4fh Debugger installation check (code 05
* I/ y9 i/ G' F& O4 N&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' T, z- s* {8 D# R7 |as it uses the VxDCall backdoor. This detection was found in Bleem Demo.. S6 \! m6 N& S- S1 d
' d5 i' d  m0 g* P: |3 T: t, G* }
   push  0000004fh         ; function 4fh: p8 y9 h0 Q. _, d$ c
   push  002a002ah         ; high word specifies which VxD (VWIN32)' X0 W  U% \* c7 U! v
                           ; low word specifies which service- M! s, l! W0 m% R1 x, v
                             (VWIN32_Int41Dispatch)
2 ]# q; a/ K# {, R) ^3 s4 B9 L# j   call  Kernel32!ORD_001  ; VxdCall; O2 g$ c9 d  R' T; u. b& f
   cmp   ax, 0f386h        ; magic number returned by system debuggers
% k& m( }2 C' ?( i3 k& M% I   jz    SoftICE_detected
) u5 T' G8 x2 |: V0 W( L9 q- n
# @& X. ~" u7 ~, sHere again, several ways to detect it:; o! ^6 C" f$ O6 v) G. Y1 ^

+ h5 O$ O6 W" K9 X    BPINT 41 if ax==4f% ]* r! R$ z" Q! t5 l* T) N
& l9 L( n5 ?  f: m. w
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one% u- X2 |% o+ g2 P0 H

& D: G: j$ S; h8 Y8 ^2 }  [    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A& M! @' }  W$ O& ^1 B" B, e4 c/ d4 I

; B9 _5 e5 d9 r6 A    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!: Y" H6 B; m$ k! {- g2 G, B
, u. q; N; K# p7 R' B
__________________________________________________________________________* T8 G3 u5 P. X4 O& m0 ]

: p! Z* K0 l' V3 j  ?Method 131 a* Z8 D9 `7 ~$ M# B) Y$ ~0 R
=========
( S: H# J5 `! \' r! n( Z3 o$ I  O$ k6 a
Not a real method of detection, but a good way to know if SoftICE is/ z1 e' B! H+ u: v* s
installed on a computer and to locate its installation directory.$ n! j* l$ S' L0 O. n
It is used by few softs which access the following registry keys (usually #2) :
9 s6 J- p# `! a% x* d& H; |2 V* r7 @7 f- \5 J! \- ]
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; q0 L) Q" y9 V# B7 B# s4 l\Uninstall\SoftICE3 O" L* s$ Y- F; r+ M* ]8 H
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ T5 X8 T, Y2 x- S0 J-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. M) V8 J) ^' D
\App Paths\Loader32.Exe
) G2 b" [$ C2 b( r& X9 u- Y! ^8 `/ P, [  L5 s

  ?, H. n. F, p# t7 ]% u" ]Note that some nasty apps could then erase all files from SoftICE directory- B' X; M" {' q. V7 h5 V5 d5 Q& R/ l
(I faced that once :-(
, y, J4 F+ }8 J7 W/ b: V' a# l5 n0 @/ }
Useful breakpoint to detect it:
& r- p9 R- J& J7 S) ~4 s4 ?
$ z' g) g9 c. P+ M( ]     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 E* l/ R. u; F7 |4 L4 G
7 s9 V2 U% G; }! g
__________________________________________________________________________" y1 |6 _% N+ M; p7 l4 E6 ]1 E$ T

* i  ~  C% l  b3 g; Z* D' [+ F, k
Method 14 : L1 B& Q4 a1 A' O
=========; O% ?, x" ]( U' ]8 x

9 C4 O2 C8 J9 Y, j9 E6 hA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
# j  o8 e( D/ l  L2 I& Dis to determines whether a debugger is running on your system (ring0 only).
% q* [. X) S6 Z  G# m5 h: C
  z+ q/ W! V3 W. V' _, _/ k/ q) C   VMMCall Test_Debug_Installed
) y% F3 E/ y# n; `   je      not_installed" l9 v& G5 \6 D) C  h0 C7 M
& w: i3 ?9 f% ?) n! C
This service just checks a flag.
) s) e* _8 ~: `4 K</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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