About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>& B& [) k0 n8 \8 B0 ^2 y
<TBODY>. X6 Z% S# K9 E8 b) J
<TR>
* d& ~) D4 o. _. s/ N<TD><PRE>Method 01
3 O5 e5 E: x4 s1 W" K=========
* c/ W# w* m7 Q1 U3 y, |, i8 s& \1 ?! D% k. E9 g
This method of detection of SoftICE (as well as the following one) is. T1 A$ b, T8 h/ f
used by the majority of packers/encryptors found on Internet.
4 F0 P3 M4 H+ V7 r4 |It seeks the signature of BoundsChecker in SoftICE
0 M0 K" _# _' v) W% s  ]
7 V4 Q3 E3 @1 w* P# ~  q+ _; {    mov     ebp, 04243484Bh        ; 'BCHK'
0 c4 T% D" T; ?  o  U    mov     ax, 04h
+ d  y' T/ f1 p; f% C) P    int     3      
, B0 a! n& ~9 u2 o2 d% g    cmp     al,44 M5 t7 X3 G; a. m
    jnz     SoftICE_Detected
9 ?2 V; }0 {( l  R/ m. H5 i. P5 l/ K" O% X3 R6 @* @
___________________________________________________________________________- P) T7 N  D7 {( i1 W
( a: _  b: R' _" O5 A
Method 02
, N  b2 V7 x% a5 v3 c8 t& Z2 ?=========3 W( ]/ D' Z# f  N) ]: m
/ i7 }" U. g/ L" K$ P* @* ~
Still a method very much used (perhaps the most frequent one).  It is used
) t- S1 n: m8 {  Z% [5 Mto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
# @; e& V( r' x) `. k: uor execute SoftICE commands...
( m1 C. B2 P7 Q* d$ V* K, cIt is also used to crash SoftICE and to force it to execute any commands" P* }- S9 V- C+ H, q- X+ t: N
(HBOOT...) :-((  . |: B: B5 D* _: x( H% t1 f
3 U6 ^! F" ?! m1 N4 Y
Here is a quick description:
- p9 D$ r; Z, u  S+ [-AX = 0910h   (Display string in SIce windows)
8 P  D7 y$ o/ a1 n# d  w$ w-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx), q  e" l1 b2 d$ \1 Q, n' f
-AX = 0912h   (Get breakpoint infos)  o- @+ [( U0 i% r# x! r* i
-AX = 0913h   (Set Sice breakpoints)
" k. w& t$ J: l1 w+ T& m-AX = 0914h   (Remove SIce breakoints)
0 C4 u  U( b- R6 V
& a2 U! N% m  c, P, y6 a! v1 O) k# n' wEach time you'll meet this trick, you'll see:
+ l* g2 k8 T4 J1 `$ o2 `8 q' c-SI = 4647h
& u! J# b" M9 G6 L! A4 q-DI = 4A4Dh  w5 X( ]6 m( G" P- v
Which are the 'magic values' used by SoftIce.
! W8 a. T; H6 t; T1 T8 eFor more informations, see "Ralf Brown Interrupt list" chapter int 03h." e$ ?7 N0 M% }: Y! D% m7 v; r& N! j
' \7 W7 h  t! N+ A
Here is one example from the file "Haspinst.exe" which is the dongle HASP
# h' h5 }/ G& b& Q! u/ T  W+ yEnvelope utility use to protect DOS applications:
* q0 O4 W' M) c8 S( V
3 O# G( `; O. T, i! T
3 I, u" ]0 {0 V0 O7 }4C19:0095   MOV    AX,0911  ; execute command.
+ X! [$ i5 V5 a9 {% T& y7 Y7 C4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
5 _' l( `) a+ t4 B9 l- t& p! V4C19:009A   MOV    SI,4647  ; 1st magic value.
) E, b/ U3 i- Y4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
1 I" `! s" l# J' I# s: S) k4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 J6 T* H% b- b' F3 Z; r4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ h/ k3 e; a. C, ?* G/ t2 A6 f4C19:00A4   INC    CX" [9 E  @! Q0 v4 _3 Y$ j' O3 a" {9 A
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ p* w# L* C8 I
4C19:00A8   JB     0095     ; 6 different commands.
# D3 I6 Q+ o9 j. U( F4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, M, n: z2 @3 i0 Y% V4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :); H/ H) _6 P0 k& f

) a! K1 a8 B0 U( g, h3 iThe program will execute 6 different SIce commands located at ds:dx, which
: q* o& b# A+ Q) p: P: X$ zare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ h9 l# G8 A% M& h3 r+ O7 X  }! S; i, @$ |  i. p  w
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.- d; l7 g; Z/ W* J  b# `1 A+ d# @. L- y
___________________________________________________________________________
6 }6 E6 r7 d6 A; |& h9 ?) I. X2 ?, k3 `. l
2 Q. J% Y% \* k" B* v8 }; ]
Method 032 a6 L% R. Y& _- }9 P. z+ g
=========
1 Q0 e, E% {/ q. `6 ]) ^- H$ N# R' z* ~4 t3 }
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 Y1 K! N! P- L! @& H3 Q) n(API Get entry point)
! h7 d  c+ B/ w! v& U. u( S9 J/ E          b6 G, |# n: M9 F4 V# I" |

6 u1 a1 ~8 V5 O& `" T% |. ~    xor     di,di5 ^1 l& f/ }" s
    mov     es,di
" L% W6 d7 c0 {    mov     ax, 1684h      
. Z( m7 B8 U( d1 `    mov     bx, 0202h       ; VxD ID of winice+ I/ Y8 z; R! {. R+ l. Z2 J
    int     2Fh) ?2 h; ~, O8 R' u' q$ M9 X" f
    mov     ax, es          ; ES:DI -&gt; VxD API entry point; v& C5 ?" c, b& g& \
    add     ax, di- R& r2 `8 g' T/ {% b
    test    ax,ax- }/ l9 [. h3 J
    jnz     SoftICE_Detected: c8 O7 z+ }, k& ~
. ^# z1 h% u8 S5 s3 Z  C
___________________________________________________________________________
( h; ?: _* i' s$ R5 ~+ P/ o9 D/ q9 [9 b, L9 _' N
Method 04
1 F% `( j( ]' g=========
2 b3 Z, R, q# {" n: j, `  |& a  `% w9 b+ L5 X* h0 Q
Method identical to the preceding one except that it seeks the ID of SoftICE7 v" w* N; }* i3 g, S7 s% g
GFX VxD.
% v$ ~, J/ s# V2 Y+ u, \2 W5 t+ o6 O4 M4 c) o
    xor     di,di
4 L: q! Z3 l9 U    mov     es,di
5 t  c; R: n) m2 \; w6 y: q    mov     ax, 1684h      
/ a+ q/ n+ k8 J  {' }, R    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. V7 G" Z+ U9 V$ d8 B    int     2fh
$ \" `$ w& ]6 l) i4 i( G    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ c# Z& Q4 z! x; Z
    add     ax, di% O% ]+ R# Y! q* x
    test    ax,ax
( _0 l% q/ ^3 j' S1 ^4 ^    jnz     SoftICE_Detected0 |7 A: o7 z& L0 y/ k
  I8 o+ J# p3 `" T
__________________________________________________________________________6 V" g! a* X/ X& U2 x2 N* k

9 K: @6 b5 A/ n! W# t- B
" i: K1 x7 l$ MMethod 05' P9 V+ @2 |& }8 T
=========- ]; Z- d& ?1 g
& t' Y! O$ t, |; M, C0 n% c* m( j6 q
Method seeking the 'magic number' 0F386h returned (in ax) by all system
) ^( Q$ h+ J# z3 E4 g/ S  Cdebugger. It calls the int 41h, function 4Fh.
! `% d1 f% G$ WThere are several alternatives.  
7 }$ ?7 ^8 n9 c* ?4 N1 t/ L5 _
" M8 G5 x4 a, ?6 g7 U6 pThe following one is the simplest:
8 I- c( \. o0 b$ g, K
6 j& j$ Y: Q" m. v2 l    mov     ax,4fh4 Z+ ~" g% p. U$ j, x. ~
    int     41h
8 z6 e& {8 k! _: D1 ^% S4 M9 T/ g    cmp     ax, 0F386
' O. I# u. l- J8 B    jz      SoftICE_detected; ]* m8 _# b* t3 L& F6 a" w" s
% b1 b* d6 b$ m/ N. ^/ B  j, O
: G1 n& j& m4 R& D5 T
Next method as well as the following one are 2 examples from Stone's 5 ~3 J1 B8 w( ]7 s; S9 E9 i1 c1 [
"stn-wid.zip" (www.cracking.net):8 t4 K1 n8 X8 r- E4 D, Z
& h: h8 j: A( N- w. K& w% p8 z: [
    mov     bx, cs7 I) ?: e" c( O( I/ ]( ]# _2 C
    lea     dx, int41handler2' T/ D( {8 b8 O/ i9 F
    xchg    dx, es:[41h*4]9 |6 j. M7 p, C
    xchg    bx, es:[41h*4+2]
3 D6 `3 r: G$ c    mov     ax,4fh* q) N" O9 K; f) B$ X  T4 i' s9 I
    int     41h
* k2 `5 b1 L: c2 v. [$ R, Y- N: H    xchg    dx, es:[41h*4]
* u  w: \  V% G% c7 e: B; K    xchg    bx, es:[41h*4+2]
. t0 b: w8 Y2 ^# r' y6 M1 C) ?7 L    cmp     ax, 0f386h% W9 z5 s1 K; S, W: S
    jz      SoftICE_detected; e2 v  @. f# W0 r

6 z2 R4 a% u5 Wint41handler2 PROC* y& r" D6 ?9 ]: L
    iret
& j! [+ j1 J$ F# G5 Bint41handler2 ENDP
; T2 e8 C% o8 I6 _- B* B1 h' j- D; `; a
7 a! e8 V! _  E; S5 X
_________________________________________________________________________7 }5 E% U2 S3 d% ^
. h! _% a0 t5 ^+ Z
6 g1 S9 u$ P% Q$ a' u% o
Method 06
: H: b* v7 A9 e=========
$ `. I5 @" [6 _) M  @( {
# S! E' X+ _5 v
" l, `9 j8 }! z. z6 L2nd method similar to the preceding one but more difficult to detect:
8 d# ~* [0 T# \) y
! H/ `# W$ K4 F* U# [" Y4 P+ @! d5 K4 W, p/ U0 ]7 g3 u
int41handler PROC1 o9 Q5 n" f2 e
    mov     cl,al1 [" ^5 K2 C& e3 J8 a) n
    iret8 F( B2 \% m& J  O' V
int41handler ENDP
6 ]/ `7 o0 L: t2 S8 m% ~% |
3 m, H8 L) V% ?* m6 t  p& e  \1 E- g' w; f% D. u
    xor     ax,ax# ^3 T- ?7 X7 B) e. S
    mov     es,ax& l' L  p% W7 W* X. V' y
    mov     bx, cs5 u& o5 R$ G5 d. N* n! @# p
    lea     dx, int41handler
: ?( O* Q( t' S9 I0 L1 u    xchg    dx, es:[41h*4]
9 C$ M# _+ o8 n. ~' |/ V- z    xchg    bx, es:[41h*4+2]' D/ D+ F& r" i; ?9 C0 t3 |$ `# @
    in      al, 40h+ D+ Q! x6 a7 Q) T3 G6 i! ~) a
    xor     cx,cx
, Z# j0 t! P$ t4 t! D( k( n    int     41h
% x" D% c( r6 M( a    xchg    dx, es:[41h*4]4 b$ |7 Z) t( Q1 J' ]- q* O/ k
    xchg    bx, es:[41h*4+2]! }8 R$ X8 e  ?2 B
    cmp     cl,al3 u. N- f9 ?1 M9 L  @
    jnz     SoftICE_detected
- z7 K' v2 U/ [$ i( h( t' r3 M+ v: v4 k+ Q
_________________________________________________________________________- F8 O: M7 O9 g- O: V6 n% r

$ J3 X7 g! N* F0 S9 ?& {  N: ^9 dMethod 079 ?' \# j) i9 ~6 |1 p! u
=========0 |8 T; u) A' Q: Z2 J/ E
& o  Z( F0 W9 I4 P. v* K
Method of detection of the WinICE handler in the int68h (V86)
! K4 A$ @5 d, n+ K+ E
0 D* X0 K+ F  b    mov     ah,43h
! P2 f6 x; w3 \* N1 f1 W, }/ }/ p' }    int     68h
9 G" [+ h; r. g: }* u3 `    cmp     ax,0F386h. ?4 B( K) p9 Q' x( k% p" v9 X0 z
    jz      SoftICE_Detected
