About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
) T' v8 U1 M& L$ m4 |% }0 E<TBODY>% X- T, M) E; `& r* _+ @% l
<TR>
* I) H3 j- G* G: _" ?! L<TD><PRE>Method 01 1 s) j3 V% b0 K, _
=========$ b. ?3 ^; B2 n! F. C+ r3 A
2 a# j" t' w- d
This method of detection of SoftICE (as well as the following one) is
' [% V) F* q4 e& aused by the majority of packers/encryptors found on Internet.- D, q/ Y6 o( w
It seeks the signature of BoundsChecker in SoftICE
2 V7 a3 q3 v7 H: M" N$ N% W. ~
. k" k$ P- P  [  [    mov     ebp, 04243484Bh        ; 'BCHK'. |! R6 J& H$ E. C, k+ c/ m; q
    mov     ax, 04h
+ e* g( K' X6 b2 p    int     3      
3 n# T+ o) O  J5 a2 {2 u) ~4 G    cmp     al,4
, S/ w# e: r; g$ _% M$ t2 B    jnz     SoftICE_Detected
" b2 ^  B7 x8 s( U# u
5 P  E4 J, X: i' j5 Z1 `6 P___________________________________________________________________________
+ i, m  d2 Z0 g, `$ T# {8 r7 G
# S4 U1 F( j! i% F. ?Method 02+ N: a' n: b- C, E
=========
0 H& @7 k8 X  }" x; @/ _& A; R! `/ Q9 _' `
Still a method very much used (perhaps the most frequent one).  It is used
9 ]; P5 k! ~* oto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 f7 ?& J$ P" n4 k! ~or execute SoftICE commands..." `1 s1 J6 `5 G2 i, a: E% h" ^
It is also used to crash SoftICE and to force it to execute any commands2 P+ v( J8 _! r8 @' k
(HBOOT...) :-((  
& @3 L; Q$ m3 P' i8 r6 A2 x/ e' t; P
Here is a quick description:$ }- g2 i6 O! m& ]* f
-AX = 0910h   (Display string in SIce windows)6 V' L( t& _) Q# B
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)7 \4 A- I, \' ^% a7 X1 Z
-AX = 0912h   (Get breakpoint infos)
" R$ h% o' @* e; A3 |-AX = 0913h   (Set Sice breakpoints)
6 E9 l% g+ e: u-AX = 0914h   (Remove SIce breakoints)
+ w  I; A0 A* ^
" y/ ?8 {- [6 O% WEach time you'll meet this trick, you'll see:
& f! N% v0 l3 G5 h0 A& B1 d4 C-SI = 4647h
5 v% W0 P/ g% l/ t% c-DI = 4A4Dh5 V* M% U  V" q6 d0 m
Which are the 'magic values' used by SoftIce.' o1 v7 ^& B/ Y( I8 B3 ~
For more informations, see "Ralf Brown Interrupt list" chapter int 03h., Q8 `% \" R1 \; U, o

' m. P( G5 L# q0 }Here is one example from the file "Haspinst.exe" which is the dongle HASP
. [7 Y  j% |9 U) i+ e& h8 oEnvelope utility use to protect DOS applications:
1 [& d- A6 a0 G" K- E( y: m* @6 {4 V' r; w) u7 j* a! O
2 b$ j# ?( _- e; J1 g5 S: B3 {" f
4C19:0095   MOV    AX,0911  ; execute command.+ a; x4 @) V6 p6 H/ z- ?- D4 Q
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).' x+ D/ @5 D/ k+ ]( d
4C19:009A   MOV    SI,4647  ; 1st magic value./ P3 B) d5 r" w5 O
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 Q3 C+ `, v6 x9 H
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
; y/ S5 g* L5 e0 s% f( ^/ i4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
- B4 q2 H9 {( D4 _' ^% s4C19:00A4   INC    CX
& T' e1 D3 g, }$ D4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
: \/ j! U4 \* v: _1 L3 i7 K4C19:00A8   JB     0095     ; 6 different commands.
  o$ c- b- T) z2 Q6 q) v5 P% g4C19:00AA   JMP    0002     ; Bad_Guy jmp back.0 c+ ?  ]& G. _+ C
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 b# p, G# W! J! g

