About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>$ v6 T3 ~9 y% d, r# C& {
<TBODY>
! S$ F5 Y/ l; q/ r4 }+ {# N- x<TR>9 K+ I! l5 B+ c' N; O) j
<TD><PRE>Method 01
7 G5 @& c: r9 s=========+ p# w, m% `1 |

$ c0 T+ o" j/ d( n6 K, rThis method of detection of SoftICE (as well as the following one) is) Z' _% K+ Q- M+ Q# N6 ^
used by the majority of packers/encryptors found on Internet.& d& h" ^! c( L% u; F/ c2 F
It seeks the signature of BoundsChecker in SoftICE
6 \  C, ~3 p' v2 N+ V" c
! x4 ^) Y, `& m6 P% B0 _( b    mov     ebp, 04243484Bh        ; 'BCHK'
8 a2 E4 F/ y) u& k$ ^- l    mov     ax, 04h
5 W, q1 h3 T' S& c" k2 }- m: _$ h    int     3       8 ~$ c+ v. ^  q" T; g
    cmp     al,4! T# s6 b1 L' q3 z7 |6 K* _
    jnz     SoftICE_Detected
# q6 W  |7 n, r5 n7 s" V# o, I( c0 G
___________________________________________________________________________/ [" d7 N  A% E* Q: Q

# {' D  s1 d- f5 d: bMethod 02
( B7 O, X2 C, J- h6 Y=========
" o/ ^4 m6 [0 e/ T- @4 r/ N% `7 X6 h1 E
Still a method very much used (perhaps the most frequent one).  It is used
* I+ p  t. ?4 m. F" ito get SoftICE 'Back Door commands' which gives infos on Breakpoints,1 E1 H6 t4 v) B2 D2 L
or execute SoftICE commands...
( {4 K# V' c9 l# K# n0 XIt is also used to crash SoftICE and to force it to execute any commands- Q' r, f# s/ o9 @2 k: _
(HBOOT...) :-((  
. o# f' \! @! n
* i5 @1 X: }. U! n7 w& F1 s( NHere is a quick description:+ f: o# Y# r) I+ j0 j
-AX = 0910h   (Display string in SIce windows)/ ]' r8 @+ o, x
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) F/ B' y1 u' l" U9 [5 a# I
-AX = 0912h   (Get breakpoint infos)1 B3 Y. G2 C+ I$ `; k- E& W# H6 j
-AX = 0913h   (Set Sice breakpoints)5 O! ?+ d+ g4 z' R. B- l
-AX = 0914h   (Remove SIce breakoints)
1 o+ w# R; {$ U" }. R7 \  Q9 G
! Z% u8 I4 d& F+ vEach time you'll meet this trick, you'll see:
0 _$ O6 S: [0 D$ e& @-SI = 4647h, R  L6 g3 }  [9 W
-DI = 4A4Dh
& b, l/ M1 }7 z' x2 S) vWhich are the 'magic values' used by SoftIce.
# g0 s. T4 ]9 X; d4 ?# v: G$ HFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.' ^% c9 U: U  U" y3 [$ I0 c

0 I/ E; ]: C7 F/ v* x0 w! lHere is one example from the file "Haspinst.exe" which is the dongle HASP5 p8 q$ E% E# A& `% C5 P$ b# T, y
Envelope utility use to protect DOS applications:
: a5 H: R* p- c3 O( k% G
) ^; b$ k5 K+ z3 Z( v/ A& T
& I' p4 R) U& F. O- K2 X4C19:0095   MOV    AX,0911  ; execute command.
  v; e! _! J8 J) x# g8 w4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
3 r* Y) b2 @0 N) f4 I. x1 x4C19:009A   MOV    SI,4647  ; 1st magic value.: Y& p' K: Z. ^7 h
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
! z' Q, A1 Z0 e4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
/ S2 ]* u* Q5 W  v4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute9 q2 i. e/ M6 r: C- }
4C19:00A4   INC    CX/ b. Z5 }# V' T5 S  Z
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 {* u7 u8 D# @# e# i0 m4C19:00A8   JB     0095     ; 6 different commands.
5 x- @: l1 z( [( {. q* v$ z, U4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
/ _; P! k* J9 B# x4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 B, }' I3 @% h, O+ v5 g# k

1 {% i& j* v8 P' rThe program will execute 6 different SIce commands located at ds:dx, which0 F! z: W# O6 E
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
( J- h- x. o- i- H  t1 n2 x/ c3 e
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
6 c: X  G) J* t, M# [___________________________________________________________________________
) l' ], [, r& g& T
+ _+ m+ g8 e8 A
$ u) C& d2 n! D# _/ FMethod 03
1 A$ _, Z4 d0 y5 k=========
7 ^$ v5 g& ]+ Y) C9 `* {& G8 K5 V1 q& M) L
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
# I( ^' ~2 Y  X3 P' }! r* W2 n* s. O(API Get entry point)* O" Q5 z: q! E( j$ @8 [/ o& q$ ~
        
; F. f" i6 o! H+ n6 k
" n1 p: D- R0 G/ M* t5 X; {* P& x    xor     di,di
, `9 E; a+ ~$ G5 E, k0 c    mov     es,di9 K8 g  r5 g$ e4 W
    mov     ax, 1684h      
$ m9 c( ?& W1 U    mov     bx, 0202h       ; VxD ID of winice
: y" `' \! s+ ]% b    int     2Fh
8 q, h$ Z6 @. x0 n& }    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 _7 s9 G9 e# L' L. d) h
    add     ax, di
. P& y% ]( D- w2 t    test    ax,ax' g) M7 @" n+ ?! E# t; e6 X
    jnz     SoftICE_Detected
2 Q7 [3 }9 h) O) ]  `  _! u! G- s  @5 ?
___________________________________________________________________________
$ h" ]+ s0 i) C8 n$ t; R9 D* p3 ]8 U1 U2 i5 x- m- ?
Method 04
$ n' E1 e" @2 e2 C=========
' J* {9 ^! I$ m: a- T& P
6 W% ~" _" b" i' ]7 B: W$ ~Method identical to the preceding one except that it seeks the ID of SoftICE
: u9 T! b1 s5 m8 HGFX VxD.
* U2 s% ]5 |6 N( |0 `3 x9 G( J" n( f( p  N. ^9 P5 {3 x
    xor     di,di) `% t6 h6 v/ X
    mov     es,di  j9 a# w3 R! A8 v: o  q4 U
    mov     ax, 1684h      
; a& d. K, s1 A6 V5 P" T    mov     bx, 7a5Fh       ; VxD ID of SIWVID0 a& s" ^) v3 M8 y
    int     2fh% W+ n7 J8 r5 j0 z1 C$ Q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; C+ _( d, r0 f. a: n    add     ax, di
9 K* r, }8 S: x; ?$ N    test    ax,ax; @% T: w" q7 k2 {# r! H. `' _, H
    jnz     SoftICE_Detected