% m, [6 Z; U% Q/ S! P4 E* O
* ]! Z. x- E9 T5 q- V( ^! o- w
1 \% }4 b) P' D8 V) ]4 T=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' v0 v4 `: k  [1 N4 f
   app like this:
- s$ j( K1 X1 L: S% f
& s# _" L% j- A( C% I   BPX exec_int if ax==68
* L8 u& C. t' R+ I- Y   (function called is located at byte ptr [ebp+1Dh] and client eip is3 B) Q* i  m, I% O) N
   located at [ebp+48h] for 32Bit apps)
. o( k9 X2 K' ?6 \__________________________________________________________________________( H' q" k: Z( l+ Q2 t3 y7 F

) y8 U; R4 g" ~; a# p6 k1 |$ n$ ?4 {7 j# i- @
Method 08
' f1 O# S6 J1 K. ~8 M=========7 Q7 R5 _  l, k# a

* p% H* G$ ?; ?- X  R/ J; f6 B; pIt is not a method of detection of SoftICE but a possibility to crash the
) }# e* |7 w. N$ ^. Asystem by intercepting int 01h and int 03h and redirecting them to another' N. \5 a9 H0 ~
routine.) W  g" G9 q: F$ ]8 \9 T4 K
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
# V1 J& p  \: w- U% o2 F! Gto the new routine to execute (hangs computer...)
/ y1 x2 n! }: v! z6 _5 M1 `& [3 n3 f. q5 }
    mov     ah, 25h" [: M9 O2 B4 p' y+ B2 J. g4 k
    mov     al, Int_Number (01h or 03h)