# f; [/ t4 G6 MThe program will execute 6 different SIce commands located at ds:dx, which; i0 N2 f8 m5 L. K" G5 Y
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
4 S- e9 z' m' i( c8 ^6 j3 t; F9 O- m" w/ h2 e9 q0 @2 [+ `6 s. b. J
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.' _* f7 y2 c( G! R$ G0 u2 Q/ K
___________________________________________________________________________
$ X- P% i" `7 H1 v1 J
  R! z: Q. y. Z" s9 J& w7 n- Y: C2 r. W$ A8 S2 W* ^( C
Method 03; `& n; M' E/ ~/ F* }
=========
. W8 c5 [/ G$ w* {. E7 L* Z: x5 b( A( v
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h( {- S% Y: @$ m) W. J
(API Get entry point)8 U9 h% O3 z- u; m/ W1 F
        2 f3 }4 R% w. V
' {8 _( ?) X' B: N3 ?- O9 J
    xor     di,di) c/ L, g5 ]. w, \
    mov     es,di0 M* d) j/ @6 g$ y
    mov     ax, 1684h      
, u! A; m* V) J- w7 `# a# O) f    mov     bx, 0202h       ; VxD ID of winice: b" l' i9 x8 J3 ]5 w
    int     2Fh
3 B7 J% a% h$ n' I% L3 o( {    mov     ax, es          ; ES:DI -&gt; VxD API entry point" G1 I, n- ~, Z8 U- v1 L
    add     ax, di
5 F2 d* v, h1 h* ~1 P" d8 @# _    test    ax,ax' L* h  \/ m; z$ m$ d
    jnz     SoftICE_Detected
& a7 Z! ^) }! Z
$ N- r1 t" O( ?1 Q" P+ ^___________________________________________________________________________
* Z; y/ k% a& i& N5 X' K4 d1 \
+ \" B/ ]* w; L! W+ t8 fMethod 04
/ S- I7 p' a+ |# w1 n, r8 t=========
% F2 \" T/ n; M" `: M( {2 [) Y3 D; D7 a$ ]7 B  I: x+ n
Method identical to the preceding one except that it seeks the ID of SoftICE
8 g3 ?1 W9 G' cGFX VxD.
8 c9 i* o  w2 W' W3 j' T9 G/ t! _$ _5 _9 `$ G, H) g
    xor     di,di
/ J8 A8 w* Y9 n/ t3 W3 n    mov     es,di' |5 w+ r2 M4 F' {' d/ c1 @
    mov     ax, 1684h       0 m  q) z" U+ E. s  E6 C
    mov     bx, 7a5Fh       ; VxD ID of SIWVID$ I2 D3 y: q: R  K/ T7 W
    int     2fh
% y: y0 x# s. ?9 D5 a! b    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ z, z4 n# q7 {7 v
    add     ax, di
! P! \) d+ f. R3 s; ]    test    ax,ax; f$ N! |: I9 }' `
    jnz     SoftICE_Detected6 S* a. A8 ^1 J) c0 @, H" M

