About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 j, V& T6 m$ }/ {- o4 a<TBODY>
6 ]. a; P" M# v" \3 A3 h* L<TR>
% d7 M, W1 R4 E<TD><PRE>Method 01 + `3 z' g2 S2 s5 x# w* I: j$ r& j% t% c
=========; V1 T7 v( f" e2 F7 e) U8 E

8 e8 e  a  E2 s( {' s$ uThis method of detection of SoftICE (as well as the following one) is: b9 ~& n! ^, A7 Z* n) s* k9 [
used by the majority of packers/encryptors found on Internet." E4 v% a: Z( ]7 M2 f! t
It seeks the signature of BoundsChecker in SoftICE$ H4 B5 a. U0 n- V9 i& M( {" J) C
- G% s. o; }* p/ y/ a
    mov     ebp, 04243484Bh        ; 'BCHK') P7 g6 R8 P( |6 f* }" ]
    mov     ax, 04h
* s1 b& H5 B4 k- Z0 v- Y+ D    int     3       / q2 U6 |1 |$ G' u  t
    cmp     al,4
( W8 ?0 o7 ^  h  H. s+ R/ d" i  e6 \    jnz     SoftICE_Detected
5 N- W' E3 T3 ~( m( h/ q
' Z! `/ O/ C  u! k8 F/ }___________________________________________________________________________
5 y$ X/ ~* N$ w* k7 W( W! b: t7 o9 h
Method 02
) W8 S) q+ r8 a! D=========6 Z; i& B2 M6 W  Z
6 ^$ q3 V# e+ G; Q/ b5 |% y% b4 O$ z
Still a method very much used (perhaps the most frequent one).  It is used
- X. x3 d5 M8 R$ Z, N, `% }0 Xto get SoftICE 'Back Door commands' which gives infos on Breakpoints,2 _; F* i8 Y2 c; R) q; ?
or execute SoftICE commands...+ i. l; a* s/ H3 y, O. L- F
It is also used to crash SoftICE and to force it to execute any commands
+ v. M  v" J. K5 P(HBOOT...) :-((  
' `8 s3 f  u5 H& m! f/ E" C% t5 j# C( Z
Here is a quick description:
6 ^) ]# S4 K2 c! h* h- Y-AX = 0910h   (Display string in SIce windows)6 F0 h  m- r( o) P* Z9 U
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)5 B- {/ e7 g+ i3 \
-AX = 0912h   (Get breakpoint infos): J) C1 d3 v: ]. M4 Q
-AX = 0913h   (Set Sice breakpoints)5 ^2 e+ y7 O$ `* z( v
-AX = 0914h   (Remove SIce breakoints)
- f" a8 f- e6 k3 B) O
5 b2 r1 g, ?$ s! ~# N9 L% `9 YEach time you'll meet this trick, you'll see:
& a9 o. s) e' @- q  m-SI = 4647h
& k' ?' ~3 i' m-DI = 4A4Dh/ Z( R% k9 V/ t: k; \% l
Which are the 'magic values' used by SoftIce.
8 E7 ~: c, ~+ I- c- T6 X- I5 fFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
+ I6 I) g3 v) L% I2 t
. r3 \7 @0 I. p* r$ IHere is one example from the file "Haspinst.exe" which is the dongle HASP; E4 W9 o- ~8 N3 C2 d
Envelope utility use to protect DOS applications:( \6 T1 }9 b& q7 s5 D4 l3 C

