About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500># s0 z, r* A+ k. c, t# M1 i0 k
<TBODY>
$ @' g2 j( V7 J( x<TR>
) r; f! O8 \' h: w  ]2 R& V<TD><PRE>Method 01
, B3 \# c; m% y4 S, y7 G4 q=========
9 Y1 Y( F+ x; d; v; O- ]# |5 L0 P5 `) f# a* v" }
This method of detection of SoftICE (as well as the following one) is
1 E0 Z6 `5 b  B; x2 K; `used by the majority of packers/encryptors found on Internet.
; E/ o- j; e3 N( A, X! tIt seeks the signature of BoundsChecker in SoftICE
& a0 \+ g# X. t* p% A4 ~, x$ U2 E
) k$ F: `$ t8 T) j# T    mov     ebp, 04243484Bh        ; 'BCHK'
* ?, z2 @2 l' \- w# i    mov     ax, 04h0 S9 J6 \" q0 B
    int     3      
+ F5 z" p2 d3 q5 P$ T" J    cmp     al,4" i+ q0 |+ S" c; W" Q3 M
    jnz     SoftICE_Detected' f8 j; L$ a# r9 C" E. F! U5 E8 i
0 Y$ g/ B+ t* e
___________________________________________________________________________
* A1 {0 \. Z" ^, q9 s& A* ~( ]9 ~5 M! x# K" B/ S' _4 R
Method 02
- [8 x  {5 J; L" f=========
" p* i/ k, W" ^  A
) D5 k$ C3 `) ~( G; x5 }Still a method very much used (perhaps the most frequent one).  It is used
6 l3 I3 o/ w$ C1 d$ b; rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
3 P* o. l0 K/ m* L  @+ Vor execute SoftICE commands...7 X; P5 W, Z# a4 m4 \* y
It is also used to crash SoftICE and to force it to execute any commands( |$ C7 _) u+ A* h! n
(HBOOT...) :-((  
  Q7 t% H' i8 F% o4 N4 @2 H% z8 c3 U
2 n  t2 Y0 L" K# x+ A- J8 xHere is a quick description:
' O9 E! {2 Q/ O. d  t4 q-AX = 0910h   (Display string in SIce windows)# P, R# o- F- F" w( k
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
- L; i$ Q" j% S# E* ?2 ?-AX = 0912h   (Get breakpoint infos)
+ ^/ V2 I6 P$ H" p) h) G-AX = 0913h   (Set Sice breakpoints)
" G+ U! E" J, `-AX = 0914h   (Remove SIce breakoints)$ m6 }8 t* p. s3 G3 J
! k* V! o; M. K, G' l) I7 C
Each time you'll meet this trick, you'll see:6 q1 v6 ^" x: P- }
-SI = 4647h' L2 ^" \' L; q2 j% p8 ^
-DI = 4A4Dh1 h% O5 W1 F% U
Which are the 'magic values' used by SoftIce.4 c+ ?+ O" y3 m  ~  F5 D2 X/ j6 K0 I
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, i- Y  U3 w+ H3 O
+ r) p* O6 X( F- j6 D7 }Here is one example from the file "Haspinst.exe" which is the dongle HASP( U) Q3 [& S0 x% D, C
Envelope utility use to protect DOS applications:& \# Q2 q0 e' ?6 n% i
$ u: h; w$ f2 m
' J3 j( n" F/ K; q! G" J" h
4C19:0095   MOV    AX,0911  ; execute command.
. ^: g6 @+ Z/ f6 {- e9 i; q' Z3 t4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! y! |& H' M" Q2 N; S3 }! ?. S4C19:009A   MOV    SI,4647  ; 1st magic value.
7 R3 _- ]  R6 m7 F5 W9 U4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
3 a4 g2 M0 d; S3 S  }4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)* J7 Z+ a+ N' ?! j- C/ l4 `$ N. H
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute! v$ M0 x, O8 h- Z( Q
4C19:00A4   INC    CX6 F) j4 \: _9 F, V
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
$ Y; L' M. S8 o6 L7 E3 x4C19:00A8   JB     0095     ; 6 different commands.5 h/ M- r& ?' T; j% N& J9 {7 o
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 {& z* u" W: |# m/ H4 U0 B4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
; Y8 Z- D3 Y6 y- `9 @7 Y: S4 W  n+ ]
The program will execute 6 different SIce commands located at ds:dx, which
9 d7 v9 C% j* b" vare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 F/ V5 }2 _; y3 [+ D; a, v2 F% j
) Y+ X7 j3 u& D' s3 M; V0 r* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
$ Q- W4 d" X- R7 \5 {; W___________________________________________________________________________1 g* Y$ g1 W; }* L/ t

& W) N  [5 Y! m' {* O( ~- P) E" w+ \5 Y3 c0 n1 c8 X% O$ G
Method 03
: _$ Z5 H$ Z4 I( k=========. x& C; P. v' b7 n
9 f3 z! G. z1 |' F% k1 q! O  z
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
! H1 K$ T0 o9 g(API Get entry point)
4 F6 g1 D0 t6 t' X' V9 ?        
0 y5 z0 `8 a- u( z% ?2 y8 ^5 T/ a* _% ^7 [
    xor     di,di' Z( S6 E$ a- e8 [7 R0 e' T
    mov     es,di
8 ?: A$ I! k1 N$ c' F    mov     ax, 1684h      
2 N4 i; w& a. w5 ?4 g    mov     bx, 0202h       ; VxD ID of winice) q, m$ r% \; X
    int     2Fh
, V9 A( Y6 z# v3 E    mov     ax, es          ; ES:DI -&gt; VxD API entry point& b! i; q/ D3 t- ]4 b6 f  ]2 C
    add     ax, di: n6 Z# S+ \% C" X/ V1 X
    test    ax,ax. t2 M9 w. \; u2 s2 ~& [
    jnz     SoftICE_Detected
/ m# o3 j/ ]" c
3 d8 a! s0 v7 Z9 y. a___________________________________________________________________________
" A' K0 q4 ?: H6 y/ H' V! _4 o8 g* d# J7 E8 [. ]
Method 04
. s" t# E# h8 @- l=========7 a1 O% f9 E% k( \+ Y& p! \5 t( T4 Y

5 ?' E+ N3 Q0 b, _$ K' X- mMethod identical to the preceding one except that it seeks the ID of SoftICE( C6 s6 M1 G) m' t
GFX VxD.
0 y7 W  m  U  @: p  b7 d' L4 A8 K0 k9 P1 ^/ ?) n
    xor     di,di0 n9 ~( z4 G: q! `' G5 y
    mov     es,di
& q% r) |3 t" n: X    mov     ax, 1684h      
  I8 `" n6 k9 p0 X& J) _    mov     bx, 7a5Fh       ; VxD ID of SIWVID
$ S# G* x! g. F7 J8 X" ]    int     2fh: E& q0 X( l8 n0 F0 N
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. E9 G% ?& |! }. N    add     ax, di
, b' s8 [( A" S    test    ax,ax( \5 e$ Y4 l+ X( i; f
    jnz     SoftICE_Detected
# D/ L$ u5 {0 Y" \. L; Y, k9 Z/ y/ a* v2 }5 i% }
__________________________________________________________________________
8 r2 A) p4 n, r7 Q. J( p
4 X" Z8 I; ^& H! G9 g
$ f, H6 X% V/ n* g# Q3 m& LMethod 05
+ J) w# N6 k! B) L8 q. g=========
8 w3 e4 s! a) @( |1 M. V# i7 o8 ~8 Z4 A  w; c# T4 B$ P, `! l
Method seeking the 'magic number' 0F386h returned (in ax) by all system
/ [8 j- J/ E3 A8 m5 i; H# r% _" Idebugger. It calls the int 41h, function 4Fh.
- W2 S7 h' B- n( F; {There are several alternatives.  
3 i. ^) r8 H" K$ W5 o$ Y
6 ]" @' b* L& a' kThe following one is the simplest:9 @- C* c& c, z6 S) s! Z

3 ]& {8 p6 S3 d# R7 [    mov     ax,4fh
$ H  T2 o- U6 e& x+ g7 @, ~/ j% J    int     41h
( f! J! R) }' \' k    cmp     ax, 0F386
  X$ q, j. ]3 P( ^0 M    jz      SoftICE_detected
; |/ A& u* f- o" V6 i
; K. H. x/ H* i6 h5 i( W  `! s3 }$ c3 ~( ^' U$ I
Next method as well as the following one are 2 examples from Stone's
, n! z" C- J6 z. R0 ^! d"stn-wid.zip" (www.cracking.net):
( a) I, H' X6 u2 D2 z5 o9 W0 e; ^/ i
    mov     bx, cs. e$ d6 @* ?+ k
    lea     dx, int41handler2+ B/ `6 A) _2 i  N" a, A9 N
    xchg    dx, es:[41h*4]7 ~7 \2 j! M. b) X, J  Z" k
    xchg    bx, es:[41h*4+2]
" h& z( ~2 e+ E- A+ W. s    mov     ax,4fh
) l/ @. d- y2 F- v% d6 T0 }' n    int     41h% H2 I. n4 b6 Z) r5 z; B
    xchg    dx, es:[41h*4]4 p( n2 M  @( R; e
    xchg    bx, es:[41h*4+2]8 x! K3 F9 ^; v. P4 g! f
    cmp     ax, 0f386h8 @" r- Q' @# y: X; J
    jz      SoftICE_detected0 ]' B  q  F6 V$ c

! N: c0 J$ w6 Y# Nint41handler2 PROC4 @7 |' c" S& `/ x  s7 W
    iret) [- m6 J6 n( E0 q- I
int41handler2 ENDP
+ v" i5 b6 B3 v5 _: ^
( V* q3 p, n1 Q7 J$ p' e
# v# A. ~( F9 R_________________________________________________________________________
8 F6 z- D& ~0 ~  y
/ W% ]! s2 i% i" n6 r) m/ a5 ?
, N) j! W. ^% n  Y- zMethod 06: R  \& |4 v$ a+ N2 H3 z2 h
=========7 Z* i. x0 `& n" ^1 E7 u. q
+ f% \6 h5 w3 y1 P
/ c! F% ^  j& @1 t2 m3 o
2nd method similar to the preceding one but more difficult to detect:
2 W7 {1 o# r/ @' u9 g; x
! |& T: z& Y* i! C2 @" V+ ]- F4 o& `" [. k
int41handler PROC
5 r5 Q9 a/ z. x; e/ y    mov     cl,al& v; E. C. l3 M1 E5 B
    iret
& R& L( }" V& B# Yint41handler ENDP3 q9 }) F1 v) r) o/ v, K

* C- G8 ~. s1 v5 f0 |" K2 c/ Y$ m) d$ m) [$ a) y: b% Y
    xor     ax,ax$ z" ]  _4 m! x. Y
    mov     es,ax
. X4 C! @  w! @2 ~! M5 n    mov     bx, cs- t. W2 t; Q0 e" x
    lea     dx, int41handler2 {5 ~- f0 J# R
    xchg    dx, es:[41h*4]
8 _- B/ F  i% t' v* E    xchg    bx, es:[41h*4+2]
3 c) W$ o8 r( Q* W  p5 |/ H+ U    in      al, 40h* q; `& o8 S* |+ E# ~  p
    xor     cx,cx
# I/ J* v- j! Y7 P+ d    int     41h
; E* x7 x) U' e( w" S, x) |) ^    xchg    dx, es:[41h*4]0 r# ?! A; p3 P
    xchg    bx, es:[41h*4+2]
( d0 U( S( {3 h1 |8 ^' L    cmp     cl,al4 |' }, j7 P) Q! e2 [- k6 E& ?
    jnz     SoftICE_detected0 V, x! i# _, \) r# A4 ?
" }  r) w6 N5 C/ N! k3 Y
_________________________________________________________________________
4 |& ]/ D7 W7 o$ m7 o1 @5 z
& S2 c1 x1 x" R+ |* aMethod 07
( Q& J" L5 L; }=========
& M6 ]$ }1 V( [! ~/ O5 d1 v* n& |1 k! T8 O/ N" M
Method of detection of the WinICE handler in the int68h (V86): |  t: C9 B: Y3 e3 }

1 U$ X; d( n5 {# q% ^    mov     ah,43h( }" z, ]. d5 k6 |
    int     68h% L  {- `$ @5 x5 v' u( A0 c- |" C4 T
    cmp     ax,0F386h6 H8 e0 q0 P0 }" D- w8 a# @( a
    jz      SoftICE_Detected
9 j" T" h  I6 k
1 I. }0 r. L% u' \6 ~- `% F  K+ v0 k1 b; j. `5 N
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit7 q3 L. L5 ^& @8 L0 Z
   app like this:
( h. U5 a) K6 Q; b) z2 I0 l
$ c/ }2 k/ ^7 n  _, e   BPX exec_int if ax==68, z$ y  X& f4 j" c1 w
   (function called is located at byte ptr [ebp+1Dh] and client eip is* N+ J  |* j% G6 W( H* Z
   located at [ebp+48h] for 32Bit apps)+ ?/ k! t% J3 D# t
__________________________________________________________________________( J: F# X3 b* t( k% Y% B; u7 ]! j
& s% V# R* f  I5 C, E, [; d
: s( R: ]; n6 G7 ?2 B0 B+ f' u
Method 085 l) f0 ]9 l, D8 t0 E; P6 `
=========1 o  v: P3 V0 r

8 y9 x$ t9 W$ Z( _+ B( sIt is not a method of detection of SoftICE but a possibility to crash the  b6 e/ |8 @1 T* m0 O0 x- _
system by intercepting int 01h and int 03h and redirecting them to another5 D( E( y% _- v+ I3 s6 |- q, _
routine.
2 v  O7 ^# [7 ^* A  MIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 S7 ^& W  `2 G: r% @- p! Sto the new routine to execute (hangs computer...)
1 o( g! P# ?: I4 b( b6 f/ Y9 M5 ?. U; U. V+ P* H, q
    mov     ah, 25h% @8 m: m. t! Q5 w4 J( Z; \
    mov     al, Int_Number (01h or 03h)
* D  z& @9 d0 }5 W% ^: a! V! P    mov     dx, offset New_Int_Routine
- F/ x, |' s3 W2 N3 g5 n    int     21h
! S7 b# u2 d& B  P  _9 P. X8 h+ K- j0 l* I( m
__________________________________________________________________________' ]& z* z! e9 i' Z$ [  m- E! @: c
' G3 ^* Z5 z" c- `
Method 09$ o2 z; P  A# w7 F
=========+ Q, a1 A/ M* M0 z3 O5 \

2 t% S) a" r* ZThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only* y+ q/ l5 T0 q, o$ M2 O! M. J' ~
performed in ring0 (VxD or a ring3 app using the VxdCall).
, X: Z( w- P- o: F, g, _) xThe Get_DDB service is used to determine whether or not a VxD is installed
2 g# I+ ^" c1 H% ~% o" [for the specified device and returns a Device Description Block (in ecx) for8 C3 P% u/ G5 o
that device if it is installed.1 P/ o. C, T, ~9 g
# ]/ i& L! K8 w4 w; ?0 G9 V
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID/ B5 U- `: V+ l- `: `
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
/ \; E, W% X- v, ?   VMMCall Get_DDB1 {% H% A" Q, y" ~" I
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed# A( r3 J% N3 A) L8 N+ g3 A; S
" z3 s% O/ R0 L. [  x
Note as well that you can easily detect this method with SoftICE:# P" ], N/ l* @' h7 K7 O: _
   bpx Get_DDB if ax==0202 || ax==7a5fh
7 ?- f$ a6 T3 _. ]: J& [: Q# b+ _$ [( c5 \
__________________________________________________________________________
) D$ H7 g: b( @
4 @  G8 E: A; K# j# ^Method 10
6 y) E3 c; Y: A, e" K& E=========
1 j1 {$ O" X# {' N) p
  s% R! i' o: m2 Z& [! T7 V=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 d! H3 |# D( ^/ C5 }% s
  SoftICE while the option is enable!!
/ w- i9 Q( V7 b0 g3 a
; Y& D. l" C% L  i* L' x+ pThis trick is very efficient:, o0 P- n9 C: H8 y4 ]0 a# |
by checking the Debug Registers, you can detect if SoftICE is loaded
4 v! d: ]) G$ U& |( {4 Y(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if$ `( |; h  H  x* y
there are some memory breakpoints set (dr0 to dr3) simply by reading their
2 x8 h9 I7 N% Fvalue (in ring0 only). Values can be manipulated and or changed as well% {: x( `) C" r  @( A0 c
(clearing BPMs for instance)" `  N( \; b5 L7 B
' |3 f* F$ P1 n, G! _+ O: B
__________________________________________________________________________
; N* Y$ H# \% G7 h
+ s8 b) T* g( ?Method 11
3 ^' z9 |/ @6 }9 w0 R3 R. A=========
+ Y$ F8 N5 Z. [5 J# _$ P
5 b: t8 d. b# Q: e# g6 H' BThis method is most known as 'MeltICE' because it has been freely distributed* X: @! e, H. x. j! a" L9 r
via www.winfiles.com. However it was first used by NuMega people to allow
7 t1 _* @; ]4 V' q  K0 O2 T6 DSymbol Loader to check if SoftICE was active or not (the code is located( E7 `* j) r+ r4 {' E! \
inside nmtrans.dll).
* ^0 h3 {( w, y5 @: b& l- D
+ U4 B. X/ k1 u! ?The way it works is very simple:* e( M: x6 W' S9 k& m5 n; t
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for" f% T- {( t( z% O2 b* ~) Q- H( d
WinNT) with the CreateFileA API.
  t: d+ Z) i9 t% ~6 A4 k+ _) ^5 |1 F& {- ^
Here is a sample (checking for 'SICE'):$ _! ?2 `; s# P* k5 o3 w) {

, \9 K; j* x* b$ F1 g% rBOOL IsSoftIce95Loaded()( {% G- u; m" N) M
{
2 }' e0 L& s  q& i/ {9 m& C/ E   HANDLE hFile;  
$ u- g; `  V$ P   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 V: u6 @# v# D7 U( c
                      FILE_SHARE_READ | FILE_SHARE_WRITE,. g- q1 [) i, E/ S1 p# W
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
$ P- f3 O- e5 s4 ?' V' |( K   if( hFile != INVALID_HANDLE_VALUE )
2 b; R. G3 K6 }- \   {9 F( u6 \7 b5 ~+ Y
      CloseHandle(hFile);
, Y4 U  V# A# F1 g, |; P: X  ~- n3 B% t2 ^      return TRUE;
% [5 J/ W! E, j! g   }( {( C7 Z5 q9 x* W$ \4 z% b% R
   return FALSE;
, k1 ^' q% ]$ d9 d& F$ q! y( X4 f}
$ }) H1 k( d  C2 @  U. ~+ Y. s  @3 f7 ~* ]' Q
Although this trick calls the CreateFileA function, don't even expect to be5 O' @! \/ t5 I- n0 n
able to intercept it by installing a IFS hook: it will not work, no way!
* d  s; g7 z# r1 qIn fact, after the call to CreateFileA it will get through VWIN32 0x001F+ d) b+ b8 r# u# n
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)* ~/ d( j! z' `; f, q
and then browse the DDB list until it find the VxD and its DDB_Control_Proc# U8 H* f  C  K2 ]( |
field.0 ]7 D# B; @, n: }1 }
In fact, its purpose is not to load/unload VxDs but only to send a
; E* b6 Z5 R9 m2 ~9 \W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE); F& i8 R* T1 Y- _6 A; g, i
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 z7 U" E/ n+ }8 nto load/unload a non-dynamically loadable driver such as SoftICE ;-).4 p. P$ i9 }2 y9 @& o
If the VxD is loaded, it will always clear eax and the Carry flag to allow
: M* m* w$ A  @3 Q+ Gits handle to be opened and then, will be detected.
1 l: H$ X) q) o" UYou can check that simply by hooking Winice.exe control proc entry point
1 ?4 x; M" r5 j' x+ P1 }: ^* Owhile running MeltICE.
& d) x: o3 [! L3 ?9 k) V( D$ d! _! v- u5 y7 F# p" ]; V# l

/ g/ s: ^" h, y0 G, N, b1 y! M0 J  00401067:  push      00402025    ; \\.\SICE% [' `0 \3 e/ ?4 ?
  0040106C:  call      CreateFileA/ J8 i& g) L! |
  00401071:  cmp       eax,-001
, c* q; K, w8 q' R: W, o5 E  00401074:  je        004010918 ^+ m9 u1 ?0 a1 s

8 m4 G7 B! ?) T- r) E
. {: {2 W5 h3 D8 ~1 k- \8 _There could be hundreds of BPX you could use to detect this trick.
0 D6 F" g3 H, R2 \; `-The most classical one is:% n# c  Q. V1 v; ?& V6 z
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||* n% o) U" r: K
    *(esp-&gt;4+4)=='NTIC'
+ N, D9 \& c% f, d- G3 C) |, V5 M1 D
-The most exotic ones (could be very slooooow :-(/ ?1 {; S! }% }- H1 u; H5 [
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" I  H' I7 }) a/ C) e- r1 k     ;will break 3 times :-(  h5 L* a* }# G6 U/ f

$ |! A8 y) H* j! A1 K9 {4 ?1 p0 I" R-or (a bit) faster: - @8 q* W) ^% {0 q
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
, v( S% m( e+ b! O% R# n
% ^2 P3 G6 A$ U$ Z   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 V! h; K9 C. |% N( s) u     ;will break 3 times :-(
6 K! h4 ~: M9 g. e- B( G
- a/ V0 `/ Y! {8 i1 b! J4 z9 J2 Y-Much faster:
$ U( r+ f6 T; B; Q/ b. h& R0 t   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; z+ k. U* |: u+ o+ s; O* s
- K6 `' S5 j  v' c' ^+ M/ I# n# ?Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
# i2 \" Q# @0 T7 S/ I1 Gfunction to do the same job:
% S* |$ R( X# b6 l9 w# M9 V( C, i0 J2 x+ d
   push    00                        ; OF_READ
1 T4 Z" ^2 e' V$ Z   mov     eax,[00656634]            ; '\\.\SICE',0$ K% G5 h; W7 b& a+ Z% z
   push    eax! `  c% m, J6 I4 Q; g* c
   call    KERNEL32!_lopen2 Y2 Y) K" B, z
   inc     eax
9 `( h* w4 F' r# [' O4 c4 p   jnz     00650589                  ; detected6 W2 ~- K% F8 a4 B8 a
   push    00                        ; OF_READ
/ m) y8 j1 I6 N) \   mov     eax,[00656638]            ; '\\.\SICE'/ `% x2 Q2 @* ^0 z1 i
   push    eax+ b' P, u" Q; A2 h& d
   call    KERNEL32!_lopen
0 p7 @" A9 d. D# ]   inc     eax
' |; g& W) \) b) ]* v4 }# q   jz      006505ae                  ; not detected. b. k1 ~! G& ]; ]7 O4 E$ C
/ Y' E$ ^1 L  {/ g& ^, a

! _% D6 |: U5 I5 x1 F6 G__________________________________________________________________________
" c3 S, ^" A, |: C3 m& p
- _  u8 d$ g( l) f) p$ c& YMethod 12
" m8 T# S& K/ Y=========. N  b2 B, p* P$ Z
8 N, B  o! U3 f  [
This trick is similar to int41h/4fh Debugger installation check (code 05) n: i! R3 {5 d
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
! C2 V. G, ^8 z4 ras it uses the VxDCall backdoor. This detection was found in Bleem Demo.3 O0 W) |( f$ `. G  q# F

. ?1 m  i3 J8 Z, P6 W4 _( u   push  0000004fh         ; function 4fh
9 |  [! `/ y2 p9 J   push  002a002ah         ; high word specifies which VxD (VWIN32)
5 K7 k/ I  v) o/ m' f+ x                           ; low word specifies which service/ @: v. h/ ~: U" |* p
                             (VWIN32_Int41Dispatch)
+ k0 z* a: Y" U: a5 p. \   call  Kernel32!ORD_001  ; VxdCall
, D; y% c% e& N: R# }- q   cmp   ax, 0f386h        ; magic number returned by system debuggers% q! e# P# ?" \# Z: D, e
   jz    SoftICE_detected( u/ s# a* H2 c7 J' `" J
8 Q- f2 O, ]! v& V- Z! l
Here again, several ways to detect it:  {9 y, G  L  D0 t" L2 u" @4 f
4 F: E6 S( k2 w- I, F, f* s
    BPINT 41 if ax==4f
/ o, h5 @+ p+ ?! V
: H; w7 f4 h8 z. k    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
$ O& s9 I& O2 a* f; |" T6 ~- m% W3 a% W+ `; C3 w  a8 V4 v, }
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 z* q' k5 s! k0 u

+ s8 p% f0 G. z* U2 X* H& N    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!$ j! [9 n3 L; y  T  C; c: u0 ]; k9 M
" f- ]5 D8 I* Y3 L9 N
__________________________________________________________________________$ l/ E5 h5 f! G. k

' _& X& ]8 p& E" ~" TMethod 13
( |* C9 U% Q5 \9 v: W  |5 I& N7 F3 G=========. d! A1 {! F. O5 B

! {% P7 ^& d9 qNot a real method of detection, but a good way to know if SoftICE is
) Y5 n. O5 X  L9 o% Ainstalled on a computer and to locate its installation directory.
1 t+ @7 W% ?) F) t% H. eIt is used by few softs which access the following registry keys (usually #2) :6 f& X7 k/ E( {9 l- W# A5 Q

* Y: X& _: }& e! P9 \$ ?-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 ^% b2 \* l! W& r5 o\Uninstall\SoftICE
. j# J: z0 v; w) e, `-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, b1 y1 q3 \& j) ?: F7 A
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& F4 t& Q( t5 x: N2 K4 I7 n\App Paths\Loader32.Exe
! _# F6 U3 a+ V2 P$ V
! X# g& [" l6 E, d' q) H! o
- v1 p5 d2 w3 b& hNote that some nasty apps could then erase all files from SoftICE directory$ W9 g) Q6 {& p, m
(I faced that once :-(
* p; H7 K* p+ K! [# z$ @' b. u, ^
Useful breakpoint to detect it:
9 f/ b$ W& [. }/ X4 t& `4 S
8 u% J& a- o' u% ?     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- [! e! h" f! E9 A
& I* n, g+ `0 K$ y& d, @
__________________________________________________________________________
: f0 [4 N* q3 X5 i% t3 @4 p. w
% x5 z/ e/ i% A. e6 a( \+ m4 F7 p4 @; \2 x4 U# b6 k  W
Method 14
" {6 A3 H) U& W2 E' c/ F  p=========9 `% K. J' |1 ?& P6 y1 a
( K0 U# I& a8 \9 ?& d4 v
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
6 A' F' q! r  @1 bis to determines whether a debugger is running on your system (ring0 only).5 g( X& H5 P& {" K  C$ \

6 O% E" S& \" E, N   VMMCall Test_Debug_Installed9 S& G- x/ x4 T; _
   je      not_installed( m5 K+ T0 q2 v8 L8 g/ u

& }: n% s/ b! s! F8 e/ OThis service just checks a flag.5 w5 r& u. w6 O5 Z% C; b/ X
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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