/ E6 N. B/ x& F2 m+ q$ ]' L: F- U+ f0 L) ?3 I1 P# x9 E
__________________________________________________________________________
/ [; x& A2 I- c! w
$ @3 `% H, y' v3 M8 L
! y  e1 B. ^. f- bMethod 05
. i! t4 D; y+ J+ q4 ~. I+ v7 x=========
2 v! v3 a# p0 @. f) a, U
1 X0 U7 E- T' h7 n: uMethod seeking the 'magic number' 0F386h returned (in ax) by all system$ P: \+ `" @/ H; _1 {5 c
debugger. It calls the int 41h, function 4Fh.' t* E5 {3 z* L4 \+ W: J" U6 o0 f( a
There are several alternatives.  
4 P. B4 x1 Y% W) z3 k; x# F4 v; O9 o$ p, f+ J& D
The following one is the simplest:4 s: I  O0 |/ H' `
( i, @; S6 ]/ o5 m/ Q. T) L: l
    mov     ax,4fh
$ K$ t7 S  Z2 u$ v6 B    int     41h8 U' @% n6 o1 F2 U
    cmp     ax, 0F3861 E" E( x5 |! y" p1 Y
    jz      SoftICE_detected8 d, A1 R! K6 R/ b& ^

# D& K9 x! H8 |! P) ?$ y$ p0 H% \" i! s; A) s+ g) G4 {
Next method as well as the following one are 2 examples from Stone's 8 `! K2 w5 u$ i3 M+ J0 W4 L8 F. {
"stn-wid.zip" (www.cracking.net):. B4 {9 a2 z. V
( G% r! m2 ?* I2 j' ?5 R7 ^1 @$ f
    mov     bx, cs
; c: N& `/ a& D5 h7 o4 E- e    lea     dx, int41handler2
/ r  ^! C, d. P$ M* T    xchg    dx, es:[41h*4]
% o$ T+ |8 [, W    xchg    bx, es:[41h*4+2]. g& B$ f! Y" j
    mov     ax,4fh& L8 D4 c. g1 ?; Q9 y. q; Y+ d
    int     41h
( s9 _4 a2 Z$ Q( {    xchg    dx, es:[41h*4]
& H- e" U1 R- C/ l* C1 h1 ?    xchg    bx, es:[41h*4+2]
; T2 n  T" B* f5 e( i( M    cmp     ax, 0f386h
6 G! @3 d! {2 C1 }7 H5 b$ J    jz      SoftICE_detected8 X- K6 p8 F& E- m+ Y+ y8 t  ?, U

2 |$ p& z3 o6 ?( h5 eint41handler2 PROC5 v" c: T: l0 v% l( X% y
    iret
* y5 H; O! ]  e' T# a4 Y* O5 Pint41handler2 ENDP1 x8 W3 `4 J2 B0 j. R' G
1 O  i2 M, H8 i  d3 ^( O& s7 _: W

/ T' G: l6 ?6 |2 C; P_________________________________________________________________________
' o. ^4 L$ B# {2 M  B6 b
' D4 s5 s# S7 x# w5 V3 z% m7 G5 G( f7 l3 z6 f
Method 06' @6 {- L. z. ~0 n% T7 @" F
=========
8 V0 W4 S6 j6 o' B  `* Y6 F5 W) m0 ^! ~& ^9 w
, ~8 _) l% x+ w) v
2nd method similar to the preceding one but more difficult to detect:
* K1 \* y9 A' o9 h  I. a  W5 Y* W* j  @9 L6 h, {5 }
4 o3 e! R3 b. T; @
int41handler PROC- M, c6 o" S! H/ |! q
    mov     cl,al
. P0 G$ D/ ]4 A4 k& z4 v0 j2 t    iret
, C+ [/ p/ [% Z% R2 j0 [5 J* ?3 a  Jint41handler ENDP
- F# t1 T( c/ d
0 Q( J0 K2 T+ |1 H& R) ?/ F# k
# {/ o) M. i* h4 C" B" }' R* v    xor     ax,ax
) O; L1 d" ^% ~3 q1 e- [9 Y    mov     es,ax# A# b$ d+ _" U1 x* `. |
    mov     bx, cs1 P' P0 H. I' W
    lea     dx, int41handler
6 h3 \) L% Z; u. C) s    xchg    dx, es:[41h*4]. {2 R1 g( e2 r2 w8 f5 j
    xchg    bx, es:[41h*4+2]1 @( }/ f6 N$ Z% ^! m! b
    in      al, 40h- T9 \6 n% R' ?5 F- a8 `5 i% P( T
    xor     cx,cx1 i, E5 c* |) d+ ?
    int     41h' o, L/ ?- @8 F# }7 T
    xchg    dx, es:[41h*4]9 A% i/ g* u  c$ D* }2 O
    xchg    bx, es:[41h*4+2]
8 `) `7 F3 g# F0 N) ?) l9 G) N" c$ v    cmp     cl,al8 T: U9 }# o/ f; {+ A
    jnz     SoftICE_detected
  @. G: ^' Y! m
+ g5 }2 |- C- X/ }_________________________________________________________________________
. ^  G7 [: Q" i- ~8 t% x+ c  r$ ]) W( g5 ~( u3 @4 b/ o$ T
Method 07
# b" ~3 {0 e# F8 ]. R=========; Z& F8 ?) m" w2 l

* w, X+ A4 S+ t7 u/ n; lMethod of detection of the WinICE handler in the int68h (V86)
% K/ S/ H" N! q+ c2 R8 P1 p
, v. p5 E! v8 q5 `$ @) i    mov     ah,43h$ u8 t% y3 h- F8 V6 T$ D6 R
    int     68h  a  G7 t. M& T# D% i  Y8 Y! ?: y; p
    cmp     ax,0F386h/ x. J1 y& g: ~
    jz      SoftICE_Detected8 P& h1 T6 `6 h4 Y9 ]5 t

