About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>" O) K7 [/ E4 M: q
<TBODY>4 [0 M) X' f+ ^8 }, z7 m3 @( Q6 K
<TR>
( c, C" w# ^0 i# S9 Q0 L+ h: o+ k6 l<TD><PRE>Method 01
( H# Y8 x" C% k- q, G=========" i8 D1 P, L5 C- Y8 C7 `" R

# K1 k& t# C+ g/ @. NThis method of detection of SoftICE (as well as the following one) is
" C  K. P8 a6 ]# n, g/ sused by the majority of packers/encryptors found on Internet.. c7 B( e3 J. v: [
It seeks the signature of BoundsChecker in SoftICE
' N2 {' o$ X3 D% ^! f# G; V, g
8 @* p9 a# r, J' r4 ?    mov     ebp, 04243484Bh        ; 'BCHK'
) v3 y  `4 }3 Q5 \/ I8 Z+ k    mov     ax, 04h
  o& Y9 y$ ~% @4 d/ s    int     3       8 E  T0 r$ ~$ y+ P4 _, }
    cmp     al,4' R& e" ~2 H  |" K7 I: Q
    jnz     SoftICE_Detected6 q( h) ^: }* ]2 ]. B
9 A6 V, J  u8 I6 ?5 _2 r/ Y2 h- b( T2 g
___________________________________________________________________________
1 F+ @" e3 q2 N+ H8 I6 K' c$ `/ G. }2 e; e$ K& c: z; J, M3 {' V
Method 02
, W6 C' }0 W5 W& u2 J+ z6 w, c=========; ~" x5 q0 G4 [3 e: ^' e
) [# O* S% [( o+ x  Y
Still a method very much used (perhaps the most frequent one).  It is used
. A& O. u7 [# T  Yto get SoftICE 'Back Door commands' which gives infos on Breakpoints,7 a& R' T1 y( J1 E$ `2 G
or execute SoftICE commands...  ]; ~1 b! g: O; c# B2 z6 g6 u" |3 }
It is also used to crash SoftICE and to force it to execute any commands
4 w1 W' a" G( P+ t9 g(HBOOT...) :-((  " w* K2 Y8 K3 n6 D' L, P8 L4 c
1 `! n5 C9 B$ Q
Here is a quick description:
% l' Y1 p8 G( a4 e, m. S3 `# f# Z4 A* Y' r-AX = 0910h   (Display string in SIce windows)  U* H( o$ v6 y1 c- E  f
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)3 t; j9 ~3 ]4 p0 `7 `# t6 X8 m3 {, N
-AX = 0912h   (Get breakpoint infos)9 X. c5 ]. S2 k' u( d7 q
-AX = 0913h   (Set Sice breakpoints)
7 u) B9 C" j" \. k-AX = 0914h   (Remove SIce breakoints): ?; o4 g3 n% ]% j% v
  C$ c) a; N' X; t  T  v* g
Each time you'll meet this trick, you'll see:, A# ^+ x& x  `" A8 |/ a
-SI = 4647h
. }5 n, p- H0 x$ h- A1 B4 ]-DI = 4A4Dh+ a8 [. V2 n' ]' Q6 E
Which are the 'magic values' used by SoftIce.
8 S( i+ O# ]9 `: AFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.# C3 ^6 u3 X2 O8 @6 M. B/ R" t# ~

" S+ @0 h( w4 B9 `Here is one example from the file "Haspinst.exe" which is the dongle HASP" v+ w% s4 [3 X* x1 x" m
Envelope utility use to protect DOS applications:
/ f# W) R7 D' m5 D+ `+ `4 b" J+ C/ n5 T0 s
, F4 p1 p$ V" y' g" i
4C19:0095   MOV    AX,0911  ; execute command.' P  s% o3 l2 t+ `: ?- n" b5 t
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: x* D7 Z8 Q& D) g8 L
4C19:009A   MOV    SI,4647  ; 1st magic value.
* j8 z+ X2 C0 k4 z. ]( q4C19:009D   MOV    DI,4A4D  ; 2nd magic value.3 Y+ P& e! q* O; x  U
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)$ ^5 f6 Q; m& r- p2 \
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  z: Q& ?" c" \4 ?7 @3 Q, Z
4C19:00A4   INC    CX
7 D& b% j  Z# k3 U( ]$ t4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' h. I) {$ u7 p) S
4C19:00A8   JB     0095     ; 6 different commands.
( k6 D: E" A  u  ?4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
9 a7 R% I6 P* d) S3 E+ f. V4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
# a/ l8 p: |- k, G5 x8 y
+ B2 k% s5 L3 P) Q; lThe program will execute 6 different SIce commands located at ds:dx, which+ d2 b2 t- O" R3 G) z; E
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% x+ i$ l7 H5 _5 M& X