% T2 L5 D2 p& Q' ?    mov     dx, offset New_Int_Routine
# G% }, i7 @; W( s# ?. Y$ L  C0 B    int     21h
, e' q) A* y6 ?6 L1 C" g* U2 K; [) n) @
__________________________________________________________________________6 T5 o( T, s8 ?$ I6 G
. A* q2 z" h: h' B
Method 09
; {4 e$ f) |& A/ Y  a) f=========
4 M" A& g& ~1 u) k8 B8 N1 R7 \/ t- P* k( q$ p- i  j
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 Q/ n9 H! h) t- y/ Sperformed in ring0 (VxD or a ring3 app using the VxdCall).8 H7 U9 f7 n# m; j
The Get_DDB service is used to determine whether or not a VxD is installed
& ~3 C2 n- j& @, e! Mfor the specified device and returns a Device Description Block (in ecx) for+ x3 `8 x6 j! n
that device if it is installed./ v9 B8 [4 W1 [+ A" ~* v
0 _/ I  M/ V7 _7 ~
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( n( n9 k) @& Q$ y0 Z
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-); P0 h7 e9 a2 V7 D
   VMMCall Get_DDB
' L6 l: o6 V( e, y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 v) [2 O- e: Q3 V. K8 V, r& A5 x6 K" J8 w' t
Note as well that you can easily detect this method with SoftICE:: U9 c0 |/ b; y
   bpx Get_DDB if ax==0202 || ax==7a5fh
# V: g- c4 `* ^8 l  r6 b! J. F3 f1 |' c$ k0 x
__________________________________________________________________________) t0 N) p6 U* O, y& N) f- y. X0 G# k# v

