找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
% [$ v- O* h& P7 h* f<TBODY>* I9 u) c$ |  @8 {# O6 R1 l; J
<TR>
% J! i" h, f9 T9 x; i# C- F8 I<TD><PRE>Method 01 * ^* A1 a: Z% g3 W7 p9 }
=========* F! {0 {2 b" H0 D. S8 |6 D8 o

- B+ S2 ^/ X+ q, h% nThis method of detection of SoftICE (as well as the following one) is0 R- V5 ?1 F/ B& E. @
used by the majority of packers/encryptors found on Internet.
) x$ Z4 P3 \" P5 u- BIt seeks the signature of BoundsChecker in SoftICE, n! G+ M  G1 `6 ~' t* k! ^0 m0 S. L' R% c
; V" R5 B" J) m$ X
    mov     ebp, 04243484Bh        ; 'BCHK'
. p$ {( J2 s/ b) J  K0 j    mov     ax, 04h
/ [- |5 A* p9 l$ J3 f  j$ b    int     3      
, [; |& I  `) u8 g    cmp     al,4
2 j7 ^9 i$ |; {: s$ J2 j    jnz     SoftICE_Detected
) Z6 x% w  `0 F# j7 f1 n. q* {# ^
___________________________________________________________________________0 I7 t4 V2 T0 U1 A

. m, @; r( ~1 z3 B1 d: FMethod 029 V9 q+ q" b& Q0 v. _
=========
  M2 g* T2 J# [
0 Y. R) S0 C' W2 |3 _2 g% gStill a method very much used (perhaps the most frequent one).  It is used) C  G0 Y3 v2 Y0 E4 f
to get SoftICE 'Back Door commands' which gives infos on Breakpoints," X+ @  D: n8 T+ i7 V9 E
or execute SoftICE commands...
/ L5 ~, M( H9 pIt is also used to crash SoftICE and to force it to execute any commands
: u) K* S8 c5 o- ~# U% z(HBOOT...) :-((  
0 [9 N6 q) \) S8 |% b- G) |. }5 ]; t; |/ `. r$ i
Here is a quick description:/ L7 e0 R* ^2 p0 H9 c" y
-AX = 0910h   (Display string in SIce windows)7 L- \+ I7 w" d9 w* Z
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
) F8 H. l; Y2 Q; p" N/ C" N# P! z-AX = 0912h   (Get breakpoint infos)
) m! y; j' @! L. m- P+ o/ K0 Y-AX = 0913h   (Set Sice breakpoints)* V( K; }/ W7 F( a  e9 [
-AX = 0914h   (Remove SIce breakoints)
3 Q  [. o( K& X7 B6 ^
, R5 R3 p  R  q2 Q2 oEach time you'll meet this trick, you'll see:. v' ?8 Q+ y" \- b
-SI = 4647h
  C9 J4 E4 X1 l* ?7 _& E$ A! R: `  h-DI = 4A4Dh/ G3 _' r! u( L9 Q9 l
Which are the 'magic values' used by SoftIce.& M1 w& v1 L  C3 j* ?3 L2 o
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.2 h' ?/ [  M; J5 D; f/ q
/ N* f  d7 s3 Q( H
Here is one example from the file "Haspinst.exe" which is the dongle HASP5 b) B3 r, p% ^9 X0 o
Envelope utility use to protect DOS applications:$ w- Y0 R1 P9 u7 A; A9 O* e