: X" S+ Z, L7 H1 Y+ U% ]2 r' w* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
1 Y9 ^& L4 V# i$ w4 @___________________________________________________________________________% H  |) k: S9 ]8 ]. P5 K  J

' k' Y* ~' J+ m% T: n% v0 j
$ {6 x# s3 D' K- Y2 s( _Method 031 ?7 I* o: F: [* V% J$ D6 w2 k
=========7 {. g; o- j9 p1 ^# R

- s0 ?3 v! c2 P5 d) b5 k' p9 lLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* q6 k6 K$ H2 L; Y
(API Get entry point)8 w+ y3 S: a* M- }
        
) C2 T! i' m6 z: l9 ?- R1 ?6 e$ s- ]' U9 T, N3 i4 A' J$ Q
    xor     di,di
: F" Y7 y# p" @! T' L( i" Q    mov     es,di# o; t& Q. l5 z0 H! j1 A. ]
    mov     ax, 1684h      
7 f( o0 E1 l) P. G    mov     bx, 0202h       ; VxD ID of winice
$ _  w% i' y" R    int     2Fh
3 Y/ A' R6 E/ O; P' Q    mov     ax, es          ; ES:DI -&gt; VxD API entry point" K* C4 E0 _5 C
    add     ax, di# v7 W) D7 f: U. v- J5 w+ o
    test    ax,ax
0 Q( J3 f# I/ A" J( R# y) u2 ?) `    jnz     SoftICE_Detected
& R2 ^2 ^, H  Z' |7 R4 [
3 M: ^+ ~+ Z) u7 p: x; Q___________________________________________________________________________0 D. ?$ X$ I- a# H9 m

1 ^; B# R' g8 j0 S7 TMethod 04
- z% q) h0 u# s; s: A7 K% Y/ t+ M) D=========2 O( A" m" w# E
7 J1 S1 [" `7 z
Method identical to the preceding one except that it seeks the ID of SoftICE6 F- V" e1 v  ^; O( f3 V4 O' Z
GFX VxD.  s  B1 _6 \5 x# v) H3 f
( S2 @# \7 _. F4 p3 W/ X
    xor     di,di
, l; [/ ]' O, x4 s/ g: i/ n    mov     es,di
8 Y4 \8 N  p% ^# w    mov     ax, 1684h      
0 O. Z( Q7 U. s6 R, L    mov     bx, 7a5Fh       ; VxD ID of SIWVID
  F7 r1 a0 D& o+ S" o; V+ R) V; F    int     2fh
9 \, r: i+ m" B5 e4 Q9 K    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 Y" b& i9 A9 L
    add     ax, di
+ j$ M' M& L$ E; @; s    test    ax,ax- ]/ ~  p# P; K* c& T! t' j8 q
    jnz     SoftICE_Detected4 e, z$ y- v0 ]. ]) M$ Q' e( u

, l4 F0 A  x" J, O1 ___________________________________________________________________________
# ]" l* \' m6 T/ N$ Q  E: P( y! w7 D" w

