About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 k% Y% r! ~( F0 X
<TBODY>+ j# }; U+ P1 R/ \  O2 p, O& |+ u
<TR>
2 L8 s( x" w- Z1 n% n: v<TD><PRE>Method 01 3 l2 M6 u. o+ I  R3 N) _
=========
: n! j+ a1 j) N
0 o: H7 q1 d' ]" wThis method of detection of SoftICE (as well as the following one) is
* [. s6 P  i' D% _1 q1 ~0 v% uused by the majority of packers/encryptors found on Internet.% }' F$ l0 X  k) J$ O* w
It seeks the signature of BoundsChecker in SoftICE8 W) g- r0 x9 U* r6 G- K9 l

$ Y/ i+ l- ?. f; j" x' m    mov     ebp, 04243484Bh        ; 'BCHK'
+ j, P* _- {, J; z, z" S3 v    mov     ax, 04h
: M9 @$ c2 w5 H9 V; ~    int     3       " j9 [9 E. d  y; E
    cmp     al,4
. }$ N) j$ D; K: {( ~/ Y    jnz     SoftICE_Detected& h3 ~/ e) n1 J! k0 o* O
- L/ [5 n( J* t6 u/ b- s  V; m
___________________________________________________________________________$ e% E% Q0 ^# Y4 s
9 X8 j5 d9 ?% j: o
Method 02( K+ I0 ], r9 T
=========! O* {) v- t8 U! G2 p
0 |# W1 u. h; L* W
Still a method very much used (perhaps the most frequent one).  It is used9 X1 b; ]6 u' I' p
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,: i! e; c# n/ A' T7 B
or execute SoftICE commands...
- L' K- ^: O7 z" r' `It is also used to crash SoftICE and to force it to execute any commands9 m' h$ y# q5 Z" w. A$ Z5 w
(HBOOT...) :-((  
  ^2 u. n6 M  e" O) T( g, z3 W. n' D0 B& V
Here is a quick description:
. H4 z" s8 t2 a7 C% x# U-AX = 0910h   (Display string in SIce windows)
- S& r# T- p- T$ z& c' Z! ]: ^-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx), {- M5 D) P9 x2 q6 `4 E7 i' i
-AX = 0912h   (Get breakpoint infos)
" m0 d* i# |4 g! P+ u-AX = 0913h   (Set Sice breakpoints)- Y: c; t* n& ]
-AX = 0914h   (Remove SIce breakoints)
- i+ _% g$ K' S
* I3 q0 I) `; \& KEach time you'll meet this trick, you'll see:( [9 Y- x$ k4 [1 E
-SI = 4647h
1 k; [0 A- o6 G, T( F4 g-DI = 4A4Dh
+ l/ W3 P. \! \8 s5 J* ?$ O$ dWhich are the 'magic values' used by SoftIce.
0 u6 o! _3 V: C/ r& d  iFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.; }  R" R5 k3 j5 Y- A
% z2 A6 u2 w: W- C( A& |5 P! f
Here is one example from the file "Haspinst.exe" which is the dongle HASP! u' e8 A' L  P( [( L
Envelope utility use to protect DOS applications:
1 I- i) l) o  D) D! F! D% ^% A+ R' r2 e( N
7 Q$ j; e& k2 L
4C19:0095   MOV    AX,0911  ; execute command.* u- o. X1 F% s% u, ~
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
" {: a* G. x, ?* y7 J4C19:009A   MOV    SI,4647  ; 1st magic value.+ s' c0 E( c7 `8 p& P% H/ F- ~, d
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 q$ f: F2 o2 _* Y7 p; u) x4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)( `7 a: M) v. }% H0 k! T  r
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute; v6 e3 `1 x2 b& V
4C19:00A4   INC    CX
2 o4 J1 I7 D+ x0 p; X4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute! }' g, {7 i: ^# J7 Q
4C19:00A8   JB     0095     ; 6 different commands.
  T' i% b7 |8 r; ?5 L( ?$ ~4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