; S5 c8 f6 K& c2 B( s( c' A
, M! g0 `4 i3 C=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# a- S9 u# n: ]5 d8 O# ~9 ^
   app like this:, z& ]) {9 X- I0 k) P! ^- ^( V
& t/ I, V0 f' m. {5 c4 m" }
   BPX exec_int if ax==682 s9 S% r7 W0 m/ e* q
   (function called is located at byte ptr [ebp+1Dh] and client eip is
3 H, ^, a/ L! u/ i1 p   located at [ebp+48h] for 32Bit apps)8 a3 }; e9 e/ s  q% A$ x* p! {2 M
__________________________________________________________________________' y; ^; M5 v& L5 b: V$ I: e. t
; _9 I8 |3 w0 _
2 k* j# s5 B. N, h; E- j& @- N
Method 08
& \( M' W- _* z; `" _8 ]2 D=========: T2 @; Q# U' L  ^3 n+ M7 s) [
  v' h4 o9 H& [7 k. ^6 n: `1 F( A
It is not a method of detection of SoftICE but a possibility to crash the- b1 ?% u% t! \2 z9 N; B
system by intercepting int 01h and int 03h and redirecting them to another5 J" |2 w8 ?* n: C1 ~& d0 L$ a/ v
routine.
; w( g4 K5 g5 `# N6 n8 I* cIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 I+ V+ I' _6 c$ x# }to the new routine to execute (hangs computer...)
% J6 {; M% ^' f0 W6 c% Z7 C0 ~
! F: f) k3 L2 y* Q, U7 u! I    mov     ah, 25h
6 C8 N3 G- X; k) i' k    mov     al, Int_Number (01h or 03h)
- ~5 L+ n4 V4 m( r- g, [) t( ]    mov     dx, offset New_Int_Routine
# u# v2 e( l8 o! \5 @    int     21h
0 m  g. i; X; z& m+ Y/ ~/ J
. P1 s* a# ^$ L3 }# g" [__________________________________________________________________________! E$ R" h5 a' h% j
; I: i- B3 _3 J: f: @+ E3 A
Method 09% l* W* ?/ J. s  ~5 z
=========
6 z) V% D- t* v. ]9 h* k3 S/ o1 z. W7 `
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ R0 j3 ^& |8 Y7 F  p+ h
performed in ring0 (VxD or a ring3 app using the VxdCall).3 Q, B/ z0 M( l& J3 p1 }% ]
The Get_DDB service is used to determine whether or not a VxD is installed
# P7 Y* ]/ _  U0 m1 q2 y3 efor the specified device and returns a Device Description Block (in ecx) for
8 f5 u  m7 N) ~8 f% Pthat device if it is installed.
) u- J; a, M% J* ]! ]# N' e( X, T4 A9 L6 S- W" a; R
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID3 W+ F  [+ H' C' \( C, F% }) l* f
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)$ i7 z& l3 m" ^% }% Z
   VMMCall Get_DDB