9 l7 F( H; P8 _& m9 l6 ?  u8 aMethod 10( j' x; d0 ~3 X, V7 |0 l% u- R
=========' a; i9 M* o' H8 N. _# a; U5 Z
! R5 h8 Z! L' `6 O( M5 M# z( p
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with1 g5 d2 j3 Z/ U1 ^/ l2 F# r4 j
  SoftICE while the option is enable!!1 S/ Y6 x7 u: K) E

# x5 N3 r* X9 V% OThis trick is very efficient:: s; V( }" y- B& M9 m/ L1 U& i# _
by checking the Debug Registers, you can detect if SoftICE is loaded. I4 [: I2 n7 h) K. ^
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if: H2 G. c6 q3 n
there are some memory breakpoints set (dr0 to dr3) simply by reading their* ?" Z9 \5 u4 b1 E
value (in ring0 only). Values can be manipulated and or changed as well
, E& S; J) P, p6 h# }(clearing BPMs for instance)  A. b  `1 l. h, _

  K' q5 G/ s: \& F; [: t) F__________________________________________________________________________
; B/ s4 v# w5 L  a  m0 q: E' s
/ Y# N$ D% c" v  I8 QMethod 11& X; @, _6 I4 {* h) _. s$ x
=========
5 U4 t1 k, L& Q; K' H7 o' R  \6 u
8 W1 G2 k/ X: r0 n& ^6 G& p' o- mThis method is most known as 'MeltICE' because it has been freely distributed& y% u* n0 n0 b! Q* T2 ?
via www.winfiles.com. However it was first used by NuMega people to allow7 J% O5 K  V5 p0 R% ~( ?6 q* Z9 F
Symbol Loader to check if SoftICE was active or not (the code is located
: T' t# D. Z8 j; l) j; e+ Minside nmtrans.dll)." j5 Q0 m) i5 b4 d1 m: g) K" N

( x! m5 D1 z: h; s& n# `( ?The way it works is very simple:
% K9 _. ~1 U5 r. P  nIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
0 G( A/ _. Y+ p- ^: @6 j7 }WinNT) with the CreateFileA API.
1 S/ x6 h( j* S3 y6 d+ J) A6 H4 Y0 O& \- n) y. \+ g- w
Here is a sample (checking for 'SICE'):) n$ c# l2 S2 x* g5 m' U) R
/ Q4 Y- g) j' I0 p
BOOL IsSoftIce95Loaded()' }3 a/ J4 z6 c$ b& u
{5 b8 k6 ?2 I6 M$ S
   HANDLE hFile;  
6 v- ^+ H' a9 j* l" }; L# {/ m   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,* u6 \* S: o  B' g% r5 X' P
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
5 V1 @4 e, H7 P! f  v# e/ P                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);* a- \% h, L: x* D0 J
   if( hFile != INVALID_HANDLE_VALUE )
. k8 @# Q) a$ a2 Z4 ^. z2 J   {
' c+ O7 J3 g9 ?1 X3 Z1 |% F      CloseHandle(hFile);
, l8 b, ~7 G. m3 T& v0 C2 t      return TRUE;% D0 i% g# E6 k& {9 c7 I* n
   }
