About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 d$ v! K3 h& ^1 b
<TBODY>
% }; w9 D/ y  y1 q; |- h* _; z<TR>
- v5 t4 B* {; z<TD><PRE>Method 01
. Q+ x2 S5 {: x4 C; w=========+ }6 {# b0 J4 G1 D6 ~
. p( ?1 J2 S$ T& `/ x3 i1 I$ x
This method of detection of SoftICE (as well as the following one) is
* h* G; E5 E5 c$ D' Dused by the majority of packers/encryptors found on Internet./ Y/ ~3 {( w; f* }( |: A8 x
It seeks the signature of BoundsChecker in SoftICE
, Y1 o. N$ [) Y3 k3 \2 E1 z3 {: |# O" ?
    mov     ebp, 04243484Bh        ; 'BCHK'& U2 A5 e; D6 r) t
    mov     ax, 04h
8 R& ]: @9 W! c% ~    int     3      
. F% e; l4 w3 y1 Q    cmp     al,4/ I, k( _! x* k! C
    jnz     SoftICE_Detected
  _* m5 K7 a9 X1 N
  m( }" ?5 h5 j( Q  z7 O___________________________________________________________________________5 J* T( g- v. f5 g! M/ c" q# {

1 a1 W8 C+ F6 }6 j2 T3 U8 `Method 02' [0 @: K' E+ u: {; I
=========
* q  L3 Q( _6 H! ^9 T6 `
6 ?3 _4 i+ ]6 vStill a method very much used (perhaps the most frequent one).  It is used
! Z& m8 i0 v- w8 }2 j- _) tto get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ u* P+ m+ g4 y) H3 |
or execute SoftICE commands...
) c# f7 @* M: O3 d9 AIt is also used to crash SoftICE and to force it to execute any commands+ i( J7 ~, `. b+ V9 D0 h
(HBOOT...) :-((  3 x9 r& t, E; h* N2 Z2 t  q

: [. c- Z, r& G7 Z1 v# NHere is a quick description:
1 @% b9 @3 N- e4 V0 M0 F$ ~-AX = 0910h   (Display string in SIce windows)$ _# D6 `, i% f' Y6 r. d
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
, X1 a- c; ]  [-AX = 0912h   (Get breakpoint infos)
( G% t. T8 Z! t% H. L( I-AX = 0913h   (Set Sice breakpoints)3 [& N! V! h/ O* P) F7 |" o3 J
-AX = 0914h   (Remove SIce breakoints)
$ P; U: U) d$ ^! S; f" F; C
9 n. k1 h. C( ^; _0 W5 lEach time you'll meet this trick, you'll see:" Q) w+ u' T3 J, P( E9 t
-SI = 4647h
) W2 f+ C7 r/ z- [7 [' l-DI = 4A4Dh  {+ x4 |% Y; A
Which are the 'magic values' used by SoftIce.$ C* T* H6 L; O. e
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.( E+ i8 z/ Y( u) B5 D

. r- ~9 Y9 o; {% t- ~' jHere is one example from the file "Haspinst.exe" which is the dongle HASP
4 O1 b0 `# N# a: DEnvelope utility use to protect DOS applications:
8 [% l& w0 V8 v# |+ e* B5 P' f% E, j7 ~$ {0 d: z0 p( X
6 l& {1 y( k/ f/ m* W' U) ~
4C19:0095   MOV    AX,0911  ; execute command.# X5 d- j+ W3 v2 Z$ x; z# F
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- b' o. n. Q" d- N0 k
4C19:009A   MOV    SI,4647  ; 1st magic value.* }0 G" S: {/ ^: W; m: K
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.+ \- Z9 Y0 F  x6 |
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 e0 s+ z# q# Z5 E" T  D2 E% t/ c, u# }
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
- p. L* g: R, q- X; q4C19:00A4   INC    CX8 a  m1 O' ~+ K0 P: q& s
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute5 s( V- w, Z5 H; K4 s
4C19:00A8   JB     0095     ; 6 different commands.5 ~1 }$ J1 i/ V/ [! M
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.! m7 [$ b- N, Z& v
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
7 l# S: q5 Y: w3 Z) |  \' o6 u6 d: H- u0 E: O& ?6 C
The program will execute 6 different SIce commands located at ds:dx, which
% F$ h3 U. R) S) [. gare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! C. c( ?7 X  B9 I- [) c, s
: g- a# J- Y7 ]. u* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.4 U# t4 A' d" U& i, R# P, Y
___________________________________________________________________________
- K8 L, ], J( c, U8 G7 O" w- A" P  ~, V
7 O9 \. m( i# J0 t! N
Method 03
' u1 r" R0 I4 _5 {=========
9 C1 h/ j" H, o' V0 W/ X1 l% h# @4 G( e( L+ v
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h, P$ r, e' ~' }
(API Get entry point)- B7 w) H2 [! B- w( P
        ! v; \' I; j6 O9 P

' m6 A3 V2 @  X6 ]    xor     di,di
- Z  o3 \( H0 ]8 T9 `! _    mov     es,di
5 o. m; K1 C8 f9 E) M6 d) S* S" O    mov     ax, 1684h       0 ~" e5 e7 _# R- E2 L/ y
    mov     bx, 0202h       ; VxD ID of winice
4 a7 E, G" K; b  f    int     2Fh
; M; P3 s% m. _& u1 A2 ?    mov     ax, es          ; ES:DI -&gt; VxD API entry point( m  ]6 K% C3 x
    add     ax, di" m) U1 e; h1 M& |8 w: ?" k1 N& @4 X! Q. M
    test    ax,ax
, H9 x6 G" E+ M6 |    jnz     SoftICE_Detected  C) P& A: q3 r

/ Y. z. R9 g, }: Q* \. \7 A8 A# r___________________________________________________________________________
$ |4 s. V  P2 k9 v. Y3 G
! Y1 ~: ]9 G( T7 b- H5 n" }+ cMethod 04
7 [- U( z: n8 M- r+ K  P! m. z4 k=========  R0 h- R# w" @6 b7 C* T

9 f* [. K  M" y3 w  T: LMethod identical to the preceding one except that it seeks the ID of SoftICE2 m3 q3 W5 v* P8 z
GFX VxD.
& f7 _+ P9 i! R! E
: E5 h, G' v6 l8 [5 ^3 L    xor     di,di4 ~, V2 n6 Q! w1 _+ n' G, v
    mov     es,di4 A6 [- K2 I# y* F& H- e/ Q3 s
    mov     ax, 1684h       " M0 _2 w* e- Q+ L
    mov     bx, 7a5Fh       ; VxD ID of SIWVID& {+ T) q% R9 B1 i2 @$ Q
    int     2fh
9 f/ o( [4 n$ I/ O  H0 d$ F    mov     ax, es          ; ES:DI -&gt; VxD API entry point' v* ~9 t. c4 I/ U6 S2 g2 w6 X& d, |" E
    add     ax, di
/ a/ W3 Q; `4 Q    test    ax,ax/ U& v2 t+ U7 `" @4 J( `- q% X# O
    jnz     SoftICE_Detected+ d8 g1 _! P4 B& D
! A8 B5 C$ Z+ ]4 T/ a0 B% z# p) k
__________________________________________________________________________& J$ t7 m2 n8 w
% r, X& h5 E$ c2 n9 Z$ `8 t
& R! p+ E5 Y2 ~: |* _, m
Method 05
1 w1 r/ ~; J' \  s& |=========5 i  ^6 |6 T) n, t
6 n' j: I  w) `1 X: D1 p
Method seeking the 'magic number' 0F386h returned (in ax) by all system7 L4 c5 w/ m" o1 H8 x; z: D
debugger. It calls the int 41h, function 4Fh.+ J# {7 L, \/ B
There are several alternatives.  
, d( Y" {/ E5 Z' {7 I, B% {7 M+ N: d4 o6 L4 J% Y
The following one is the simplest:  Y" n& Z! Z" I2 C6 J1 a# z6 B. p0 B# j# E

5 L* Y6 N" |, I5 i# _# X/ {. ~    mov     ax,4fh7 @& V! B, m' W
    int     41h
% D, M' R& D, v- z" T9 o    cmp     ax, 0F386# O3 N1 i4 C3 K/ W
    jz      SoftICE_detected
0 @0 w# n; ]1 _; p/ [6 v. ~% }; H$ B7 ~2 s9 N0 I5 |5 \
: h1 C6 ]: I6 R  i
Next method as well as the following one are 2 examples from Stone's
9 g5 z* j0 U- H- Y7 \"stn-wid.zip" (www.cracking.net):+ T. R8 Q( T0 e4 h  Z( T; C7 [4 `
! c- F5 u2 p: y6 [2 \
    mov     bx, cs
$ |0 C# J( w7 p' t; V$ l    lea     dx, int41handler27 B. T6 ~4 j/ e: T1 }6 ~7 h
    xchg    dx, es:[41h*4]) u7 }  Q0 s2 Z3 J7 h
    xchg    bx, es:[41h*4+2]
& Q0 d8 ^$ Z; |. |( h# B    mov     ax,4fh) v) [6 q; x" R" M& ~* t! @5 Y
    int     41h
8 ^6 p9 I+ H  y& l, S/ G. `( P    xchg    dx, es:[41h*4]7 o" w$ h" a6 [2 p3 t
    xchg    bx, es:[41h*4+2]+ S/ s, R# o0 }: `) L4 u% m7 H
    cmp     ax, 0f386h9 t# e* m8 W  r" Z- R* A9 v
    jz      SoftICE_detected
+ I6 R1 m  [+ [% \
9 F$ a8 {7 d- ^: H% Z- `) ~int41handler2 PROC
  m2 C/ r/ J7 P; k    iret; ~! G3 w6 i. Z1 I+ H' n; {, A
int41handler2 ENDP
- C2 z9 h1 [/ n% v! R+ ~- Z6 x8 Z" x, x3 U' \7 |6 k; m6 k( V! h

2 e; m% y2 ~( \8 u5 y_________________________________________________________________________
8 X' d( {/ E1 a$ n) _. V3 _# |& N' O! E9 _) O/ W
% u& p* a/ v/ _( U1 J
Method 06( T( M% Q3 x1 ^
=========- A2 o" B+ H, N+ G

& J% z* t5 b( C# P# K/ ?- J
" R2 \; K" m4 R  M5 n% P2nd method similar to the preceding one but more difficult to detect:
" i$ A, \1 D* V0 v
" j) M" `8 P, ]/ v- w+ J4 d1 ]5 ], t2 j' |3 i
int41handler PROC' R6 @- t# ]2 I, i- a7 \
    mov     cl,al
" r% L0 R/ I4 g' ]; X$ D- o    iret
3 b0 M% Q% a% X- V) u- fint41handler ENDP% o+ k- `% }7 V' c

& U/ I! T. C# H4 U; Z/ }3 k5 D
+ d* c7 [7 C) I9 Q    xor     ax,ax
( ], Q! X7 M' `1 l0 `1 i1 d, L    mov     es,ax, X' C" _( ~" e2 a' v* W1 Z
    mov     bx, cs5 F7 K# C6 o- O4 E/ Q4 @
    lea     dx, int41handler! I( r+ L, {( k9 a% ^2 u* C1 o% v$ O
    xchg    dx, es:[41h*4]
3 M1 A# T4 ?  {8 A    xchg    bx, es:[41h*4+2]* A$ a0 y3 E; h4 J8 n
    in      al, 40h4 X; _; D: C1 }. V! E% Z
    xor     cx,cx/ _2 g; {% X" q6 b; J( e; C
    int     41h) z: k2 A- D6 h1 s
    xchg    dx, es:[41h*4]
- i7 M  S' s( ^    xchg    bx, es:[41h*4+2]
! S2 Q& i( L1 b0 S    cmp     cl,al
* o0 M' I( e$ \- Q    jnz     SoftICE_detected6 t9 t9 `' j: {. b0 w
6 n: G! u- U. M3 Z, }  L' s/ p
_________________________________________________________________________
" `% K' @2 W; \2 W8 H; s: X% q
Method 07& Q0 R! E; X3 k( L
=========
$ |* g: V4 `& d+ ~! p: o. v3 ~7 ^; o2 J) T9 j
Method of detection of the WinICE handler in the int68h (V86)  s; i* k+ k* R) {7 f

3 a' Q' @5 o4 l0 \* W( s    mov     ah,43h9 H/ d* M9 C0 J; e, }6 f: {
    int     68h
/ s1 {8 ^( o4 H! L% w! \    cmp     ax,0F386h
: c, g* t5 t9 Y: ^+ `4 r    jz      SoftICE_Detected2 ?+ s; c0 l/ x; I! M3 m% a8 e( L* r

- x  D; U1 \, p# Y7 S5 |" @0 S: c$ h& m* {/ \* H
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
" L5 @% ?' h' s4 l7 H7 ^   app like this:
+ M: j, b' v  Q* b) h( R" P8 `( @9 b! k; h* S7 }6 {/ X( |! o
   BPX exec_int if ax==68
2 Z# O/ ^7 y. Q" T+ K0 i   (function called is located at byte ptr [ebp+1Dh] and client eip is
. m) W' l  y8 `   located at [ebp+48h] for 32Bit apps)
5 O3 J: s  ?5 R1 }__________________________________________________________________________* x1 z( p; \3 d( b2 O- z

; h. r9 a* P0 L# J8 i7 o0 o4 M. h4 p! V* T/ w/ D
Method 08+ w5 `/ d; z! J) g0 `% ?5 S
=========5 p0 l5 L, O. q

+ p1 X2 h! C( f' Z4 a' E) n7 q& iIt is not a method of detection of SoftICE but a possibility to crash the5 u# _* L3 Z& {0 u/ n: \
system by intercepting int 01h and int 03h and redirecting them to another5 P6 k7 T$ Y' u. `
routine.
" m& Q+ y4 ~+ s& \It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( C( ?6 n; J0 u" f
to the new routine to execute (hangs computer...)& r2 c9 D1 o! n) ?/ S) R7 v

$ w: _! Y1 W; R; q! k1 S7 ?    mov     ah, 25h
( E0 p& r, O9 l' Q0 T% e* g! a    mov     al, Int_Number (01h or 03h)
$ S2 S- J% {4 o# m' }8 U& {    mov     dx, offset New_Int_Routine4 R/ a" x9 ^" c  `
    int     21h$ @0 v1 w7 l4 x7 O4 e) x
2 `$ f* K9 d) w! v6 w- W! Q
__________________________________________________________________________
( Z( G6 B% O8 w0 X8 }9 Y  p( K: T* T! n0 O1 ~' Y' T4 E. b9 Y* r/ h# \
Method 09' Y+ f8 ]# ~/ q
=========
; g- O7 b, S( Q+ e2 G! c, n3 D' v1 T" [) c- P- O
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
  x+ T4 Z- j  O+ r! g! Pperformed in ring0 (VxD or a ring3 app using the VxdCall).
; q6 P+ j* b2 ^' H5 J  G: }) XThe Get_DDB service is used to determine whether or not a VxD is installed
8 E9 a" i7 ~  u; ?for the specified device and returns a Device Description Block (in ecx) for
5 V/ I. A. |8 l0 o! G" |% Ythat device if it is installed.
0 o- D5 P: y( r' T1 D. ?7 Z/ D
: i4 `& `! P) B; c/ _, Y7 c9 B   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
" v* j; ~( G9 W* H* z* z   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
2 U! f  g% l* H) U" t, w   VMMCall Get_DDB8 i- i% n2 N$ u- M& e( s
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 }! D& R4 ~7 L. L. }1 O+ U- S
' V! c. @% g, t2 J, }) {& i
Note as well that you can easily detect this method with SoftICE:) O% s+ u) f1 Z) y
   bpx Get_DDB if ax==0202 || ax==7a5fh- s4 C, @  n4 w% ?, o# Y0 f/ B
, H9 \- Z/ Q0 S) ~- s  R
__________________________________________________________________________
$ v- L, s0 `5 _1 S# t5 ]# n  ^0 `7 F3 y- s  w3 C) y
Method 106 Z( S* B& o6 N8 N
=========
# j3 C+ Q  ]$ n$ I/ k1 B/ f7 b! q( y9 ^; R0 c
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% E4 d; h# y* m  j0 J! U
  SoftICE while the option is enable!!1 y! b# l) |8 t; n1 {9 P
; b; p/ w* H6 z% h% x6 Q# L+ m
This trick is very efficient:
( j# B: p9 G  X' Iby checking the Debug Registers, you can detect if SoftICE is loaded
2 D8 F( [- z+ Y' p% Z2 z% w(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
) o* A) a5 C8 b  C* Mthere are some memory breakpoints set (dr0 to dr3) simply by reading their
( @7 L) N+ f: Evalue (in ring0 only). Values can be manipulated and or changed as well7 H) @) S# L& a! k& P$ a1 c+ J
(clearing BPMs for instance)
, W6 }8 J5 V  g. o+ m
+ D+ J: }1 Y6 L/ {# |$ T3 S__________________________________________________________________________# `; Y$ m7 d! r) |+ G4 C9 h

8 J- W' C: C, u' |9 e' u2 TMethod 11+ [. V  g1 _% H$ f; |! J2 J
=========
  G  ]! X/ N" |; l- E$ k6 L
) N4 f* [: }6 b& a4 q7 q& Q% m8 I$ zThis method is most known as 'MeltICE' because it has been freely distributed
% N6 U8 J* ]+ i1 c7 ]. Pvia www.winfiles.com. However it was first used by NuMega people to allow$ u+ o" L. V- j3 ]3 a3 S
Symbol Loader to check if SoftICE was active or not (the code is located
  ~+ y0 Z6 \& G5 ^inside nmtrans.dll).
, k; }1 q- ~( K9 ]7 I: D. }( E$ E* N0 X8 @* Y$ f# M3 z
The way it works is very simple:
* x, U# u5 ?7 bIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- t# T9 v( E6 J2 w& m7 p, g$ EWinNT) with the CreateFileA API.
& S9 T  U" b$ r& H7 v8 J/ S0 a7 T- t7 u. h, x( Y
Here is a sample (checking for 'SICE'):
. `' r* a& o  M' [7 I
! E. Y. f9 ^6 O- ?9 A% Y8 V4 J: s) bBOOL IsSoftIce95Loaded()8 i2 H$ J! ]/ F; d$ U# b4 @4 v
{. }4 S8 T1 }9 w8 _
   HANDLE hFile;  + |6 q+ f' n4 r0 R, x4 W) S' Q
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ Y, D% N- |: B( Y8 B+ r
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
8 @: b( {) G3 ~7 ~0 n/ t                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
& X5 i" d0 E% e- c0 G0 j   if( hFile != INVALID_HANDLE_VALUE )
! [4 y* G2 Z8 N& f   {
. K" L3 x- Z3 X; Q      CloseHandle(hFile);  a- q, w) D) y  F" ^+ l* c% _
      return TRUE;1 r+ C3 l& n! _- }
   }& I' D/ b0 Q" ^- o) c
   return FALSE;
& w- Q+ c( N# _1 _}# }: E& j/ Y. k, C5 v7 m

( H# ~$ u' K% s  kAlthough this trick calls the CreateFileA function, don't even expect to be
. D  a# ?1 x2 Q; }able to intercept it by installing a IFS hook: it will not work, no way!
/ H6 Y5 s* H# I& R8 SIn fact, after the call to CreateFileA it will get through VWIN32 0x001F4 f! \8 p% q' \) Z: A/ j
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) {) }" t( V; B# P4 R: [
and then browse the DDB list until it find the VxD and its DDB_Control_Proc8 r0 P6 B! u% L, L1 P/ P0 q. q
field.
) @: x9 H* Z" g2 A7 q1 h( t+ DIn fact, its purpose is not to load/unload VxDs but only to send a
; [/ w, Q+ l8 L3 A* g" d( kW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)* S1 P( S  _+ X+ Q9 x# M
to the VxD Control_Dispatch proc (how the hell a shareware soft could try/ ?$ D5 y1 ~8 g: P) C
to load/unload a non-dynamically loadable driver such as SoftICE ;-)./ q# J; E5 `! ?
If the VxD is loaded, it will always clear eax and the Carry flag to allow7 s$ I  p4 J8 P' L/ u
its handle to be opened and then, will be detected.
8 m/ r2 D/ s1 T: g2 R3 W( E2 g2 J) UYou can check that simply by hooking Winice.exe control proc entry point6 T6 [4 O% W  _3 W
while running MeltICE.
& a3 Y" Q) z' `/ y, L; w0 [$ s# M+ P7 B3 N* p/ M7 ~# [8 E4 }" T9 E
% u2 k" H+ }2 i8 E
  00401067:  push      00402025    ; \\.\SICE  D; {8 d7 ?# S6 `
  0040106C:  call      CreateFileA
: `/ A, i; u1 R# U8 ]. X  00401071:  cmp       eax,-0011 J4 f  |1 Z# H% J
  00401074:  je        00401091& w+ U2 b7 T# I4 n7 r
; }0 z0 ~7 {5 W) v* z; e7 l

5 ]/ h9 m& ^  n1 E! h( B2 gThere could be hundreds of BPX you could use to detect this trick.
: E7 K5 L* P# c, U3 p6 b-The most classical one is:
% M( s. j, ?. C) m- E8 l) n  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* r- `2 G) H' t! Z' E% G    *(esp-&gt;4+4)=='NTIC'
: F, D  P; P3 {7 v  ]8 t* R# j% _1 f9 A; Y6 j: d1 v
-The most exotic ones (could be very slooooow :-(4 r: M) b7 g$ U: f6 H6 ^  h
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  $ @) x7 k, v1 m! V. x, {5 y: _; Z8 D
     ;will break 3 times :-(8 ^2 a4 T9 J# b8 P& ^8 {9 V$ H4 D

7 e' U) D  r& y3 A" d# ^-or (a bit) faster: * ~1 f  j) i# h3 Z; G' B
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'); j! @/ H6 ?5 w: ~. X, h7 s
7 l, O+ L4 S) C7 B
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  # Z& Q  Z, H$ e* B
     ;will break 3 times :-(0 e3 {8 R( q/ n9 d

. I# E( c7 |, P6 ]3 [' c3 j-Much faster:
1 F! M" _0 f1 {) l   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ b# [( x9 o3 L  K) y
2 W& \0 ^& X. }3 pNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
, C5 L. k  Y) ~function to do the same job:0 b% T& W8 u, A. I% E5 G- R
9 V: W) c4 i4 X5 z
   push    00                        ; OF_READ" M) e' |/ r* Y5 P: m
   mov     eax,[00656634]            ; '\\.\SICE',0
" H+ p5 m5 Y7 w; ^. s   push    eax
. m. r7 s& ^0 Q. x" d2 \   call    KERNEL32!_lopen+ j( O4 T) _$ S. A
   inc     eax
6 T/ g/ Y5 G! w) s. j   jnz     00650589                  ; detected; T, i+ o, o% y+ _9 I
   push    00                        ; OF_READ/ t% D* S8 g4 k% N  ?- E/ h, X
   mov     eax,[00656638]            ; '\\.\SICE'. t; |( ^3 c! v. J
   push    eax6 t% K! J: I4 ]+ E3 e+ I
   call    KERNEL32!_lopen
% X6 {% \6 A4 m7 e   inc     eax
4 Z+ I, Z6 v8 a3 T9 ?6 e   jz      006505ae                  ; not detected/ i3 f/ N0 b& _( Q/ M
1 A  o# J9 P2 p1 B! B
% s2 D4 l' J" R8 R
__________________________________________________________________________
& x9 ~+ P# s, |+ d6 j; ~( t# k- A  _. o6 |0 A% c
Method 127 S7 m* [5 |, i, I6 p
=========6 L" j# Z# ?; m0 C  A$ `% D

" d- b: z& O1 xThis trick is similar to int41h/4fh Debugger installation check (code 05
( D) A! ]0 |$ M+ D7 U&amp; 06) but very limited because it's only available for Win95/98 (not NT): X+ B( Z. t; u0 k5 _3 k
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
% u* B" `6 B5 Z8 S5 D. |: I- N
+ i! T6 s8 x& ~- Y' q6 g& k" e   push  0000004fh         ; function 4fh" Y5 G8 L7 B  Z! g! s0 O
   push  002a002ah         ; high word specifies which VxD (VWIN32), e& F0 x& e  Q% f+ }7 ^
                           ; low word specifies which service
3 V5 G" r2 c3 \                             (VWIN32_Int41Dispatch)
; }* L( Y* K! I2 ]$ V   call  Kernel32!ORD_001  ; VxdCall
2 k: E8 i$ e7 u0 [6 s, g3 g- o   cmp   ax, 0f386h        ; magic number returned by system debuggers5 }3 V7 I9 Y, P4 k( m! E- Y1 |
   jz    SoftICE_detected
2 f- Z  r0 L$ [. M, |9 e: b& g% K- C& G" ]
Here again, several ways to detect it:
! U6 B1 m; `( i+ R: e$ W* z6 k: p5 d; J0 k2 Y7 d( v/ g) }& A
    BPINT 41 if ax==4f: E4 W! N& H$ \* r8 o
$ U, @) g) ^$ M2 o9 ?4 a: C
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one& I4 C$ b1 F3 L  p: b- B

" e0 f, x6 H3 A* n% s, f    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
5 T6 _0 A5 M3 z2 E9 H2 C- A. Y1 A* u1 a; d; k0 T
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
; h: c) \" n( N( L) h0 }$ v  J; I" f3 g9 N
__________________________________________________________________________8 `4 h# D9 P! Q# o6 o- q

- _7 {$ Z4 H, c' u, ]Method 13% F1 r+ F1 A6 c* V
=========4 @) Y# W4 v" f3 w4 w0 c5 R
# b0 r# G8 N: f) N8 X7 ~
Not a real method of detection, but a good way to know if SoftICE is
7 i5 t: X( }) v' U0 uinstalled on a computer and to locate its installation directory.
3 s% f5 D# s4 |, {( |It is used by few softs which access the following registry keys (usually #2) :% B  ?+ J; f" Z
/ x( O; z+ W& V) Z
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, H- q- y2 v# ?# V\Uninstall\SoftICE4 c9 D+ C/ }7 I7 N+ y
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 C( ~' h. H- h, O
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) z2 F1 [) V/ n  ~
\App Paths\Loader32.Exe
6 m! g: b7 r( F/ w: ~3 o2 \' V. R* l4 F4 I9 ~
4 }9 M- n$ N6 p! ]
Note that some nasty apps could then erase all files from SoftICE directory8 S5 Y8 I/ q/ |: G8 {
(I faced that once :-() S4 R: h3 x+ z0 T: G" G

, E, z& w/ K% B. ?& x; iUseful breakpoint to detect it:, ?' u; V5 p5 ?" N
# o- {" `0 r' ~  z  O" r4 S  z- {
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'3 e8 `; s0 y9 I& e- f% d# i

$ a2 J! h1 U8 f: _0 I4 i1 L__________________________________________________________________________
0 h7 F: C# N& c# ~: M  [
' i$ P" p! B  C6 G% H& T# ]5 Q7 M" R5 g8 y
Method 14 + |9 |) B* d2 O* i# h. |. X0 `/ U
=========$ o' t( \( y+ A* v9 n& P( V

" Q$ R+ i) M6 R& T: ?+ O9 ]. E' b' [A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose% G2 V( m6 P2 g& b( C6 T
is to determines whether a debugger is running on your system (ring0 only).# P$ ^( q+ W: E6 k" h' M
0 C% I8 y2 w7 B5 l2 v2 [/ d- }0 `
   VMMCall Test_Debug_Installed
# E+ I' V8 r4 N% t7 z   je      not_installed' t* ?% P# _- m3 o( D
# g- v* {7 u& N, n
This service just checks a flag.
6 l2 i' W+ p; T8 V</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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