找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
" X: ]7 m3 l2 t: g. P( x5 x<TBODY>, ~2 i. l  `2 E1 p" {" M8 \
<TR>
8 Q* c0 u- o* Y4 O+ [<TD><PRE>Method 01 1 }! F* t! ^/ L' S: E# H
=========* g' n4 A4 N  h: Q1 a0 |3 ?4 j2 P

0 ^# W. }/ @* m# L; xThis method of detection of SoftICE (as well as the following one) is
/ P6 V+ J. m( `used by the majority of packers/encryptors found on Internet.* N# l4 p8 {2 B+ z4 V. U
It seeks the signature of BoundsChecker in SoftICE
/ ~/ N, s" X+ B+ M
5 l. e5 m# N7 K: g% G; }6 \( B    mov     ebp, 04243484Bh        ; 'BCHK'
9 M; A9 h4 ~- B    mov     ax, 04h
& r) ]; {7 @" O  r* Z7 t4 i    int     3       ! {, \; D- p# }# G/ V6 f! c
    cmp     al,4
, C  O2 B' O1 u% z    jnz     SoftICE_Detected
; |, W  V5 q+ O5 O) a4 P# o/ s4 a7 p# v3 J. z# O3 ^# u
___________________________________________________________________________2 j. |/ r- Y. p

3 Y- W& f1 Z+ P" `; BMethod 02
! t  x. U  s- C% P+ W2 G- h+ ~=========3 T5 B8 \; H3 a
- _4 c* S5 d0 y9 w, @$ Y/ \
Still a method very much used (perhaps the most frequent one).  It is used6 K# B# Q7 H) g1 u; l! {, b2 a$ J: j
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ I2 T% i4 O& W7 Z- f5 f3 ror execute SoftICE commands...
" }+ G9 Y* Q7 X0 G4 ]" ]; ?It is also used to crash SoftICE and to force it to execute any commands+ t+ J7 O. O* x  z4 [
(HBOOT...) :-((  " S, M( _  |2 V5 R3 b& ^. A) O6 E
; O6 C6 B/ V* g( S- K
Here is a quick description:2 V& s8 G$ t" S' M% u) E) f: |
-AX = 0910h   (Display string in SIce windows)% ~) i+ Q% I3 L/ I: M7 [
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
; w  _0 N0 Q5 K, O5 ^-AX = 0912h   (Get breakpoint infos)+ f- w9 @0 A7 {/ v
-AX = 0913h   (Set Sice breakpoints)
+ L8 Z" W& F9 S) l-AX = 0914h   (Remove SIce breakoints)
$ ]' ~3 s: M4 V2 T& w. Q+ e' ^! u7 L9 x2 i' F' b/ b8 \# o
Each time you'll meet this trick, you'll see:1 X7 e* Z/ T3 M
-SI = 4647h
$ t4 e  T7 l$ P; Q3 {2 J-DI = 4A4Dh# N- T9 h: N/ y3 I' E/ b( M5 a* {
Which are the 'magic values' used by SoftIce.
+ x& J  P& K% q8 @. B+ z# j2 BFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.  j0 O' C/ B. l( s
2 {- E5 j* i$ d% ?+ C! Y
Here is one example from the file "Haspinst.exe" which is the dongle HASP5 U$ e# J) T7 v
Envelope utility use to protect DOS applications:
9 c  C' ]# N2 g% @5 p: |* J
  h( ]9 o+ X- h$ E! F3 f$ z0 p" A# N( Q4 l  j/ W. w" K* i) @  p" R
4C19:0095   MOV    AX,0911  ; execute command.
+ D- v# E, @# O) r; A4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).( S! J) _, ]+ L7 n% m5 p1 k' k) O1 h
4C19:009A   MOV    SI,4647  ; 1st magic value.
- _3 O; o: x* \  c) f: y' a1 {4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 [$ d2 k+ v- F0 x. G. r( L- ?
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
& ]; k1 E/ M* o( l4 v4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
0 m4 }! B8 D! Z& ~/ B4C19:00A4   INC    CX8 X* x  K9 J3 \2 w
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute2 A2 _, l( C( b: L0 c2 ~
4C19:00A8   JB     0095     ; 6 different commands.! X! l: k$ |) S0 b; k" L( y
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.: O: h# w' \8 B/ w* g$ F7 O  _
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! C& p* z$ C* P2 L5 K

% D3 [7 ~8 N9 q: ^9 ZThe program will execute 6 different SIce commands located at ds:dx, which7 [: x' N! _/ K
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
8 i" n  n; W. h1 [! M) h: y
3 m8 s7 B* o4 U( q: D8 \* q" n- D* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: i) X% {* ]9 A0 O' J1 b* O___________________________________________________________________________
' P. B8 o) c2 L
  `9 F  R! C* o0 K9 Q/ e$ {# V3 n
) R0 {. o$ l" V: I$ x: ?3 s5 sMethod 03
, f0 @9 \% i7 ]/ H! e! w$ Z=========
: f$ _" B" h0 r5 V
& T* b. O$ Y1 h# {& W0 o4 o, RLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
0 T. S5 }$ H  Y: F(API Get entry point)# q  D: N5 E. ?4 v
        
4 b) L+ U. ?' u+ ^
) D) L: r/ T# t* _2 g    xor     di,di+ D* e( \, [% W
    mov     es,di+ q& G4 ^! g$ l- e4 Z6 T' a
    mov     ax, 1684h       * o+ c, R1 u0 J( ^, k* i1 G5 a0 a7 j
    mov     bx, 0202h       ; VxD ID of winice7 L' q8 |- a* j
    int     2Fh
3 Q- {0 d# t: N- Q! e" P6 S    mov     ax, es          ; ES:DI -&gt; VxD API entry point* U% o- u* ?3 ~. R# j6 t, h, ]
    add     ax, di
5 Y7 x( n, h5 @* ~! u5 S  Z; Y    test    ax,ax
  D9 g, X" r4 Z$ k    jnz     SoftICE_Detected7 S& G. [! c# b7 h- h" R. ^7 m

5 ~6 O1 w6 }- t. s. s* d2 P___________________________________________________________________________
" t  W& O# _1 H, L& I5 [2 o/ D$ @, o7 g# J4 }  p
Method 04& `8 U) Z' f+ G" e9 p+ [  k8 @
=========1 E0 b& [7 w8 B% S* Q

( W* S; I& x& X6 w4 S8 G: GMethod identical to the preceding one except that it seeks the ID of SoftICE, @" H8 e& R+ V
GFX VxD.
8 j# Q- U: V0 g4 c; ]1 N) z+ k4 E; d5 X. T: }3 [
    xor     di,di4 N4 G' z* j) X
    mov     es,di/ y' J3 P) @' C# z7 I! l: y( t
    mov     ax, 1684h      
% r6 i8 Y  ?/ I' e' l    mov     bx, 7a5Fh       ; VxD ID of SIWVID5 _8 l! M' B. _6 d$ U
    int     2fh* Z4 y7 b. b" K
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* ^% E2 e3 W, c    add     ax, di+ L/ f. a2 w& U% l' `+ M
    test    ax,ax
5 [& X+ `' @5 m& H( l% @6 s    jnz     SoftICE_Detected6 y' N" q+ o7 a

0 g; F  A! a& `4 b$ A6 h3 S__________________________________________________________________________
/ Q" T- u) U1 W: d! ~; G- R+ X* Q3 ^/ k

( S0 i3 q! W+ I  wMethod 05* n  x- \8 y3 e2 `6 Y
=========+ Q5 T3 n" ]# a2 S  f
' C' N4 w8 z# `( F' v, f
Method seeking the 'magic number' 0F386h returned (in ax) by all system( o; W& V/ w: S5 p) N2 N
debugger. It calls the int 41h, function 4Fh.3 Q6 q2 Y2 V3 p1 p/ t  _- l
There are several alternatives.    c2 M% U$ @6 C$ B" N  V
  Y" u, m" f8 g( b& K
The following one is the simplest:( `" u( o' l1 o

3 q* @5 Z3 G) ^* p8 [: d    mov     ax,4fh; t3 v2 V/ t" ]. h) @9 C: j
    int     41h  a" U- _7 [6 `, V& v. z$ l" U, `
    cmp     ax, 0F386
9 U6 @* v" Z; o$ |    jz      SoftICE_detected9 @9 Q1 T# L/ f! {

) r0 [$ m. R) f* R- D' C/ c' r4 {; j% ]7 c* ^
Next method as well as the following one are 2 examples from Stone's
, r  n( T& J! v2 x% O"stn-wid.zip" (www.cracking.net):
, {$ m+ e7 @. u- t2 L
2 D* w3 A9 S% o5 ^7 Z4 o    mov     bx, cs4 X; R$ M1 f9 l
    lea     dx, int41handler2  y! M3 A- ^$ E5 A  r3 K
    xchg    dx, es:[41h*4]" r  j) t8 R0 Y2 m# A
    xchg    bx, es:[41h*4+2]# w6 {3 Q  o( A
    mov     ax,4fh0 F& j) k( K2 _' ?* t
    int     41h0 j% Y' Q: W+ g* V( M- Y. }8 m' r! T
    xchg    dx, es:[41h*4]
" W* d! B0 F9 B3 j# ~; r. \    xchg    bx, es:[41h*4+2]
$ q2 o8 t1 D% A- g+ @    cmp     ax, 0f386h
$ C" ?; v# J& T& C4 l* L+ [    jz      SoftICE_detected7 b- R- \! D5 B5 I' y' T) _+ m
+ D/ n! a, O3 c$ R( @
int41handler2 PROC
- l) p, G2 H7 s- P* O* F: x0 R    iret6 m8 x# e. g2 ~8 Y+ \
int41handler2 ENDP& f% T. \$ {8 t4 z8 f; x4 s9 V1 v

4 I9 }4 j1 ]8 j1 R" ~- b" w1 \2 G& w# v/ s/ b0 U
_________________________________________________________________________
$ A8 [" I6 I+ p+ P. v2 D: s+ N3 n+ f" h& l6 S- F7 A, w) Z) s4 N  l2 ~

% H' |( q$ R" l- ^6 O$ h0 ZMethod 06
" s# q" \8 i$ ^# w- U3 \0 x=========, m# I4 ~% r! e2 @. b( h- ]8 S
4 t% e. g' c. j. Z% @' [4 W9 F( m

+ j/ ]6 z" \. N9 F; ^3 g, t2nd method similar to the preceding one but more difficult to detect:& m) u3 ^4 D/ G) d

, t7 T# |: P0 Y% A3 C6 Y7 K/ _9 m
int41handler PROC
0 f' H3 C2 ^# J8 t6 z    mov     cl,al" d2 R7 C% r8 ^) Q
    iret
& r: f+ @( s0 T! j% pint41handler ENDP3 M% s; o% [7 |! R" s) \' v: k

2 U0 M% }: ~! g( r/ O/ ^5 b( j& |
' p8 o& _( R: x4 }- ]- C& r    xor     ax,ax$ a. x* f' R( a7 h7 N7 z
    mov     es,ax
4 I8 v8 w- q, ^- T& G% m! `( C    mov     bx, cs
! n6 t, m! b' W9 d3 L    lea     dx, int41handler
3 s( r6 v; @) E1 i8 @    xchg    dx, es:[41h*4]7 s( S3 B; ]3 q
    xchg    bx, es:[41h*4+2]) ~; J$ }( n2 B- q
    in      al, 40h
' G* w+ Q" H/ O: I8 W    xor     cx,cx2 w* X$ a0 s" c+ f- n0 a% a2 q
    int     41h
1 ~6 x" z. ~/ [- L' q; c    xchg    dx, es:[41h*4]
, p5 B% X: U2 ~+ X+ o7 H. e- i1 Q    xchg    bx, es:[41h*4+2]1 o/ ?; D4 H# c4 M, W, a, D
    cmp     cl,al
0 l) q  V( B2 o# H% z1 K" z    jnz     SoftICE_detected
6 |' a: H9 F. ?0 A( y6 S
0 v) ?3 Y: ~( A: U_________________________________________________________________________
$ Q4 H+ ]0 C. f
8 \& u1 j" z+ `; ^  [/ MMethod 07
+ U3 D9 D2 y) ?+ ^3 u=========- n6 t: F7 l' {7 N9 x% H
) h; d+ k+ J2 T, a- i
Method of detection of the WinICE handler in the int68h (V86)
2 {" b1 W" h. M: ?6 m( u7 Z+ [9 M# {! p
    mov     ah,43h
0 |( c. v0 r: {( p1 M7 Z) x    int     68h: J6 U1 V( M5 t7 E# ]8 I
    cmp     ax,0F386h8 l* w( k% r2 Z2 c8 k( c+ g
    jz      SoftICE_Detected
7 Y1 J3 ~+ W: q" V, r8 ?
- f) {) q& r4 @  c
. u- I5 r  I( T' t; `=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit1 E. a& P; X5 v+ P5 v
   app like this:
3 t0 |- |. J% T  m- V" \! y
) e: T/ `6 e5 R$ D3 Z7 P1 J; z   BPX exec_int if ax==68* O, K& n* T: k1 P
   (function called is located at byte ptr [ebp+1Dh] and client eip is
9 X/ ~& V7 T6 p   located at [ebp+48h] for 32Bit apps)
0 q! T9 G6 {1 t2 I) Q* V* }__________________________________________________________________________
$ P/ E+ P: p+ R; c+ k
7 S. U! H" P  l+ E( H
. {9 i7 A# L* ^. P* x  BMethod 08: u3 [6 a- o6 F
=========
3 @  z3 o2 L- {3 x5 N. l2 s: _6 h+ r2 P
It is not a method of detection of SoftICE but a possibility to crash the
9 g4 r- q1 y- u" J. B  F3 |1 nsystem by intercepting int 01h and int 03h and redirecting them to another# J2 c# H$ C3 q9 r! X! _" A
routine.  q; P5 U3 p) g& N! I
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
! m2 ?) @7 }1 o6 ]2 Wto the new routine to execute (hangs computer...)
4 F: p% i! u% ?6 h- Z, E4 w
3 \9 o! Q. s/ o9 v0 e/ A" _    mov     ah, 25h
, \0 _6 V& P; T# E# g; o/ P! i4 z) `    mov     al, Int_Number (01h or 03h)
1 P; U, _) K! _- K! S  B* c    mov     dx, offset New_Int_Routine! `( h0 S# D$ e% ~0 ^
    int     21h
9 }- O  G4 \* T- Q$ i; D: K9 l0 l) v; b% I8 I3 K2 |
__________________________________________________________________________* |' t* R* l, u% w& a0 m

# d3 j2 i4 d: n' D$ B. ^Method 099 D# G- j0 B# G% `
=========
: ?8 o* y$ O# {2 x/ [/ g' B' k) m) c  ]  R2 f7 p
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only6 @& M8 ^6 {/ O* A2 b8 f
performed in ring0 (VxD or a ring3 app using the VxdCall).
3 s3 _- {4 b1 g, L) T: B% K. VThe Get_DDB service is used to determine whether or not a VxD is installed
3 q: j8 u3 v' kfor the specified device and returns a Device Description Block (in ecx) for/ W; M7 v% r' L  A& R& H
that device if it is installed.. y+ h2 J- a9 j2 z

) j1 E9 t8 E( i3 b! f* u" D" r+ @3 _  t+ y   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID) ~" n1 i2 k" @
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 s' F: e1 d& Q9 G3 \
   VMMCall Get_DDB* U; r" v. T. h! E
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed5 i% J$ o) w+ H% Q6 B

% }7 ~6 A& d9 m$ vNote as well that you can easily detect this method with SoftICE:
( ?+ j% b4 m' p7 r3 c   bpx Get_DDB if ax==0202 || ax==7a5fh
& V  v' ~; s/ ~8 G1 k
8 w. k/ ?# |1 i6 g__________________________________________________________________________
' t" H8 |. S. Z2 X9 i( u! G& o/ X. r, O( @  e, u/ S$ f
Method 10
1 g. `2 V" s6 i* `* h% p6 Z/ m=========
' d4 h- R7 `- ]! _! Q3 ?5 z8 Y3 r0 ]- B: U7 R: i; ?* L4 a) P
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* _8 e, W& n) ?; g& b  g2 P# F! x  SoftICE while the option is enable!!; K& T% M# g* `: |. I

6 z8 T( C. R7 F- BThis trick is very efficient:
- v/ R  Y, Y9 x0 G8 g% Dby checking the Debug Registers, you can detect if SoftICE is loaded
' C% e1 g0 K( \7 J(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if1 c6 M! Z' D/ r7 \
there are some memory breakpoints set (dr0 to dr3) simply by reading their/ n7 y3 x0 j- K# [6 u1 y# P
value (in ring0 only). Values can be manipulated and or changed as well
, U, n% t4 x1 b* C(clearing BPMs for instance)
, o) Q+ x: ^+ a: z, e. W( K" V! |/ U8 R7 m2 m
__________________________________________________________________________
# _  _7 [- N3 O/ @6 N6 G2 T. U8 P5 D
8 m+ a$ F( j* {7 @6 GMethod 11
9 Y% r0 c1 Z/ P- |=========& z7 l5 p/ H+ v; ]- \

3 T' I5 _" A1 G! X4 |0 MThis method is most known as 'MeltICE' because it has been freely distributed
4 ]; b5 m. s9 j$ H7 fvia www.winfiles.com. However it was first used by NuMega people to allow: g3 o5 p, X' x% D. ]9 F5 f+ ^' S! D: G: l
Symbol Loader to check if SoftICE was active or not (the code is located. E& _# m. f  ?- a, b5 N
inside nmtrans.dll).. |, T  y3 d1 T" H

1 H; P! n6 ^8 R/ t  x$ P5 @The way it works is very simple:) j* D, U' w- v& P; ^
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for2 T, W- p) t0 k+ U2 \; H
WinNT) with the CreateFileA API.5 \% B6 u( Y. Y6 s4 G2 d% p

0 q2 T( @: B8 s, \, {1 dHere is a sample (checking for 'SICE'):6 S; Y9 i  H7 O. T3 s

; m/ R# j! u. I" ~! IBOOL IsSoftIce95Loaded()
/ d8 W. y" h& ^( |% ^- g. w{1 k9 G9 B9 w0 t# k$ T- B
   HANDLE hFile;  # @+ B% X: @% r- R* k
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,/ _- r+ v% o' H1 e! z; o. W# M
                      FILE_SHARE_READ | FILE_SHARE_WRITE,  H6 C1 n0 H. v% C5 z/ y  \! o
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
' b, E1 f) ?0 }! a6 x   if( hFile != INVALID_HANDLE_VALUE )/ o& p/ }6 }' U+ o% Z! i. x1 M
   {3 R' |' c' G5 v6 K
      CloseHandle(hFile);/ u) r( F, B) N5 M: E
      return TRUE;
: |- F$ ^( l5 H. I- }   }
  T2 n  T, T* r8 `* M2 x. p+ ^" n   return FALSE;- Q3 I& e- V0 r6 N7 [5 [+ [( B$ [2 S. G
}2 `1 y, a: v* D6 e" E  `

3 h( d7 t  `: u; Q% AAlthough this trick calls the CreateFileA function, don't even expect to be2 H9 Q4 V. _( [7 L8 q
able to intercept it by installing a IFS hook: it will not work, no way!$ J8 y% N' t- m* y: {. c2 }  y/ G
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
5 [  D# \% V3 E+ A! ]& K5 \2 Xservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)2 x7 L8 `' ~( g- Q
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
% [# i. p. [6 S1 U; afield.
  U3 y, T: ~4 c; b4 VIn fact, its purpose is not to load/unload VxDs but only to send a
# P, z2 s6 P3 lW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)$ @* V: s: N. ~
to the VxD Control_Dispatch proc (how the hell a shareware soft could try. H' D: Q6 m+ t/ z5 c; t1 b9 W/ ^
to load/unload a non-dynamically loadable driver such as SoftICE ;-).( C2 E% z% Q! ^1 W4 D7 G1 D
If the VxD is loaded, it will always clear eax and the Carry flag to allow
5 j- e: i/ y0 b8 |$ O! vits handle to be opened and then, will be detected.
2 E! R$ u  X. Q! \2 e: q! yYou can check that simply by hooking Winice.exe control proc entry point/ M! e  H( n- L! h6 K" k
while running MeltICE.
5 S) C) p4 }8 P: c6 G( b/ L! q, G+ F+ \- p$ m( y% `

7 }  ~9 J, U/ ~) T8 @0 ~& |  00401067:  push      00402025    ; \\.\SICE
; m+ h1 l# c+ R% j  0040106C:  call      CreateFileA7 z# W  V6 r6 `9 g+ F! F/ [  X
  00401071:  cmp       eax,-001
0 ]* ^/ b$ `9 Z: c: J  00401074:  je        00401091
! P' I; K8 V" i4 p- M7 Y: _0 J
0 _5 ^9 b9 s: F6 p: o4 g2 G5 I5 U/ f) Q9 ?3 q
There could be hundreds of BPX you could use to detect this trick.
: N" r7 k/ W( p-The most classical one is:
* Y" y- R7 m. O( j  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
  o7 M/ B! y' W9 l    *(esp-&gt;4+4)=='NTIC'8 m+ M$ t" {6 K/ L
/ `7 t! Y9 I/ `: z
-The most exotic ones (could be very slooooow :-(
, ^: A  c# y- w& p- D   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
: w' {( k5 b! T" q( c' _9 S     ;will break 3 times :-(
0 V5 H: r# E) `* \, u
: |& {- F. N: u% F& T& Y! i! O-or (a bit) faster:
4 v. Q+ g2 `+ N" R+ c( T1 Z) }( P   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ [+ O2 d% S* G+ m. ~1 K& o5 U: t0 m- q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
* `; P7 q! v& O+ ~4 D  r     ;will break 3 times :-(- J( l! Y' v  l4 d! }6 X
( G  R" P" ]- l1 G
-Much faster:
$ `, `* k  I  n2 p   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
, c% p* @6 `/ G- q* A
/ m% V7 w0 \' K% F8 j, E; @/ DNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
3 D7 ~0 T% Q9 Y5 O6 @function to do the same job:7 g; s. ~, p+ C; |2 J& @
* _  P  _# A! x( u( i4 P! O3 Y
   push    00                        ; OF_READ
1 B+ u1 g: B( \1 i  y; m. u% Q   mov     eax,[00656634]            ; '\\.\SICE',0* M: b1 x8 ]4 K6 e
   push    eax
7 d' v- q5 j2 O   call    KERNEL32!_lopen
6 R. ^# F# n5 F8 A9 q* y7 k   inc     eax
* k( _4 x' N, i' \6 h" G   jnz     00650589                  ; detected( M$ t5 G7 H# W* v; u8 n/ b
   push    00                        ; OF_READ
) }1 o# N$ U4 g  R( x   mov     eax,[00656638]            ; '\\.\SICE'
$ @9 Z6 j) u6 s! H, j; m   push    eax
. p4 A1 \# `7 S7 \   call    KERNEL32!_lopen& m1 a! U! l& R7 z- Q
   inc     eax
% Z5 _( C) ~: l) V   jz      006505ae                  ; not detected
) F9 s, T0 \) o8 ~) @
9 f4 z4 o' w" z4 g
: P6 ?6 H: \9 s' E6 B4 a; E__________________________________________________________________________
( j  H1 T6 w5 D3 ~2 P' G* A
. k/ o! w' y3 ]2 \# j, [Method 12
  y. z1 {# E7 R- N( W=========
! Y0 S+ ?+ x4 g( L' _) S# Y, S/ C& L$ ], R8 B9 z0 y0 f
This trick is similar to int41h/4fh Debugger installation check (code 057 I. z* p9 b( j) n  T  V- z* m& c
&amp; 06) but very limited because it's only available for Win95/98 (not NT)- n9 q4 ^8 k/ N, I6 u5 z# D9 F
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.- M8 M! S' Z7 _
" k2 o, i) k/ X5 d7 M: [
   push  0000004fh         ; function 4fh
5 A1 D1 P( V9 ~2 l& t" H* {: Y   push  002a002ah         ; high word specifies which VxD (VWIN32)
  ^: N: [. ]( q! E8 F                           ; low word specifies which service/ y5 }6 ]% d5 l* v/ s, V! H
                             (VWIN32_Int41Dispatch)# }( v& n: f7 p6 `% j  _3 ~, z
   call  Kernel32!ORD_001  ; VxdCall
9 y: S3 j) `" e! f5 H   cmp   ax, 0f386h        ; magic number returned by system debuggers+ Y' j. H/ l2 \
   jz    SoftICE_detected1 @( b. L; l/ X8 s8 u

2 y' g% q' v1 G" a7 P  a5 eHere again, several ways to detect it:
6 A) w7 B! ^5 L' }( d5 p
1 b! d9 \5 p$ M. c4 l    BPINT 41 if ax==4f
' o& M$ c5 Q: [$ h
0 {. ^) r% \2 w    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one1 W! n; ~6 K2 t& O

2 N, B; e3 {2 A    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A2 ~5 m) _! ~  {% T8 q
# Q3 p1 D3 ]8 S
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
$ a/ V5 i0 ]/ W6 X  e: {
- M" M  L6 m. b  U: }- i  K6 C) ^; C__________________________________________________________________________1 R  ?: J6 t3 h- `8 \& q9 N$ r

7 L" L; Z7 ^, T" z# x8 c0 F2 g  rMethod 13! \; t* {: }- [
=========
; t! _# c' d3 q! k0 X/ D( H
- x# B, d, ~8 o% [- iNot a real method of detection, but a good way to know if SoftICE is8 c4 s1 s- i, Z7 w0 [
installed on a computer and to locate its installation directory.4 {/ p" G) n% P2 j
It is used by few softs which access the following registry keys (usually #2) :
! w. m& s5 \4 q& p. D% {0 I* P/ Q/ |2 X  x7 }/ E
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 [: n1 n/ n2 ^& z
\Uninstall\SoftICE+ r) m9 F: S  F* R7 X# r* R. |
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ m" A. ~' ~. U-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; ~% t2 o! ]. @! E) ]  t* j. d" v
\App Paths\Loader32.Exe
& S) s1 C4 q8 y1 o' ?2 q
0 l' Q6 d* y* Q1 u3 @2 L0 V5 B+ I6 D
Note that some nasty apps could then erase all files from SoftICE directory
5 q! r7 J6 w; @/ q! g6 m(I faced that once :-(7 N6 l. z4 l" x" S7 ], m& j

6 ~8 [: e5 o4 a- I. qUseful breakpoint to detect it:; s& @. ~9 V8 s: c" y/ X
! h5 J3 h( K, v4 s' d! H+ p: Q  |
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
# v. J3 |, f' t. d
8 k8 K6 V8 _& t__________________________________________________________________________+ q. U: N% h/ _. o" F( @

6 W  H7 N- B# G* u" F( P5 U( i3 L* M& W' Q4 ~" N0 k. N. |
Method 14
8 [- S3 h* A; X9 E6 a. l/ M=========8 o8 w2 o' ]# _1 O  s
  h4 f" n" L3 h; y/ e- W
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
; H% `2 W( F+ L3 ~% |- o7 u9 Sis to determines whether a debugger is running on your system (ring0 only).5 Z; O: j; C- t: W: @! y5 k1 G
* S5 [* O; L/ w9 U0 t+ r
   VMMCall Test_Debug_Installed" T3 Y$ z* ~- L' R* p
   je      not_installed  h: F+ }2 X- L4 n

" b8 k' M* h: {- N5 hThis service just checks a flag.
2 w; w  O+ ]2 B1 d  y* k</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-7-30 20:26

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表