/ H* R, E( J+ ~' b4 F0 P+ U__________________________________________________________________________+ z* I/ j: B; [; h0 u$ |, I! z  x

1 O9 ~- P' y& Y' ~( o4 |+ |
; s& `/ y, I6 B/ P8 v+ qMethod 05
1 r& ^3 N3 y% [2 ]* r5 f=========. y: B9 `- {6 o- K
1 C* m  C: q# d# U
Method seeking the 'magic number' 0F386h returned (in ax) by all system
/ G. S1 J9 _" f, F: M0 Mdebugger. It calls the int 41h, function 4Fh.# w) k9 a  n( h3 ~
There are several alternatives.  
6 B1 S- a4 G" z- E. q7 \
; u  d2 t% m1 H! wThe following one is the simplest:
4 M6 [$ U$ n  X6 B2 @0 p" D1 d
* }& W' S3 }/ W, Q# t- m    mov     ax,4fh, j* t9 ^5 I+ S9 s0 J/ ?# E
    int     41h
4 O, c  a. ?' L, g; v* V    cmp     ax, 0F386$ z6 V1 }" Q# P& I$ ^
    jz      SoftICE_detected
/ M9 h4 \% M) d0 j6 C9 G! C; H. p( j, ~/ o9 X" @4 D" y0 C

( c% ]8 c: x- t0 k2 zNext method as well as the following one are 2 examples from Stone's
2 Z8 Z& B6 Z0 ^8 M"stn-wid.zip" (www.cracking.net):
& R/ r& A' x, M' _; D
; t* ~2 ]: a5 |    mov     bx, cs3 M/ g" f1 L; V7 E  t
    lea     dx, int41handler2
6 Q" I) |! h  T. e4 V. J" U) G    xchg    dx, es:[41h*4]
2 W0 @1 L' e% r9 r+ G! \    xchg    bx, es:[41h*4+2]
  U8 K6 ~) h8 ^' G/ p! U: p& W    mov     ax,4fh* t# V0 ?+ l; `# C" z* F" w/ J7 b3 f
    int     41h
) ~7 D( J7 A* ]  ^$ B, T# |    xchg    dx, es:[41h*4]4 q, V$ m* j! S: _+ S
    xchg    bx, es:[41h*4+2]! T( B% v) S4 K" W
    cmp     ax, 0f386h
$ \- h( \7 q# n- w* u    jz      SoftICE_detected  o) u, Q/ m7 N% u* r; B
/ G6 B6 ~9 k( [! y& X# u1 o
int41handler2 PROC/ A3 l* E+ ?% D% _8 R( C- v
    iret2 I4 [+ b3 n1 B
int41handler2 ENDP
9 r& z1 ]' |& n9 X3 f5 w0 S. q4 G; [: D. U4 t# z

0 Q* H# X% z5 G8 |0 a_________________________________________________________________________0 B+ j6 m4 P5 n/ I& S
$ C2 B8 F/ A+ Y- J  z

; V- a4 _# o* z: }/ |: L8 g( n; gMethod 069 K% a( {# C7 D" W3 b
=========4 U1 |8 n; V. r% q9 l. i

! v- ]4 A) h" `; d7 S* \
* ]0 k& ]5 t  I& `1 |& c$ m2nd method similar to the preceding one but more difficult to detect:8 ]' c& B6 i+ m5 Y, ?
! Q5 R& s) m; v" Q( R3 r
. h% W* z3 c1 w+ K
int41handler PROC) z: A) P% M& E. V9 R; m3 M
    mov     cl,al4 j* |1 q$ u5 m* E& n1 U" C9 v
    iret
3 m7 R1 ]! C* w+ ^6 I& ~( pint41handler ENDP1 t' @$ h+ H0 J: x

/ I. ^/ f$ t* p) v  _5 J# Z8 r- o- {1 V( t
    xor     ax,ax