( Z4 ?: o: z5 x5 N: W1 dMethod 05! }" b+ @2 [; R. o9 M( \& P
=========
5 u3 w) k: i  p, ^
$ F; U- l6 n& W1 |5 R$ @* TMethod seeking the 'magic number' 0F386h returned (in ax) by all system
1 R! L4 {' Z. _. M" udebugger. It calls the int 41h, function 4Fh.
: Y) {& `! p$ ?: d* T4 NThere are several alternatives.  
3 v& m+ g" |( ?. G, u9 i! O% Y9 @2 [% Y& R. B+ p: C
The following one is the simplest:
8 i4 i6 Z+ f9 k5 ?! D1 B8 c
2 T5 J, y: O8 A6 v7 z    mov     ax,4fh: [  l6 ]0 y% w) d: f
    int     41h; |. D: G: o2 ^1 d
    cmp     ax, 0F386* |/ A) A2 \/ z2 b/ Z
    jz      SoftICE_detected! t$ m/ K) @' _6 Z7 r5 d
* w5 a+ D) o" J( J+ ~: w* H1 Q
% ^0 [7 M7 ^2 x" ~
Next method as well as the following one are 2 examples from Stone's % G& p1 T- z/ W6 e/ F0 N0 h
"stn-wid.zip" (www.cracking.net):2 L+ j: @8 w/ w: I+ S, D
4 Q& H  z; p, \+ d! u$ c; I
    mov     bx, cs
- I3 x/ k0 v; [7 \. H/ _0 n    lea     dx, int41handler2
, g1 {: w) ]6 F" o3 y. D; d    xchg    dx, es:[41h*4]
3 ?8 h  v$ g) D0 N" f1 [" w    xchg    bx, es:[41h*4+2]2 w+ r$ {4 {" j) p# z2 G. s
    mov     ax,4fh! l0 @% R" A6 _: {
    int     41h
, P  g8 w4 X) y' ^; s% o    xchg    dx, es:[41h*4]
4 S* j* v* I/ {, x6 k  E0 f! N    xchg    bx, es:[41h*4+2]
, K0 h- u6 M( n( ?$ b7 s    cmp     ax, 0f386h
, ~% |9 \! E8 X4 v! A8 F    jz      SoftICE_detected
6 x- q8 D$ s1 b& X1 J9 n9 K- c5 k0 z* N5 U
int41handler2 PROC6 ^6 f! a6 B" b8 z! v3 u1 p$ v
    iret; p$ {& a. r* p5 A& T
int41handler2 ENDP
. ^6 @! x# l/ ?. `9 g. r2 x: N2 [4 i$ x% B' Q

" Q2 q+ t& B+ W& t_________________________________________________________________________7 G3 R. S6 c1 Z8 ~, d
) F# P  e3 I# X( M! y2 f: }. `$ s
9 S7 F' P. a+ H
Method 06
" M7 b* i6 [. O0 n8 `=========
: z7 E. L2 f% ~2 ?# m
8 F+ k: t3 g8 Z& Q2 u) P; V/ J& w5 Z& f: {. b1 W0 j, ?, q) z
2nd method similar to the preceding one but more difficult to detect:
& V2 t9 p  x$ }! y) R9 B  a  V& u* }  Z  I

/ S2 q/ v) A" H' G2 K2 s. aint41handler PROC
% v) D9 |6 o" Z6 q4 q5 L1 |; }. r    mov     cl,al. _+ Q/ T) x5 G( r/ J6 Z, X& U3 R
    iret
& |5 @- d4 n, Y7 wint41handler ENDP5 k& @% t0 V. j1 R
( b! Y! z8 Z+ Q$ ^- S' Q9 _

  ?3 i4 F0 ^, T$ \7 J0 ?    xor     ax,ax" t1 c$ Z# }$ f+ o) l
    mov     es,ax
8 S; _8 U( A- T/ l3 g4 u1 \    mov     bx, cs, H* M* p! u  [; y
    lea     dx, int41handler
1 @  S3 ?' p, B0 N9 Y: {    xchg    dx, es:[41h*4]
; x7 y& k1 v6 ?& L  e    xchg    bx, es:[41h*4+2]
7 \) }/ K# V0 j9 z1 D% F0 |    in      al, 40h& e4 V+ I6 ?. K
    xor     cx,cx
! m) C2 C' i/ ~# ^# T    int     41h
- U1 D1 |: B2 v# b4 {    xchg    dx, es:[41h*4]$ R, g0 D+ D3 u8 ?# k& g! Y
    xchg    bx, es:[41h*4+2]