- g: I7 a6 ?0 O* S9 q   return FALSE;
3 F# H9 n* {( J! o  ?}
& |' x7 h( [2 S" z+ Z# M) A" i3 ^  y" K7 t2 c: S+ G; Q
Although this trick calls the CreateFileA function, don't even expect to be+ ^+ P+ C; |3 s' c  P2 R
able to intercept it by installing a IFS hook: it will not work, no way!! D9 u! c- ]* s9 u4 H4 `$ o3 Z$ d
In fact, after the call to CreateFileA it will get through VWIN32 0x001F; g2 s" O6 P& s% m
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)+ }1 G/ ?1 \0 g5 w3 s$ b0 b9 {
and then browse the DDB list until it find the VxD and its DDB_Control_Proc$ F( t  F, V3 [) a6 Y
field.
+ e3 i- _/ o- ], K8 b; cIn fact, its purpose is not to load/unload VxDs but only to send a
+ Z# Q+ B# v$ W( O; V: ]W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 U2 Y) v2 t; n3 G
to the VxD Control_Dispatch proc (how the hell a shareware soft could try; z* W. H  y" t; }, C
to load/unload a non-dynamically loadable driver such as SoftICE ;-)." |4 @/ D) J. A% e& V3 F
If the VxD is loaded, it will always clear eax and the Carry flag to allow: N  w5 D1 I" y  \: s
its handle to be opened and then, will be detected.$ p6 F; _" J  ^
You can check that simply by hooking Winice.exe control proc entry point
( e, Y3 \% ~, j0 P& Uwhile running MeltICE.
! I& S6 h$ Z% d2 Z, x, t: E7 ?1 E0 ]

* ^% _% K! J" b5 A! T. q) i! ]7 i  00401067:  push      00402025    ; \\.\SICE
# o# j. S' M+ C7 I4 Z: M  0040106C:  call      CreateFileA' h. g. e' |0 r: u
  00401071:  cmp       eax,-0012 i8 N$ G, ]; q; V) s8 P# l) b
  00401074:  je        00401091
+ c, T/ ^% ~; ^: Z3 M1 @# @) j" J% c% ?9 P, K
) U3 ^- A* p9 y, a5 T
There could be hundreds of BPX you could use to detect this trick.2 |) E/ |- d+ q  V: d+ R
-The most classical one is:
$ c  `7 D5 A  C  w: U3 Y  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||2 L$ R" B6 }. H5 N  E0 {5 n
    *(esp-&gt;4+4)=='NTIC'
