About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
) j, a. s3 |/ p9 \  D<TBODY>9 E/ |! I) O: P$ D% w* F* [
<TR>
/ v- ?5 ~( r* u<TD><PRE>Method 01 4 S* X( g( h- j
=========
2 c' D- j0 ?3 I6 t4 T9 ]5 z8 e) i/ Z" `% V& a7 m
This method of detection of SoftICE (as well as the following one) is
+ l  q! X" }+ A" Q3 W; m6 @9 Vused by the majority of packers/encryptors found on Internet.1 I: W6 n4 s: O8 k
It seeks the signature of BoundsChecker in SoftICE9 ~8 a& c" p$ S: v$ i
8 `) v* M2 p4 l+ Z
    mov     ebp, 04243484Bh        ; 'BCHK'% s$ \0 h; m, A8 a8 a
    mov     ax, 04h1 q) M: w+ ?. s+ n- U% o' S) v
    int     3       + D6 X; h+ v9 _  y
    cmp     al,4
2 [' B, L# K9 j, a    jnz     SoftICE_Detected6 u  x7 t8 d) d6 p

  p4 E: ~& H5 l___________________________________________________________________________7 B5 |8 u1 j" A" `: ^; A

& {/ h8 L6 B, y5 M, qMethod 02) Y" c2 }4 _& P* [+ u8 [
=========
+ F8 G: P' C- O2 \! B/ d  B; h4 c' f- t" U5 I$ `' s* g2 I
Still a method very much used (perhaps the most frequent one).  It is used
  c% l& p/ m( f* mto get SoftICE 'Back Door commands' which gives infos on Breakpoints,, E; D+ U, v* @6 w- t% ~& m2 G
or execute SoftICE commands...
. [* ~2 m2 o7 ~; P4 g5 @4 c/ bIt is also used to crash SoftICE and to force it to execute any commands; X- }- R. v$ K& P6 |
(HBOOT...) :-((  
  w, n. K2 r! h( p( U% R4 @! s9 m3 k  {* m8 b
Here is a quick description:
7 c* D0 G0 Q- h  `-AX = 0910h   (Display string in SIce windows)) E" j- o+ |7 z2 h1 J" l3 K) \; j
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)+ `* Q' I. [: C, Q; X
-AX = 0912h   (Get breakpoint infos), I) B; c: A" ]3 x: y- J% v
-AX = 0913h   (Set Sice breakpoints)5 [. m7 v! m: i+ |( m1 `) ^
-AX = 0914h   (Remove SIce breakoints)
& M4 P8 q3 O! }4 c" n/ d; k& _7 F
9 v1 S9 ~* z0 \0 [- w) k0 _' `Each time you'll meet this trick, you'll see:" w9 [$ S9 {* ?" [/ H
-SI = 4647h0 y( ?* m- g/ w
-DI = 4A4Dh' j( O  b: I7 _6 W/ I6 e1 r3 a+ q  }
Which are the 'magic values' used by SoftIce.2 G, W9 v5 J) o" `1 ?  b
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.9 ?) R6 ]. J6 E0 Y
, m; I4 I- d! D0 a
Here is one example from the file "Haspinst.exe" which is the dongle HASP
+ {5 {2 `# n' y7 u9 L7 [: B9 AEnvelope utility use to protect DOS applications:
- Y7 U  G9 L7 C6 B7 E0 M* u/ W8 P  _9 O7 i0 T# i
, a& \( p8 m9 K( j
4C19:0095   MOV    AX,0911  ; execute command." B6 ?) j7 I9 p! |9 y" N7 l
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
3 R  `. _1 P5 k% O( N0 e$ Z4C19:009A   MOV    SI,4647  ; 1st magic value.% W  `) O0 Y/ v# q
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ z5 @. ]  w# Z$ q) {& E- X& Y4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
8 F, v' o7 S6 D9 n4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute' p* |9 x4 u/ t8 A6 K
4C19:00A4   INC    CX
+ _4 ]1 I& W3 [" X$ ^- v; y4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
: {' y! `9 ?9 r* Y' z1 ^4 D$ _, m4C19:00A8   JB     0095     ; 6 different commands.
( Y0 L* [0 H# |* F/ P1 r& m/ Y: Q4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- \  }8 @5 W9 o) `0 _, m. A
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :); q& u2 L: z" F, o' A( n6 @
9 o3 q' }- q" c/ x) K/ k
The program will execute 6 different SIce commands located at ds:dx, which
+ j% _3 n. W2 X1 e8 _' l- ]. @8 zare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.' z% G  Z- b) r' s# p

! F* \$ O( _7 \; A" |, U6 x# t( l* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
- r5 o6 W" e$ f5 G/ G; T* ____________________________________________________________________________
9 r. k# e3 F8 N( f; _4 W+ U" ]( \: `  K$ J8 d# e$ J+ m

2 a) _) |6 w/ F; |. x% J9 pMethod 03
3 y; ]( {& {5 ~: ^1 D6 A=========
  Q4 t0 `  x) b3 ]; o! `' ~) x+ ?$ l6 T  R! x9 L
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 b8 j4 ~$ F$ s6 K# [(API Get entry point)% X6 V3 w  Y. n* A) y2 e7 i7 [
        
+ w; ?- p  G( P1 ?& t+ n& f' ]; [. r. g3 Q8 L$ ~$ F
    xor     di,di+ u- {8 K0 ?4 p6 }  ~; y1 J
    mov     es,di: s; ^2 R  j0 d9 ]$ h  {
    mov     ax, 1684h       + E. \8 S" s7 ~6 [/ ?
    mov     bx, 0202h       ; VxD ID of winice, |2 U+ V. ^  S& X: t0 g
    int     2Fh% Y# W  {8 n" Y% ^5 u. r
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( `1 t8 H/ f* S$ ]2 _" O    add     ax, di
) f" g2 n! L6 o9 Q3 k: Y    test    ax,ax
% H7 ]( _) c: M2 }. m    jnz     SoftICE_Detected
' A. W, k' F+ `3 f  \) Q4 P" i
% w+ ]4 B  v* V3 ]# r___________________________________________________________________________
& S6 t) H# G: W# m" y& R6 ]* f4 Z
Method 04: I5 s2 }1 ]/ `4 R# {2 K5 F' W- D
=========. K% |) H5 w; n8 J) E% U7 B

* _) C0 K5 V$ AMethod identical to the preceding one except that it seeks the ID of SoftICE: k) P( g' G" i2 O8 w, A
GFX VxD.! a7 r. \* }- M7 ~3 S9 t, u. e& O

5 a" `) K2 h, A    xor     di,di
0 C9 M* x7 w7 C. {9 W" H8 d+ Q) ^    mov     es,di
* D) f: o3 ^; P4 C8 Y0 L# ^    mov     ax, 1684h       ( E; A/ }8 y' i7 u$ y0 Q
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
: {+ F# }" ^. c( L$ Y% B    int     2fh
1 K+ z5 A4 s+ Q/ ]) o/ A0 d' U    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ i/ w) v& B) I! p7 L# z
    add     ax, di
. ~+ C, a- @) C# m    test    ax,ax% d$ n8 c( g7 l) B/ U* c2 }' t; d% z/ j
    jnz     SoftICE_Detected
( G9 {0 ~. l: h9 }
: @4 u; s0 A  s6 R5 W__________________________________________________________________________: n; }* m$ d! m

: P; F, D* H: _/ _! G4 I7 g+ Y' y
. l3 e2 q( y5 k' c- ~' ZMethod 05
4 @$ ]8 p( V: w7 d1 e0 Z=========. C3 D) Y* d* ~
; v' Q8 e( q6 _% o
Method seeking the 'magic number' 0F386h returned (in ax) by all system# B: [! ?; s7 @/ X
debugger. It calls the int 41h, function 4Fh.* v0 e& Y* Q. @" T: D
There are several alternatives.  
+ H& K6 H0 f2 ~9 e. T2 S( ^2 H: I5 m1 @. n% ~- @- P7 F/ R0 Q' f
The following one is the simplest:
% t# q  t$ Y) V, N3 ]4 Y
9 t0 J3 \5 r# r5 L/ J* v- v    mov     ax,4fh
2 U" s+ ]8 S- d  R    int     41h( j" |- ~" H! o  k9 V4 i; V( _/ z
    cmp     ax, 0F386- v4 l2 y1 H: o$ B& ]
    jz      SoftICE_detected
( w3 {  S0 e3 m$ T! B2 F% G7 r' O1 \9 r

( U% m# a, |# R6 Y: f7 y: B( ?Next method as well as the following one are 2 examples from Stone's
& J- }8 h( m" G"stn-wid.zip" (www.cracking.net):
& |: ~. \" |9 D' ]9 a# [, a  t) _1 H5 v8 I
    mov     bx, cs
. Y  O5 I' R4 f( e8 U    lea     dx, int41handler2, B5 g+ a" Z. r* Q  g
    xchg    dx, es:[41h*4]6 d1 |9 j4 a3 c  j5 G3 E% x( ]* u
    xchg    bx, es:[41h*4+2]8 ]; N0 `7 y5 X# T0 G
    mov     ax,4fh
( h7 F6 e6 J/ P  p4 Z  J    int     41h
& f: e4 I' j! e$ u6 F% ^    xchg    dx, es:[41h*4]
  _8 ~. R# E) a7 M( B5 u' X    xchg    bx, es:[41h*4+2]
' T: X; P( H' p' V- h1 n    cmp     ax, 0f386h8 E* |1 s7 d# z) b8 T4 _4 O$ m
    jz      SoftICE_detected$ J3 M+ {- E- `! ?9 a% e

3 q; q: P% n$ m- p) cint41handler2 PROC
+ s$ x) T$ t/ n/ b* D" d    iret
$ y/ a* T2 d) t( Fint41handler2 ENDP
3 Y5 r* ]. J  F$ F2 k* L- F  O8 q' z9 S5 w. c+ \3 S; B2 ]* i
+ x" C4 P) k% O" I& E8 F
_________________________________________________________________________! b# _- T' x$ ?9 y- Y8 I2 w
# w& E1 a% j) u/ {
) h& s; }8 A. ]" O. c
Method 06
8 k! l) O1 t2 R=========
- y  R9 ?7 u+ }  q
1 U( T$ d9 |; r7 h% o# e- M& |; L8 s
: p% \. m% H! A  f& \- z2nd method similar to the preceding one but more difficult to detect:
7 l/ M0 W, J+ ^: Z9 z! H
/ s  k) }, U1 X! M% n' C6 @3 o
  C, t/ N3 @/ O: }3 @* u# W4 h& rint41handler PROC8 `' s, k7 {+ z' d  V1 q
    mov     cl,al