. n. C, H4 U3 [: e& v& H. v* w# s( y. X8 W
4C19:0095   MOV    AX,0911  ; execute command.
8 D: q" r- O, e4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).! L- v/ L0 `; I
4C19:009A   MOV    SI,4647  ; 1st magic value.
) ]. G' z$ c' D/ @) P# F5 C4C19:009D   MOV    DI,4A4D  ; 2nd magic value.- u9 ^/ Q* T5 M0 s) d! d
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 g6 [* _% G' v8 x9 ^4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ I: s* L5 y( m8 a8 j
4C19:00A4   INC    CX- o  n0 z, L! }! Y6 t1 t. `
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
7 x5 k8 J& H+ _6 v2 G4 u/ h4C19:00A8   JB     0095     ; 6 different commands.
8 G. z5 ~+ B  O4 y( ]# u% F3 a9 S4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
3 {  g$ ^: B. ~9 K; Z/ P4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( k8 K" h% M: [& S3 x( m9 |' F' s( |& s  o0 v
The program will execute 6 different SIce commands located at ds:dx, which) U9 _7 P2 p! ]! W& l0 S( b8 J' o
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.. s8 r! W  }3 x* I9 k$ b; ^0 ^  e) D
$ l% w+ l3 R  q6 x- r7 Z2 K4 O/ Y2 A
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.( p( ?. v/ }" q4 g; y
___________________________________________________________________________
) I/ G2 G9 V) D8 ^% o# }5 I
4 p6 O  R6 I: Z
) `! {, b( G3 B2 Q  U4 h/ ]% oMethod 035 `  B8 r, Q" D1 |( e6 o( z0 H
=========
1 B) }8 u9 Q9 V  p% d( y6 Y" d7 k% o+ [
' X5 g$ b6 Z; ]7 a1 z, P% GLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h9 |2 k; A+ z4 N& u, j
(API Get entry point), @; r$ Q6 N" s, J. q$ E! K
        
" O# g9 O8 P7 ]1 r# f% E; B$ ]$ v( o9 z- U/ @* d% e
    xor     di,di
& d; z" L" M, Q* E; f1 P; o    mov     es,di
- K1 }( F* U' o    mov     ax, 1684h       & `% K+ n) r; b- p! Q
    mov     bx, 0202h       ; VxD ID of winice2 E5 f' [5 R: H/ m
    int     2Fh" e, ]9 k- d( I( a0 r& L/ q0 @; Z( s
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 W" A$ Y% E  j% h5 P) i    add     ax, di
) |4 ^" ~& e( l2 p5 n% R$ k: {    test    ax,ax( q) h& {8 g" g/ e) ^+ G
    jnz     SoftICE_Detected
  z6 V* U" A6 N' E; c2 [3 u) Y3 j- K