2 Z/ C0 W  ^" K4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
4 c5 s% J% N( L2 t. d% ?  v6 g1 T1 }) z7 u+ h
The program will execute 6 different SIce commands located at ds:dx, which
/ A# Y, j$ u# e% aare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 [. [" ?; h# l
) {. Y' M! n8 r( @( K* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
4 V( Z" w  n4 w& [___________________________________________________________________________
+ e! q- |9 C' B9 Q8 A: ]! B# E, x& K) h: ^2 P5 x7 W/ e
6 l, b3 F8 [, T' V6 s9 u/ K
Method 03
9 r* _& X8 q9 o, s3 m9 Q=========
9 j4 h, d' W* K8 `% R# |' z7 w* z4 }" c5 J( p
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h" X. M* B2 @# v2 Z7 c3 y& D
(API Get entry point)
/ u* \) C6 ~: \        
, ]' F8 }7 |9 B" ]" N0 I( t
! O7 I, {$ t  D1 R    xor     di,di! }: v/ `. s6 ^4 J
    mov     es,di$ e$ R- g4 T8 P% R$ {# u0 i
    mov     ax, 1684h      
- ^1 @" Q& Q/ u1 v& d1 t    mov     bx, 0202h       ; VxD ID of winice. h8 a5 k  h' G4 U( e# Y
    int     2Fh6 x% P  g: Y. h. N
    mov     ax, es          ; ES:DI -&gt; VxD API entry point( R/ r2 n4 L- S& n) n- t
    add     ax, di
7 a7 m+ ~- T$ T1 M+ V" L  w* G( x    test    ax,ax4 r5 Q/ P, O6 }
    jnz     SoftICE_Detected
+ z. ~) q+ U( R  g+ Y$ F8 K( a7 W) s
___________________________________________________________________________7 X9 v$ o: p% P" S/ R: R

* E! c8 b& v2 F: x  {+ D# ~Method 040 @9 o5 q$ A. b- I. }; L4 b5 z
=========
( \. i& ~; W5 w7 B
4 m# H$ n- k/ W' ?Method identical to the preceding one except that it seeks the ID of SoftICE
. J- w% p  z& K4 hGFX VxD.+ Z: H  z/ U) R; w" g
" H6 z' f0 y9 d
    xor     di,di, A( [) {- Y6 A" a7 ]- J
    mov     es,di+ _. {( x( r8 Z) r
    mov     ax, 1684h       # U9 N2 p3 C+ p  H
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
" S+ c/ E6 }  k! ^7 ^9 R    int     2fh* R+ X* o7 x3 U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 C  Q, V1 P* w* y0 x2 J- X    add     ax, di
$ d1 U& P4 B! _! f    test    ax,ax
0 m9 D) _0 G6 n! E* w2 A    jnz     SoftICE_Detected
& \: E) P* F* F+ d( G; P
, R- j0 b  b7 T/ N0 C' ~__________________________________________________________________________1 P  F, R: ^, R2 d& ~7 Y
% A7 ~$ i1 m6 W5 g' j) ~

. A( P% d/ n4 @$ B) x& g2 xMethod 05
# q; ?/ Q9 C, w=========
6 K' y  j! F: ~/ E+ u# p9 z+ H6 z9 F8 G
Method seeking the 'magic number' 0F386h returned (in ax) by all system
  H* q3 M% h0 K/ ]+ w" p- ~; e- p' Kdebugger. It calls the int 41h, function 4Fh.% K5 d  n, n, M, e) @+ N" M
There are several alternatives.  # S* B% [) q7 o% N* x% b

  I( K: C$ |$ M5 BThe following one is the simplest:' n  _/ Y0 ]- y4 l! G% B

0 k7 n% _+ G- ]+ i4 m) K    mov     ax,4fh
, R! S, D8 }6 I, @5 m2 }1 j    int     41h
1 i$ k; L* E1 l) G    cmp     ax, 0F386
% v' o9 O2 L5 y; p    jz      SoftICE_detected
: l9 Y9 `7 N% ^& ~, O" u9 F
  L& R1 b6 R0 g' S, U1 N* B0 [/ b/ b$ P3 S4 r4 [
