About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
2 Z8 y: ]! Y# Z& E) C: V0 K, k8 f<TBODY>
  x/ x* t4 e5 Y& b0 Q<TR>
4 `6 P2 _) U8 j/ @; Q8 O; N<TD><PRE>Method 01
% `( g& d2 ~7 r! X=========
5 D4 z6 U0 C5 f* d) J* T0 x5 M! ^! A
This method of detection of SoftICE (as well as the following one) is
$ U8 Y  f* E" S8 F0 ?used by the majority of packers/encryptors found on Internet.
9 c- r2 X; x: M" e% u% d, oIt seeks the signature of BoundsChecker in SoftICE
/ F* c* e) K& |2 v
7 A9 f4 k% U9 q- o# `    mov     ebp, 04243484Bh        ; 'BCHK'
9 ]5 q) [; D. g8 ]) Z- ^; U; k$ w    mov     ax, 04h! m- d& z) s1 N' z  q* X
    int     3       . ?; @! W" g2 d: K3 R# V
    cmp     al,4. X, A% }4 e1 |# D+ {
    jnz     SoftICE_Detected9 ?- ?% Z  ]2 b2 d) C, x, W7 Z: }
5 v6 N) |/ G- t5 b
___________________________________________________________________________4 Y  [1 P3 \! j! O" N( M7 O
% c, v0 h3 r; T; f% r
Method 026 H$ s; q4 f$ s2 h- z, F. }' [
=========
2 v/ I% Y- T3 F5 g# F" X. X6 r2 Q6 U, [8 W  ]  T
Still a method very much used (perhaps the most frequent one).  It is used
) H/ ~1 ^- \9 n7 jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
7 E4 [0 n: M* nor execute SoftICE commands...+ s( K4 Q: O. W6 c, u2 c9 f: x( g
It is also used to crash SoftICE and to force it to execute any commands
& w0 M2 H. G3 @& R6 g  j% [2 X(HBOOT...) :-((  
2 i# Q5 u: U- _8 s$ [& S
* K( N- q' O, \+ K" G& _9 jHere is a quick description:/ {/ D8 u3 Z: ?' b3 @& j. s3 q
-AX = 0910h   (Display string in SIce windows)
& N( o* k/ ?! }7 ^( T' U-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
1 j" U+ G4 s) I7 M( Y, c4 q-AX = 0912h   (Get breakpoint infos)4 ]" [( N: C  F8 J' f( \
-AX = 0913h   (Set Sice breakpoints)
: M/ T5 F2 c" @! u, n( X: _-AX = 0914h   (Remove SIce breakoints)
9 j7 n' i/ ^3 M" C% ?- k5 {; G
Each time you'll meet this trick, you'll see:
+ i, r2 S. ?8 t2 ?  E$ \& U' |-SI = 4647h
0 A2 h" I3 I; N% c5 d/ X) U% K-DI = 4A4Dh  D) V3 c6 ~. b7 ^
Which are the 'magic values' used by SoftIce.
2 ]* E, g1 q/ N( U. Q- Q7 f9 J: `( gFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.! a9 O, q) w2 W1 J; _! ~  v
. }+ {) v5 x2 T0 P% w* D
Here is one example from the file "Haspinst.exe" which is the dongle HASP
5 N9 n' j. ^! Q9 @  nEnvelope utility use to protect DOS applications:
5 U0 f3 Q8 d2 l7 y" e9 d# {9 k) [$ f) z0 I' z. B
$ ]5 u7 P4 F. V6 N: F
4C19:0095   MOV    AX,0911  ; execute command.
2 n+ d0 _% G2 D4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- }. v: G6 g3 G. F3 r/ i' \# a+ d
4C19:009A   MOV    SI,4647  ; 1st magic value.
# {7 }+ A$ O' U4C19:009D   MOV    DI,4A4D  ; 2nd magic value.: f3 _8 K  r5 E4 W+ b
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
- Y% Z8 K0 S2 Q6 Q0 m& c% b' N4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute5 K1 _4 q7 j; D9 S) b' V8 k4 L
4C19:00A4   INC    CX
  X# H2 N- L8 s! c6 V1 B6 W" g4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute& i8 w4 w. q6 z4 ~+ E; N
4C19:00A8   JB     0095     ; 6 different commands.
9 x: C  p- d2 O4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
/ Q: ^+ @1 i8 @# e2 G6 H' z7 t* r4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)* @( h0 J/ c* g" r

" _; O1 f/ v- y/ F; `  \The program will execute 6 different SIce commands located at ds:dx, which
3 ~* t+ |7 _( P3 I4 \( R0 U4 Xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
: b  G7 }% y0 Z# I  K7 T$ \8 m, q, u6 ^: h. b5 v; S
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.3 y' ~/ n  J) A" h  p% X' o
___________________________________________________________________________9 l* E) R3 X& R/ h
4 [5 y+ Z# D& Z1 U! {$ ^
# }* B: d# L4 H. |, a' y% |; P
Method 034 C# Y2 f" t# @! A  Y
=========
' X, W7 e; l3 V* M
( P( H& h2 E& GLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h6 I' b$ J  D+ j5 H2 B
(API Get entry point)
: [; @/ Z- z2 d3 C5 G1 E+ N        
0 E; k( i' Y6 n6 H4 J3 ]  _
  j9 _& ~8 L: H    xor     di,di/ L  F2 g% J1 D7 M  q+ N
    mov     es,di0 S& o( |0 s) p# h
    mov     ax, 1684h      
  e  C) [+ E# R1 f& V    mov     bx, 0202h       ; VxD ID of winice
! g3 Q" o; g/ z7 e/ X    int     2Fh
/ F# T7 ^+ S0 l8 @7 G; X    mov     ax, es          ; ES:DI -&gt; VxD API entry point, o- P: s) P: _0 n2 R* t9 {
    add     ax, di' p: K" K: T6 [/ X) |) z! Z
    test    ax,ax; @) {# F; ^) X2 Z) ?
    jnz     SoftICE_Detected5 M) E$ M4 `0 Y; b: F# l. B. d

1 O/ C1 H" q. j1 }( T2 F___________________________________________________________________________; P5 r- o, K0 Y. x5 B

5 y2 m6 n' ^* B% a: ZMethod 04
% q2 q' a( l5 P" `' c=========
1 m; Y; u2 m& W+ \
& y" [4 G/ p' N" X: P/ U1 JMethod identical to the preceding one except that it seeks the ID of SoftICE
7 `$ F# T+ h6 q! I, l2 q/ eGFX VxD.
7 ?& O9 y( w& z: A0 f1 g4 U' w$ z
) U& X! ]& f6 B5 {' o6 q& c    xor     di,di
' s" r5 Q& C$ z: m3 c; e# O    mov     es,di
9 s' I5 k; f$ ^    mov     ax, 1684h       , j, a7 D% _/ e' d
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
6 f5 l( Q) t% e$ p1 x6 ]    int     2fh: z* q5 t: d' T4 J* l$ `: C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ b$ {* p" A' s- \2 a8 g
    add     ax, di1 E8 J  k4 k; D3 w. z/ Q2 Y
    test    ax,ax
3 g! z6 m* v4 y  I, K    jnz     SoftICE_Detected
5 L/ L8 l, _. `- J
: D* n& ?2 t* n& `1 m+ Z1 D& c__________________________________________________________________________8 o9 }! f, ^* Z0 E
0 H; C6 S- ^% r3 p( h1 @& [8 k

* V  {# ^+ O4 VMethod 05
2 O3 p+ k5 W) q2 i- b: l- T=========/ I% ]6 {! L$ v& p
& m9 b' W* @' {0 B! b$ b+ U# I
Method seeking the 'magic number' 0F386h returned (in ax) by all system  C: U! @( d+ W9 ~
debugger. It calls the int 41h, function 4Fh./ f% h5 C7 F: e8 @: |2 x  `0 ]# r3 p
There are several alternatives.  7 B6 Z9 h( t; T
8 K- K0 E: }+ F. F( m' r+ x
The following one is the simplest:
" x. k( [! w. [! x9 J0 q
, P& I, J) I' r" H4 r    mov     ax,4fh
$ V2 h7 \7 f' v* w    int     41h
; }% d1 k) ~0 B2 [6 X7 h    cmp     ax, 0F3867 n1 N0 f9 R/ }6 k
    jz      SoftICE_detected
; _1 c/ A0 {0 P
, z5 X2 S" O0 k+ n: e, g! @5 {2 @2 W
Next method as well as the following one are 2 examples from Stone's 6 ~. k+ ~" A8 H
"stn-wid.zip" (www.cracking.net):8 D$ n" B  {' _- Q1 s  V) F
; s. L% D+ f) B# O% a1 @) p! |! P1 a$ ^
    mov     bx, cs
& n8 P. M) q  X8 b) F2 y    lea     dx, int41handler2. K6 M0 V7 M' [$ B4 ?) D5 C
    xchg    dx, es:[41h*4]5 ~4 o* F" I  x- g
    xchg    bx, es:[41h*4+2]- Y- S* i" e4 K. M
    mov     ax,4fh' U# Y7 S, d: O: g/ {6 j3 r
    int     41h5 O9 k8 [  w' U1 i1 W  z
    xchg    dx, es:[41h*4]- J. ?8 u6 \: p5 o' C, i2 ]6 C+ `
    xchg    bx, es:[41h*4+2]1 w+ i: |; o! L+ O5 M- s! p
    cmp     ax, 0f386h
$ k: _) o; K. M: u$ R' t2 _    jz      SoftICE_detected
+ y* m! C& X$ F  J( k
# G; w% b& t& _int41handler2 PROC
+ m9 t) h: P; Z& V; k4 s" p$ Y    iret
( a2 p; I; B4 |int41handler2 ENDP
/ a2 ^7 ?) k, I2 m
  c1 I4 n' S. y2 S$ M* h6 z
$ V- k. T+ o( q2 o6 p4 ?! Y& _) c_________________________________________________________________________3 U, C* y: e. A; m0 n" I0 h
6 L- M- N0 r% e5 U& p/ G1 ?

# ^4 ^" \/ |1 d+ M1 v3 G; ?6 Z8 XMethod 06" {8 M4 Z; O8 ?5 B, a! g8 {
=========6 w* v5 d5 k: |1 C/ t. [

# }5 K% A$ m; r3 [6 a& r
, t- W7 F2 ~7 E  s. L( y1 q3 Q2nd method similar to the preceding one but more difficult to detect:* ~1 u9 _2 j7 y9 U3 H5 \3 D
% Z: Z5 a) `/ y2 s. \8 }* J

+ `5 C+ E6 w  {& A- ^7 jint41handler PROC
+ X' n. j& L6 F4 S$ c$ M    mov     cl,al8 R+ o4 P3 K% o. n1 U
    iret: p( A# H* B; n3 m0 t
int41handler ENDP8 q: \( a4 I/ p3 c
6 c5 v; [8 t( r& u3 }
) q6 u' g8 m2 ^. r: q
    xor     ax,ax8 C6 m; H5 F2 y6 J1 E
    mov     es,ax
1 x/ A; d( Q  E& X# d    mov     bx, cs5 X) H: z0 z4 [% {+ R
    lea     dx, int41handler
# ]' v% |6 @, j1 B( o# X    xchg    dx, es:[41h*4]% G* _4 y( f) A8 |; V
    xchg    bx, es:[41h*4+2]) m( \- A' Z. D
    in      al, 40h/ W( D  j) R( k+ b, A0 d
    xor     cx,cx( s: o3 s' W% ]* }: G5 d" {
    int     41h
; W* l3 I4 B# |4 G6 m# W' B/ g8 y    xchg    dx, es:[41h*4]
( A' _  R  P/ v# |4 g( D    xchg    bx, es:[41h*4+2]6 Y# R7 L' p7 d) E
    cmp     cl,al" ~5 t  J7 |# w. z% L9 }
    jnz     SoftICE_detected
  G8 G/ m% y" R5 U% }! a8 F2 L
; e4 O3 x2 C0 N9 b$ F. d_________________________________________________________________________4 i4 L  q; u% @% g3 E6 a
9 Q% ^1 T( T' s- |5 B
Method 07
- ?) R( t: P. H8 F1 g=========( G4 b' m* }9 U6 l

+ |' `( {2 L5 o/ [; J3 AMethod of detection of the WinICE handler in the int68h (V86)
1 A/ T. ]3 ^* j9 M5 _; d- ]+ u! w) z
    mov     ah,43h
- _$ c4 ?: _/ O- N5 ?1 A$ `) V    int     68h: H! ]  i+ \' e. v6 _% c
    cmp     ax,0F386h
; k4 R: q! a7 a' P0 i: B3 E    jz      SoftICE_Detected
, s& g! D2 N' i+ m" D0 X: {) C& J7 Q7 z# Q* Q; ^# w* E

5 k. ^. m# }6 u" F/ D. j& P=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 R3 _7 m( N. E. q   app like this:% ~5 ~3 ]9 D3 s7 o% B
& `: O, l1 W$ B% H, J$ U
   BPX exec_int if ax==68
; ~2 E2 Q9 Y4 c! u   (function called is located at byte ptr [ebp+1Dh] and client eip is
) C& o9 |, e" K( j   located at [ebp+48h] for 32Bit apps)( N" Q" C: F0 u. z0 Y4 C! K+ g
__________________________________________________________________________
: j1 U; m0 c( B+ C" ?+ n2 W. s. L2 Z! u
! q8 F+ N+ J1 T- w. [$ |& A; M
Method 08
1 H9 Z- Q# h' u* ]! V=========7 Y; G8 p. f# b" ~7 h% R3 j8 }

! c' g) P/ {" n5 l% MIt is not a method of detection of SoftICE but a possibility to crash the8 M. {+ s( P! N$ N, Z* b8 f
system by intercepting int 01h and int 03h and redirecting them to another
3 a2 J5 Y, g5 j1 G8 Aroutine.' k3 ^, u6 w. n  Z9 e0 ^
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ Y& }0 d5 F, X9 ^/ ato the new routine to execute (hangs computer...)
# M3 h, V; j- v9 z. p* ~3 E
# G& _5 u1 E& s# F- f! z    mov     ah, 25h
( f3 {3 |/ J4 T" Z+ n    mov     al, Int_Number (01h or 03h)
6 f( V5 c; G9 x1 K$ ]( g    mov     dx, offset New_Int_Routine
" T* a" {$ z+ F. n4 X1 C: E    int     21h
9 L4 U1 j+ P0 ]# b$ P5 A
# [- n8 Z0 U1 c/ g& \: S__________________________________________________________________________
% k/ k+ \4 \$ y: y% Q  v5 w, r5 S+ T1 i: k7 n) M8 g
Method 09
& _( T. T! E) c: X  D=========9 b2 B$ c  |; \& i* h+ ?
, Y- F5 J1 H$ a8 L) T+ e& f' g0 W
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: ?: i2 t3 n- U" d
performed in ring0 (VxD or a ring3 app using the VxdCall).$ o+ |$ S$ P5 Y
The Get_DDB service is used to determine whether or not a VxD is installed( m. g- Z" U( y" y& Z3 E. |3 B
for the specified device and returns a Device Description Block (in ecx) for" D) `8 n( [3 n) {+ F
that device if it is installed.  }8 E: j! }5 g* ?

! s1 S0 W' p6 x( i( m+ _   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID% ?- ~7 w7 g9 U* T% j% Y! Q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% v8 x& p; r  |6 a   VMMCall Get_DDB3 Y: J$ Q0 @) k6 V
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
6 E& a8 G- ?. S4 d6 m/ Y. m$ p' H& }0 N7 l" N( N$ n0 I
Note as well that you can easily detect this method with SoftICE:( u# ]  R* b3 R$ Q+ |6 L
   bpx Get_DDB if ax==0202 || ax==7a5fh, g* Y( z- T3 _. X, \
. H, t, W) T4 u3 ~6 Q& N
__________________________________________________________________________
4 V* G! d' f$ b; {3 r, o* o2 \& n0 N1 ]7 Z
Method 10
0 f  P9 y0 H2 B( d) ^" Y+ R" z=========% }+ W- n' M) Q# B9 |
6 D9 V# `" C* L5 I, I5 H$ h/ h
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 C& A* @" _& u5 C) B4 ?5 G
  SoftICE while the option is enable!!& E4 n* V% j: ^) `3 a" f# Z' ^  c$ S

+ @* P1 {8 V( B  |  s8 G% oThis trick is very efficient:" j+ S+ @' B. V# }2 v
by checking the Debug Registers, you can detect if SoftICE is loaded
* G9 c. E5 Y: S$ M# w, K(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 v) _8 {$ b4 t
there are some memory breakpoints set (dr0 to dr3) simply by reading their" c# o4 r( q: H7 E8 T( d
value (in ring0 only). Values can be manipulated and or changed as well; Z. T# l* `& R$ p% X8 V6 ?3 [
(clearing BPMs for instance)3 F0 E& i# O5 L3 u6 b  o: V

( {, F. z& h* T# ~9 `__________________________________________________________________________
% L/ D7 s3 }5 u2 z7 t- l
. z" o4 j/ a0 ~+ S  nMethod 111 b2 d3 }1 x7 a$ y
=========6 Z  @% ?: F0 `$ _/ m
& y% C# F* H( s( H; k- ]" W
This method is most known as 'MeltICE' because it has been freely distributed7 \" p1 N" a2 r9 X# ^, Q
via www.winfiles.com. However it was first used by NuMega people to allow
  g8 D9 c# }! zSymbol Loader to check if SoftICE was active or not (the code is located
. ^0 V6 G+ t) a8 Dinside nmtrans.dll).
+ Y. c1 T/ [' ?8 L  w5 C# z8 q" v9 t
The way it works is very simple:
2 w( C* t& S  A* d& m' XIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
0 m% H6 c; P1 eWinNT) with the CreateFileA API.- |7 m( L3 E) U1 o" u

+ d2 x2 ^& z5 ?) |Here is a sample (checking for 'SICE'):$ p1 v8 O7 c5 v0 u. j

8 i5 P/ _7 z) Z1 s! c/ GBOOL IsSoftIce95Loaded()) ?" F/ {- E  V4 J1 T- Y4 ^" y& x
{. V/ f; [. Z( K' s6 g& Y
   HANDLE hFile;  
: W- [2 L& L" q' m2 M   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
( q8 B$ Z  m! M" S+ u. ?                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% J5 [1 J$ d. U6 F' ]2 E# J                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ e1 q' m* p/ d, g4 y) j9 W+ Y6 o   if( hFile != INVALID_HANDLE_VALUE )
! e; f2 B! z+ l* ^" I   {1 W& x$ m/ K' \+ I/ J% ^
      CloseHandle(hFile);0 R5 B; H4 v+ Q. @
      return TRUE;4 [6 B/ D# Y0 k: b
   }  V& U$ Y  w/ c3 N
   return FALSE;
2 j. ^9 e/ r" s) F! E( u}
0 m2 }, ?! t( i% L
2 t' t8 q6 W$ I1 \" q9 AAlthough this trick calls the CreateFileA function, don't even expect to be5 `0 t8 M) r. a' s6 s' M2 x# j
able to intercept it by installing a IFS hook: it will not work, no way!- K) Y9 U1 {& k; O
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
& c+ q3 i  [9 b2 D. V; J0 G% Qservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
2 {7 Z0 \. T5 b8 Sand then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 x4 X" W3 P7 U) A% Jfield.% j  f1 z. x. ?  M; h
In fact, its purpose is not to load/unload VxDs but only to send a
5 P; l0 b3 Z+ F7 kW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)9 N& Z. G2 L6 _
to the VxD Control_Dispatch proc (how the hell a shareware soft could try6 t# s/ _* G6 x9 t+ G! g# `
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
# R5 @9 e/ t0 D1 {9 X. S/ a; WIf the VxD is loaded, it will always clear eax and the Carry flag to allow; s% J0 V; a- Z1 c6 }; \* k
its handle to be opened and then, will be detected.
6 t% Q  i4 e5 H2 r- UYou can check that simply by hooking Winice.exe control proc entry point
6 f6 u/ k7 k) F  K9 ^! Cwhile running MeltICE.
8 |+ j& F1 ~9 [& G
. R: H. `0 N  x0 e# T. L
# o$ P  g: K1 a9 h7 m% X  00401067:  push      00402025    ; \\.\SICE# N4 {$ @/ f' Y6 B
  0040106C:  call      CreateFileA
& t7 f" T% K) Y) }# I1 T5 N( l  00401071:  cmp       eax,-001
" ^% c5 @8 _/ |7 e, L  00401074:  je        004010919 N' B" w+ q0 T1 s' T8 @$ S
4 f5 R" D. B6 R1 M2 H: q; m: h. q% x

1 g+ ~9 r5 G1 M' rThere could be hundreds of BPX you could use to detect this trick.
+ ]5 k" r4 `8 Q0 l: H-The most classical one is:
$ J5 K- R$ U) o  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
9 w7 r; S8 i' \& o  ~! D& A4 K9 e    *(esp-&gt;4+4)=='NTIC'# o' T9 P- V# o  x7 z, L
/ c' Q+ a$ O  |& z* o
-The most exotic ones (could be very slooooow :-(& H+ E0 c/ K1 v
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ' x+ I* P5 u5 X3 V! R, K
     ;will break 3 times :-(
* C' @. k1 W/ J; `2 [7 g: \, u
% I2 y; G- V" s) Q-or (a bit) faster:
; H7 V. s# y" e) \   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')/ Q+ H8 y3 e. t2 |! j  |  K

0 K) W+ _/ H' \7 F   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
( f$ S; t# ]8 l3 q, _- i- X( z2 T     ;will break 3 times :-(
8 `: S5 h% S5 I6 z" c" x
0 w; l; @+ K; g1 g# v' @$ H2 g. r-Much faster:
7 Y/ l+ S! A8 n   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'2 j# s% `! U: \
3 v6 X, }; }- n/ F# \  {! W
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen% W4 g7 L. t) q0 k/ `
function to do the same job:+ H+ J, b* h( a5 q

3 ~  N  p8 C# H) G0 ], {' J   push    00                        ; OF_READ
; R# M( s5 m' I: ~% b& n   mov     eax,[00656634]            ; '\\.\SICE',07 _) J3 `5 T7 F* O/ [; z
   push    eax7 t. ]' m% \% ~. [) ]. {, Z
   call    KERNEL32!_lopen' d, t' t9 {+ H3 Y4 Y
   inc     eax5 m) W) i/ n3 Q3 D" \# V
   jnz     00650589                  ; detected
6 J  d1 e7 l* i) c& {8 _   push    00                        ; OF_READ
6 u  }9 S) P  I   mov     eax,[00656638]            ; '\\.\SICE'
. d9 h! w  M; a* i; e; |   push    eax$ N2 c- O: K- i( a& L
   call    KERNEL32!_lopen! Q# u# G! S! f  p8 Y
   inc     eax. p- W& U' I$ `0 Y& e& ^6 Q7 y# a
   jz      006505ae                  ; not detected- z; N6 h& ?0 z, [

3 ^  B, H. W4 C# e
' Y. ]. E8 S9 ]1 h5 e) J1 X! V9 V__________________________________________________________________________3 n1 T6 w+ p1 @3 t

2 m6 U4 k' D2 i, C3 v0 R9 [9 GMethod 12
+ {- x; ^6 V% u+ h# E8 ~=========5 u( C7 K$ R" U5 O) c: V

4 i1 u( W7 r- \5 ~+ ?This trick is similar to int41h/4fh Debugger installation check (code 05
2 ^3 `1 ]7 s1 p6 M3 a&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- M" Z0 r" `6 f4 M* S3 pas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
8 u; N( ~2 u9 O8 F
. d/ _; y" _3 a; e2 P; D" l9 W# o   push  0000004fh         ; function 4fh: e& N9 \# b, e3 z+ H, [- ]6 U
   push  002a002ah         ; high word specifies which VxD (VWIN32)' X9 A$ h! J6 {* [5 A6 {5 h5 `
                           ; low word specifies which service; M; W* s3 H- K2 x
                             (VWIN32_Int41Dispatch)
4 m5 Q2 _- S3 M( `6 ^4 U% E   call  Kernel32!ORD_001  ; VxdCall/ [6 u) R& l9 S
   cmp   ax, 0f386h        ; magic number returned by system debuggers: E5 u* @! ~2 k0 k/ M
   jz    SoftICE_detected, W% {# \3 Q( H$ a

$ o$ P. V; X4 U9 J- U/ O' M8 WHere again, several ways to detect it:
- v% e' ]) I$ b
- t, x' h( _; q/ Y. \1 x0 H- d    BPINT 41 if ax==4f
  T6 b! p1 d" P# t/ e4 E- V# e
2 l* V3 R0 Z7 R( T! V$ M    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one- x. ^& `& @  G9 {" _

$ X- I0 `" `# F4 w    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A1 O0 K! N* y7 x2 {$ q; Q1 I
) r& j/ o; P/ n& d- e4 {2 g; D
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
7 ^: ]  k) ]: l7 X: V
& P8 g$ y$ a2 B__________________________________________________________________________
! M" x. d. E( F! O& r# F2 y
. y, c) C1 A+ OMethod 13
9 j' H/ t7 `8 R2 i# G=========
" |5 T6 ]# i$ j, ], t- w9 `4 u) J7 `* S& S9 G& T! D& C
Not a real method of detection, but a good way to know if SoftICE is
6 l- A1 X) w5 [) ?* u/ E" minstalled on a computer and to locate its installation directory.& Q7 x5 l: r" R3 F! T
It is used by few softs which access the following registry keys (usually #2) :- I. X7 g" V8 u6 R0 R

$ H# d" N, a$ S-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! p5 {9 f: [- a& ?( j% c
\Uninstall\SoftICE( |2 M3 f/ g! W5 Q" E- G
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; b4 `  ?; j8 k
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  R; h' t( j( D6 |
\App Paths\Loader32.Exe+ }) C# h4 D) X8 Z# q

1 [6 w* [( F) M: s- Z: D* [# m1 }% K
Note that some nasty apps could then erase all files from SoftICE directory
7 p" I7 z; Q2 C0 c(I faced that once :-(5 x; C0 W3 g! K4 e5 ~6 ~

0 d0 V' y9 }0 Q& [$ O) XUseful breakpoint to detect it:- A! [* s/ E! o  H, M- m/ X# v
$ ?7 ?, d1 r4 k  B6 x
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 |, ^$ g# _2 U4 [: d+ A
6 M1 B% z8 h/ f* y. }7 L__________________________________________________________________________) m& K; [& g9 e; b' y8 x
% k5 |6 `  p2 t. A( b% ^$ p9 L& }
4 F4 U0 s5 i0 ^, W1 M. u
Method 14
, S* ~6 w/ e' r0 d$ l& F- L=========% _) W9 e, f6 Y) ]; z& r; u& l! D
: y) U. J: ~& B1 P1 L) P
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ R3 Y1 T! E% O7 x
is to determines whether a debugger is running on your system (ring0 only).& P) |- x# k9 G! G2 O
- }  v7 |! X3 _4 o9 H: i4 J
   VMMCall Test_Debug_Installed( B9 {7 N% X+ V8 S
   je      not_installed
$ V' y8 A* s7 V# j( Z/ T
1 H# V6 `6 ?6 r& ~  mThis service just checks a flag.
+ t: a5 A) V8 }/ [1 Z! s</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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