7 W: [$ m4 f% ?. }" ^- m( J    cmp     cl,al4 E4 l3 K/ A* Q  r& z8 e
    jnz     SoftICE_detected2 ]* B- E# J* @/ o* E. R2 v

' j" h4 j% k$ y3 X+ b_________________________________________________________________________% {3 r7 y0 z& P& e5 c

; u$ x) j# y0 G. A  ?: ?) qMethod 074 Z1 E" V, U5 v7 Q: f; g
=========
9 |, X4 \- T- c
9 K+ b2 C! g. J8 \. yMethod of detection of the WinICE handler in the int68h (V86)0 Z8 h' k; N7 {" |# R

! v' l: S$ `/ g, }2 J  `    mov     ah,43h
( u& w/ v( B' x. j1 f    int     68h
  N, r% [7 k3 f    cmp     ax,0F386h3 e# g% m( E) B  Z& l. m
    jz      SoftICE_Detected# e! P$ Z) M3 a' s7 I
# k. `  z- ^0 `$ z
6 i1 s1 ^' n0 d
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
( J9 Q2 B8 j8 s& W0 X   app like this:
' D7 ^4 V# z1 r( ^' ], L/ y0 ]1 l9 |" y
   BPX exec_int if ax==68  y3 h+ }* j7 M. N7 ]
   (function called is located at byte ptr [ebp+1Dh] and client eip is1 E5 P. r: u* q$ f. w' U
   located at [ebp+48h] for 32Bit apps)