& x8 H/ l. D, W( q9 U4 L# M! u    mov     es,ax
1 t3 m% Q+ ?( o% Y; U8 r4 d    mov     bx, cs6 v) F9 E- w/ R, j
    lea     dx, int41handler/ e1 D5 `! P0 e9 W% n* g+ j
    xchg    dx, es:[41h*4]* ]6 f/ G: C; H* x) f
    xchg    bx, es:[41h*4+2]
# N6 J. a* y7 R- [) s) a    in      al, 40h
4 d$ G; b0 z/ Y" d9 ^    xor     cx,cx' G0 I: k2 Z8 D( P/ [; c" \
    int     41h2 H. b/ j% ^# U8 r0 h6 ?
    xchg    dx, es:[41h*4]
+ a: Q! e( q! ^; W, _4 {3 U    xchg    bx, es:[41h*4+2]
% [! ^# Q7 g& D    cmp     cl,al" l& o/ w3 x5 M/ [# u" r
    jnz     SoftICE_detected4 K. i! i6 O9 x0 W+ \, d
9 e; N1 ?2 O2 @: ?' Q' R, Z) B
_________________________________________________________________________
6 _) J/ G' @2 B! L  ?6 ?
8 B& T/ _, w  b7 u& k) SMethod 07
% ?* d2 q4 h) k" u0 w" O. D4 e. k=========
% v5 }- g4 M, S1 q% x1 A& j/ U6 j0 o; Z% W9 `( N1 R
Method of detection of the WinICE handler in the int68h (V86)/ A; n; b% X& h3 W* p  W
- ^2 O" Z, ~. E8 E: K# w) S; d, y
    mov     ah,43h
# u7 z% A0 _7 G' G7 ?$ B    int     68h& I* K% U: A1 m" N  S9 ~
    cmp     ax,0F386h
9 C7 o1 H, w- l" |2 |/ m    jz      SoftICE_Detected
: L4 a9 I# S  U$ F( X  Y+ j  o, I2 v- b( S
! o' H4 x) k! W! X
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 i4 C! t0 l  {1 x- ~7 ^% a
   app like this:
) Y2 P/ U% E# p8 _& O: O# ^
) E9 P4 {9 ^; t% [6 Z1 F   BPX exec_int if ax==68
  v" B7 i' ?0 T9 \   (function called is located at byte ptr [ebp+1Dh] and client eip is
3 a# k8 n& @( s# u" T" T# h6 e( o   located at [ebp+48h] for 32Bit apps)
$ o, h! `9 B- l3 P# K- X! d__________________________________________________________________________
) S: u; s* Q% T1 K- u. M+ d
1 R9 J; o" Y+ Q1 [- X+ k2 c
1 `; P1 N* _9 C  o- b, DMethod 08/ C- p( i* b& X( r6 W
=========/ @+ q" o8 H  y& x2 `

8 n1 T8 [, U9 zIt is not a method of detection of SoftICE but a possibility to crash the& @) T5 o# R9 ^1 Q' d+ o: ]* j+ |
system by intercepting int 01h and int 03h and redirecting them to another
4 P1 P" D+ R. j! proutine.
1 E6 \/ j3 x: ~) ~It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
% r0 _2 E) t) Q. _( g: ~$ w8 r0 Tto the new routine to execute (hangs computer...)
5 V6 b! B9 i3 ~* n% A
& A" A/ n, p& G; l& P% _2 F4 ?- K    mov     ah, 25h8 N' D1 ?( I  v
    mov     al, Int_Number (01h or 03h)- `8 I; N" V% M4 I
    mov     dx, offset New_Int_Routine! ^; q  H! s" @" i% e2 j5 k
    int     21h
' p: U' ~2 F  ~! L4 ?; b! u$ `6 d& n! z' c! e; ]2 {9 T) n' z+ ~
__________________________________________________________________________/ ^. P- i7 X! F8 E- }3 x1 f0 l" o
& W1 ]3 D0 u+ U' }1 ^5 }' |) _
Method 09; M4 o2 @' Z$ d% l* m
=========2 s' f. w% R- R! Y% i3 |

