找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
" B+ x! N) ?; Q( \& h<TBODY>7 |% O# y' Y% I, I  K
<TR>" V+ S/ X0 w7 ]
<TD><PRE>Method 01
& z1 j) w; {4 V% u=========0 i# a6 O5 X3 |0 j% Z
* m+ g0 i* y1 ]8 b
This method of detection of SoftICE (as well as the following one) is
) [; S+ B1 @% d2 f* w, v8 D7 Jused by the majority of packers/encryptors found on Internet.
4 R: [1 L- v9 K" a$ b: A# IIt seeks the signature of BoundsChecker in SoftICE4 u; a2 p7 o( ]

, _/ W2 T& n9 P* e    mov     ebp, 04243484Bh        ; 'BCHK'
& |# Z$ q3 C. B& t0 y% n6 Z+ R    mov     ax, 04h
4 T$ U' f. I3 j8 |- ]. o# A, Y* i    int     3      
& v4 \. m% Z5 ~8 m    cmp     al,4
! E1 l" |: d, ]5 r4 K3 ]( S    jnz     SoftICE_Detected4 v+ u% O, W4 v: {

. H; s9 q. L4 o+ [2 ____________________________________________________________________________
. t) \0 N3 y; T/ A& b7 V
8 O  D( j$ N8 i7 M! @Method 02
9 A' s3 J% ]' c=========
+ l* C8 z% L. H8 [3 \: g8 w. V% l8 ]: q  [! G; l
Still a method very much used (perhaps the most frequent one).  It is used! V9 a# e0 y8 {) F/ E. I
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,$ @3 X) j" D& }3 [
or execute SoftICE commands...
/ z1 F. D3 J% f" VIt is also used to crash SoftICE and to force it to execute any commands0 o7 X4 A" @- r1 X6 t8 n' B) ?
(HBOOT...) :-((  ) Q; Z  Z3 {/ V* M. E# m; N

, T3 c" F( C  ~+ T5 mHere is a quick description:9 @. e+ F; Q7 h, G
-AX = 0910h   (Display string in SIce windows)% B! H( r" K/ n
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
# Q  P/ ?0 R# a1 P+ ?-AX = 0912h   (Get breakpoint infos)$ ]# }8 A: |$ W2 v& u; D' x5 x
-AX = 0913h   (Set Sice breakpoints)
( Q& E1 x% F) z( Y6 @) J- A! }-AX = 0914h   (Remove SIce breakoints)) e% y  j2 g$ e( T

. ^- H* G. T, Z: Z5 L9 d/ zEach time you'll meet this trick, you'll see:! `! o4 a4 f+ D: J+ ^% {. N( O
-SI = 4647h' ]( r8 z" z$ P% S" E# s
-DI = 4A4Dh
2 u. J' J% v8 H! D" u9 L: i. X) |Which are the 'magic values' used by SoftIce./ N- F" o+ s) q/ S( a
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.- G5 r- C3 o  R0 K3 U( v2 H; P8 P
% w0 x" }; Q, g9 t: c
Here is one example from the file "Haspinst.exe" which is the dongle HASP) A  f8 @) V: h
Envelope utility use to protect DOS applications:
; t3 b+ [+ i8 t: q' c+ z4 f& J+ x7 l  x, P0 Z9 G" d" B

# L/ w, p* s5 N4C19:0095   MOV    AX,0911  ; execute command., [) k! f2 U! n5 k
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
' y$ t1 k3 v" A4 }4C19:009A   MOV    SI,4647  ; 1st magic value.
) d* l  n+ t! l" S8 Z) c; `. R% G4C19:009D   MOV    DI,4A4D  ; 2nd magic value.1 m0 _( v! G/ x* ~
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)% c- S7 U0 l4 O* ?* m* w
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
  z7 J- [) l! @- e" ^4C19:00A4   INC    CX6 j0 A( y2 {# U0 X
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute" `3 o/ m5 g" k5 {9 e5 o5 d- @
4C19:00A8   JB     0095     ; 6 different commands.4 y# P* {. r  B" X
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- K( q8 \+ b# J: }+ i
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)/ J2 H9 i# v- Y) U
# r+ H& ?# e$ P: t
The program will execute 6 different SIce commands located at ds:dx, which  G& M2 |5 U  _# i8 G3 e, w% k
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.. m+ k$ `; z8 F4 a' \. s
- x7 @* r5 Q* K+ t
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ B/ N* h+ ~: P, @2 r/ R" T' k7 S
___________________________________________________________________________
( u% j* F: C1 z% |' b# M' q7 L$ j" M1 m

6 i5 o- p( B. K3 q. F' D9 L$ C# XMethod 03  `! P/ ]$ I. g# p
=========( h* ?" L' y# m8 `% b
+ {! d% n, o& H: O9 n
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 U6 P" a9 ^* j4 _1 ]+ S(API Get entry point), q& u* S! }- G$ r
        / t" G8 A6 B2 }
. W/ C4 T0 |  J
    xor     di,di
6 m& s- D( Z8 M! ~7 R    mov     es,di1 e! x; f) `8 v% n
    mov     ax, 1684h      
, E9 o2 e" r& T! ]    mov     bx, 0202h       ; VxD ID of winice$ g% ]' ^( G8 C9 C2 G
    int     2Fh- _* |* m" K0 M! M' N8 v# [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' r/ }" U+ F  }1 }    add     ax, di
6 C( T: @5 b; q+ F    test    ax,ax
% E: C$ C3 `3 D3 ^2 F    jnz     SoftICE_Detected
% I) {& \7 i4 P4 G+ a" k; [. q3 e/ o; U
___________________________________________________________________________
! j. ]" \# D% I1 h; l  d. P/ }/ M- {4 _$ P  p5 F
Method 04  r2 D) u8 |6 r0 ]
=========! {# C" }* o6 s
. c  ~* R8 f; [
Method identical to the preceding one except that it seeks the ID of SoftICE
( o5 \; B  O5 _% o% p' c! I7 kGFX VxD.! `: n& {1 f( L

! e4 x3 |; J2 b" @# p    xor     di,di
! J  g( L0 Q) E9 i8 W: b    mov     es,di' Q% D1 o$ v! W0 l4 S+ K8 \# d) h
    mov     ax, 1684h      
9 J( `$ f9 c2 H8 |    mov     bx, 7a5Fh       ; VxD ID of SIWVID, L6 W* d- n6 N3 b% |
    int     2fh. ]) m; U5 t9 |9 v
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* x, |3 X( {0 [! S# v) E3 H: P    add     ax, di
' A0 G# P2 N+ {" _    test    ax,ax9 S6 a! W3 g% E6 x4 n
    jnz     SoftICE_Detected
) J7 W; S5 S3 y7 C5 G8 e, H+ f  W
6 J" U8 u( V  X% a__________________________________________________________________________( u+ [3 l! [. C( k

2 n7 P, A* V* L7 j
% w2 _' ]( r2 q+ z# sMethod 05
* d" Y3 y4 b3 b1 c, c3 D=========
# i- g6 g8 V# z! f) D! R0 s" D' m
Method seeking the 'magic number' 0F386h returned (in ax) by all system5 S9 J* K: s3 h: c
debugger. It calls the int 41h, function 4Fh.4 L* Q6 T5 C5 g+ ?& q
There are several alternatives.  
& Z! s& o) _7 m( C- a" a4 ]2 n% i$ u7 w6 L3 \( m3 R2 ?
The following one is the simplest:
) U2 f7 w" D  P! p7 I0 l( Q) i, U7 a2 p' |  y
    mov     ax,4fh. u9 \) l4 z, e
    int     41h
0 K: Z4 L6 `0 W, `5 i! C: x, H' R, i    cmp     ax, 0F386
) [: Z  v3 i" V* c9 I  G    jz      SoftICE_detected
, _. g% j6 J5 D9 e! y! M( B6 }* s& p, S
. A/ N! X, O7 Y5 \# t) l  T3 X
Next method as well as the following one are 2 examples from Stone's ; i. \4 W3 Q, G" \' g# `: @
"stn-wid.zip" (www.cracking.net):
5 _* E/ b; G9 P
0 E" u& [3 X& e/ m5 S4 f    mov     bx, cs
8 p, q% R8 g. v( E& v' i, O    lea     dx, int41handler2
, T" \; B% f5 I4 ~  k    xchg    dx, es:[41h*4]$ u; q6 {4 I$ J4 E6 C" c' t, o
    xchg    bx, es:[41h*4+2]. a; ^0 t( n$ F. v3 C' x
    mov     ax,4fh  H( h1 ~4 F. e+ Z$ _
    int     41h% g* `1 X# Q/ X2 d' o
    xchg    dx, es:[41h*4]( W& U1 ~* T& r: F9 q7 ?- w7 {' R
    xchg    bx, es:[41h*4+2]! C' q. I( _' G6 ]+ N1 r) V" u
    cmp     ax, 0f386h
! o6 |% J. r- @3 y$ o    jz      SoftICE_detected
7 p9 s+ E3 Q- q
; K6 i0 Y6 |6 T8 jint41handler2 PROC) c; r; a  \/ h) R2 I
    iret
, ?% s- J( K, S& [int41handler2 ENDP
8 q: [; ]- a$ b# D$ @) m: Y1 |1 i2 }( ~2 a3 x2 [' y+ W, t

# o. u8 |0 ~% Q' I_________________________________________________________________________
0 k( ^/ r7 R8 J: f4 `/ r3 i
' }) C& ~. P$ k/ T" D3 }- O
' }7 {" x& h- JMethod 06% T% Q$ g/ E" z
=========+ a- k5 X7 j% I) ]6 l9 A( F

2 h! V3 p: n' S; g, d6 x+ A/ ], {: B6 D! J+ P; }
2nd method similar to the preceding one but more difficult to detect:( M. \: x. r7 g1 j" X

% E4 C1 }: N" ]: M+ P" _% N; B! u: J( r: \' R4 c& E
int41handler PROC- N& l7 m3 I8 g2 b
    mov     cl,al
) i; Q. V: R7 y) N, r2 d9 q    iret
- E3 a* p0 v  |- z4 G% T' @4 iint41handler ENDP
7 b9 `: ~% o0 K2 {% t/ o4 O* T* z% I  f% i: i5 A( [
3 h+ c/ T& E5 N. j% u& w
    xor     ax,ax. k+ K1 |% n. `* G$ ]: \" r2 P& ~
    mov     es,ax; d8 J3 F4 \8 d- Z% V  \/ v2 J) r
    mov     bx, cs3 f: l# s2 N' x
    lea     dx, int41handler4 o# G* y$ s4 `
    xchg    dx, es:[41h*4]  ^& j' \& `0 l5 d' K7 A
    xchg    bx, es:[41h*4+2]6 T+ F- ^: |+ @5 e" A
    in      al, 40h
8 Q( e- y5 B9 c5 Z. f" e" F( J    xor     cx,cx
9 f' q, n- K& t1 N    int     41h3 [2 ]% h1 R+ x* F; M2 V
    xchg    dx, es:[41h*4]
) `5 f9 h" M# A9 ~2 e7 x    xchg    bx, es:[41h*4+2]0 P7 l8 d, H# r7 Y! I
    cmp     cl,al! u; ?9 K% n8 b& x
    jnz     SoftICE_detected
0 Y) {3 C3 r% b, A
1 R4 }5 W$ \3 L% S2 ]_________________________________________________________________________
1 D- O& H* J) f1 ]5 I0 w! A' J! a1 y
Method 07
; y' T5 @6 p/ E( l2 g, e6 ~- {=========
- G! S. Q7 j- H/ `# s+ v( e3 j, K1 Q! K0 [* l) W0 I" d; W7 l, t4 y/ ]
Method of detection of the WinICE handler in the int68h (V86). I  z3 ^# W" {7 P

" O; h( h  u/ I$ {    mov     ah,43h  R; \: ]$ j7 [" Q& d
    int     68h
  i% d2 w8 F0 K! F9 ?* ~& N) F    cmp     ax,0F386h
) X) X$ Z9 l, G4 _% R* S    jz      SoftICE_Detected6 {# q+ V( J" ]/ U7 h* _; t4 E& }

) H, x5 I2 O8 d5 M. i: w/ A4 v! [, b" k( m, c- k
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit4 D* M& G6 n3 b! Z
   app like this:
! e- N& ~" s7 n6 Q" D( f2 O/ m3 {0 A+ u. y7 L7 E
   BPX exec_int if ax==68
6 m6 Q. p5 G4 s2 ], `: A   (function called is located at byte ptr [ebp+1Dh] and client eip is
" ]. {& `. t# F1 \* a5 x   located at [ebp+48h] for 32Bit apps)% Q5 ]6 e: R4 d& r
__________________________________________________________________________( L4 F& V! u3 e

+ ~! Q  t  y% S  ^+ {9 ?# k8 i% q" q. b5 l
Method 08
: O  x) V5 d" ]- b2 @=========
( P! S# ^# f3 D: _4 e# i2 g) ]6 J+ u- C7 n- l( b# p
It is not a method of detection of SoftICE but a possibility to crash the. s# f( E0 U3 b  S
system by intercepting int 01h and int 03h and redirecting them to another2 k6 Y* f  S0 f* r/ B5 Z; X
routine.: F% }% F- G2 S0 m- Q' F
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
' y# d/ ?2 u" @* Cto the new routine to execute (hangs computer...)
% z* N% J  D( @* o1 f
# O& |8 `# S8 x6 j7 H    mov     ah, 25h
  k6 g% J( e$ K! o1 A( H7 R    mov     al, Int_Number (01h or 03h)
, Q' f# V' N7 Y. H( J' ]! C& Q# U    mov     dx, offset New_Int_Routine1 N/ _3 _1 P- D
    int     21h
- t2 v0 E( w9 M; Z) b; B* ~( Z
1 x) \$ v" `3 t3 e__________________________________________________________________________
2 T8 ~  |- W0 Z! W
  i8 S* Q# O7 L4 w, u/ @6 i/ {Method 09
( `, E& ^. b7 _, |=========7 q% O5 m  f( G+ P! ]7 U

5 r  r1 U! l4 Z2 Z' ?This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
7 c* p% I9 ]. A  R( @performed in ring0 (VxD or a ring3 app using the VxdCall).' T, p0 y, ~& x
The Get_DDB service is used to determine whether or not a VxD is installed
7 i1 C( Y7 Z1 _; O9 J  @9 \1 kfor the specified device and returns a Device Description Block (in ecx) for
' b. Y* _- ]; U0 P8 q2 m4 Wthat device if it is installed.
) d4 E+ r( s: Q, s) \  ]7 S& B: r* H, E! @2 U/ u
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID! X* a+ t; Q& P2 Q/ q3 u& ?
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)- D, Q$ C5 l+ Y$ Y! d5 X, x
   VMMCall Get_DDB3 H7 G8 O! u- u  K8 u) r/ f
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
  p! f' X; A/ X8 Y& c
5 V( w7 ~/ t" O$ FNote as well that you can easily detect this method with SoftICE:8 l2 l& A. \" b
   bpx Get_DDB if ax==0202 || ax==7a5fh
! w% B+ R+ \( \6 r7 V) J( {, {# H$ Q, h- V8 [; \+ y: H
__________________________________________________________________________
; o" y& A, Q" p. V, _6 ~
8 e- u8 q) q$ DMethod 10
! n# p8 g2 N* @. o=========
' g; l. z/ z6 F( r' D
5 K3 }+ [9 @  |; t* b' L=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
' d9 g7 |3 W6 `2 d& R7 {  SoftICE while the option is enable!!! }% k4 q) O$ D& v! D

% p: a& L" [4 R" zThis trick is very efficient:
$ `, \& ^0 k, Y# X+ fby checking the Debug Registers, you can detect if SoftICE is loaded) P3 a" L2 ?+ f& _
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
0 T) w$ G3 `5 `2 y6 F5 Hthere are some memory breakpoints set (dr0 to dr3) simply by reading their
* {9 O7 k* ?9 bvalue (in ring0 only). Values can be manipulated and or changed as well# f# ?- M6 x0 v
(clearing BPMs for instance)3 u$ z9 h1 D+ E, n
3 S, A! D. G" r- c/ G
__________________________________________________________________________2 ^. ^" B8 m5 i

* D" B/ q5 ]# uMethod 11
! ?4 g9 |9 x/ Z! O7 A$ }=========
. w) @) y- Q  E. h; {& C4 K. T* {) V5 H3 u0 @* d
This method is most known as 'MeltICE' because it has been freely distributed" O) X9 P1 o0 y! Z
via www.winfiles.com. However it was first used by NuMega people to allow6 Y! `' K. U* j* {/ g2 z
Symbol Loader to check if SoftICE was active or not (the code is located
: M% M7 M# B& K! m* ~2 Sinside nmtrans.dll).% r9 u6 \4 q6 E9 z  F* Z
5 }# W3 a4 H& g2 I5 q+ ~( c0 I
The way it works is very simple:
7 P0 r8 ]/ l5 G) d+ j# v* qIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for* V, |0 m. k( E8 k) K+ H
WinNT) with the CreateFileA API.
8 M4 @) E/ d& y
9 x, ]8 h+ ?- AHere is a sample (checking for 'SICE'):
$ l+ |% i# Y! r8 l/ S' r( T0 o5 F: N4 Y) t6 Y  K- D# a8 A/ W( M
BOOL IsSoftIce95Loaded()
( Y, Q; X5 i% n+ f+ C( W5 C6 `6 H. m{0 ]1 [$ H! a5 s" P8 A
   HANDLE hFile;  2 e, M5 W& q9 c6 C7 Z5 T
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ y0 ^0 ^( `& y                      FILE_SHARE_READ | FILE_SHARE_WRITE,4 t% Y  P! w4 b8 y( A
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);$ P- ]; ~' o9 i
   if( hFile != INVALID_HANDLE_VALUE )
% |* M; ~; _2 }" }7 y0 X$ F   {% t2 _" r! r1 i' S, ~! \
      CloseHandle(hFile);
# y5 @- W7 A7 R/ P" d      return TRUE;+ ]7 l! t/ P& @( v' g
   }5 |' g& \) E$ e- ^% V
   return FALSE;
' ]5 n" E: S& d9 J}
; A. H: Y7 b2 P2 r5 r% z" d
- V/ t$ U- ]! F2 V7 JAlthough this trick calls the CreateFileA function, don't even expect to be
' i6 d1 G& Z8 d2 J" B. Y  Y9 o& xable to intercept it by installing a IFS hook: it will not work, no way!
: k1 F& l! K( C( E  u* k. \In fact, after the call to CreateFileA it will get through VWIN32 0x001F9 i, Y2 I. }7 S( F) u* }) J$ R& m  r
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
9 W2 [2 g5 |# R: kand then browse the DDB list until it find the VxD and its DDB_Control_Proc) w9 H- Y& ^9 o# c
field.
* l# V7 o# b* {) tIn fact, its purpose is not to load/unload VxDs but only to send a
( I3 {0 I$ W9 I2 u" r/ w% oW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 K# Z4 R9 u- j4 @' c; cto the VxD Control_Dispatch proc (how the hell a shareware soft could try
5 _4 D$ q% M- I  M0 _( p8 uto load/unload a non-dynamically loadable driver such as SoftICE ;-).
5 s& ?% f! [. o8 c" S5 SIf the VxD is loaded, it will always clear eax and the Carry flag to allow
4 A$ Q4 K) ~2 Y- \4 g% \( i1 Gits handle to be opened and then, will be detected.
- p# H+ T; H: j( C/ v8 tYou can check that simply by hooking Winice.exe control proc entry point) _7 s1 s) t7 o& i: o
while running MeltICE.
5 H4 b. J* ]! L: A+ |* ~1 T& J4 |2 B- w# ]; ]/ C

1 @+ w" w. T2 n8 i  00401067:  push      00402025    ; \\.\SICE
1 r) b6 [, I6 A6 L2 `  0040106C:  call      CreateFileA1 u* W6 X) _& V" P# [
  00401071:  cmp       eax,-001
8 |/ g' L: B# z' O" C8 z  00401074:  je        00401091
' v; w% t& U; A- w! r  _" r* V4 V
  L  z) e0 g0 K; S$ \1 H2 _
% K% t) f. n8 n5 p/ ~There could be hundreds of BPX you could use to detect this trick.
6 s  J+ L4 p6 e  J" B/ q1 G-The most classical one is:0 h$ }& _5 N4 S- I2 ~2 F
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ x7 ^( a) |" A' e8 _
    *(esp-&gt;4+4)=='NTIC'
% Z* y; j1 C1 a; Y- a2 i: B8 C$ I- w1 t% j/ f, f: s
-The most exotic ones (could be very slooooow :-(
! S  ?; b. V" \& n   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  9 k, e5 H. X% z! {; _
     ;will break 3 times :-(: o# g( G& q9 @" {( I# L# O
2 D) F, k% Q7 K  Y9 R9 V9 g
-or (a bit) faster: 6 z& r+ C# T- \
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# b" u- j# b9 P2 Z# {3 E; M' p# n( R5 }
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  / t+ ?/ G, Q" }' Q/ z; f  ^5 n, Q  _
     ;will break 3 times :-(+ S# b4 H8 C, t# [" ?

& ]. v. T/ v  {9 A) n-Much faster:
: ^5 i8 R& y( ?/ S- ]& X   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
2 ^# m; y0 B0 B, B, e+ ], x0 G/ `8 J7 A! B1 T* l
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen- V! D+ Z6 T3 t- M
function to do the same job:
2 h2 d* W$ `2 U3 {# Y: c4 T  j) r' p. P/ u* _: l+ N5 ?
   push    00                        ; OF_READ, S8 V* ]; J1 ], D$ Q2 X7 a
   mov     eax,[00656634]            ; '\\.\SICE',0
: g+ s$ Y  W1 G6 @) t: T  W   push    eax4 _& N; P; D, V) ~6 I8 t
   call    KERNEL32!_lopen4 F9 M; F' p  n
   inc     eax
6 f0 s5 b: v* [) n   jnz     00650589                  ; detected
0 ^' y7 c! p  ~   push    00                        ; OF_READ' Y6 L9 {" `. G9 N% W
   mov     eax,[00656638]            ; '\\.\SICE'
- _  L( o  e9 \! E/ W2 H) b+ u   push    eax
# Q( X* b$ J8 `: ~# L- f& M   call    KERNEL32!_lopen
  ~1 k7 N9 C2 d8 l   inc     eax! z5 [& o# e& c' {* \+ {1 _
   jz      006505ae                  ; not detected
# l+ _& D' k# ]1 h! n2 S8 P( J1 n
1 i# |8 a; q2 c* D' b. T# p* x8 S
8 I* ]  e$ f; f. v__________________________________________________________________________3 p# N0 P' y7 Y- g% T, S

; @/ b) A3 z6 ?# M0 X) b( UMethod 12
) E) w1 X, Z- H7 T/ ?=========, ?0 n+ s9 O+ ]) q5 g: `

* b! a  y) s( n2 i  iThis trick is similar to int41h/4fh Debugger installation check (code 05( R! d2 Y  f- B0 {
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' W; F. J, Z0 \$ y" ~as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
, T, P% X6 H' P3 q  s9 D& u) y+ D& c( V  l( n9 k
   push  0000004fh         ; function 4fh
2 M4 j2 C9 U. p4 y! M   push  002a002ah         ; high word specifies which VxD (VWIN32)
& ]1 R0 g" ]8 v0 l6 v: ^+ n8 u                           ; low word specifies which service
; x7 ]! j) E: B, ~                             (VWIN32_Int41Dispatch)
3 B" q, T; j0 A( {: a, h* S) M* `   call  Kernel32!ORD_001  ; VxdCall
' e; L; n# n, K5 U+ R! f% m1 @   cmp   ax, 0f386h        ; magic number returned by system debuggers- k- n% t2 q8 B
   jz    SoftICE_detected; q% o% B* v) d$ H

) N' g% o3 y- b, z% AHere again, several ways to detect it:
! f: x, S9 u% ^. w; d' a# Z( }1 d" I8 O1 x
    BPINT 41 if ax==4f+ D5 q' g% J. Y* M: q

