About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
$ E+ o' {- M( n2 V* N/ v<TBODY>
- T" K5 d3 E" m: ~0 `<TR>
5 n  c1 P. D6 v: |8 j8 e<TD><PRE>Method 01
- [8 Q8 i) X4 `  u7 E7 Q=========
3 U5 u, q. e& D) X
) S+ B2 w  }6 k& ]This method of detection of SoftICE (as well as the following one) is
9 s7 z; E+ q& [' v" I+ |( |9 I( Gused by the majority of packers/encryptors found on Internet.9 ]0 ^- e/ @$ \4 g# h! {$ A
It seeks the signature of BoundsChecker in SoftICE
  {  F6 x% F3 [  m- F1 r: x8 o2 n. Z. I) {
    mov     ebp, 04243484Bh        ; 'BCHK') I" z& A- u" U
    mov     ax, 04h
0 `) D/ ?" z; B' X) Z, z    int     3      
$ u0 B& }7 Z; r9 ?) Y- N; Y    cmp     al,4
4 O' m# g: \, w* p7 b5 \' y    jnz     SoftICE_Detected
+ j6 H& [& E- V& R( F; ]) \2 g7 p- O# N, t8 c6 y
___________________________________________________________________________4 M8 q3 }: J  s0 ^' i
$ b3 ~# r! y" b- o+ r  N
Method 02; b) g7 t  J/ h9 P
=========
7 u5 `0 o, m% O6 T. S( B  W0 b' S
Still a method very much used (perhaps the most frequent one).  It is used
/ m! N' \# K; R' z# b: w+ M, wto get SoftICE 'Back Door commands' which gives infos on Breakpoints,4 z" @0 I. ]% _% v; N' b/ ]. R
or execute SoftICE commands..." i0 K8 Y' e2 z2 ]& y
It is also used to crash SoftICE and to force it to execute any commands
( C' m$ r* a( M- h9 \' ]+ f(HBOOT...) :-((  
3 {  t: m7 V+ E1 V/ |, I7 H2 z4 Z& P
Here is a quick description:
# A: ]. ^( E7 i4 U+ X1 \-AX = 0910h   (Display string in SIce windows)3 A: h1 t. ~# S$ U4 p
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)/ X; G/ G1 h: N
-AX = 0912h   (Get breakpoint infos)6 }, _/ z- x" i' @2 w& R% W. K
-AX = 0913h   (Set Sice breakpoints)0 G; p, K0 ]; A% `) Y
-AX = 0914h   (Remove SIce breakoints)
* U. i0 p# o  j% W
, L% J4 T( u. }! k3 lEach time you'll meet this trick, you'll see:
/ \& p3 W; Z- v7 G. @) u-SI = 4647h8 \, G1 J( m- b- {) X6 o9 @
-DI = 4A4Dh
$ T9 N9 |$ k; z" j& K. c6 K, SWhich are the 'magic values' used by SoftIce.
9 N: o& i% N& ~2 _) Z% `6 [For more informations, see "Ralf Brown Interrupt list" chapter int 03h.# l3 _& p" L' {9 q7 ]  t3 O

, O- w1 Q% {9 E( ?0 |3 c& b2 rHere is one example from the file "Haspinst.exe" which is the dongle HASP
2 G# }7 \0 B6 i/ t7 ^  x" }5 r1 qEnvelope utility use to protect DOS applications:, G) S* p4 U8 E! w6 z8 n0 o

5 |! Z4 E7 G. l# N- f! E( t1 V$ D! }4 V
4C19:0095   MOV    AX,0911  ; execute command.
# G. D* n6 ]; Q8 x' T# i* j, \9 t4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
) W% h& j3 p  H5 `5 K! D( W4C19:009A   MOV    SI,4647  ; 1st magic value.* J' i  N$ O. d
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
# r9 h+ ?: q( [+ A4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
7 L: c( u( v2 [/ b& j6 j, A4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute9 B3 c) s$ h& \6 M. Y! `
4C19:00A4   INC    CX
7 G# C0 c  z; t3 T9 x4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 ]) i6 S. {' ^& t  p0 S4C19:00A8   JB     0095     ; 6 different commands., Z5 X2 a/ w9 `  u7 {
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.$ F2 L# p1 [+ R) }  ^4 X. Y& ^3 H  s
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)( w% L& {/ ?, N0 ?# F" ?* E
; m% P3 n8 m2 e- j9 A7 _, {
The program will execute 6 different SIce commands located at ds:dx, which6 A& X, T8 ?% }" c5 c) Y; l' P' Z: ?
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.8 E8 U' |7 i! R6 ~9 A) ^+ a

/ W$ }  \  V5 e1 W; U* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.4 l/ b6 t% n0 t. s' N
___________________________________________________________________________
* y; W: J+ c9 Z3 t$ M5 x2 I7 B) T( l6 a
: i* x7 w, s6 X, w9 ~" i9 Z# y% F
Method 03
2 E- _6 l6 R& [! r4 [- t" Q# C=========
! j: j  k  a( [  v7 E7 j' K4 X" A! H5 A8 @' G- {* p3 k
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* ~8 f( C4 \3 t+ E( V(API Get entry point)
' t; F/ G. g" a# ~        ! S5 I( e4 M; l) ]4 h8 B4 `

% j% o# ]- m& b0 Z, B    xor     di,di# T% |9 P8 y0 c6 a/ \# u( \
    mov     es,di2 t+ V& e0 X% E) H9 E3 h0 P
    mov     ax, 1684h      
/ _0 g0 m6 V( M    mov     bx, 0202h       ; VxD ID of winice: z. v& A- m, C
    int     2Fh
5 ^) A" I! u+ S7 ~( I    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 ^1 e! N( O9 u
    add     ax, di
2 i$ ~4 a) m, X0 w, V/ I" ~% r4 i    test    ax,ax9 m% j; q) u' L+ M1 n6 m1 Q3 X
    jnz     SoftICE_Detected9 Y8 Y$ R& Y6 `) \6 m

. ?5 f4 m' i7 m) J# Q5 S___________________________________________________________________________1 H- C! k/ w/ {0 |  v+ Y9 ?
2 e. o) j* Y5 A
Method 04
0 t. C2 O$ j  C# p" {; v) ?! ]=========
  @6 @; A- r6 l0 u4 \2 T
/ I. c( t3 F# P3 t$ PMethod identical to the preceding one except that it seeks the ID of SoftICE4 L/ a) \+ U" C' n3 h1 W: D
GFX VxD.
  v* }: x* ?& x4 {( j# s- C. B
2 b2 j) Z/ i( n. m& Z6 b    xor     di,di
/ D4 s4 m6 K4 f$ W% }    mov     es,di% W$ b. j/ e+ L$ d7 z: q
    mov     ax, 1684h      
3 R: S: r( I  U# `8 e) m/ n2 B    mov     bx, 7a5Fh       ; VxD ID of SIWVID# _- o- R1 G# Y1 H
    int     2fh/ i% A+ F" e8 g3 Y9 E. V
    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 W, x) n5 q7 @- Z0 O" x
    add     ax, di
" q8 ]6 |8 I4 x7 a0 G2 c2 M    test    ax,ax9 W1 \# m, k; o
    jnz     SoftICE_Detected
" R: j6 |' P, _9 J7 m4 I! w
( j# }1 x+ t( C" A9 F7 C! k: b* s__________________________________________________________________________7 k* B9 l' R/ e* k- Q
! H& ]% _' B: V

9 y& l9 i; T# GMethod 05
3 n% C3 |! Y0 C9 n4 m& C8 a! C=========
9 V1 m5 s) ?/ q; N1 b* r' R% |* H+ n; B% b4 K5 x
Method seeking the 'magic number' 0F386h returned (in ax) by all system
/ H  w! r0 @: y. Qdebugger. It calls the int 41h, function 4Fh.! a# z( y2 i6 S% m( E
There are several alternatives.  
) ?7 h# Y4 }) e/ K+ l5 E& v. e% V/ D* a+ E% u1 Y( j) T4 G/ T' T2 ?
The following one is the simplest:5 f/ I( ?' w& A( @  ?( x, t
, O7 f5 k% ?+ ]' N) U
    mov     ax,4fh3 @( \: Q0 C  t9 t
    int     41h
- i$ ]/ b) I( u0 C1 O# }    cmp     ax, 0F3862 V, ^+ ^% y5 C9 Z4 N7 V  {
    jz      SoftICE_detected- `1 g' h8 M$ ?$ [: O9 p4 J( d. ?7 b' v
( V) l# x4 D5 h2 x
1 f: ]+ o7 \0 u) E5 [  ?
Next method as well as the following one are 2 examples from Stone's ) i' |) _' v2 u4 Q" j3 a
"stn-wid.zip" (www.cracking.net):7 n- L. a( J9 b2 k( k; O8 e4 ?
5 U2 k/ B9 `9 q
    mov     bx, cs
* X; ]* J( u) K# v    lea     dx, int41handler2
. |' k3 r' L: r. _+ u' O- U) E    xchg    dx, es:[41h*4]
% J9 `$ f* s1 j9 q    xchg    bx, es:[41h*4+2]
  x9 p+ E$ Y  m: X  C2 N! R    mov     ax,4fh
2 r. |: |9 {! R( _1 p    int     41h
+ _3 J* }$ R! B    xchg    dx, es:[41h*4]
3 Z  ]- J+ C1 R+ M1 b3 E% I9 I- p) m    xchg    bx, es:[41h*4+2]
; K( z4 Y0 C7 h- f0 L    cmp     ax, 0f386h
$ G5 W6 E/ A5 O    jz      SoftICE_detected8 ^+ \1 e( Y& n

2 h1 a. u, r9 E/ p/ i. [1 c0 |int41handler2 PROC6 D9 |6 x0 x! O* o2 j) r2 {
    iret. Z  J8 D6 X- E9 F/ C
int41handler2 ENDP
3 O+ d) J( A, w* F: D3 I7 O5 P/ d( ?, T& E) g, `. f, m
; J+ N% Q$ \% J' l; t- A; G; N
_________________________________________________________________________8 K9 Z3 m' I1 U
. \( ^( ^& M# x! Y0 {5 t

' j) a' O( O4 y- q0 nMethod 06& e6 \4 a2 p# L
=========; q- O' P2 {; n/ w% c1 y5 E& `

; ~9 \/ ?1 D/ I* B3 p+ T; ]/ u; C# N/ f0 W5 X
2nd method similar to the preceding one but more difficult to detect:+ Q7 [4 v4 e) G9 x, T
1 E4 n" [4 Q2 L- ~
# Z) h$ G7 o; R0 p
int41handler PROC
3 M# {7 c) l6 f4 X    mov     cl,al
4 e9 _9 s6 ~9 v" ~5 ]; g- P    iret+ J1 M' Q) s+ k9 X
int41handler ENDP
' T9 k/ `6 L# e: z3 ]/ K, z3 d9 B0 g' ]5 B) [6 o( |$ t+ t% p

9 ^' V8 C' v9 a    xor     ax,ax
, n( l; Q- Q& g  t    mov     es,ax; c4 X% p' a4 m/ j3 a! E
    mov     bx, cs
0 S) G) T5 Q7 S: p9 {    lea     dx, int41handler
3 X7 T' H: f7 T# ~6 {/ K; e) \' v    xchg    dx, es:[41h*4]* e' P" _7 `" r' Z$ Z. U! y
    xchg    bx, es:[41h*4+2]
/ H) }8 r/ w" Z$ Y! [8 v% n% h    in      al, 40h
- L2 l! ]+ M1 a" b% k    xor     cx,cx" W  a. Q. w7 Y; K7 m' J
    int     41h
' H- P) g- j. {+ k* Y( S    xchg    dx, es:[41h*4]; P+ ^* [( ~% i# E
    xchg    bx, es:[41h*4+2]
: Y/ A. ]: W& k    cmp     cl,al7 o% S1 p: D& r+ J- Y
    jnz     SoftICE_detected
" T# E, Q- r8 i4 ]
; ~( M) N: h2 x3 s5 K+ `% f1 p4 I_________________________________________________________________________
3 t9 A4 k" G0 `- c/ l+ X5 c, w5 Y# Q3 O' p$ f0 Q
Method 07- n7 c$ j; j+ D, Q2 H
=========
. p2 ^% M& Y# y( R3 _0 C$ f( d& I% ~1 \! z$ W% N1 H* S5 B. @! q7 @4 [
Method of detection of the WinICE handler in the int68h (V86)
. E" E0 S+ |0 q  |1 {: {, f/ T5 A  R7 ], p! u
    mov     ah,43h  n& N2 Y) K2 L& x/ j9 T$ s+ F
    int     68h
2 O8 x+ @3 ]) z% |) i8 X    cmp     ax,0F386h
1 V/ F! ~9 a3 @    jz      SoftICE_Detected! f6 F% i. b. J6 U
* a. ?9 e# D' J+ v