___________________________________________________________________________
7 P5 P% W) G, x2 t: J5 L
5 e) \4 ?3 p+ [! {- _Method 04
1 }( z6 \: ^; O( O/ D=========* d2 P: v  F) T; f% z
5 B8 [, E! y3 [$ z( r
Method identical to the preceding one except that it seeks the ID of SoftICE( K, l# ], e7 X
GFX VxD.
7 y! H$ z' H6 N5 k$ ^" r. J! d% L; t0 T  ]& o: h2 U
    xor     di,di
  ~/ a0 q+ ?8 v0 j    mov     es,di
! g' ?/ V$ }1 h    mov     ax, 1684h      
$ S( F( ~' a! o# u    mov     bx, 7a5Fh       ; VxD ID of SIWVID: h! }/ P- }( l3 S
    int     2fh
, V" c# s) ~) L+ Z    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 e' H0 V' m! l# q0 N  S8 {: y
    add     ax, di/ U, B5 e7 ?3 Y* t
    test    ax,ax7 j/ @( ]5 y; |  |
    jnz     SoftICE_Detected8 b: T) ]1 L3 T
: D$ r3 t1 O  u( P: `$ P+ q- L
__________________________________________________________________________! X. B8 y  A  H3 l9 K. z! i+ {
- B5 p# l5 E" c* i& Z+ `

' x: h( Y0 a4 u+ t; T2 T9 f& qMethod 05
& I! S3 ?' z6 E=========/ H" S! u8 W! A3 {. m: r1 Z) m
- a7 A& Z& ~! Z. R
Method seeking the 'magic number' 0F386h returned (in ax) by all system5 A- X9 x3 E6 `6 B+ c5 ]
debugger. It calls the int 41h, function 4Fh.
/ Y. m! K- \& |; ]( I1 D6 c4 pThere are several alternatives.  
; \# f/ N3 y' H  I3 f) i2 C7 ?9 [: l! {
The following one is the simplest:, }$ p0 ]# ?- w3 X1 [! |  a2 D0 e1 v

' C/ R; d3 j' ^8 a" p) L    mov     ax,4fh
+ @+ p9 c: p; h9 d" W    int     41h
2 p$ w9 n1 h- E. Z& T0 U0 z    cmp     ax, 0F386
$ w6 R& o; Q8 u% K5 o. y3 s    jz      SoftICE_detected) W4 P' l5 G* G  Q" _1 A
5 p; \0 Q6 }' r0 g, S4 c& L2 q
, M$ W" g1 L7 x+ C
Next method as well as the following one are 2 examples from Stone's 0 P$ O  M+ b. D% g5 K! K& O) i. k
"stn-wid.zip" (www.cracking.net):& `1 C6 n- h; y. a7 e4 N& r
8 c3 v' w; g6 v, m8 \& T
    mov     bx, cs
/ M0 Y" V0 T2 C8 _2 g    lea     dx, int41handler2% A$ B3 c3 ?3 n' j8 S4 S, q5 k
    xchg    dx, es:[41h*4]
) u6 D* J0 X- {! N' T    xchg    bx, es:[41h*4+2]
9 B' r$ z: z( }    mov     ax,4fh
6 F# u6 j; a/ k; f% r$ u    int     41h
$ t$ Y) d; e6 T2 _, B: [, D- s$ q    xchg    dx, es:[41h*4]* A* J) ?+ }2 ?
    xchg    bx, es:[41h*4+2]
# B( C) [3 D7 W5 ]) u1 U) F/ ?, s    cmp     ax, 0f386h
! i. S5 h8 }5 P/ D0 E    jz      SoftICE_detected  s2 b# U# ~6 N
$ f7 H& ?5 K* g; A& Z
int41handler2 PROC& n8 _1 B# c- c& h4 S6 y
    iret
1 o/ i# g3 P, D6 m9 X2 i+ lint41handler2 ENDP1 P- r9 e2 M8 G# ~' W) ~
1 D2 P0 b, L. n) ^) B# D

/ O+ `/ t/ z( T& v2 I_________________________________________________________________________
7 E/ y% Y! m) Y  g3 G3 u8 t$ @8 H% @3 H8 y' M& r6 C: ^7 J# `

) B9 C+ V" o* Y" P9 R/ O8 O1 ]; ^Method 061 J  b: z6 [4 J2 o' s
=========
' q( ^$ p2 _* N+ d2 H0 }
& P& A4 T5 m- l7 `" g2 a2 Z  |" i* j4 n* G2 g+ U% s" N1 Q
2nd method similar to the preceding one but more difficult to detect:" {) F" n1 g2 T' R) ?

0 q/ ~( n) [) R/ x: C2 ~, V1 F  H: s9 ]8 P# e2 j
int41handler PROC8 V3 W% q$ i, d7 _4 d2 q
    mov     cl,al- ~% A' ], c3 t$ _2 N
    iret
( {2 r1 X" t( ^+ t: @int41handler ENDP
/ c9 c: v" m; v& n$ k! U2 _& g1 B9 O" ~1 L3 I" ]) n, n' ?

2 w, {" v3 q! e5 e7 E    xor     ax,ax
1 t, S6 ~" J* _5 I    mov     es,ax
( O& A% o# K" _, m) A    mov     bx, cs) W6 f' Y& e7 O2 i; c/ C! F2 C
    lea     dx, int41handler% i  D4 R. ^8 ~2 M" a
    xchg    dx, es:[41h*4]6 A/ J" p4 O+ f
    xchg    bx, es:[41h*4+2]
) g& i# j' R6 H# V' S! Z* T    in      al, 40h3 |7 c! s% q" V6 a; K
    xor     cx,cx- Q& Y+ M  J' v  K2 ]/ @( h$ h+ \5 I6 ~
    int     41h2 ]& S6 i. T  R) c# _1 @9 \
    xchg    dx, es:[41h*4]: s2 _, Q0 y/ o
    xchg    bx, es:[41h*4+2]
2 w/ l( i$ C4 c' K    cmp     cl,al9 t8 d0 T. ]6 ^. \. p  _8 w( T' G
    jnz     SoftICE_detected
2 }% O3 F) F3 [+ f) h5 D) w3 P
. |3 f1 _+ l4 d( p+ C! G_________________________________________________________________________1 \& o# l! P2 J' r
3 c" v' S2 ?- t. O9 o( x9 F, U
Method 07* E% R+ `" E3 t/ q1 u( D
=========/ H" d! a9 |3 j& A) T
! h( l( g, W" z( K& j: _
Method of detection of the WinICE handler in the int68h (V86)" g! C$ s5 v) W

* u( C5 G* g. D; U    mov     ah,43h
9 m7 ^  V- k. e' ~" c  U! |    int     68h
3 ^  Q) q. [3 g+ l5 w    cmp     ax,0F386h
8 N+ v5 l% m$ z0 z5 O' Z) _" f    jz      SoftICE_Detected7 j2 N+ Y4 S% ~
. G4 d" y; U, F4 H% s

. |. i9 `/ y% e/ |=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# _' o3 G" ]8 \) |   app like this:! x! D! U! J% B; x) o  p

- X8 j1 o) B/ [/ i   BPX exec_int if ax==68
* i/ }+ F  ]4 z3 j/ d& \9 D+ p* ?   (function called is located at byte ptr [ebp+1Dh] and client eip is4 G# D% k! j! o8 W& d/ }
   located at [ebp+48h] for 32Bit apps)
; p4 c! _0 D4 u" O__________________________________________________________________________0 R: ^( e! q+ b5 o% f7 W! c: i
% N  M! I& g% C  H* O  c5 j3 X
! X. x; R& j0 L& C/ r, p
Method 08
5 ?  U8 D* P" m5 N9 m=========7 e( _) g- s( {% t/ L$ X4 T
3 H+ T, I7 Y' f
It is not a method of detection of SoftICE but a possibility to crash the
7 f$ V: X# s- H1 `. j1 Osystem by intercepting int 01h and int 03h and redirecting them to another8 J  U4 z! E% y8 o! X5 t
routine.- D+ q6 R) p# r5 P
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
* ^; s' v# G, U$ Q1 kto the new routine to execute (hangs computer...)
9 ]; w3 S4 p" v# A0 B% s1 ~7 e
5 x- [3 M- n* R# W8 m$ L" w) z    mov     ah, 25h5 }* T/ D* x) t0 J; X% N
    mov     al, Int_Number (01h or 03h)
! Z0 ^3 j, K4 O* `    mov     dx, offset New_Int_Routine2 H5 Z9 ^0 U7 `; F' b  |$ K
    int     21h
4 I# Z* q$ h% D- `3 h* {, c3 }# ]! C1 V9 A; I
__________________________________________________________________________
9 @" O/ c/ U7 v; [4 `  u0 X' f$ i' L
( u! G8 `  K+ a1 oMethod 09
' Q, F$ b6 i7 V=========
5 E' g: }3 @- o2 `# v5 j, m/ U8 @( C" U: L1 J1 t# n% d
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% y& v- H' x+ d4 g* A, }6 V2 E
performed in ring0 (VxD or a ring3 app using the VxdCall).
6 _) L2 v- e7 F, f% }, b! LThe Get_DDB service is used to determine whether or not a VxD is installed
# N4 K# q5 G( `6 P! x. yfor the specified device and returns a Device Description Block (in ecx) for4 h5 X% h9 J% J& \2 l" j
that device if it is installed.
/ H9 O$ z+ W% t" r3 p: \  `, ~. j6 S/ P" d5 |. _
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# o* w/ V; ~, d. v) I4 a  q2 Q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
" U, e, d! B6 r0 X& U, t   VMMCall Get_DDB7 ?; ]" ~6 }. Y: ]- v) S- d
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
' F! _  E7 G# S$ ^! W+ B  r2 Y% |* R" v8 J2 j& v
Note as well that you can easily detect this method with SoftICE:0 r$ C9 H& u: b) c
   bpx Get_DDB if ax==0202 || ax==7a5fh0 k7 ]7 z- O3 `; e* O

" k  j9 t: C% Q4 b+ V1 V: b__________________________________________________________________________
# l$ A- X( Q) B1 C$ {; Z
, @% k& o% Z, i* z! l8 VMethod 10
  _' O0 D7 J+ u/ D. ?8 z- W$ \=========; Y! t# X# J, R9 M

/ U; w: h0 b2 t: F=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with9 b/ e. E1 L5 `9 y2 {- D3 l8 Y5 M7 l
  SoftICE while the option is enable!!; y1 B' ^! B# K6 N  {& v3 R7 u6 B
" a: F, T1 Z$ c6 I  ^/ W0 g
This trick is very efficient:/ K2 ?. `8 a1 u$ m( R  H
by checking the Debug Registers, you can detect if SoftICE is loaded
+ n4 E- U" `2 a4 I(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
' U" ], h1 k8 t! U! @there are some memory breakpoints set (dr0 to dr3) simply by reading their4 n" t0 R# G" _3 g4 N
value (in ring0 only). Values can be manipulated and or changed as well
6 P; I( M3 _% x6 F; \* J- z% e+ ~(clearing BPMs for instance)
# @' P# a4 l' A, @: g. v
- O& J# f% H+ u0 |3 E/ n" H__________________________________________________________________________+ i- R$ M2 ]* r3 t. y$ t" j. J

8 K& _' I$ }7 E0 W- E* PMethod 11
* P! F! x4 d1 A=========. y" Y4 b5 W0 r4 f$ S$ V

% Z  T. H2 p5 i% l( o3 eThis method is most known as 'MeltICE' because it has been freely distributed! }) Y, T3 a& Q; a
via www.winfiles.com. However it was first used by NuMega people to allow' [2 ?, _* C  t5 Q. c
Symbol Loader to check if SoftICE was active or not (the code is located4 Q$ i4 S! x- P$ F0 }' @
inside nmtrans.dll).
; |' O9 o, H( P
' E# S) [3 P% @* \5 k( c' M. FThe way it works is very simple:: p; k2 k! ?- r" i
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
' ?0 R( L) {/ @WinNT) with the CreateFileA API.2 A8 W! X1 t1 V. |4 b
# ^* b! ~' U9 o  r1 F0 c8 t
Here is a sample (checking for 'SICE'):
  d6 V. b' \3 _( @( d: C" w! v4 E
+ n# o) s1 m9 y4 `8 ZBOOL IsSoftIce95Loaded(), ~/ `" f8 u5 A$ [2 f' W
{
% V: d+ U/ D/ K   HANDLE hFile;  : s/ P/ a* F1 L" y
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
5 A' m% l* c& r  b. @' h                      FILE_SHARE_READ | FILE_SHARE_WRITE,
6 c0 v9 h! ?$ z0 f* G                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);# T0 x9 s' v( p( N8 \. [" @
   if( hFile != INVALID_HANDLE_VALUE )
! y+ \( q7 R! d6 Q( Y9 B   {2 ~' z( K+ M0 k
      CloseHandle(hFile);/ i. H7 S4 E  t/ {% P3 _
      return TRUE;
/ |3 H9 h- K( B: N) t3 W! E1 I% u% z: o* C   }
! J4 Q, e6 D$ ?& H8 z) @3 }   return FALSE;
$ i7 |! g( {" _8 b9 @: H, E- K}+ Q  p; a  D$ ~$ G# |

& t+ y9 J0 }. X% F# IAlthough this trick calls the CreateFileA function, don't even expect to be
. m% h0 N; N% fable to intercept it by installing a IFS hook: it will not work, no way!, P2 g! T9 c; f' ~$ L
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
9 g6 y' u% \) [service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
) U, }$ O; W3 D1 F% S* Iand then browse the DDB list until it find the VxD and its DDB_Control_Proc/ H- V+ T( u7 q6 _# f# K
field.
/ G& B6 t" s+ ]( C, w% OIn fact, its purpose is not to load/unload VxDs but only to send a & Q- a! x0 c0 v' q0 F" s
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)5 F1 w' n8 }3 |! J
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 @5 G( b7 I* p1 qto load/unload a non-dynamically loadable driver such as SoftICE ;-).8 j  V1 L: _% a7 }( l+ \% F
If the VxD is loaded, it will always clear eax and the Carry flag to allow
! f2 T! G* F( X# |/ uits handle to be opened and then, will be detected.& G/ p, ~# L% Y2 v, F- V
You can check that simply by hooking Winice.exe control proc entry point
+ G, T1 m" r- t& cwhile running MeltICE.
4 @% W9 d0 V) K0 X, f7 P
7 E  @3 s; ?7 u3 F! d5 w: p* q  n3 E; s' S% B$ f! B* O' X
  00401067:  push      00402025    ; \\.\SICE
7 s6 c1 b2 Z/ ?" m8 }' Y  0040106C:  call      CreateFileA4 C: q0 ~8 ~6 @0 T' C
  00401071:  cmp       eax,-0018 C3 P* h2 s. Y9 {! y4 S
  00401074:  je        00401091
( O7 W# i8 v% X2 q" q2 p$ u, e5 O1 ~! H5 z% C; z2 ~

  W4 K1 e  L3 d; `- p% K, FThere could be hundreds of BPX you could use to detect this trick.
; G2 f& I( N! G-The most classical one is:" L: [! N/ }9 V# M: D) x
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||* `# n6 x6 s' T' v1 Y( D
    *(esp-&gt;4+4)=='NTIC'! M3 L7 {9 s) o3 p- p  v
: {# P4 H1 e% z) _3 Z" `
-The most exotic ones (could be very slooooow :-(# \7 Q% Q( i. m1 W, Q
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 Q* v9 o' d; S) l
     ;will break 3 times :-(
, z3 i+ m3 c9 Y  v) _! [& d7 J
; k; d& I6 s" J. u/ G3 }9 S5 d$ x-or (a bit) faster: 7 y3 ^( d" x  S/ Q- A: W( J
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) R/ F, t6 ^) L% W, F/ `
" d4 z- p; ~7 G4 \9 h   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 t" H+ I/ V4 @+ K3 K4 s     ;will break 3 times :-(
9 r4 B- U$ M  A4 ?+ Q- G8 q( H! b/ [, k
-Much faster:: c9 D6 A3 ~# [" Z6 X
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 v. h4 d: ~1 V0 H
8 V$ g+ g1 R+ j# m& _5 v8 |
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen+ K, Y* `. k, Q. d! _
function to do the same job:
, b( }$ G2 y5 n' ^3 x
. A5 p+ A+ E& Y$ T' {3 {   push    00                        ; OF_READ8 t% |5 \2 K! M5 E3 D2 X, l* c
   mov     eax,[00656634]            ; '\\.\SICE',08 {. E2 L- n, G9 P
   push    eax
; Q1 t; @8 D% _6 \, N& |   call    KERNEL32!_lopen
3 Z3 ?# w* }9 h, @5 \* r1 U   inc     eax
6 z3 o6 t/ [- a  o0 a6 ~+ r' \' H   jnz     00650589                  ; detected) o5 g4 O: }+ H. l
   push    00                        ; OF_READ8 H/ u1 k  t+ u, ^6 r0 s8 a, c
   mov     eax,[00656638]            ; '\\.\SICE'* ]3 }1 k. }$ q7 d( {& u
   push    eax) d& [7 u% `) i6 b
   call    KERNEL32!_lopen
( n) X9 Q" h% Z; ]+ `2 e( ^   inc     eax1 p7 }8 E0 V# o6 J
   jz      006505ae                  ; not detected' |* z# S+ d0 G5 N

4 l* f# h. a+ Z0 A
# P! s9 w* R( f3 y+ X9 f3 U__________________________________________________________________________, v* J1 \3 S) o0 s! i% e- R
  _3 y) S# U9 y9 w0 Z
Method 12
% P" s- k9 ^0 m0 P1 z=========
( e; S; |$ |# e# L/ U( F/ f
0 v7 H! o4 @; z% r  K* E/ nThis trick is similar to int41h/4fh Debugger installation check (code 05
- J; ~& R5 `) V9 _&amp; 06) but very limited because it's only available for Win95/98 (not NT)
0 Y, ^* c# M6 r4 `' has it uses the VxDCall backdoor. This detection was found in Bleem Demo.
& `0 T' P6 z0 T0 q* {9 F- T% t  `8 {3 u2 l! s  o. ^8 [
   push  0000004fh         ; function 4fh
6 F( j0 P: F4 ~! e* v8 g' B   push  002a002ah         ; high word specifies which VxD (VWIN32)# ^7 E1 J! o9 @1 r) w
                           ; low word specifies which service
4 J. \+ u3 q! M) p# d$ ]/ U                             (VWIN32_Int41Dispatch)
' t0 V7 d6 `; \& J* F   call  Kernel32!ORD_001  ; VxdCall
: X) k2 L1 {! J1 m' G" b! _  F1 C" ~   cmp   ax, 0f386h        ; magic number returned by system debuggers# ~" d5 A% C7 Z; M6 e  b
   jz    SoftICE_detected
, w& C) S3 }' P- z; |, x3 }9 A6 v1 T4 u. C% C2 g
Here again, several ways to detect it:8 g) e. u+ `# N1 t! |4 ^

7 @# @4 z& I4 F3 \! z1 y    BPINT 41 if ax==4f5 I/ T- `" c: c- O  b4 h

) `& C# u0 R% z) I8 v$ Y. w% B! j    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one% F- `6 `& n8 A7 L$ x
1 a8 T1 }# ?# p) l9 W
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A# k3 s. U) q. X3 _8 J- j8 P/ h

8 Y% T! Q- V# o+ z! L, x, t' u3 i    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  Y  p8 y2 M# \1 {- w- ?

3 p% m5 ~1 F) ^9 b2 [: O__________________________________________________________________________' u  j3 [, F2 d
0 E8 J6 H; q, Q8 _6 M9 C2 m
Method 13
6 Z' J7 g- q/ E7 p* |. M3 _- s=========' h5 F$ U9 Z, b% O9 P: {

7 L9 T+ X2 o* R" t4 c9 ZNot a real method of detection, but a good way to know if SoftICE is' m7 V9 R, a* G; \# K: v0 W
installed on a computer and to locate its installation directory.
& j- u% @1 q- ~4 p5 d5 ~It is used by few softs which access the following registry keys (usually #2) :
/ t: J/ J% W6 d4 s; m5 F2 F6 X( X6 A3 G% H
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. \/ x# Q6 p- d! j  M
\Uninstall\SoftICE
8 K; ]* b4 O2 y: A-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
& ]' r) i7 R) l1 H9 O7 W, X-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* ?) C1 g, e; X% ]\App Paths\Loader32.Exe
: [" Z" k3 k8 v+ Z' C$ B$ x; B" E2 z
, Y% f" N' L+ O: \  Y, Z
$ f6 f* W9 `2 W' ]0 Q/ l: L) Z- qNote that some nasty apps could then erase all files from SoftICE directory
5 f/ D4 c! ], }( K(I faced that once :-(6 k% x- I7 {" k3 |
+ V9 x( o' ]0 }' Z  G( n
Useful breakpoint to detect it:
, h" A+ A9 R& s+ b3 ~' D
8 f4 l( h  m) Q# o3 ]     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 U+ G  o% M  z" W& r& m
( D( }8 e- g) A$ d8 Y# r; h__________________________________________________________________________
* ~' Y5 f# O; b& l4 M7 O2 P  u' s. d- d; R5 P
! s- f, ^; a% ^# ]
Method 14   ~* a$ {' p: D( u9 T7 T
=========+ ], N4 [2 `( \  E0 g0 V. b
: C& [0 a, G. v) j8 ?( D8 H3 b/ f
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ M% \9 e& j8 ~$ Iis to determines whether a debugger is running on your system (ring0 only).
3 S# R' z5 z- B0 i$ E
4 ^$ m$ W) p  v$ ?   VMMCall Test_Debug_Installed3 b: b/ [5 j0 z! U; J* S5 `
   je      not_installed  O! r! S" ]8 U, k1 ^; a7 v0 x

' T4 V7 n' G5 V3 S0 F) h, X6 }This service just checks a flag.
) ^* P5 N) v: I, k1 O& p" r</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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