2 K# y& `5 ]! o( Q5 Z9 GThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
8 r+ J0 N1 J6 c- l/ A! E$ ?2 ^performed in ring0 (VxD or a ring3 app using the VxdCall).
( S' P4 q' F7 z  c$ B: [6 x: jThe Get_DDB service is used to determine whether or not a VxD is installed* J4 Q) T/ @  q* V5 \1 P, z
for the specified device and returns a Device Description Block (in ecx) for
8 Q. w- [; K: D% O* t( xthat device if it is installed.
# |3 A7 M8 l4 P2 n9 r
* }! Y9 N: c- i# v7 u: I" h   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID. t; L4 R  l* t) I+ [3 ^# u/ I
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 ]1 r5 n2 T3 q+ E4 V; Z; p* b   VMMCall Get_DDB  e9 H/ K5 K$ U4 j# r
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: ^7 O. z& h! [. z; w+ O) t6 L. t7 X! n: e
Note as well that you can easily detect this method with SoftICE:* @- G! z" i! T% S+ |1 B
   bpx Get_DDB if ax==0202 || ax==7a5fh
4 R% c) Z+ x# {; W" B; U5 l% ?4 m& ?" P2 h/ a% S
__________________________________________________________________________
8 _; ~' K2 z/ J+ ~1 i# R/ D; ?8 D! w' x9 r4 a8 Y% Y3 X' D' M9 L4 X$ H
Method 10; b* @+ F8 w+ \# M# e$ o* S
=========
) C7 b5 I6 _0 h1 {% q  k  j8 y$ m$ }2 D; n: w
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
" }9 @9 a8 r% m/ ?& P  SoftICE while the option is enable!!8 l$ g" [. n: j2 B2 i
; N( m* U( j1 z3 C- P3 b1 b1 |8 f
This trick is very efficient:
& Q' W6 Q' [. `& s! ?- Lby checking the Debug Registers, you can detect if SoftICE is loaded
8 D$ q4 G6 L! u(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
( r6 P+ P$ o, ?1 y4 Nthere are some memory breakpoints set (dr0 to dr3) simply by reading their+ C2 K- }- `- Y
value (in ring0 only). Values can be manipulated and or changed as well
# \: K+ M. @& N- C(clearing BPMs for instance)
4 |4 R. I' ^/ v/ p, y6 e9 o
* j. p$ `  \& P- c__________________________________________________________________________
; R* o4 L2 u: J5 S0 K& L4 W7 i4 l" u) t& N
Method 11$ Q& y; Z0 V7 w5 S- I4 f
=========) }% I" d2 \) o9 S

: J$ G/ N2 ?8 ]( f' X& cThis method is most known as 'MeltICE' because it has been freely distributed# Q6 D) z* r- G( L/ K8 D, {& _
via www.winfiles.com. However it was first used by NuMega people to allow
, \; I$ T) D/ g# o0 pSymbol Loader to check if SoftICE was active or not (the code is located) y) [5 p/ k/ a# d) {# ]
inside nmtrans.dll).
8 s) Y6 L. n  y
# C: [5 D  `" n) R( N4 {The way it works is very simple:
  @) ~' @6 U/ ~; ZIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for+ R& `" j8 v& L- H# m) L9 Z
WinNT) with the CreateFileA API.
- w& ~/ f. n; Z( }* Q4 H
' v$ e9 Z1 t/ j* N/ ?# YHere is a sample (checking for 'SICE'):/ z/ E' \- n: ]# G: K. k: H: I: L9 E

8 C! i1 G5 r& }( R! f6 WBOOL IsSoftIce95Loaded()
# R2 \9 B# F* w{0 v5 t6 C4 P4 p" F9 i3 C6 ~
   HANDLE hFile;  
0 ?- w1 T' A' }4 W! x& W   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,  w* z9 @+ O8 c8 G- Z7 C
                      FILE_SHARE_READ | FILE_SHARE_WRITE,; V+ X  ^, b% [
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ I9 Q& F% ?* ?7 q   if( hFile != INVALID_HANDLE_VALUE )8 R& U. a2 n" c. j& J
   {- {; y, c: G+ t- B+ `
      CloseHandle(hFile);
+ ~+ C. W2 ~; l+ s3 A      return TRUE;
4 E9 g1 d# I. v- x) c' @7 o8 B   }( l# Y( N$ e+ ^: h) p
   return FALSE;; F2 P& l, j8 M( t
}
: |9 h2 D6 P; D3 V) j+ L% d* `% [2 C1 O
Although this trick calls the CreateFileA function, don't even expect to be
1 j1 B- P7 r+ G+ mable to intercept it by installing a IFS hook: it will not work, no way!
/ C9 N  y0 j9 J$ ?3 Z& t6 _+ xIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
, _: C4 W6 a! [+ ~8 `service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)* `  o( Z0 R8 \6 x" U
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
% y5 Z: o2 Z2 u7 E% S, qfield.
/ R% F, ?6 \2 ]9 Q2 H. Z4 yIn fact, its purpose is not to load/unload VxDs but only to send a
0 L1 ]5 v* V0 ~. ?4 ^" m! L7 CW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)) ~% W: w( `) m/ g
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
; z9 P% d, H0 I( c( tto load/unload a non-dynamically loadable driver such as SoftICE ;-).
! x' F" e9 f  P* M4 ZIf the VxD is loaded, it will always clear eax and the Carry flag to allow
" g4 Y/ X: G2 h% m: wits handle to be opened and then, will be detected.
! \" ?6 t0 \1 g2 I* @6 ]( \+ e: i5 rYou can check that simply by hooking Winice.exe control proc entry point
& S. q* d  N3 L. C$ n* Awhile running MeltICE.
. j  C/ ], e: j+ T9 f7 P, S5 c$ U& ]9 @# v9 k6 v) ]
5 a  B# u+ I# G- Q
  00401067:  push      00402025    ; \\.\SICE
7 b; S* C9 _$ o8 G+ x7 |. U# m$ f( o  0040106C:  call      CreateFileA
, G$ t7 p  g0 G+ V+ e( z# d  00401071:  cmp       eax,-001/ C0 ^; n& H/ V' j, F; C  I; y) j
  00401074:  je        00401091
. n6 f! E7 z# g: E
7 }* a8 l0 u. z* Y5 d* w0 W9 s0 a# ^) E5 L  d  z9 f
There could be hundreds of BPX you could use to detect this trick.$ J+ M; l  |' ]& Y1 i2 z; D0 r, T. A
-The most classical one is:$ G; Q; H; |: E* _8 @9 X+ d
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ B! y$ I8 Y% L, N
    *(esp-&gt;4+4)=='NTIC'8 I; ?+ t& R& Y( K9 f8 |
) t6 G- D6 T/ g9 E" x0 L, R; P
-The most exotic ones (could be very slooooow :-(/ {; Z: d) S% ^
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
2 R! d3 Z  u6 z0 w2 G  Z& v$ E     ;will break 3 times :-(& l9 Z% x+ W- _  }- C4 P) d

* x. e' a  v  o8 @7 @- U- i-or (a bit) faster: / o: i' D( m" X" ^# E9 e/ ~1 F- u
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
) q- k) I3 y1 w3 G4 v
: e% ~1 _/ O4 G6 d1 d, G   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 {1 y# T4 H0 y
     ;will break 3 times :-(! ?3 \$ H9 @8 r; S- W
& o/ ~7 m% ?3 K: I. v
-Much faster:$ p- }5 m* D" Z( t  c" s
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'' I2 X  m, z4 z/ P' A

6 ^* ^7 k$ U; A& ~) qNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
) W# i/ N0 q3 x# f1 `9 G4 }function to do the same job:" ~: T9 X8 z; j/ d9 z) Z$ K
1 f. k. W6 L7 n' {
   push    00                        ; OF_READ
2 X% x, }- e+ i# J9 r% d4 i1 Z   mov     eax,[00656634]            ; '\\.\SICE',0( [- q2 Q; ~) Y/ w
   push    eax
! q) A+ F! G4 M5 ~( j8 c. z; T$ v6 B   call    KERNEL32!_lopen/ I% W$ [3 c2 _* }; X
   inc     eax- U3 S7 D5 n; u- r
   jnz     00650589                  ; detected! o5 [# l2 C$ d6 l+ W2 h5 n. `; z
   push    00                        ; OF_READ- J. R9 I9 \5 b
   mov     eax,[00656638]            ; '\\.\SICE'
* y# c, K8 s& {7 G4 J   push    eax4 Q% S5 A4 M$ `8 f
   call    KERNEL32!_lopen
; Y" }! Z4 Y& F% d0 j  ?   inc     eax" d+ G- |+ f- G. N
   jz      006505ae                  ; not detected
+ Z0 ?" R; L0 j; k
3 C5 Y9 x$ k9 n7 Z* M
2 O! {# _' ?% F1 a$ r- }__________________________________________________________________________' V: Z$ e0 n0 H

: `  ^8 U. n+ g9 AMethod 121 b, x# o0 A6 h: k
=========
' v! _7 R) c2 _( l8 a# g
6 ^3 L. s  W/ ZThis trick is similar to int41h/4fh Debugger installation check (code 05
; c6 |8 `$ b" x) x" x8 g&amp; 06) but very limited because it's only available for Win95/98 (not NT)$ S( |! j2 m; ?) x
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" j( H; g% d4 g% k; o: l, \0 i/ |! v* t# g# P" [) T
   push  0000004fh         ; function 4fh3 y- p( `4 w" i& t. d/ E
   push  002a002ah         ; high word specifies which VxD (VWIN32)- g' C' a/ f, i. b
                           ; low word specifies which service$ j6 x6 z, q7 [( w$ V6 y
                             (VWIN32_Int41Dispatch). {: G2 I. @- ?& z; O
   call  Kernel32!ORD_001  ; VxdCall3 T. _+ O/ O) o) V) g) Q% \* {
   cmp   ax, 0f386h        ; magic number returned by system debuggers, s: H$ w+ N$ [5 i2 D
   jz    SoftICE_detected
6 e5 v% K& |% |4 Q( U+ w$ W
" l# x5 a+ `0 aHere again, several ways to detect it:
8 J, n; J2 a# {# Y( v3 z
! `7 L4 W% J/ V8 y    BPINT 41 if ax==4f3 U9 `% A; a) M# ?) x

7 u0 A, k. N3 y2 e    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
  N: f# m9 f1 a1 y- A( ^! }3 L* V/ ?( t9 T
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* m; a. q" X. L7 y3 X
. e% p& h' [: U# f! y4 ]
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!% J+ f" b; ~: h% X# b+ H/ u
' Z! R7 j& o5 A
__________________________________________________________________________) h2 K3 s% D" O' n6 e- c

. K. z! Y  o" f+ V; Q' E1 W+ L" R0 oMethod 13$ S9 y0 V# k  D5 ^
=========
0 }  B. U$ x, c) u" r2 x. p3 H+ c3 v" \$ {
Not a real method of detection, but a good way to know if SoftICE is
1 e5 B. L% M2 vinstalled on a computer and to locate its installation directory.  d( H1 z& a+ l' ?# g0 c. o$ Z; D
It is used by few softs which access the following registry keys (usually #2) :
7 e% }( B8 \! t" }- P0 E' L0 V
& p) |; s. `2 Z3 t3 G# d* d. T-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ N8 J" V: ]9 ]& o. b* H  h\Uninstall\SoftICE) g/ E2 W6 _% Z3 I5 v* q7 t) {9 y
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE. R" v* w! s! w1 `3 J
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 K3 i" `: k: z: A+ x% U) e, N! U\App Paths\Loader32.Exe
' S7 T8 P7 m% G0 r0 _+ e" I3 s7 {4 o% S
6 Y3 r# W7 h: L3 [" `9 S1 v
Note that some nasty apps could then erase all files from SoftICE directory7 W9 _& x) \5 _, K$ @/ E
(I faced that once :-(
/ ^; l$ h* f& F  B) F9 ?: \+ ]  f# l! ?% [4 n
Useful breakpoint to detect it:: q, p, w' R) M- j$ A
( [, X& t5 u" \9 H, d
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
! N( a# V$ {' \* ]0 B! t) d1 X; O1 Z+ x& ]7 s$ R' O, }- l3 v
__________________________________________________________________________
- {4 T  B% j7 M4 Z
2 _5 z9 x; j' m3 A
! ^+ f! b* |8 G: Z" w% KMethod 14
- C" I* W0 x- I# z& W* j4 `  a$ [=========
% L9 F; A5 x5 c) ?) r
2 c0 Q# J5 D% k1 C) N% rA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
4 n) d% [4 s1 W7 K) uis to determines whether a debugger is running on your system (ring0 only).
1 n5 V5 ^" y) p- `
( }6 r4 H* s  n/ n% I   VMMCall Test_Debug_Installed' B( F. ~- M& B4 l+ A1 X: w
   je      not_installed' E! B" M6 e9 W
/ e$ q: V/ Y7 f+ z* i) d
This service just checks a flag.
% s' h) O* ^1 R' y3 F; T. N</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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