8 F) O5 H: F, ]: c; P$ ?
' z4 t1 v" `+ k+ n/ w; n-The most exotic ones (could be very slooooow :-(% ]" Z( Q4 T0 ?9 h' A
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
9 S" x) a  i9 L/ z* [     ;will break 3 times :-(+ b" \7 u5 P: o8 ~, F

- |" ]% ^1 ]8 e( S' y-or (a bit) faster: ' Q$ X% @& {8 y4 g9 f
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
7 ~8 H9 ?9 ]# j$ R! \5 B2 [! V/ [+ c+ D. B
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 u5 L8 f3 I: Z     ;will break 3 times :-(6 k2 Q$ ^, b5 w9 O) d

/ M7 z8 A$ S- F& c) `( N0 K-Much faster:) |1 z) R& B$ Z: m- w, w
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
2 }/ P  s" p) Q& Q! Y0 s- }4 P6 s! y8 |) x; R
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen7 k7 ^9 [. [3 H: s, }3 N
function to do the same job:- t& d7 h# G7 z. Z

8 e6 \: s$ w# B! `   push    00                        ; OF_READ* a3 |$ @' q; P9 s# V" s
   mov     eax,[00656634]            ; '\\.\SICE',00 \5 V1 A- ^5 K2 C& G
   push    eax* S4 t+ H  O2 \" a. e
   call    KERNEL32!_lopen0 X9 a. k6 N) h) \; P+ G
   inc     eax& H$ m, B: P7 {
   jnz     00650589                  ; detected5 b1 ^! C: ?3 _' \5 O4 d/ s+ m& q
   push    00                        ; OF_READ/ [. i3 l; @; S* X" e- L/ Z& x
   mov     eax,[00656638]            ; '\\.\SICE'* C4 {& ~: y7 B: X8 g4 l8 t$ m
   push    eax2 R9 Z* P% F. p" n3 F
   call    KERNEL32!_lopen7 s6 L8 R7 y# n% G; e
   inc     eax" k! D) f0 k9 N9 D, ^
   jz      006505ae                  ; not detected* p. N2 ?9 r0 K* c
" s, r6 z  X# @+ E4 e

3 \8 I1 U/ q  q/ F0 h* r- G__________________________________________________________________________
/ Z9 v" e  i* w! u/ A' B4 k, J$ D2 O
Method 12
% @; _# y2 g. v: r=========/ O) p5 k" O+ ]3 ~2 F
- b7 a7 V1 i+ c4 U5 T
This trick is similar to int41h/4fh Debugger installation check (code 059 H9 Y: O& I4 d5 T" b
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
, v7 F' @/ j  L# B' I9 E: r1 Xas it uses the VxDCall backdoor. This detection was found in Bleem Demo.( A) S8 g2 Q+ n  w

3 ^/ a6 n9 v+ P% U& q5 _   push  0000004fh         ; function 4fh
% J8 I1 t4 X. r& U   push  002a002ah         ; high word specifies which VxD (VWIN32), M3 w) G$ k' _/ a7 A! g
                           ; low word specifies which service
# N: q: @( O0 e                             (VWIN32_Int41Dispatch)2 ]) R& F) j" z: F# o4 {
   call  Kernel32!ORD_001  ; VxdCall
  }/ W+ |+ `* [4 C6 I3 w   cmp   ax, 0f386h        ; magic number returned by system debuggers2 J# Y: |# |2 K5 B* c- P; S
   jz    SoftICE_detected9 W6 Y% L9 o* T6 ~

6 `1 {. d' r& A2 I; OHere again, several ways to detect it:
4 a0 b8 I$ N# K2 J! N$ D2 m4 [  i6 X5 ~) V) A" d( p
    BPINT 41 if ax==4f
0 k& b4 N: S) A* k2 E* p0 X; V$ |4 [5 B- i' C5 k+ M
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
' F& u- q7 P/ @
0 ^" c! t8 L6 Y# T% V. ?    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A/ Z8 T  P- V) ^& M/ r- ]/ ]7 F7 a
/ P, e; W7 f/ i; _4 U/ s
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 p( ~+ F7 Y, `0 W4 b/ m' v1 E# j# N! R9 n, d1 k% I) W) p2 K/ }
__________________________________________________________________________& K- y7 X2 _  V
# r% j+ d3 a+ F0 {+ R
Method 13/ F& f: o" }# @6 P
=========
) Y( N8 D0 @+ _/ }/ D$ ~. \9 s6 X  v- D, f- f
Not a real method of detection, but a good way to know if SoftICE is
5 U( ^2 B) l! W/ W0 W9 G1 Hinstalled on a computer and to locate its installation directory.
6 D. N' F7 v2 gIt is used by few softs which access the following registry keys (usually #2) :
5 S" _8 i5 {5 p' Y/ g" H$ R1 H( k' i
& t! ~7 ~! {1 U* }! Q: U, Q-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* \) g( C. u' s9 @
\Uninstall\SoftICE! t1 p0 D- A; a, e- D1 B- v
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
0 k! M7 u. `, P-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 G, C+ H4 Z* S
\App Paths\Loader32.Exe
+ O: `# c% x& C7 s2 n) |' U  p6 F) x
0 L* @. v6 G- f4 V0 h! j* n6 v6 v4 _. T
Note that some nasty apps could then erase all files from SoftICE directory
) _  L: h/ L* B( f3 |8 C(I faced that once :-(% I4 f3 p( M) K$ {" T$ i% ^) P" w: d

. z$ k4 v( Q. C% C9 X4 h- cUseful breakpoint to detect it:
: W# ], Y0 `9 c* y/ Q) I! A5 h
. s& ?0 k  M$ F6 d0 y5 ^/ T' l     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'+ Q; M9 i) j% R& c5 ?) W

% j) W* f6 e6 n: Y__________________________________________________________________________/ h' I' }* W& F: L7 y! U8 L! W

& L8 J) I* S& b4 ^
& x2 ^% H$ ]! h, Q4 |* a7 H2 gMethod 14
. B1 r* o; [; x% R# ?! p' O=========! T* |" k3 A8 K2 U
" E/ n$ d7 U- {- t! {# U
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
" k+ [$ X$ k$ t" T; f; kis to determines whether a debugger is running on your system (ring0 only).
6 z6 v* J: u- O& L4 u' G9 S2 [. ]7 k1 d; I
   VMMCall Test_Debug_Installed
# U8 o3 ]0 E( O( w3 ?4 T# z  ]   je      not_installed
3 @1 F+ @* ^& L- C& y( C+ @
* F$ g1 T$ D+ O: ^) OThis service just checks a flag.5 y/ j* V8 C. e, n8 r% X9 N6 q
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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