2 d2 P9 v7 C/ X% V3 ^, i4 N- o9 a  a/ _, X- v; E
4C19:0095   MOV    AX,0911  ; execute command.
8 b; Z* z4 ^( }$ X# f, @+ y4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
) y3 [( o  b! P6 }+ C( p2 Y4C19:009A   MOV    SI,4647  ; 1st magic value.
. \7 H* e% {, H9 {" Z/ C& L4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. V& F* e- V) q3 G/ ^  p& V4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
' P* j4 H' F/ ]1 p; F  `8 F" ]# L4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
" b2 X3 O8 Z7 ?; Q# n" X) ~4C19:00A4   INC    CX
( T$ K' C# a& r" V5 G4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( ?3 r5 w7 H& j& r( k
4C19:00A8   JB     0095     ; 6 different commands./ R/ `2 R( C# @+ A3 G- d
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.0 v+ K$ h' ~& p: b: _2 R& Y9 p
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 P# S) ~1 S2 G* ]4 F6 `$ J2 M4 p0 z. r% C1 y' z' i1 x
The program will execute 6 different SIce commands located at ds:dx, which
0 }. k. y: F: m9 z$ K) `are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
; @+ _8 D3 m! u% [" ?# @5 m3 [1 s9 v6 z1 A* [0 b& a6 H4 g
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.- G' o4 R, W1 s
___________________________________________________________________________5 l( L' Y  E# u& f9 i4 U" L! G
5 O$ @8 W. q$ Y

' A' T( q1 a& pMethod 03+ {5 u+ [7 L5 f4 r# R- S6 q
=========: Y0 m& S" m6 h/ c5 `$ F# N
. z$ u2 F3 B8 Z  B
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
. ?. z( F- ?' r: ^3 y(API Get entry point)
5 v  I( ]3 A# w( ?/ P& {9 f        7 B5 C9 f( O! I* t- |( F

* z, t, O$ m0 i2 k    xor     di,di
/ U/ l+ t6 q" n( E, S; \) _    mov     es,di
% g6 _1 Q. c  q: m    mov     ax, 1684h      
1 ^& c9 @6 a; g# g) D    mov     bx, 0202h       ; VxD ID of winice
5 c2 f+ J* d# |8 P( u8 L' Q    int     2Fh
# t) Q/ ?9 V& P* _8 ^4 H    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 \3 d5 X4 O- E6 w: V) g
    add     ax, di, T2 X  N" s0 h" W  p. [
    test    ax,ax
* U6 e+ s# A; P& |) h    jnz     SoftICE_Detected$ Z2 j/ e, z7 H! l* F" C" d

0 ]1 j! H7 ]1 b1 V' `# s  E. k___________________________________________________________________________
% \5 b. I+ F2 `! c$ I8 @. Z; K2 l+ f4 F/ i8 {
Method 042 \3 l8 n1 g. x4 u( y3 m% Z: h. e
=========4 `; r& {3 a! u( a
' B+ j8 R* {" |1 n% B
Method identical to the preceding one except that it seeks the ID of SoftICE
7 `- m9 `7 r% y8 }: B. XGFX VxD.1 ?7 J) O/ K$ {% ^1 s1 H
* j$ u& a% M6 V# H2 _9 Q5 b
    xor     di,di
* ^+ x4 C/ T  N( j$ ^    mov     es,di0 X$ w  ?* i% f# a" S
    mov     ax, 1684h      
# v& B/ n8 J' {1 [  G    mov     bx, 7a5Fh       ; VxD ID of SIWVID
* b) ?" Y$ C% ?( A    int     2fh9 ~+ B- P; T2 l& ]1 K2 O5 v
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 ]! I3 |; M, Q$ z: N    add     ax, di7 M5 |7 Q+ |3 r
    test    ax,ax+ p1 ~) l5 p+ w3 w% A
    jnz     SoftICE_Detected/ r8 N/ W, ?: g5 |0 I
3 W8 ?: O1 u. R+ A$ q6 X
__________________________________________________________________________
% [7 c- k' s3 @2 e' ~: e  H: b- W( r' F0 L& e
* }  X4 w& B! l1 p/ k: _
Method 052 T( P. v# w1 t& ]  z
=========3 `+ X2 g" @/ Y% ^) ?7 V& k. l
5 `% f2 ^0 A; w' B* H, ]
Method seeking the 'magic number' 0F386h returned (in ax) by all system
! q' z" L/ F: G- sdebugger. It calls the int 41h, function 4Fh.
3 o5 c# F8 _! a' A, b' HThere are several alternatives.  / C( I% l+ y+ S3 C$ e
% c( Z  _  a; P  o
The following one is the simplest:, Q( K  q4 i* |  K

: q! ]7 i' P; S/ `    mov     ax,4fh" m8 w& R0 U. {, F- e) G( x5 g
    int     41h9 P% `5 ~. Y* b& g7 f3 {
    cmp     ax, 0F386
, n& q# b& ?6 ?# l9 {3 H    jz      SoftICE_detected* E! c6 b+ q# E

( ~- m3 O. \3 j/ X3 U; R
: H+ g3 z8 e+ B7 A0 x7 ?Next method as well as the following one are 2 examples from Stone's 6 e6 \: c3 b* N" O' a6 n; i
"stn-wid.zip" (www.cracking.net):9 `% g3 j( j1 A& r: O
+ d5 o) q7 h9 e" G6 A  z/ }
    mov     bx, cs; q1 k; c! \8 k. g% h
    lea     dx, int41handler2. o% ]# `. g6 q. R8 i9 g
    xchg    dx, es:[41h*4]8 j4 O& l0 |' \/ k+ J" ?& ^
    xchg    bx, es:[41h*4+2]
" r# V: r0 B/ C    mov     ax,4fh2 f: |4 G; j! e" O
    int     41h
- S1 {" c, ^% [    xchg    dx, es:[41h*4]2 Q5 ^; Y- S6 f* Q( a- n
    xchg    bx, es:[41h*4+2]# W5 U( a2 F( n5 X
    cmp     ax, 0f386h- X8 ]/ w* e$ x4 B/ _5 j5 ~) C, n
    jz      SoftICE_detected- E9 v7 k6 R6 ]3 y. W9 U; A& B

: o' G& z  B3 w3 E1 w! Gint41handler2 PROC
$ F! ~7 [. ~& p) v# E    iret. T& N6 K0 ~' l9 E9 ~
int41handler2 ENDP
& @9 v# [$ `6 i; j/ \. c2 B0 A6 {/ ]( p6 z5 N

5 Z. G& E) ~! a  l% O_________________________________________________________________________5 M, B/ i; S: t/ W8 K8 }9 U' l: y
2 h: q: y  B  X& T# Y; Q