9 J2 u+ u) r) C2 T1 [+ R% m9 N    iret$ F. u' U) {- B: D, f
int41handler ENDP* p+ [( F& J* K" w+ q* @  ~6 G# ~8 @

1 i: V! `: N5 ]) C: J: V$ `3 i, K4 z7 F; L0 ~' p4 Q4 M6 W
    xor     ax,ax% e3 ~3 o. e# q5 X& s1 ?
    mov     es,ax& }, l$ T& [  \. _9 F6 Q& w4 e% R
    mov     bx, cs5 G3 r' i6 |9 D3 {
    lea     dx, int41handler
4 V8 D3 _' o3 d% L  K$ y    xchg    dx, es:[41h*4]- l+ H5 F; w( C. d  O
    xchg    bx, es:[41h*4+2]
3 v: q1 Q: r2 b  k    in      al, 40h
+ Q5 |% r4 M# N2 t; R    xor     cx,cx
/ G, P  ~! @/ m# v4 N4 ?    int     41h
3 I4 J: I; f9 a    xchg    dx, es:[41h*4]& G, E6 q% Y- i* e: h: `1 O' f
    xchg    bx, es:[41h*4+2]
& u2 E0 H! E2 m! Q: M: [7 t    cmp     cl,al
5 H4 F; D  ]' H  W& q    jnz     SoftICE_detected
9 v+ Q3 F+ o* D, Y$ ^' o* z' z; R* x& z" S/ L, |
_________________________________________________________________________. D1 P, }$ c$ s" E5 k  I% k0 }
0 S" E, Z" {; P/ O. _6 W
Method 07* O* P  B. e! I6 ]+ U9 r
=========
, P$ U/ O! \1 h8 d$ v+ R+ X: Q- y- y, w: D( g; L- W
Method of detection of the WinICE handler in the int68h (V86)
9 v2 F7 j# q9 w5 k* P6 B2 F
4 K; e  F4 @; \; B$ p1 U    mov     ah,43h7 H$ ^9 c+ E& Z: W' P
    int     68h' D4 K* E0 p! j# J6 L! W
    cmp     ax,0F386h" a! G, n4 |1 \7 L3 K
    jz      SoftICE_Detected5 e2 |( U9 J% g- u/ h* s
& d* v5 q: @3 N/ j  P0 ^+ f3 ~1 G) l

% f2 ?4 l8 j: S+ I0 v=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
% S  Q3 a( {. s6 Z( m: Q) }. _' {6 [7 j   app like this:+ h4 @% a& c& k7 ~5 X1 w
6 M8 Y+ F9 U5 Y1 v
   BPX exec_int if ax==689 U6 s+ K  r- I9 |& e6 A% c6 M
   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 _8 s1 ~% }5 b  Y5 R% X   located at [ebp+48h] for 32Bit apps)
2 B9 B  B$ B) g__________________________________________________________________________. |1 K8 |) p0 g

1 {+ I; ]3 d1 G  n8 Y' l4 g3 u: m# e3 c5 b. J
Method 08; T# H% n( f& z8 I; O
=========
/ r4 v* W3 g7 b, q9 ?! Y9 `( N4 v. h8 O
It is not a method of detection of SoftICE but a possibility to crash the7 _& m2 K4 Y7 O% T" q, Y
system by intercepting int 01h and int 03h and redirecting them to another
- ^& X! `4 N, m4 L# T% M6 Sroutine.
% ]5 |  h& C# P0 y' |/ oIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 B7 L5 ?5 v  v' k* bto the new routine to execute (hangs computer...)  o. a1 X8 f! U( y% P  E; ^$ D
% L( f7 F# {$ f5 ^
    mov     ah, 25h* ~) O( ^5 L) ~( I
    mov     al, Int_Number (01h or 03h); z+ t9 S& l8 D9 c
    mov     dx, offset New_Int_Routine
6 {  ?' Z' w+ m5 _    int     21h
0 v4 h) }9 w6 R3 [5 K, E
, W8 A% i5 t$ s) [7 z__________________________________________________________________________. W- E7 Z4 |  ]+ p$ u% T- `

% x  D2 R% P2 k. LMethod 09
7 P. Z7 ?2 x3 [=========
+ y% b6 b( P0 ~5 T6 H3 K9 l
& L$ T- _7 U8 A. ^7 CThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
" Z$ q/ I6 |) }/ h! q1 bperformed in ring0 (VxD or a ring3 app using the VxdCall).( b* U9 H+ v# o2 S  c
The Get_DDB service is used to determine whether or not a VxD is installed
: \: z9 D8 H) ^for the specified device and returns a Device Description Block (in ecx) for/ D9 K  P, _" |
that device if it is installed.4 A( |5 C6 z4 i
+ |6 T+ N; ?5 s  W
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID" T# N6 j  t) v3 O# g9 U
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 B9 y4 c7 ?) F7 x% @
   VMMCall Get_DDB
& t! x( G" |: @/ I   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
' f* \0 u* I8 k+ o! G" O0 `: T6 q6 a- G, G- x0 ]. f8 _( V5 g
Note as well that you can easily detect this method with SoftICE:, I1 V, J- S. `5 f& _1 \4 _
   bpx Get_DDB if ax==0202 || ax==7a5fh
$ C. j$ j! v% W  |4 O" r- m  ?1 q! c
2 Z4 S" ]( U% L  w  p3 P: Z" w__________________________________________________________________________9 p" r7 @9 `% p3 G
4 h# ?0 Z4 g. K
Method 10
* M% H0 R: t  ]2 U6 M* R=========8 [2 c& S& T; {  t6 y$ V2 }- N
9 T% }2 Z% m/ D) z& E2 R8 r
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
/ R7 Y& i8 W! `2 @! E0 H! e. |  SoftICE while the option is enable!!
) g3 D) J. b: D  D' l
& Z& [( m; C  @: ?# H) iThis trick is very efficient:# ~, H+ G  i- g4 i
by checking the Debug Registers, you can detect if SoftICE is loaded
' P9 U4 L- L, a4 p) E' o+ g(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if) z) ?$ |& U4 a/ l# b
there are some memory breakpoints set (dr0 to dr3) simply by reading their/ F+ K; g# `  K; {' u. ^9 T& r, k
value (in ring0 only). Values can be manipulated and or changed as well$ d% d6 r9 r" W5 A' u2 e2 P" d
(clearing BPMs for instance)4 V4 ?' S5 B' J$ I% O: T' `
' B- j% A% o. f/ a3 J
__________________________________________________________________________
- l* h- G3 b5 s
, {8 N/ w0 ?! D! y/ DMethod 11
5 X% s/ ^4 Z. \5 v& u) M=========
; X% }. o( B/ i; b' i+ r7 q- ?! B. O; @' `5 c
This method is most known as 'MeltICE' because it has been freely distributed$ @* k7 C9 v  M' _
via www.winfiles.com. However it was first used by NuMega people to allow  Q. s6 l& z7 _3 M5 h
Symbol Loader to check if SoftICE was active or not (the code is located
$ B2 E6 E: o' C, b( I. f1 u0 H" F1 Xinside nmtrans.dll).0 f' g6 d3 _0 @( X* l

3 P) T( C# q2 }- o2 SThe way it works is very simple:
- O& c5 O: [, {( bIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- p! ]2 V. N- t5 y" Q0 P) x( vWinNT) with the CreateFileA API.
& B- ]9 J2 i( Q3 S! c
: V$ q3 E% q% O1 z& X3 IHere is a sample (checking for 'SICE'):
6 \0 r; ]' ^3 J5 W* `# d/ J: [( y+ ^
BOOL IsSoftIce95Loaded()+ r. }! {3 R6 c) O- w
{
& j9 ?+ T! \! W: [' S$ d, U2 L4 V   HANDLE hFile;  
/ @2 K! S" `4 Y: }- e   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
" Y: v  z, \( K# T- }1 d                      FILE_SHARE_READ | FILE_SHARE_WRITE,
2 }/ ]2 k0 l( }: F0 M7 ~6 a                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);; v; W7 W( P  Q  n+ ^
   if( hFile != INVALID_HANDLE_VALUE )) ~: Z$ r6 N8 l$ Y; P8 h$ O+ J
   {
2 W/ {3 W: h( X, |  n5 s      CloseHandle(hFile);7 ^! `5 L( `8 [# v0 ]$ C
      return TRUE;; P6 L3 z3 j+ ~7 P2 t! F, q, j
   }6 [4 F" l" a7 E6 o
   return FALSE;
( m6 u; w# J1 N3 q" @" C}* p$ m+ c9 ~7 V4 r) F2 _6 U
! L2 B4 b$ Q7 I% h8 J2 c
Although this trick calls the CreateFileA function, don't even expect to be8 r: T8 p+ J" A  P7 Q, F6 C6 y
able to intercept it by installing a IFS hook: it will not work, no way!+ [! b1 d0 ?9 s) t
In fact, after the call to CreateFileA it will get through VWIN32 0x001F5 d3 N  W& M, \; G+ p  [' _2 Q2 c1 F; m
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
: w) _7 s" r# c" Oand then browse the DDB list until it find the VxD and its DDB_Control_Proc0 n' u- ]8 a$ D4 G3 N
field.0 K0 ^: T" q. h2 J
In fact, its purpose is not to load/unload VxDs but only to send a
$ d% J9 t3 c7 kW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  u% V$ m- _/ X  k; h
to the VxD Control_Dispatch proc (how the hell a shareware soft could try1 W# P2 h( e9 c/ Y* h" X4 \
to load/unload a non-dynamically loadable driver such as SoftICE ;-).0 d- d! C% `( `+ p4 P3 A
If the VxD is loaded, it will always clear eax and the Carry flag to allow! H/ P- z! x9 v
its handle to be opened and then, will be detected., p' D1 {5 A  R& A
You can check that simply by hooking Winice.exe control proc entry point  i% l9 d5 G$ C
while running MeltICE.
# |$ P& B$ g; \. w( W: G  v
! D+ V% H' l9 @7 |2 v; Q& E4 \" s9 ?! L# |+ m# S1 r
  00401067:  push      00402025    ; \\.\SICE% J9 [5 o2 B* v% f5 R# `
  0040106C:  call      CreateFileA
- |5 A  M5 \' f  00401071:  cmp       eax,-001  B2 U, U9 m! U8 S$ k
  00401074:  je        00401091
; y" W8 k5 S+ ^2 N# \$ w7 M( O) b
4 I) `3 u: ?: i/ R- m6 U$ p. H+ W0 c/ T+ }# T1 Y; ~
There could be hundreds of BPX you could use to detect this trick.  L3 K8 F. W, c& I' m
-The most classical one is:
4 ?% s; u3 R0 A* ~! P  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, B) ^6 Q: o9 r& Z1 j$ f+ U    *(esp-&gt;4+4)=='NTIC'
% o: l) U* v' T7 m
4 i0 P7 ?! T0 x) U2 `- @-The most exotic ones (could be very slooooow :-(6 p, }9 ~1 X4 n
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  : }# `: h" v  C
     ;will break 3 times :-(
" @  Q. [6 ^9 [5 n* y% o5 P1 d3 k7 p. l  ?1 k5 _' g  U
-or (a bit) faster:
- w! h1 o$ _+ r   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
8 ?8 _, F8 Q% b5 U8 e9 H
, T1 P2 J+ x: Z: J0 v   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
4 q' T5 s1 ^" U5 G# U     ;will break 3 times :-(2 ^4 B8 x) }8 v, W8 ?

% h. j: k5 T5 Y5 k: c-Much faster:7 l$ s9 M( x2 x
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'. G% E  @6 g" z0 ^

2 p; e8 z4 Z/ a$ P9 X5 Z3 p7 CNote also that some programs (like AZPR3.00) use de old 16-bit _lopen, F0 [7 H& }3 x8 c- K
function to do the same job:# t& [# Q, F" d

0 ~! H+ O/ r  R0 C- p   push    00                        ; OF_READ1 K& |# V0 T3 {6 b
   mov     eax,[00656634]            ; '\\.\SICE',0' ^2 o/ @$ C3 Q0 ?
   push    eax' x- r3 F1 k% v: Z" s! |* c: x7 X
   call    KERNEL32!_lopen
7 ?4 j' g/ c5 I* c, f; g   inc     eax
  `% L0 C1 l; o: W   jnz     00650589                  ; detected9 t4 R4 A/ K1 H, y! |
   push    00                        ; OF_READ) `$ A( g: o0 M% O( x
   mov     eax,[00656638]            ; '\\.\SICE'( a$ A0 p+ R7 b6 Y. Y% O
   push    eax! P$ W& Y' p1 x1 X+ k$ \
   call    KERNEL32!_lopen
# B& H+ f' `& s: W( }   inc     eax% ~2 F- H/ A1 G8 k$ e/ _
   jz      006505ae                  ; not detected- B9 N8 T9 \3 {3 j

8 V8 Q0 Z8 ^) h- c% z$ t  y! q
* q) Q+ w# P7 D+ ?! L__________________________________________________________________________6 k$ E8 }, q2 d+ ^. Q: T9 ~4 O' n

; ]& K* S  i8 i& l; i% o2 V2 sMethod 12, `' Q5 c+ d) A# x" s; Z
=========
- B) c! y% w/ G) N5 j( s" ]9 q& n: ]8 p% T- \6 e* q' d, B. [5 j/ B
This trick is similar to int41h/4fh Debugger installation check (code 05
1 Q; }  }. F* i# O2 `' y% Q  [) S&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 _! M5 _! x4 b  S. d& t! aas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
( Y9 M5 F9 G. L, P- R+ ]2 e  K* p1 e- _9 F) z; I/ }
   push  0000004fh         ; function 4fh, |' \  u. h* Q+ y. j/ u" j
   push  002a002ah         ; high word specifies which VxD (VWIN32)
+ W8 ^/ F4 q) C  z6 F% x                           ; low word specifies which service
% X: G, w$ W% Y7 g1 b) m                             (VWIN32_Int41Dispatch)5 S6 h3 C+ k7 a' Z
   call  Kernel32!ORD_001  ; VxdCall
1 `; o4 a8 H+ u   cmp   ax, 0f386h        ; magic number returned by system debuggers- G# p1 N8 q# U# H- g
   jz    SoftICE_detected
# O! U3 r: j) Z  Y- q. l; h' x$ @0 G
Here again, several ways to detect it:
+ ^& `# L" X4 ^7 }" R( Q' n
# j# [9 m. K, r3 c7 h3 M: `! G& j    BPINT 41 if ax==4f* Z: [  k$ r, o% N- D' z, U! Y3 f

$ p: ?! D$ r1 E/ {    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one$ O2 s2 l0 s4 \4 d! ]5 V" k

9 w$ e' S  h9 D* \' E    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A+ I  x8 F9 R# _( E
% z4 _/ f0 d+ u8 ?
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' K, C; [! t" B, a6 G0 b) k7 ^5 L
0 j: |6 q$ L2 N, Y5 E7 q__________________________________________________________________________
0 n% R$ f9 H# ^+ f2 U* ?+ C* U; d9 ~3 D/ A( W: U
Method 13! n9 T4 F6 t) M4 Z% {6 q; z
=========
. r" }1 d# K" r. _) F( s- b1 S
% |% ^* o5 P$ o3 Q+ _* O. _9 [Not a real method of detection, but a good way to know if SoftICE is/ e* u4 \6 \5 i; A8 u
installed on a computer and to locate its installation directory.7 b9 F0 \: y/ U; e- M' x
It is used by few softs which access the following registry keys (usually #2) :
4 w7 }; T# W2 b% c2 E7 T, U! L4 b3 ^7 A, R
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ F2 X* |1 [; @  f, y
\Uninstall\SoftICE
# d- N" [: p. a' }5 ?) ]5 F1 k' C-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, T: \% z! h% T; `: e* K' i-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- T& F' {  Z& k8 d4 M* A\App Paths\Loader32.Exe
9 N6 ^/ N  \( K% u8 b
7 D" g. ~# r5 f: y5 d' n4 S/ H' O4 N$ G3 e7 r
Note that some nasty apps could then erase all files from SoftICE directory
% b8 N$ c+ m6 K4 N' q0 ^( S(I faced that once :-(
1 y" ?0 D2 t9 f7 |7 z, M% |
( W) P0 K$ B2 {- @  dUseful breakpoint to detect it:
6 }. T* }5 i% }% l" E$ _- x
) d- I1 }  m2 n. L, j5 M     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'2 W1 R  M# Y6 t$ A. T
- ?8 z) d) R8 e' ?" d* |
__________________________________________________________________________
) Q4 P8 P( u- S. o
/ y2 ]# I6 d* H  u: ?- K' U4 `9 L1 q- ~
Method 14 ) I" G3 B8 v9 X# H* S
=========0 N' r) Q/ l7 Y$ O2 `3 [/ ]
2 K( s# }- h7 q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose& T8 H, x" {7 \; e3 w# d
is to determines whether a debugger is running on your system (ring0 only).
$ \. R7 h( ]3 w' r( G5 H9 J5 ~" b: \0 J# R4 [( `3 D- b8 s
   VMMCall Test_Debug_Installed
* i! x* Q- {. r   je      not_installed2 w6 f4 ?* v1 S1 Q+ y' ]& h
- c: F' `5 P8 j: v
This service just checks a flag.0 p' D. J( l) q% D, I  {
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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