- r; g7 g8 e+ R$ e' l__________________________________________________________________________1 a$ S1 x3 G' l3 ~0 d) F
1 f1 e) ~* \: ~/ u, j$ D9 G+ D6 m
9 o5 S3 r$ {+ W- ^4 m4 O8 N
Method 08! r$ n% ~  S. ]% r6 l/ ?
=========
( M( t* U+ Y+ Q/ S! c
9 ?& b8 {5 W& [$ q6 WIt is not a method of detection of SoftICE but a possibility to crash the* `$ g7 S6 n& s0 W  z& n1 L
system by intercepting int 01h and int 03h and redirecting them to another( ?# p5 g- P2 t! a
routine.
# l% }3 }9 Q0 w4 bIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points- |( ~, e3 F5 z( F
to the new routine to execute (hangs computer...)
- f7 |. O2 s1 o0 w. _7 i( e
" {7 I0 F4 t4 p9 T! B) ~, e) p$ D    mov     ah, 25h
6 [2 H3 K1 G8 Q# H# a    mov     al, Int_Number (01h or 03h)  x/ d, E  g7 Z- @+ e: Q
    mov     dx, offset New_Int_Routine
, _# C& B& \! u. X: e! D+ S    int     21h
+ f  n' f/ O# b1 r  o  {5 H
. V, K9 t( Y) L4 V4 H* O7 M+ t( \__________________________________________________________________________! l, ]3 Y- C& x+ p# u5 P

0 U0 O# P, b1 H  ^" U1 bMethod 092 _+ L9 b' {" _/ c; `2 r9 p
=========8 v, Z; x% h, S

8 d0 b1 W. y9 p; Y) |6 l- E9 ?This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
2 R; H+ l8 N; kperformed in ring0 (VxD or a ring3 app using the VxdCall).( g( \3 l6 A' u# w, Y! o# o
The Get_DDB service is used to determine whether or not a VxD is installed  Y8 P# c) I; Y* k
for the specified device and returns a Device Description Block (in ecx) for4 S( {+ Y6 Z4 {! @& i
that device if it is installed.
- o+ z. a9 b, u2 \1 ~: g
  {; X+ Q) u: O   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
" e8 L% J" ]' O7 f   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)8 w0 d0 W8 _3 e/ I5 Z
   VMMCall Get_DDB1 r. z) [0 {; S
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: s8 \) n1 P8 Y8 N

4 Z. c/ s+ i3 Y  dNote as well that you can easily detect this method with SoftICE:6 q; B4 Y" L: A1 H6 ^
   bpx Get_DDB if ax==0202 || ax==7a5fh$ S5 D+ ~3 ]5 m, V

* I) r: v) N( T. L__________________________________________________________________________+ H; b/ r% J' e! z3 w3 a

+ M4 G2 H# e9 ?8 I  W3 MMethod 10
, {2 N/ ^& U* i1 ?+ e=========) @0 o  b/ U8 k% r
/ P/ T( \, k; l! Z& M
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
/ k" Q+ U4 F. R6 |  SoftICE while the option is enable!!
' L2 E: x: f0 g: s6 b) \: _* j2 ]. ~
This trick is very efficient:0 l& P+ p, C$ m: f) C; g# P! {
by checking the Debug Registers, you can detect if SoftICE is loaded
- U& B1 H* l. w; p& u8 `$ k4 i(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ ?, s. I5 l# \4 w  `2 Athere are some memory breakpoints set (dr0 to dr3) simply by reading their+ y; @0 |5 O# b9 {- W
value (in ring0 only). Values can be manipulated and or changed as well
$ y$ A; ^5 i- ^  J- E  x2 W# K(clearing BPMs for instance)( D. m  B: F( \' @6 N
/ c; \5 H! k2 J5 o, T2 D
__________________________________________________________________________
' ~4 D4 Q) U3 x, e+ ^9 `3 E; j5 _1 m7 L4 T' [( h/ S5 M2 q4 q( E- L
Method 11% O/ s6 y' I* z% x
=========
1 \5 M# s6 ?2 w- }$ k
+ I% I- f+ V4 K9 L; Y! ~This method is most known as 'MeltICE' because it has been freely distributed6 Q; \$ D8 e8 ]& E9 p8 t
via www.winfiles.com. However it was first used by NuMega people to allow
4 Z8 A% l1 q/ O! |7 gSymbol Loader to check if SoftICE was active or not (the code is located
1 y8 L7 ~! Q7 ^/ R* R9 o- d, jinside nmtrans.dll).: u# Q0 L3 M; k# \
5 Z4 g8 N8 D3 m1 N
The way it works is very simple:
+ W( V% [, v* ]It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) @+ o% r2 \" Z6 [WinNT) with the CreateFileA API.
. l3 R5 z6 R* O, J; c$ o9 m, E- E4 v1 w* ]( }) ?7 I
Here is a sample (checking for 'SICE'):) \0 C' a4 u8 v  G
! a* u+ d- a' p' }0 e
BOOL IsSoftIce95Loaded(): x3 p; q3 w6 n
{
6 j& |/ }. [- Q" k6 E   HANDLE hFile;  % m1 f" H1 D- }  `
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,' y5 w8 O- K' r+ q% b9 J
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
* }4 B* e" Y' f6 r                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  [- r7 F# b  q# h- z
   if( hFile != INVALID_HANDLE_VALUE ): i& {* ^  G  S/ M9 n4 H+ g
   {
# V7 S2 x# z  s      CloseHandle(hFile);
6 x$ T4 }! n# X' x# E  g      return TRUE;. T  ]/ Z+ M  t! \
   }
2 G# {9 X) o2 W3 r7 s   return FALSE;# ]7 V  S! z1 c1 S- ?7 o
}
- V+ O# E# c# D  w2 L* l  B& x6 b( X8 c8 P8 E& K. g- w
Although this trick calls the CreateFileA function, don't even expect to be
0 Y1 @! L# K' S/ Bable to intercept it by installing a IFS hook: it will not work, no way!
: b; I: \8 {' s  ^1 ~" UIn fact, after the call to CreateFileA it will get through VWIN32 0x001F/ p! f/ T- X0 e: ~0 C$ t
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 l, ^1 s/ ^6 w  t$ ?
and then browse the DDB list until it find the VxD and its DDB_Control_Proc. Y# B" L( z! N1 \
field.! i" I7 J  W- K$ I* T
In fact, its purpose is not to load/unload VxDs but only to send a 1 P1 V5 R" R- S9 j3 a
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)3 V" E) p5 U( v
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
4 c  g# W! S& i' P3 I( z0 E; Vto load/unload a non-dynamically loadable driver such as SoftICE ;-).& Z/ u# [2 K3 G. c( d: w
If the VxD is loaded, it will always clear eax and the Carry flag to allow
* @0 O+ o( c( u4 s8 h$ L" Zits handle to be opened and then, will be detected.
! i, p( x' ]3 Q# `$ DYou can check that simply by hooking Winice.exe control proc entry point1 u- h3 C& M% F
while running MeltICE./ v0 M' r/ m; P: `' u5 {5 ^

( h  ~' [% t# p
4 G  c5 ^) |: U. u  00401067:  push      00402025    ; \\.\SICE
) F' C3 z& C3 B9 M2 b  w5 n% A  0040106C:  call      CreateFileA1 }* K/ t7 Q2 E1 n& }$ f: m
  00401071:  cmp       eax,-001
1 q2 x& E$ O( N- U7 V5 ?# k; A  00401074:  je        00401091
7 B" W1 h/ [) d" p/ c3 k% W" _+ D* z1 A; C+ d

! M/ f/ r0 I# n2 j0 cThere could be hundreds of BPX you could use to detect this trick.5 b) @9 |. w- M! Y% D/ U  W& X4 _
-The most classical one is:
6 h0 M7 ?! J9 H: N6 c6 g! S  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
& q( i0 s. c# M9 E! T6 \    *(esp-&gt;4+4)=='NTIC'
2 w4 f# w5 v# k& d' u6 B7 I
1 l) P+ h  D6 h* u( B-The most exotic ones (could be very slooooow :-(# [: t0 [+ o- q3 Q
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
7 E4 b- G5 f  I# k     ;will break 3 times :-(
9 w: m/ d/ ~0 }6 s" N8 I- s) ?
-or (a bit) faster: % a/ o5 O( d" ~
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')- n4 [! p4 a$ E( @  F9 y9 M
0 ~9 s4 Y! ]+ C- u% N
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 F5 I" l1 c7 g0 E1 L1 A) i# g     ;will break 3 times :-(
6 e/ e' R2 s; {+ m% c$ M6 L0 N4 j" `5 ]# N- o5 Q9 ]  @
-Much faster:/ Y6 z) T% g/ d
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'- M; l& I3 e7 t, G: t( b
& H9 f( `+ {+ u% S! ]% c$ z. w
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
$ k  o0 c$ p  R+ B. U! m) {2 Ofunction to do the same job:
. l  m9 |6 s7 f" Y& R! X5 T, c+ t$ e6 d
   push    00                        ; OF_READ
, D3 p- G# M, Z" W- Y   mov     eax,[00656634]            ; '\\.\SICE',03 s: N6 e: @6 X1 ?% F1 J
   push    eax
0 [  K, c, x9 r! v! i   call    KERNEL32!_lopen1 x$ |/ q3 w/ b& ~
   inc     eax$ O- U& g& D- |* e+ o
   jnz     00650589                  ; detected& @( z, `& \1 X
   push    00                        ; OF_READ
: }- n/ r- G' R  @   mov     eax,[00656638]            ; '\\.\SICE'
* y' a2 H: m+ j6 ^, U  y) _   push    eax
1 ?2 Y: M+ L4 J+ I+ ^& b6 O- U   call    KERNEL32!_lopen, A  A6 n  ?+ N3 m* r
   inc     eax1 ^& m7 _( I0 U0 B1 e2 @
   jz      006505ae                  ; not detected
7 r  f! t# ?' x, I9 `5 B) l9 T. p8 P6 ~  a9 V8 W
- B! g6 n) T4 X5 w) j6 Z
__________________________________________________________________________- V$ ~% x8 R4 U* l) ~) d, X

7 m4 J. Q8 Y% P1 UMethod 12
9 H8 X% P3 E# Y5 _5 y1 Y; x=========5 X0 n+ v4 K* o+ ~: _6 }2 x+ h' s
9 X7 E) z3 l& a: B: J% F% g
This trick is similar to int41h/4fh Debugger installation check (code 05
# z; n/ ?- o" U, ~5 P&amp; 06) but very limited because it's only available for Win95/98 (not NT)$ d9 t: G& X* [- {* i& e
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
/ [! f- V& E5 w4 d
/ }$ u5 w* ^6 J) p% M2 W   push  0000004fh         ; function 4fh$ A* e2 J! x6 P, L1 B
   push  002a002ah         ; high word specifies which VxD (VWIN32)+ [4 ]/ z# J/ N" r3 N) u  Q7 g
                           ; low word specifies which service
6 }; S: K  [' i                             (VWIN32_Int41Dispatch)
  M0 `, _$ j: x# I   call  Kernel32!ORD_001  ; VxdCall
" q! T' H% a/ }5 b& b2 ^   cmp   ax, 0f386h        ; magic number returned by system debuggers
5 T$ V- D, k* O: X, t   jz    SoftICE_detected
' @1 `+ e6 i, `
. m- B: }+ a- ]; S( n. P7 M( _$ iHere again, several ways to detect it:
  ^9 p7 R- K( J
- T6 D8 f' m  i    BPINT 41 if ax==4f
) i: q. M5 Q1 v& _% d+ q/ L
4 V. x: b* X9 H  }: p% {    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 m% {( o0 f/ v8 a0 b6 l; I
/ P. H+ K! W' F/ [) ]7 Z' r" u    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A7 W3 {( e. P# q6 B" W
$ }* @% |# ~/ X* Y5 C* d3 f
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!. p+ B5 p0 b5 l5 b

% ^1 R' _, F! u$ h2 v9 r6 l__________________________________________________________________________7 K! C$ R) ^' k" i3 a
( W& h- ~1 W" _' H9 T% I4 o
Method 13
+ ^! ~4 J( c3 @=========
0 i3 ?7 e8 \5 X
: L! G! W; W- h% \: i* [Not a real method of detection, but a good way to know if SoftICE is9 W: k' v: ]7 J# y6 S! x  T& w
installed on a computer and to locate its installation directory.1 r: Q3 v" L# G2 f& [8 D
It is used by few softs which access the following registry keys (usually #2) :! }) h7 U( R" H* w; Y7 O/ l2 U

  r9 p5 Y8 `1 L6 f$ J2 o  F-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# O' C6 n# h' l9 J, y% r% p\Uninstall\SoftICE. K/ L# ^& l) v4 \
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
6 M' x% S) _3 m' `2 G-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ y/ W& c% k' _( F- }) |2 n2 ]8 F$ j
\App Paths\Loader32.Exe9 K2 r  I/ L6 x1 z+ r! R/ E& {
0 v  ]1 ]' M! I2 Q
- E# \5 X* v  @. Z2 h+ v
Note that some nasty apps could then erase all files from SoftICE directory
7 b8 \" ^) R+ G/ a2 u5 y, i( E% `(I faced that once :-(8 j% e# Y8 c( |+ e
/ B0 A0 z, s, z8 `5 |0 f# D* O, Q
Useful breakpoint to detect it:
, S* I  r4 C6 }; A
/ _8 p% g6 F* W0 y" X. R     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'3 K2 X( j- ?  j: x
3 @; b/ }# m8 U, o
__________________________________________________________________________
' G+ |- N0 f/ s4 L& l) n# R( w1 Y- F! E, t
9 D7 q/ y& o* j$ G
Method 14
& n; l( Q4 }! r( _* m- j=========( q' T- m+ F, {2 V& r

: _& E# f# A! z6 KA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 J; r) Z( k& p5 s
is to determines whether a debugger is running on your system (ring0 only).
0 l0 L4 U, u8 a$ b+ L4 B
" F1 A8 w: W% X; Q   VMMCall Test_Debug_Installed
" P6 E4 S: H+ l( {7 q6 ?   je      not_installed) k6 e, M/ e. e* a3 C
* U6 y+ `6 z2 X6 a
This service just checks a flag.
: t; |+ @" Y; K# _, @</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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