# R; o8 B- \" F4 OMethod 06- v5 q! g% {7 v
=========
6 N) J- `* J& X4 V0 g+ G% w6 x3 r% O, g6 I) A
. k# q' j" W; ]* y# N- v4 ]
2nd method similar to the preceding one but more difficult to detect:; m  n- l. @& Q* K) r( x9 V
2 n6 V: _( ^8 `
4 t. b( l0 k1 b2 V8 r! t7 e! D+ b
int41handler PROC$ V0 ]9 L- M' |
    mov     cl,al
6 M5 F6 O+ E" U! H' B. N    iret
  Z5 m4 I" p! H( B* @: ]( _int41handler ENDP
& o& W, I6 m4 v; S+ k* l
- k" V; S2 o7 ?% k8 m$ H
4 v* _  k) N2 A/ m/ o, m6 c" w/ N    xor     ax,ax
5 N* ]9 `. m4 R    mov     es,ax' u9 Z' Q1 V1 L/ @! X
    mov     bx, cs
6 O; O$ w+ |  @' V8 {( F    lea     dx, int41handler) L+ h" E" c  u. m6 G% d2 j  k- A& q
    xchg    dx, es:[41h*4]
9 N9 B$ C0 \" i3 |( r0 ~/ A    xchg    bx, es:[41h*4+2]% B8 x; d# w( A$ w2 v
    in      al, 40h
; @+ G7 J6 ]9 N$ t    xor     cx,cx
) z6 K- v. m7 E    int     41h* ]- P( y/ S4 H  |9 |: o6 ]
    xchg    dx, es:[41h*4]
3 F* s1 q: c, }, L* j    xchg    bx, es:[41h*4+2]
3 g+ b" C3 Q' p- e    cmp     cl,al2 t1 e6 N7 W8 T0 ]
    jnz     SoftICE_detected
4 J9 r8 D/ f) b' @: h( i" C& Y+ j  |: ~1 D9 C
_________________________________________________________________________
8 x8 G7 ]: v$ M( g: v9 u+ c" D  |& F' M; \3 c
Method 07
8 A4 _( Z  a# Z7 a9 P% L4 b=========
. h7 O; h  P) f4 X7 m
4 M% U; G. a* F1 b* lMethod of detection of the WinICE handler in the int68h (V86): ~) C$ |! \: z
; Y2 K( Z, Y4 g6 d0 w5 P+ i6 s
    mov     ah,43h7 j  y- G2 i  F4 G4 z
    int     68h
( r& \/ w5 {$ [    cmp     ax,0F386h
; a& n1 v( u) S1 R8 ?    jz      SoftICE_Detected( \/ \/ X0 B: _7 C! R

! @8 C% M. p1 _$ v- S1 v4 ?8 R9 e9 T( N) D5 q7 p$ p
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
/ a/ Q  ^+ y4 C% I6 |. A   app like this:; n1 P* u' @4 s6 N6 S( b! n

; U( c' T: b* d   BPX exec_int if ax==68
. _  Y. t% {1 }6 P7 }& L: v( Y   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ F  `$ C2 X! z; ?# x: M  l4 U   located at [ebp+48h] for 32Bit apps)
& F  w: O; K5 A, }__________________________________________________________________________) P. _! c7 e5 P4 x
' d) R5 ]1 n3 C# ^/ E. S' w9 d
6 I( f7 L7 J7 h; H$ ~; z
Method 08
- p1 H+ h! x+ h) Q2 J=========
5 S: y, }! H  ?$ q6 z5 S5 g' f
: X8 e3 I2 e: K  z0 O1 xIt is not a method of detection of SoftICE but a possibility to crash the9 F; Y8 F8 n0 y
system by intercepting int 01h and int 03h and redirecting them to another
3 V- q5 m6 ?7 g( _routine.
* b$ p/ S# U; ]$ v  tIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ w1 H- ?+ d) z7 U$ G$ [to the new routine to execute (hangs computer...)
+ U8 s/ q! M5 Z8 K1 A
; e+ n( c9 n6 q+ s- H$ k9 \    mov     ah, 25h- G5 A+ H! ?6 J6 X
    mov     al, Int_Number (01h or 03h)
- v& x$ @9 f0 @# ?) u" R    mov     dx, offset New_Int_Routine
, h' X! {9 a# D( O4 }1 `    int     21h1 F* Q) d  j" i! g& K* Y

, Z7 W. p, `2 I, C- B__________________________________________________________________________
0 T. k8 i6 I7 [7 N! Z
! T1 K4 h' T! V- x; uMethod 09) x1 i- y7 z" {  I
=========
4 N6 e' C9 {0 E+ o6 d
( o9 L0 F5 y# V& J* S* {This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" x; j" X2 P9 l. V6 b  o
performed in ring0 (VxD or a ring3 app using the VxdCall)." h$ i7 M9 x, W1 C" N( O: j0 A* `
The Get_DDB service is used to determine whether or not a VxD is installed
3 ]$ G3 Y" v* c. Z  ?+ Pfor the specified device and returns a Device Description Block (in ecx) for8 F6 F6 N4 o1 ~
that device if it is installed.
" i5 E, g  i7 c) S% T; G* E& a$ I. j, m5 T! V
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID' o9 ]8 n7 W* m( O$ W6 L0 t+ Y+ S
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
4 C' x# c+ N: Q$ i: p   VMMCall Get_DDB
5 c! p& H4 J. {1 \+ T   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed( a3 w) x2 U" d5 g7 E. K5 t

- s0 K7 `: L4 Q' H" B4 a6 i, ?& `Note as well that you can easily detect this method with SoftICE:
  |6 L+ B6 [& r% d, D   bpx Get_DDB if ax==0202 || ax==7a5fh  k% S6 ]$ g4 i

, p; d' `2 s* i; _' N__________________________________________________________________________
  g5 |( X  D3 M! U: C: Y. b
) E" J+ c- P9 q3 r+ n/ tMethod 107 e: r% G- C( q$ c# z
=========
* R+ z- [& F5 r: r1 T  q" K% z( x$ W, o6 U! W$ y
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with" G: m4 X0 K% n. P1 L
  SoftICE while the option is enable!!( M8 K5 k+ f0 ?5 x% @

' A) \  J" \7 }% M- H1 \This trick is very efficient:
; `, n% S' v4 k5 d) G" B' Y, uby checking the Debug Registers, you can detect if SoftICE is loaded: e. g# B' d4 ~* y/ i7 j1 c) e
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if" J8 Y2 `! `: g" k% b: i% ~
there are some memory breakpoints set (dr0 to dr3) simply by reading their
5 d& T+ B& v8 f- \" P! f/ cvalue (in ring0 only). Values can be manipulated and or changed as well
3 [' ^0 k% J8 r0 ~! t(clearing BPMs for instance)
) x" m& p( x- v% V2 k9 w' [. k: W
__________________________________________________________________________) R. O9 Z1 g; B, b$ |0 R( d
2 i1 M) q9 O& R4 U
Method 11
" s( ^# f8 H) F4 h) b/ F. w=========3 ^) t1 f' O" _5 }2 N; `9 [% K

- w( ~& Z) n: G! y$ ]' LThis method is most known as 'MeltICE' because it has been freely distributed7 P0 @" @! S0 P0 O$ D2 k* U
via www.winfiles.com. However it was first used by NuMega people to allow
/ V7 w! P3 G2 |8 f" e# vSymbol Loader to check if SoftICE was active or not (the code is located
+ O. k* [: V" Y% m1 f4 N2 U5 Pinside nmtrans.dll).
2 _0 D. R+ x! `
' F. ]2 {3 J* b0 b6 RThe way it works is very simple:
: u8 K. P# j  `# ]- r5 dIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
2 i, h9 y4 E; `* I+ O7 DWinNT) with the CreateFileA API.4 d* `5 l: L# l  Q
: v, o, r- k9 g1 m9 h9 y
Here is a sample (checking for 'SICE'):
+ B0 r6 G. W- n/ g# c) B/ _7 I, t  R# w1 E$ U0 V
BOOL IsSoftIce95Loaded(); L' i) N6 ^0 D9 `4 `0 p8 c
{& l& Y/ A! W+ E
   HANDLE hFile;  4 L5 |3 c% f0 |- G5 d: O6 ~3 ]$ J
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
9 ^6 E5 v. M% m3 P                      FILE_SHARE_READ | FILE_SHARE_WRITE," g0 H) b7 r8 |7 h& k8 q
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);- C) G& s6 Y) U) M' A( L3 \
   if( hFile != INVALID_HANDLE_VALUE )
- b; L) e2 l6 |0 ^) j4 d   {
+ K/ q5 z7 l* F0 G3 i; h      CloseHandle(hFile);
$ p* `# C: `3 ]# \. s$ U! d/ p      return TRUE;+ a* r8 J, K% w3 z6 q# O- I/ f
   }1 Q6 T" n3 T0 R/ V
   return FALSE;# t7 H# o* o; ]1 l: Z
}0 _( V! k5 x  Y/ V; A& s  O

5 f. v/ W, ]1 ?* E% b' \8 I. YAlthough this trick calls the CreateFileA function, don't even expect to be1 \! \: @7 O& R' x) W4 n# U, ]
able to intercept it by installing a IFS hook: it will not work, no way!* _: a/ P, v5 c# j) @  s
In fact, after the call to CreateFileA it will get through VWIN32 0x001F. l( v2 W: b5 h, R. j
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 y# d0 B4 n& f7 J' I* S9 ?4 Oand then browse the DDB list until it find the VxD and its DDB_Control_Proc- `  J2 m0 A3 x% k. N4 K5 ^
field./ z1 ?1 i: [7 A$ h! D, N
In fact, its purpose is not to load/unload VxDs but only to send a . }7 a/ ~! v  H
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)0 G- Q2 C$ _* M! v
to the VxD Control_Dispatch proc (how the hell a shareware soft could try$ |9 n- i3 W! h# F  p/ K% y
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
( _$ e. R) ?* R4 b( z: Q; W. }3 J# v9 FIf the VxD is loaded, it will always clear eax and the Carry flag to allow
, w* E  |$ S* e/ x: Z' E' L7 U1 Hits handle to be opened and then, will be detected.9 E0 }) x; L3 K7 H( \5 M
You can check that simply by hooking Winice.exe control proc entry point/ ^2 q1 C# V5 q! e
while running MeltICE.+ U/ ~8 q' G3 _" f; o. ^- h" F0 P
6 D& D" R% z0 p; N+ Q
: d" t& x; R' J# o6 K/ ?, [
  00401067:  push      00402025    ; \\.\SICE8 |% x- {' x$ X( b1 o
  0040106C:  call      CreateFileA" n  n# [9 v& x3 M( r) t
  00401071:  cmp       eax,-001
: M7 b) v- i8 X6 ~" G0 @  00401074:  je        00401091
: A7 G' [- p0 W4 G6 \
# Q: D6 ]4 ]/ \# I& t* l9 z: A1 J3 X: L) Z7 \0 n" y3 _
There could be hundreds of BPX you could use to detect this trick.! D( K$ g  F5 A' h
-The most classical one is:: ]( O8 o/ }/ A5 |+ H
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||+ [2 h. |0 j4 `6 V0 @) q" c
    *(esp-&gt;4+4)=='NTIC'
+ d3 I( h, J$ n& x5 Q9 n- C* B& ^7 G5 ?
-The most exotic ones (could be very slooooow :-(
- N' ?+ F2 h7 C   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  5 Y0 n2 `/ F) Y9 Z: b3 p$ T6 u# @
     ;will break 3 times :-(4 a+ e/ ?1 _8 ~, W# z9 r7 Y0 X+ m8 ?

1 Y8 R1 g& {, A( R/ Z-or (a bit) faster:
, N- R2 P9 x3 w1 h4 v   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')& S1 l6 j3 n5 [# X
1 e% P" q% X$ x" D* H0 m' K
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
% k, g8 }) D$ H0 T( f* ~* j     ;will break 3 times :-(5 U8 l! q" L  o) Z+ e

5 d- r9 I5 y1 ^4 V, t-Much faster:
# H4 y$ ~$ y% h: o4 c/ r   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
& m; l$ F0 ]* ~; [& M! Y3 N# f( B, @, `2 ?6 t
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen" h9 B" Z% Q4 L
function to do the same job:
! s+ l! h3 n4 u* u( E+ \: X: S  \1 U" d+ u# X
   push    00                        ; OF_READ9 y* Y+ V- d/ |1 r4 f- @/ H
   mov     eax,[00656634]            ; '\\.\SICE',0. X! @2 ~# ~0 z; D, n1 p0 x* r
   push    eax; D/ J) k; W. ~
   call    KERNEL32!_lopen
1 i8 X8 J/ F* F/ r! [  G3 l$ t   inc     eax7 A2 G6 ^  S) z1 t% ^* i1 n4 e0 S
   jnz     00650589                  ; detected
# J% u; t$ v+ h- S* g. b4 b+ D   push    00                        ; OF_READ8 O1 O$ U  `( c. H+ z" \% S. P
   mov     eax,[00656638]            ; '\\.\SICE'
' j( i# L" i+ D1 ~   push    eax& b: n$ ]' }% d3 h/ b) I7 E
   call    KERNEL32!_lopen' e5 J6 l0 V# E$ B, y* j9 p
   inc     eax
0 r$ F3 F* a5 J3 z# P$ a; x, W   jz      006505ae                  ; not detected
' ]$ Z/ B2 s" o& i7 C! a- u9 q$ u! y2 C( a9 a* T9 o5 g- @
9 X7 D% r0 D3 [1 @% B
__________________________________________________________________________/ N) L. @/ j9 h. p% r

+ O+ y* _7 x# y2 P: B3 a9 oMethod 12
3 J) E5 B- b- N+ L=========, g0 {6 B- ~3 X! D

# l7 T* I/ y9 P( h; ]* F: m6 EThis trick is similar to int41h/4fh Debugger installation check (code 05. d4 [2 h1 P( k1 l+ }% I
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
1 ?$ u6 c7 m2 s: Sas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; ^0 B# D) p; e( t
8 N: R/ }  R% n! K, |7 H" J   push  0000004fh         ; function 4fh
/ r8 _2 J. m% S7 f1 P   push  002a002ah         ; high word specifies which VxD (VWIN32). E5 D( z4 q$ B* K' g& M
                           ; low word specifies which service
6 Y, L: h# J' o3 q4 E8 m) z5 U                             (VWIN32_Int41Dispatch)' L0 o2 `. Y( O, s7 v' t
   call  Kernel32!ORD_001  ; VxdCall9 h6 J* F* z8 x8 F
   cmp   ax, 0f386h        ; magic number returned by system debuggers
; L+ L" P6 o: q3 }$ r+ F$ j4 P   jz    SoftICE_detected
4 R# J6 X: F8 Q# U1 `  R$ I" a* Q, M" u' z
Here again, several ways to detect it:
/ w2 O8 G5 _4 r% W2 r4 s! l4 ^5 A* R
    BPINT 41 if ax==4f
/ R0 z4 f+ ]: G
9 ?& B2 ^0 h( w) d7 L& S    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
3 d7 A) R" ^$ [) @" ~/ o$ X3 i( R; H: w7 J  F$ b, s  y1 Q
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A6 w/ O, Z3 \& d

% W& N  }# v6 L1 G0 \    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
* a% E# v% Q$ b9 a# R
7 D) p5 W5 t* v6 k/ Z9 E__________________________________________________________________________) z. q0 B. M$ `) l/ @$ J2 d0 h" d2 I

; H  G! Y3 J9 j3 F0 q/ b# ^Method 13
) _" m% Y0 j4 K$ {% X* g5 U=========# E, p4 ^) C$ U' M" Q
1 Z( ^( T5 k# D' D
Not a real method of detection, but a good way to know if SoftICE is6 D( z$ X) b: u0 {2 E3 n
installed on a computer and to locate its installation directory.) P7 Q6 z9 g- P& W) D
It is used by few softs which access the following registry keys (usually #2) :( W  o% b% z. k4 e" t$ M

! u# o% J# m. x: @7 I) r( G-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. j8 ]. o  p: M7 b$ m\Uninstall\SoftICE, }  n& |! [% i. I0 N' M1 r8 m
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
) w8 Z1 K5 R5 u" n-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ D8 X# m# S9 Y- A$ f+ f; D0 ~% Y
\App Paths\Loader32.Exe; n5 w7 }1 {& o9 Z

" P% o; K5 m) |9 e$ K) {+ _0 S9 R' N3 ^1 r+ y7 M
Note that some nasty apps could then erase all files from SoftICE directory
7 \% s2 t: ~/ M9 r$ F(I faced that once :-(
! m) f6 c$ J' g1 N  z( p5 e) D0 N4 ~4 x. }7 X8 G& s( \
Useful breakpoint to detect it:
# x# B8 X6 k5 I9 D: S( E  _3 s  c" G2 [- }
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
' I4 h& f- Z5 e4 y; Z3 q
% d, {" i0 n5 B! e! Q5 q__________________________________________________________________________
% ^1 |+ y1 X# u2 f( C, s4 u4 X
- t7 F6 u# @. v9 D  E+ w+ j% U4 t* j% e8 T2 K' m
Method 14 ' [; p- ~" p5 M" o0 k! C, W* h
=========
* l# z4 F6 d% Q! {, z
. [! \0 O' {. Y3 i* S% e( aA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose% |- x. H/ T  v$ _( [: c9 D
is to determines whether a debugger is running on your system (ring0 only).
, F6 M3 k+ v% }) {
5 J6 ~, ^" n4 W4 Q* a: l   VMMCall Test_Debug_Installed1 I+ Z2 K: L9 I
   je      not_installed
8 p3 c$ _+ r  _2 Q3 Y( [/ s0 g9 G- H+ s' j) m2 ]
This service just checks a flag.2 U" q2 U9 l) D; S; ?7 r
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-13 13:32

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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