Next method as well as the following one are 2 examples from Stone's 4 A% I7 n# C& P8 I3 Y6 N3 m7 V/ |
"stn-wid.zip" (www.cracking.net):" u" @3 G' {6 X$ ?0 E* B, O

5 g# g, N9 T& T" M, k    mov     bx, cs
- D) G7 |5 N5 d. \6 P9 y, a    lea     dx, int41handler22 A; G5 z& L  L' Q) N# M
    xchg    dx, es:[41h*4]2 l* p1 M' [5 t4 Y
    xchg    bx, es:[41h*4+2]
# D4 {- S' x" e    mov     ax,4fh
! y, |, S  ^/ p0 x    int     41h2 ?% A+ E5 \9 d4 e
    xchg    dx, es:[41h*4]. f  Y* ~# Z8 M
    xchg    bx, es:[41h*4+2]
5 C6 D  a, S# ^* T    cmp     ax, 0f386h
# t7 Y: K  v4 g0 d- C' m    jz      SoftICE_detected, S2 _& ~. C4 J7 A! {

# x! C2 j! z+ m. P& h' Oint41handler2 PROC  ^2 w4 Q, P) N- [$ B
    iret
& z; L5 S7 {9 yint41handler2 ENDP( v) Z0 W* N6 s& x8 e

/ @, L8 f9 _0 R1 ]
% S3 x; \1 x' o_________________________________________________________________________# n( c2 h2 Z, {7 u$ b1 l
) z' n( x( A) a2 O
4 C3 k8 y2 U; L( o9 R' _
Method 06$ R$ o7 V$ m; ^7 H9 M
=========7 ?2 ^$ }, [% D1 Y
  s# B. i$ m8 {
3 D* {$ w1 k; c* U, H
2nd method similar to the preceding one but more difficult to detect:
( Z, l8 \+ R" s) z0 e! S7 e" I  ]# g$ ?5 C9 k& ^9 F1 h
$ {# a9 V( k4 `; q
int41handler PROC
/ [+ Z# }7 Q, P, l( x# d    mov     cl,al
. K( k: I' k  C/ k    iret. ^% E( `" t4 s5 b$ H% X# k- W3 E6 ]
int41handler ENDP
1 B: K- ?8 D+ ~5 o# y+ H- E$ U) _1 O3 B. b" d3 O
2 ]2 k6 g- D, ~; y: p
    xor     ax,ax
# d. t: ?$ x& C9 k    mov     es,ax/ L5 C$ c. o4 O, s6 q
    mov     bx, cs
: f8 a) m6 p8 Z/ c+ x' t3 o5 ]    lea     dx, int41handler: D. E6 q5 |+ h( l2 o
    xchg    dx, es:[41h*4]
4 {& H! t' h3 R7 z* T6 N  h# S5 j    xchg    bx, es:[41h*4+2]
5 s) V# ^# m# q) W    in      al, 40h
/ q* K* X( E" X% M7 \# P1 w    xor     cx,cx; w* z, l0 @- Z) a6 p7 G1 M+ T: O
    int     41h+ R& p; j5 @3 t$ J* G9 m
    xchg    dx, es:[41h*4]
1 ^7 d+ |  ^3 U/ ]$ `    xchg    bx, es:[41h*4+2]
" A6 P) m5 m8 u; n2 K6 Q, L3 H2 ^    cmp     cl,al4 s, `' P5 q4 w0 g$ a' G" `) z
    jnz     SoftICE_detected
/ X- U9 }& B- `/ w" U9 a( R4 v8 V! k( [0 U* o3 }4 ^
_________________________________________________________________________
7 `- g9 e% p$ W: T* }' _. @  J  j% I1 f* ~% a8 ?
Method 077 M, V; ?- g' ?- o/ i# v
=========
! P& X* X7 P5 }$ m: d6 {, G( ~3 Z8 [6 k
Method of detection of the WinICE handler in the int68h (V86)
& j' k6 B/ O' b- Z- O" D' d
/ `9 W; Y. H: g# P1 M  v    mov     ah,43h
$ O& y: y. a2 H2 w8 W    int     68h2 K; u6 }; Y& Z; g/ ^% T
    cmp     ax,0F386h
. _: |/ n/ E" a    jz      SoftICE_Detected
/ @' i6 t, O) T$ Z# i* H" I$ n" Z
- Y% C) R6 a" p4 z! g6 K2 c/ `0 g& n4 \' v/ K
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 T7 F. }) O2 d8 Q5 C   app like this:$ [* b+ b2 n8 k* o; l- ]- _+ ~3 N; d0 y
+ a& k: x2 b6 F* b$ N) Y4 D2 C
   BPX exec_int if ax==68; J% w; u' U( }, ~* d3 l7 c% j
   (function called is located at byte ptr [ebp+1Dh] and client eip is
+ j8 ]' W% W% o2 \; e   located at [ebp+48h] for 32Bit apps)/ q  h$ {! V7 r+ o! D' J' [
__________________________________________________________________________8 E/ L3 Z$ r. ^# p8 `' f
, K/ E. E' ^  S" Q* p( e