; W1 G5 A( k3 t7 }' j' i, y5 h=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
2 S$ j# I* g' K6 o   app like this:
, K/ e$ _- C7 u" Q
. N$ s; C0 l# b# [* D0 W$ b% w   BPX exec_int if ax==68
$ z' s0 R9 o7 ]5 d2 G+ X3 c! ~% {4 x   (function called is located at byte ptr [ebp+1Dh] and client eip is
; D/ @' s2 x! K( p   located at [ebp+48h] for 32Bit apps)
1 o5 Y8 C5 x2 D; {( ]__________________________________________________________________________2 {/ P/ w" o) r0 n, {" i

1 f0 I0 h4 G, `- F0 i  J
: F) z3 `$ n# p) e  W& K' `Method 08; Q  S. Y' z) v" x- a4 Q+ t+ k
=========) M, ]! q3 N* @9 _, Z
4 d7 Z- t2 ?& t! `
It is not a method of detection of SoftICE but a possibility to crash the6 C# e0 l& x" D' g' A* Y
system by intercepting int 01h and int 03h and redirecting them to another
+ `# L4 a8 G3 M, Oroutine.
) n  s' W8 J. ?4 j) yIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
3 @- O3 u' u( {# {! _" l) {' P1 v% Fto the new routine to execute (hangs computer...)
" `0 J+ m$ U+ m! c% }7 b
8 M6 F* {* d2 Y% L9 R& S    mov     ah, 25h
( E$ U# ~3 s; p1 O    mov     al, Int_Number (01h or 03h)
6 O! N1 `0 \5 R4 H1 V2 ~9 Y    mov     dx, offset New_Int_Routine
4 ^; _2 F) ^! @* c    int     21h
2 l  u+ _, v0 ?% U$ Z+ E. p  ~4 A
__________________________________________________________________________
3 n4 z8 e3 _2 i1 e) e" Q
  O7 a" n5 P) v+ e, ~- JMethod 09
, p* X  @- T4 r! Y& n9 {: k=========
7 ]. v! h9 i+ @5 O' O' a/ y$ N
7 g. N9 B& v% bThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 y8 r% j. }7 S& d( x$ {( j( b0 ]performed in ring0 (VxD or a ring3 app using the VxdCall).
( p5 ~! m* E. Y$ \0 t1 xThe Get_DDB service is used to determine whether or not a VxD is installed- [+ N, {7 \" {" n, @" g
for the specified device and returns a Device Description Block (in ecx) for2 f  Y! e# ^- r4 r) Z1 b4 ]
that device if it is installed.* l  W" O0 ^, [$ o1 F
3 Q( q# f& G) i6 H% w  e
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID; I8 h# [& Y$ S0 R. H4 Q/ A
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 I3 Q4 U  w8 e2 W* Q   VMMCall Get_DDB
. r# i, g" [8 U% D9 m1 J  Y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
& E! G; e* n4 i/ {2 U
" V! Y7 N1 v9 n/ N' f& ANote as well that you can easily detect this method with SoftICE:
; P: ^/ C* b( d- w. i. j   bpx Get_DDB if ax==0202 || ax==7a5fh. T6 _  A2 _4 B- q4 E4 p
( S6 \: C# C# y: G/ t7 L9 o
__________________________________________________________________________
) R: o, w3 L" ~" m! P. G# c; i  y- c4 j3 \8 G
Method 10* x( c( [# x# H8 m0 _; g
=========
, B* \( A* ]9 p$ O) }$ I
3 D% ?9 g: H1 Z=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
2 s1 y* d4 l5 Z( Q& y1 m5 \$ k/ ?  SoftICE while the option is enable!!) y. {7 C8 Y1 F  d; h( G

3 G  K- O- k) p  N- N; NThis trick is very efficient:8 ?0 ^# c# Y! g" ~
by checking the Debug Registers, you can detect if SoftICE is loaded
; C# j/ G9 s) {0 s(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if$ A# }1 L8 g0 d" [
there are some memory breakpoints set (dr0 to dr3) simply by reading their  F/ b7 V- f; e4 `: m/ f; {& n, m
value (in ring0 only). Values can be manipulated and or changed as well# a2 _4 h+ `! H( t
(clearing BPMs for instance). v+ a5 \; l7 u. d. k; q

8 ~% [% ]  m2 D! U( R; s: O* M6 x__________________________________________________________________________
+ q4 W# b: O  o( i5 L  y. ^9 C8 _7 h  O% z! F
Method 11" h1 g7 V7 y5 T# I! A
=========
. [: e7 O/ M) U" o0 U; j1 m& @0 w
  e& ]. G& T' z( S1 z; _This method is most known as 'MeltICE' because it has been freely distributed* c8 A2 h& g6 N$ f! M
via www.winfiles.com. However it was first used by NuMega people to allow, g4 w8 a! u5 X( E8 ~# V
Symbol Loader to check if SoftICE was active or not (the code is located
  \( O  o# C5 y9 sinside nmtrans.dll).+ e# I4 f& R) g, [; `- E! Q2 i
0 x/ H3 q8 O- b( K
The way it works is very simple:2 R, h/ ^6 e) d! ~8 g
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for6 _- q6 v: S7 B3 g5 t: X
WinNT) with the CreateFileA API.
, N  k( a8 r2 Q+ x+ b- @6 s3 r4 j( d
Here is a sample (checking for 'SICE'):7 x5 O, @, D& |; v+ E/ c' ]; m4 u
! |" D* k6 U" Y6 z
BOOL IsSoftIce95Loaded()) D; _  _$ g  q
{$ W6 g1 V9 S5 Z+ C
   HANDLE hFile;  
  B1 X2 U( ]/ Z8 G" S' J  z! x6 T* a   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
* \) ]7 G; }% X9 ~" b3 ]                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ X/ o3 n! e: _
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);* j' X" d; Z% t- ^3 B0 G8 D% f
   if( hFile != INVALID_HANDLE_VALUE )* p* O/ {5 I# `4 n. v! s
   {
; A$ d+ a8 a1 \" f0 m$ b      CloseHandle(hFile);
/ Y+ T; I6 |( P4 p$ m1 h' q      return TRUE;" N" C1 i; _* @2 {* O8 _* A
   }5 H2 X( v5 `. h* t
   return FALSE;
0 A1 ]; `7 \' q0 t! t4 ^}
9 \2 o& K4 T6 G3 Z
6 {7 b/ A2 O( hAlthough this trick calls the CreateFileA function, don't even expect to be
4 c2 m2 m2 k0 u/ E1 Qable to intercept it by installing a IFS hook: it will not work, no way!# t2 @4 b2 a7 F* v" X
In fact, after the call to CreateFileA it will get through VWIN32 0x001F7 {0 l9 A0 s- ?6 b, P
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)$ _3 I6 C1 V- [* ?' ]3 Y. f
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
0 u) l8 I0 K& Q# bfield." D4 M0 y; G  n5 N* u8 i
In fact, its purpose is not to load/unload VxDs but only to send a , o! Z$ Z5 R3 }# n. ?2 K" C+ h
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
7 U# z$ m% c  W2 @4 w  @3 Dto the VxD Control_Dispatch proc (how the hell a shareware soft could try
( e& d. e0 d+ V7 B& Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).
0 q/ L: z5 t6 u, ]! ]) P. h* ]$ eIf the VxD is loaded, it will always clear eax and the Carry flag to allow
& z3 t7 r# J& ~its handle to be opened and then, will be detected.
+ I( k! q* ^1 l+ @1 u7 v; g( ~You can check that simply by hooking Winice.exe control proc entry point! X3 `$ \: E2 j; |5 T
while running MeltICE.# `$ v. g4 t: h  K
9 J2 v- _. g" p; l

4 _3 M! i2 c* J6 ~  00401067:  push      00402025    ; \\.\SICE
: U( a( V! A' N. S* B  0040106C:  call      CreateFileA; X: y; Q, _; r
  00401071:  cmp       eax,-0011 i, p  R# g1 r1 O3 `, s/ R
  00401074:  je        00401091
% f4 b# e7 Q% C& u! r) y. I5 T7 m4 j
& L( e1 ~8 S6 q5 j3 }: ~
$ O# ~' Z  n. N/ }2 u  H$ ^; ?There could be hundreds of BPX you could use to detect this trick.( F% \9 e" Z  o
-The most classical one is:
& `* K2 n6 ?7 S2 S  w  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, X# D5 B  \2 l6 n& m3 I! f- ?    *(esp-&gt;4+4)=='NTIC'
7 r. m3 e/ p* l, F
- Z6 _, |$ X9 |5 X-The most exotic ones (could be very slooooow :-(
/ H; g- |0 l+ a9 u2 K# ?   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + K; z. J/ D, k% B0 H4 v/ L: v
     ;will break 3 times :-(6 \; B# N8 k8 L% \  c

% W% z' O8 H" ]7 q-or (a bit) faster:
0 X8 O" F3 K* j% r   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'); s, S: j4 W5 O" E+ M$ l3 e
( T( c* a5 Y+ |2 P0 f* S
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! P5 F! l, X) ]  u9 |
     ;will break 3 times :-(
. w# Y" m% p$ h+ J$ e  H8 q% v1 n( |# f" @. q5 m& j  E
-Much faster:
4 K" ^  T. C' I* p7 E; P5 b   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV') J% M4 s8 Z3 B- |) q

$ b* \6 n  N- P) w  RNote also that some programs (like AZPR3.00) use de old 16-bit _lopen4 D/ ]- e  A. ?, Z; c& q6 I& L% p0 ^
function to do the same job:
) V! z; [8 ]7 R7 o3 O6 Q: d9 q
3 S6 H: C2 ^( X1 a, i   push    00                        ; OF_READ: o$ x1 R6 O( n6 z
   mov     eax,[00656634]            ; '\\.\SICE',0
0 d+ v. _% @8 o, [6 s( ]" j. }   push    eax4 Z3 }% _" `- r
   call    KERNEL32!_lopen1 p% o( M" O. X/ i% i
   inc     eax  f2 ]. v7 B4 m( ]$ b; x
   jnz     00650589                  ; detected8 }% E& A5 s2 U- R+ Y9 j" x
   push    00                        ; OF_READ% f# W9 ]7 K! H2 s" E2 u
   mov     eax,[00656638]            ; '\\.\SICE'7 p9 P4 Z2 f1 {. F2 O& M
   push    eax) D, w, n  h% E$ o' }1 T7 j# B: @4 O
   call    KERNEL32!_lopen
0 U# E- H8 e. X3 `" V   inc     eax* M+ B* B  j" Y* J$ _
   jz      006505ae                  ; not detected
& R* _: s) V$ z$ s, Q+ G% M( v9 T; m2 o9 A$ o
- Q1 E6 S) C$ k2 E: q
__________________________________________________________________________' @  V6 V; Z: w+ Q
7 c- A- x6 Y% P8 W; F6 m1 N) Y
Method 12( c& H6 j6 b# [5 y2 @& S6 @$ M
=========1 U# V' x+ `$ {  v6 ?

2 d3 o( _! c' Y+ |) G% n1 oThis trick is similar to int41h/4fh Debugger installation check (code 05
. x6 |+ W3 Z' X7 v7 F&amp; 06) but very limited because it's only available for Win95/98 (not NT)% `# W, X8 ~- [! X; _8 p, N; W6 B" w
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.3 Q4 v$ l1 k& X' k6 Y/ h
6 J+ n. S3 {5 z4 t) @  F5 F
   push  0000004fh         ; function 4fh
2 r+ j) F; @; \3 q- d: n& \" q; m   push  002a002ah         ; high word specifies which VxD (VWIN32)7 p. \! |0 Q6 c4 y
                           ; low word specifies which service
) n1 b& Y) v5 }. ~' y/ c                             (VWIN32_Int41Dispatch)
% X$ J5 r' ?. X: V, E8 [) {8 Y   call  Kernel32!ORD_001  ; VxdCall
: u5 O% `- C0 J   cmp   ax, 0f386h        ; magic number returned by system debuggers. N/ S+ N1 Z$ j; y% U# b: u8 q
   jz    SoftICE_detected
1 |& ?6 R/ X+ |* e/ k. b
" T2 }" v0 @4 c0 THere again, several ways to detect it:
' {$ e( N( v3 U" Z  }9 y' E( M* ^% x; H( p" L7 |; Y' e5 p  _
    BPINT 41 if ax==4f
! c0 J3 d' l* j  a$ E% S, j
. o! u4 T$ H& a' G6 q    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
3 k, s) |4 y5 V) {& q9 j9 Q( ^2 W( O: D4 f& D# w
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 E" v3 ]: }, ]$ {
6 E- ]1 E" v4 e2 ?. I& f
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!0 ~" h# Y9 A' q- s& g4 f

( H/ l# Z  T5 ?3 c) W8 J__________________________________________________________________________
& @, G& p, i8 R" ~
  _" A8 P  a7 B3 ~3 m/ fMethod 13
* ^0 \  w& m! j" R. h. l$ O=========; O0 U& \' n# Q! y6 r5 g4 ~0 T
' S, P9 S1 Y3 @" b
Not a real method of detection, but a good way to know if SoftICE is# l7 g' g% a* M
installed on a computer and to locate its installation directory.; ]' j- [7 z; Y) j
It is used by few softs which access the following registry keys (usually #2) :5 x% y) }( W0 M2 h
5 _* s1 g0 E, |: N, y
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 k$ ^, `' O' h: k
\Uninstall\SoftICE
& P) K9 k( T) P9 e( }: g1 }-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE2 w& K7 [+ d8 m, X2 Y" h
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' D- M& ~, @. y% F: U( q, M\App Paths\Loader32.Exe) p4 K, l# j3 C6 [
0 K+ R8 S% U3 W8 [

6 }* V/ t, r0 f1 [' YNote that some nasty apps could then erase all files from SoftICE directory
& k/ N* b+ s+ ?) T2 `(I faced that once :-(6 D0 g9 p; {. f
: i. C: K. W9 c* C( }0 q( y( k
Useful breakpoint to detect it:/ w5 h. W+ B! M/ _: k' U

/ {; h( W, E+ x, D2 d4 X! V* |9 H     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'' _- r" P2 J- G' f7 C+ y

5 c$ H  g3 r7 p! `4 l3 h4 U__________________________________________________________________________. i0 u! W! N$ a; S
" N9 h, A" I6 i8 |0 x: B! X

6 V) D; O' w7 Z7 X' x8 q8 [Method 14
' c$ \2 U# a  k7 n; X=========
% x- A4 V# E+ |1 I  S- K% h0 p& w, ~7 E) {+ f3 r2 d& G5 D# Y( D9 \' u
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose& n8 k) l9 l6 }% _
is to determines whether a debugger is running on your system (ring0 only).
& R; Q% W* C2 s1 c. `! c$ V- b& `0 P8 S
   VMMCall Test_Debug_Installed8 t! o6 }0 _! j6 f
   je      not_installed
' M8 b& f; ~9 e$ L3 ~
, R& [' `8 R6 [# z4 O, X4 jThis service just checks a flag.  l9 S; |6 L8 r5 Y. u- z' s$ q& D
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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