- \4 i) H& [: l( T+ B! w6 H  T" D2 h4 Y2 `   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed9 Y) f! O, b5 O9 j- b  @5 C

$ _7 t4 u, t% ^Note as well that you can easily detect this method with SoftICE:- Y" t6 ]# a" G, b4 U; n( X
   bpx Get_DDB if ax==0202 || ax==7a5fh9 {2 |' [! s5 ~( j
- p) r0 X% u9 M  w# j! \3 C' m
__________________________________________________________________________
" @0 U9 Z1 m+ d7 p* l9 X
1 r% K& F% Z% F$ p) ZMethod 108 p( _( m+ U3 P: X# {2 @1 M4 L! W
=========
4 ^! f1 q4 t5 g: _! Y1 D+ G$ ]5 p8 _% N( s
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with. o1 E; P& l- A3 c
  SoftICE while the option is enable!!/ ~1 S! L% D0 H" g! W3 \

6 F  R* ~6 z. V& m/ N7 F& aThis trick is very efficient:) @; b( @7 J# ]% L: X7 `
by checking the Debug Registers, you can detect if SoftICE is loaded
0 Z$ y2 Y# n3 `0 v) A(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: n; c1 c9 {; X+ M, v6 {( ?. ^0 N: v' [there are some memory breakpoints set (dr0 to dr3) simply by reading their
' c+ }: T+ ?! l8 @" Dvalue (in ring0 only). Values can be manipulated and or changed as well0 O: u& ~% E2 R" }
(clearing BPMs for instance)+ g* l* j( R1 {5 ~/ X

" i( S- p" I7 ^5 n, x+ U, H4 x__________________________________________________________________________
& x  v5 ?% Z. U) g$ h: C5 C
' e3 }, q7 ?/ {7 ~6 ~7 e% BMethod 11' c4 m1 b& }% u/ d$ V/ W& o  n# z
=========
/ x1 K" r$ w. V, w9 d0 Y7 x& F! G' P6 F7 v* ]% g
This method is most known as 'MeltICE' because it has been freely distributed
% q, I2 f  A  v& hvia www.winfiles.com. However it was first used by NuMega people to allow
$ h0 U- y: P. I8 w2 |% Q6 @, M2 lSymbol Loader to check if SoftICE was active or not (the code is located8 w: N# N$ K& @2 z. Q) ?
inside nmtrans.dll).( w' D: e+ X- V8 }7 u* r
% x. t6 v2 O, r% i  p0 j, i" ?
The way it works is very simple:/ l, j# m4 X) p% G
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
7 X& M1 l  R# B- kWinNT) with the CreateFileA API.
! q1 {! Z' a0 B, b& Z3 E2 V' p# T5 r
Here is a sample (checking for 'SICE'):4 o$ ?5 u- z9 |8 h1 A! q6 x

% c/ K4 I6 U" H% k" h- g* ~5 gBOOL IsSoftIce95Loaded()
* }( t& O+ D* \" k+ I! V{
# U! t5 t/ H$ x2 O   HANDLE hFile;  , Z: y% D: N: U7 b& ^
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
- K  q: [' X" o                      FILE_SHARE_READ | FILE_SHARE_WRITE,) d, w8 Q' M7 A3 R4 h" V! k/ S
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);3 d, T1 j/ J* O" w
   if( hFile != INVALID_HANDLE_VALUE )% r4 p: F" g- k) f7 }  W
   {
0 w( f3 l2 Z( N1 t/ d; _      CloseHandle(hFile);
, p" m" |5 _4 L" M" C7 p& R2 ~' h1 v      return TRUE;$ l  J" x! g7 d1 Z- x
   }; u' t7 T+ }6 h8 K9 _
   return FALSE;+ a6 D' n- u$ O
}
! b8 s$ ?5 g. R, K8 j: l7 J1 e7 a+ J& }! x/ Q
Although this trick calls the CreateFileA function, don't even expect to be
( N4 P- L# W4 x' _able to intercept it by installing a IFS hook: it will not work, no way!
: ^. Q, M' b, L: J8 m* mIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
* q/ A7 Y, a+ P! d: a- Fservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
$ e0 \8 M/ F4 R  B9 n* |' A) band then browse the DDB list until it find the VxD and its DDB_Control_Proc% V- j- f; c2 c# j' ^
field.
. g/ ^" f& A* R$ i# L. A1 V% qIn fact, its purpose is not to load/unload VxDs but only to send a
2 [1 r) K4 {, k" j2 W9 U2 `& i4 ~% BW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 X( \8 A& c) m
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
- U7 n& l  k* yto load/unload a non-dynamically loadable driver such as SoftICE ;-).# B" w/ E( G1 X* p+ F
If the VxD is loaded, it will always clear eax and the Carry flag to allow
# [0 C, e' Q% n# Lits handle to be opened and then, will be detected.  A. ?; T- ^8 z+ U7 A7 K
You can check that simply by hooking Winice.exe control proc entry point; j! C+ o: }$ s1 Y
while running MeltICE.; l, T. y: g" v: [; z' D: B

0 w9 q4 H4 c& p3 o& T& F) |" w/ q! I5 ^5 F
  00401067:  push      00402025    ; \\.\SICE5 x. V( l1 [% l. W% g. E. y
  0040106C:  call      CreateFileA
' K! L4 Z3 V; }( Q  00401071:  cmp       eax,-001
% y1 L- C) ?" P8 e  00401074:  je        004010917 P- D: f3 u7 N* u2 u8 b
; j4 q: P6 _5 y, Q5 |6 R

- ?' p; ]- i9 ]There could be hundreds of BPX you could use to detect this trick.# ~2 X6 S  u8 [2 s/ E% j' |
-The most classical one is:' b: x( j  Z8 k' [" h
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
8 e% {9 _$ z* g) h4 q) B# G    *(esp-&gt;4+4)=='NTIC'
0 @9 b( J# w% a7 U: R) j! a7 u* h/ k/ P" B+ M/ B
-The most exotic ones (could be very slooooow :-(* K6 q6 i+ a, n
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% s& h) `+ n, P     ;will break 3 times :-(2 @. k; }. x/ j1 g3 d

: Z, U/ \: b- {- m4 z' R2 k# `-or (a bit) faster: 0 ^! ]' C, l  ^( w) H7 q
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! }. c1 ^, N. M" ^) V

$ [1 i. z( u$ a1 Y/ Y9 d/ F   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  0 N7 p5 Q7 F8 \5 S
     ;will break 3 times :-(& j6 h6 e! i2 l

/ J- @% `+ l7 l% K( I1 F-Much faster:9 `0 q# {/ E3 T: m0 N
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'- B- J4 {: E3 `8 @

) u/ ?% `! {2 G; D% ~  zNote also that some programs (like AZPR3.00) use de old 16-bit _lopen" Q8 H' ~" Z; B. H/ H9 C& M
function to do the same job:7 R7 r8 b; G6 R+ V/ q0 f; c' h
7 ]# `7 W' [, J7 u; o4 Q  i# m& _
   push    00                        ; OF_READ
7 |$ s2 I( Q6 E* c# N   mov     eax,[00656634]            ; '\\.\SICE',0- `5 b% r3 Z. J* _& L+ t7 h
   push    eax9 F- G; s% L( d: I
   call    KERNEL32!_lopen
5 ]: z9 B+ [5 v, |7 M& ~   inc     eax
1 {6 G4 X( V) w  f: K5 U/ ~# f% C   jnz     00650589                  ; detected- p$ D& e6 z8 q( Z% ^, Y9 _
   push    00                        ; OF_READ
0 z! Q  A+ L- ]5 D$ ]4 L3 n   mov     eax,[00656638]            ; '\\.\SICE'
0 [) ]" V, J9 u1 E5 F   push    eax6 J; I/ |, \# e- W$ \; J. f$ |! P
   call    KERNEL32!_lopen
! R2 S0 p1 a6 b. d/ `0 w   inc     eax& p5 g( O1 k, T1 p' R6 g- V
   jz      006505ae                  ; not detected) |' }3 c. ]1 Y) M& Z5 A

, i: @; _) ]; [/ M( i2 W- n7 F6 w4 W# _3 D& r# N. Q9 L
__________________________________________________________________________1 a4 i- H9 S" x! n# f# E

, M5 r: r. c/ Z* c$ ]Method 121 {: q: N5 S3 n) h0 H
=========% m- e' J1 V# }- l/ |
* V9 }8 N! v1 C9 s/ w7 T# ~
This trick is similar to int41h/4fh Debugger installation check (code 05
" @7 R& v/ Z/ f&amp; 06) but very limited because it's only available for Win95/98 (not NT)
* N- y0 V) c3 Tas it uses the VxDCall backdoor. This detection was found in Bleem Demo.; j- ~# D% B; }1 R$ F2 C
# D( P6 M2 w) e
   push  0000004fh         ; function 4fh
) y) Z# `5 I; f6 M% d3 h4 D. K   push  002a002ah         ; high word specifies which VxD (VWIN32)
# a& I6 G1 j4 U( a/ }                           ; low word specifies which service/ e! c) V2 ]) z2 ]5 R0 c' F0 t: Y
                             (VWIN32_Int41Dispatch)
* D5 T5 X  {! W' ?/ M" i. W( q   call  Kernel32!ORD_001  ; VxdCall
* U/ U/ E) I4 M% {- W9 K   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 M9 e& g- d% D) i1 }2 P   jz    SoftICE_detected
& J3 A2 i* v) ?( p* Q; X
. ~# k# l' r) Y2 y" ]' G# x# }Here again, several ways to detect it:
3 c+ s' ]& t  o) Y& X, U
  r! t; P" V/ k+ c! c1 N    BPINT 41 if ax==4f
5 v9 N1 V% H- T/ P2 W  j& G2 ~$ S+ H, O; q$ m( j+ n3 I
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
4 r1 Q  U% a; \( Y4 F9 M" q* e# r8 b0 M5 f$ [* o2 G/ _
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
9 X: F. T& W! O# Y) t! z
  M' Y2 {& d( g5 k" R    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! D# [) b, m6 x- d' K4 O! }  J
! o+ o0 \8 t5 Y: l# Y
__________________________________________________________________________
6 g6 G- M4 t1 G" I$ C1 |7 t2 X6 ^8 |+ I/ k2 D
Method 13
+ v; I5 R2 q5 Z, D=========
3 i2 U. [  n2 _  @
3 x  x/ r; D+ r. NNot a real method of detection, but a good way to know if SoftICE is
! I% p8 e) p2 m; ?3 ]installed on a computer and to locate its installation directory., l$ W1 e% y' a/ v
It is used by few softs which access the following registry keys (usually #2) :5 h) y! W" Y3 ^) a1 |) ^  ~0 ^
& V0 i3 R, E1 t+ G! Q$ U6 z% F0 p
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 {4 ?: g  H$ @+ a1 ]7 p\Uninstall\SoftICE  g! y" C0 Q+ z$ ^( v: A% [
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ q, s) P; a$ O  ~9 |# t-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ s. N# m" p/ Q: }% N\App Paths\Loader32.Exe( F$ s* J7 v9 p: }
+ z+ z  q: Q) x' r5 M7 ~/ A

# G. U4 l. x0 [4 p- nNote that some nasty apps could then erase all files from SoftICE directory: q# @4 z) g3 L$ A+ z' f2 J! X. V
(I faced that once :-(
4 t" i+ b9 B! a! {* a& _; J) a
+ c$ X% r5 ]! P9 @5 q' o' {Useful breakpoint to detect it:5 V) ^) c' n8 f8 J5 d) H3 d

; y. A# l$ ]8 m     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; c  f. s: A* U2 b* ^9 K' H9 j
5 {( z" d3 d1 `5 v__________________________________________________________________________0 t$ ?$ }2 W! w3 s0 ^
$ h: Q: O1 e" ?2 W
3 F; T3 x8 T6 X0 J9 ?' ]2 n
Method 14
% b# @. i2 G; l2 j=========6 Y2 {- W6 V2 d! a2 ]8 W) P
7 \0 O  |2 Z, t
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 E0 T6 q% A2 N% c: N* c7 [. A
is to determines whether a debugger is running on your system (ring0 only).4 N" S. ~. e( k6 k4 k( V% j
4 R0 s5 M- O+ C8 X/ g
   VMMCall Test_Debug_Installed
0 @; E/ E9 k& U3 \* c5 x   je      not_installed
; x& e" P& O6 y$ H& a
  E% K, J( H' `! c& `" bThis service just checks a flag.
1 z2 W9 t' @& u! z</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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