# s' I* I+ N6 ]; S6 G9 uMethod 08: c9 C9 @3 k2 S- m# s8 T* ?+ L( g
=========
" |5 f6 t/ {% Z& ]: Q7 `1 I
$ A0 Y5 c  F, P2 k# GIt is not a method of detection of SoftICE but a possibility to crash the3 B; Y; o6 y5 W
system by intercepting int 01h and int 03h and redirecting them to another# y" R# a  A: H1 \! T# ?
routine.1 b$ H! g- e3 {# I' X; h6 m
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
1 Q7 x2 [, j1 lto the new routine to execute (hangs computer...)1 }4 Q( U' N  I0 j8 g
( N$ S) o, l. X' g- k2 L
    mov     ah, 25h
( z# D, L4 i2 j% w* v    mov     al, Int_Number (01h or 03h)2 `. g9 X) g/ D2 |+ F6 I$ J8 d
    mov     dx, offset New_Int_Routine( U5 `. U5 A# Q1 O1 h1 \/ {; }
    int     21h
& L4 w5 t' c- K/ o; ~# M
" h) Y. [6 t! o__________________________________________________________________________) U2 n! V/ H+ {$ S

) O3 B/ D- m+ c' t0 `* uMethod 09
1 I5 U! e( v$ K4 Z0 Q& ]# i1 _=========  V0 q3 G/ ^1 j" d( {) z% h. Q  G7 G

! g4 A$ Q( q! @" b, g* T- K) uThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: m% Z! R) i. J0 u
performed in ring0 (VxD or a ring3 app using the VxdCall).
4 U7 z9 _! b/ nThe Get_DDB service is used to determine whether or not a VxD is installed9 m5 l% p2 Y, d# {
for the specified device and returns a Device Description Block (in ecx) for( |2 P0 Z3 A6 s2 P" c6 o# H' T3 H
that device if it is installed.
+ `  b9 g8 B1 j& K, V3 q# V+ ]8 ]% l
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 Y; K4 z- v: W) ?! M  {1 J3 I
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
4 h+ V  n/ b0 U  ]1 s  B& k9 n   VMMCall Get_DDB6 K" Z6 s! R0 Z4 d
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 F7 m2 Z& n* z/ W8 x
* z6 D9 B* }8 u% P3 S, M+ `Note as well that you can easily detect this method with SoftICE:
) K$ W& v8 d# a; O& O# Q( q/ _6 Z   bpx Get_DDB if ax==0202 || ax==7a5fh; U% y+ f8 j3 P# H8 N

2 k; l* q, S" s8 w* t( V) L__________________________________________________________________________% b0 I7 h1 }, h9 t) k
9 R1 A7 d, Q9 q( X) ~
Method 10/ t. T8 v; h) ~  g9 E
=========
2 Z% T* ]; O% X0 v6 |# _
# c! ]. r6 k1 T  t=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ d  Z6 N  F; }6 N, [  SoftICE while the option is enable!!: V4 j# T' ?  X: U
) F4 `& @; o0 G% \7 S/ S2 x) b
This trick is very efficient:. G! a% P7 D0 k1 Q+ b8 O2 `, Q
by checking the Debug Registers, you can detect if SoftICE is loaded
1 o- Y( P1 ^& q1 }(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ {' j6 F; T! K8 U- }3 p, B6 `there are some memory breakpoints set (dr0 to dr3) simply by reading their
9 L8 ?& N  n& \7 E# r! jvalue (in ring0 only). Values can be manipulated and or changed as well, n6 U; z% W- h4 R6 k3 _
(clearing BPMs for instance)
' Y3 B" ]2 v4 |2 ~  A. G
) n: g+ k" e& v$ G& A__________________________________________________________________________
, z( Z7 B5 m! a0 j8 `7 X5 a. @! k# `7 z0 k5 K; ?
Method 11" G- G1 k2 o5 Q' x! q! f8 e. L' k" M
=========
% s! I8 V  S0 S0 N* E8 k
- _) l( S. X9 G, \% e- OThis method is most known as 'MeltICE' because it has been freely distributed
3 j3 `- s+ g! l. o3 z- p) vvia www.winfiles.com. However it was first used by NuMega people to allow& M+ H2 m! W" F1 B+ {; R0 A
Symbol Loader to check if SoftICE was active or not (the code is located
. A. D( K* c- B+ x$ X/ zinside nmtrans.dll).
! T* e2 O" W& o6 ?
: D4 j! }/ g6 q6 M3 j6 o. aThe way it works is very simple:/ t2 s$ R; z2 S7 e& l( _
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for# G' B" z& N/ q0 D' l- g% O
WinNT) with the CreateFileA API.
  a6 w7 @1 i- ~8 H; O8 i7 [  f: ^! I7 _4 e$ h( S
Here is a sample (checking for 'SICE'):# k" |$ f: K8 T& {' S% R" a

2 \- H" l* l. ^* C, ~$ m; m& _BOOL IsSoftIce95Loaded(). ]/ Z- |) V6 S# t$ T( Z
{# P, b1 R# [- l% z
   HANDLE hFile;  . W# p. A# n4 d
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,/ I, Y) m% l: z# b4 B3 ^; U3 k
                      FILE_SHARE_READ | FILE_SHARE_WRITE,; g' b; t# m' o- Y( _! y' s
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);& c8 ?) R* T1 k
   if( hFile != INVALID_HANDLE_VALUE )4 e$ W2 t* N; s) p# f. Q
   {
2 C  U% t2 O5 A      CloseHandle(hFile);- ^3 _) c6 y5 K; z' n% u! e. f
      return TRUE;  M, g  d& d' `6 h# O) u
   }
9 S, h3 G* V, p0 f   return FALSE;+ H: C! q: |) f: @& x
}
% v# ~  b9 [1 y5 x% o
6 ?: U7 M% X0 f$ U( J( |5 P: T6 sAlthough this trick calls the CreateFileA function, don't even expect to be
" E0 t' O" h3 [' s3 V: Dable to intercept it by installing a IFS hook: it will not work, no way!
" N6 r% N6 v. V7 P8 A$ uIn fact, after the call to CreateFileA it will get through VWIN32 0x001F, v$ G  d) ]+ D! z
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
: @2 W7 ~, o2 d/ p& E' Cand then browse the DDB list until it find the VxD and its DDB_Control_Proc+ r& ]' E$ {3 j3 ]5 K
field.4 w) U3 }& D0 \3 m% R
In fact, its purpose is not to load/unload VxDs but only to send a ( h& u# ]( ]" I
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)& Y; b# a0 d! `5 e1 Y5 L9 v1 y4 |
to the VxD Control_Dispatch proc (how the hell a shareware soft could try2 V5 w" p" ]# G- |6 {8 @
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
, H6 X2 a% Z+ W7 QIf the VxD is loaded, it will always clear eax and the Carry flag to allow
* t* c) F3 k" ^- A) R& l$ _  m# iits handle to be opened and then, will be detected.
8 P' v0 D. x/ J. O' DYou can check that simply by hooking Winice.exe control proc entry point5 k0 {2 z2 V& K$ H: q9 i3 s
while running MeltICE.
$ L2 d4 y; J. N7 b* Q- F* D* B- w- w3 o- r

: u7 o- h. L8 s- b0 B* \  00401067:  push      00402025    ; \\.\SICE" p9 p$ R9 F! W# \! W( c  I
  0040106C:  call      CreateFileA
( v- Y( H) c0 O9 ~  00401071:  cmp       eax,-001
  p2 U' z* b7 h! l4 r5 K  00401074:  je        00401091
4 {. t9 r9 k" o- Y: _/ ~
3 Y/ e: T4 q% B* h1 _
2 D- d* T, z) E# a! ~  k1 Z6 r: PThere could be hundreds of BPX you could use to detect this trick.& a; W7 ~' A4 |' K, c
-The most classical one is:
* T' P( F  c* O) F  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* x8 F' t7 F3 f    *(esp-&gt;4+4)=='NTIC'& ?+ z# w! R0 z" q7 U) R) H# t" O0 l

$ n7 l" U8 u0 T1 h6 q-The most exotic ones (could be very slooooow :-(
7 C: |* {3 r! \/ B   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
: ^2 N2 X' w7 N" \! y. X     ;will break 3 times :-(
0 \+ Q- Q; v( r' ?+ R" |! q: t
1 F1 G( i- O- z4 B( C# p+ Q-or (a bit) faster:
6 K' t! A6 J+ h% L8 d   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')$ t- ~/ J0 ^* x( a# ?* _3 S

0 z: z7 Y0 f# d4 s: z   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'    M4 c' T' n% ?9 k
     ;will break 3 times :-(
7 a+ V/ S1 f" ]1 d% X
3 K8 I9 d+ N: w-Much faster:
5 c0 T, j( `3 X+ H: s7 B1 Y   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ }4 Q6 a0 C0 X) S( Z' _( u* w2 q4 Z# [' T
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
3 E% T' \  g9 `% ]4 k' f8 h7 Nfunction to do the same job:
6 V0 a2 k* B2 c$ G( F3 C7 y$ g" w
6 R6 _: X" [) j% }) w5 u7 y   push    00                        ; OF_READ
) O' e+ F( O: u/ m* G   mov     eax,[00656634]            ; '\\.\SICE',0
7 y3 B8 o+ C. a1 b   push    eax$ i- _+ w) K; [
   call    KERNEL32!_lopen
6 x, @4 S7 J& d1 j" W   inc     eax
2 t1 ~- R5 ]( l% e6 o' ~6 ~   jnz     00650589                  ; detected
9 F7 Q5 u! l% }  x" ]0 b   push    00                        ; OF_READ% [* \' J1 d4 v" ]% U
   mov     eax,[00656638]            ; '\\.\SICE'
! ?, p3 Q2 l" x# w' i   push    eax+ s) T3 P  V3 P9 `
   call    KERNEL32!_lopen" W4 ]7 r4 C- X+ |4 j+ v( i9 Y" X
   inc     eax( w# D4 ~  {1 G& r
   jz      006505ae                  ; not detected, b8 T( N; G) n; T9 }3 A; q
: d) h0 O1 b3 |

$ T9 A/ k) E  q6 J+ |$ a__________________________________________________________________________
- R. A4 @& g5 s; Q& V* j0 B1 ?$ z& E- U4 z/ N
Method 12
) v0 B$ [. {5 j8 e. ]+ T2 V=========
$ S% D( e6 ^' ]- u- a% D* W7 O; @6 K# M* M: Z
This trick is similar to int41h/4fh Debugger installation check (code 05/ |  L4 S5 [) \& L5 J4 Y% w
&amp; 06) but very limited because it's only available for Win95/98 (not NT)+ \* U8 s+ A2 B5 _
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" B! P/ ^) Y1 W9 I- [% t
6 G4 U9 z! v9 o: A   push  0000004fh         ; function 4fh
' V& a4 z1 C, x   push  002a002ah         ; high word specifies which VxD (VWIN32)
; r( j& d- o1 V' f. x+ P                           ; low word specifies which service
6 w" M7 i5 a, @2 E' y% U                             (VWIN32_Int41Dispatch)$ T3 i2 G; d4 {& |9 K  s
   call  Kernel32!ORD_001  ; VxdCall* c% u: T. p+ U5 `
   cmp   ax, 0f386h        ; magic number returned by system debuggers- t( \( l- t; }) ?! o  O5 D
   jz    SoftICE_detected
& ?; |$ w& l+ Z; ]% t/ q/ U7 m# G. u: b
Here again, several ways to detect it:1 V* Z$ h# _4 g. \6 F" e
; F/ Z8 q: ?0 T1 p* h' \
    BPINT 41 if ax==4f6 q5 B9 I9 f; w( a( q9 U& v  j5 z( f

1 H- E4 _8 n% ^7 T" m/ R: V    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
5 Q& @, ~* h5 o8 l$ t& y; L
. b( {) _& u1 Y# o) c" \% y  x    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- \7 z! b# w. C% H% ]- K: c% J+ ^2 k0 a; o1 ?' S# I9 Q2 x% r2 N
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!4 g2 s$ ?* b/ [; O( Z4 Y

# h+ p* q9 A2 K* S' c; a__________________________________________________________________________
+ }2 W; C% I6 v$ G1 T" O9 h: j& s/ m
Method 13
! t' A6 m* X- ]3 `9 f=========# b# y% Y6 t5 P8 o8 ]
$ A$ K, L$ B' Y  _) w
Not a real method of detection, but a good way to know if SoftICE is0 \) d( y; D0 I; x5 F2 S
installed on a computer and to locate its installation directory.. P2 l6 H: j' @5 n. t
It is used by few softs which access the following registry keys (usually #2) :. X" B0 Y7 Z1 @+ }& h4 v
4 X& r6 ?- C, X) i$ W$ t1 s
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 d; B8 o; ~1 x7 ?2 {2 P5 q$ y+ [; l
\Uninstall\SoftICE
4 n: E9 d" G' p) o; d9 @: {3 Q-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; U5 b* M, T7 X: B1 B8 y% ~
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' W" H% q( {7 c% }' @
\App Paths\Loader32.Exe% z7 T9 Y5 g" ^- r+ H) ~
; q$ ?- a5 P2 x+ M% A9 Y0 Z

. V! l' i% R" ~& dNote that some nasty apps could then erase all files from SoftICE directory
, `* g! ]( i% n" T8 g7 \2 S(I faced that once :-() {- X' C: a6 \
' P- T2 k: C2 v0 ^- Z, k
Useful breakpoint to detect it:
- _0 @$ P8 L9 g- Y# d2 N3 o+ r  {7 _( r: r) E+ @" R- r' ]
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
0 e- S: t- s0 O3 ?: s* h
* a' j+ G7 y  G' Q9 k__________________________________________________________________________0 d0 O3 l, R5 H% ]" n& u

! O8 Z- ]: H( o4 Y1 X% x
) T" h6 G3 f7 D: P0 {Method 14
! P  v, }0 r% {3 c! Q=========
) f- K6 `! _0 E' k1 [( w; ^4 m9 S( M# E+ V3 Y4 g4 T1 Q4 |& a; A
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
9 L+ `! Q; ?' e" Q! C8 |0 Ois to determines whether a debugger is running on your system (ring0 only).
3 o$ R9 d. H6 E
, y8 m8 J3 L: j   VMMCall Test_Debug_Installed
+ c7 }( b4 ?: j$ ^: o4 P   je      not_installed% |' D+ K# e( T$ ?  j

' O% t1 z, a5 m6 l1 L: o! XThis service just checks a flag.( p1 e( U/ V  Z. U* t4 O' H
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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