! x' L9 c7 k- N% M    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
- H- q$ ]4 A7 n, J% t+ ?8 T5 `6 I. h- }( K: s
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
3 J4 p3 ~, g: u
2 B! a4 _5 W9 F  U    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
0 e! Y. |& ^! Z7 s0 f. N' p+ C- ~9 H+ U8 T: F: C7 w
__________________________________________________________________________
. J+ O* h' ^$ }& J" \
: q' ?; f5 O# h2 ]# }7 e7 r# WMethod 13
0 @+ w) N* U; o/ E) |=========/ T& k  b0 B0 N0 ?9 L# {2 y$ e
( ~: R  R0 W$ m- T% x7 w* i
Not a real method of detection, but a good way to know if SoftICE is/ ~" M( a+ D" P4 N0 W
installed on a computer and to locate its installation directory.
7 x* @- O3 B6 M* H. A$ Q3 p3 m+ NIt is used by few softs which access the following registry keys (usually #2) :
/ H3 ]& _) x: F9 `: r! W, G* g. g4 g2 K" Q1 \% E( O' X  X
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, g9 z1 Q( T6 q! o1 X
\Uninstall\SoftICE
  c5 o9 ?$ V% ~: W8 D-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( M6 M- \# q6 t0 j$ y  h-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( j6 k9 }& s; Y9 F( I\App Paths\Loader32.Exe
5 }+ A6 E+ ?1 w/ C* G8 @' _0 Y2 {* l8 P
+ [# G! Y3 R5 m. I! L; [% A3 C: f7 l/ i" Y. I5 G+ h* E
Note that some nasty apps could then erase all files from SoftICE directory
, k7 i8 ?0 A  E( u(I faced that once :-(
, F8 z# [) D( _- I! l; M& `( Y$ a7 f  B: P( k1 N
Useful breakpoint to detect it:
; V3 }  L6 S( _* X& T! `2 _8 s& r2 k! J: j; M# _
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'+ q7 O* y8 J" c# |4 X
, q3 P& Q* Z0 J7 U
__________________________________________________________________________& M4 D* D- I6 O, ?! o- W8 ~# \' N( x* i

# e3 E' x  K3 P- [* u
- I& c# ~$ ?: v$ P4 A# B3 x, U; e7 H# KMethod 14 3 g  v9 f; Z0 S1 Q! Z
=========
  v2 n4 Y$ h0 ?# P( M' |! m2 z8 j# O+ M6 G5 \; Q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
5 a/ O' j* p2 Mis to determines whether a debugger is running on your system (ring0 only)./ `( X" {- C) v  {- u

0 Q- x* i% N" M) L/ R   VMMCall Test_Debug_Installed/ H! Q5 \, ~0 I* g( w
   je      not_installed
8 G& T% h9 M* H( m: L  R9 l& m/ H0 I
This service just checks a flag.
+ y8 y& `0 {+ D- d</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-12-24 11:42

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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