找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 D, S5 W$ I. V+ G' z+ a/ \
<TBODY>
. ~6 t9 M; E# U: ^<TR>+ `* n, p" i; n4 Z. r
<TD><PRE>Method 01 ' [) m  b. Q2 e( v# p  d
=========
/ e4 N: G9 W0 W: H2 C
, }" t, N% d' pThis method of detection of SoftICE (as well as the following one) is  w3 k/ n4 [; C/ |# d2 z& U, {
used by the majority of packers/encryptors found on Internet.& _( N* n% q) ]4 i
It seeks the signature of BoundsChecker in SoftICE
) r8 Y  k- V6 E; C: X' }' `& C7 K! g% z$ n( M4 f) @: R
    mov     ebp, 04243484Bh        ; 'BCHK'3 \" o5 o3 R" J6 Z
    mov     ax, 04h
2 u2 X' m2 |- ?    int     3      
1 d/ ^% Q# V8 e) \, _+ e& ?    cmp     al,4* ]+ n/ {* i% q, K
    jnz     SoftICE_Detected; W. _" e, m2 ]+ q  \

7 b2 [# k1 ?8 y% ^___________________________________________________________________________. B, ^8 t* b; D& h
3 y& h9 |- V3 O/ N! o5 X: M! ~
Method 02
9 a+ P4 C5 s; H! ?4 K5 _7 Z=========% c9 F; d( N8 C
2 d& C* N+ l( }1 e
Still a method very much used (perhaps the most frequent one).  It is used' r, j4 n5 q. n4 W, f0 @3 X
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,8 D8 n: R+ v3 A1 O% `' R" G
or execute SoftICE commands...
: x4 A7 T5 `% LIt is also used to crash SoftICE and to force it to execute any commands3 [8 P) G0 X9 e
(HBOOT...) :-((  
$ ~, S+ C+ R9 V/ [# v" U, J* D' e( g* e* Q9 M6 f: P
Here is a quick description:8 n8 I5 A. N/ @0 E5 G3 n7 x; h
-AX = 0910h   (Display string in SIce windows)
% r% C- I1 w! o0 P-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
7 i# b$ J! J7 V+ ]2 o-AX = 0912h   (Get breakpoint infos)) r1 M* D& U* K/ L1 G" t- v
-AX = 0913h   (Set Sice breakpoints)" ?  j. I" b: Y/ a+ s& q
-AX = 0914h   (Remove SIce breakoints)
1 v3 Z5 r( |$ z: h, u( k6 W1 P- N. h0 ~* E
Each time you'll meet this trick, you'll see:1 C$ P0 k: D, s3 Q( j
-SI = 4647h; I2 \( X7 S  S. K6 K$ f8 _
-DI = 4A4Dh: b& |8 `9 j; s% B; F0 ~
Which are the 'magic values' used by SoftIce.
/ G" a9 g. [7 c/ E9 o* yFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.0 a- L1 C8 P/ h* J9 l$ p  R
/ K, {2 [+ U& z* v1 l* v# W% }; k
Here is one example from the file "Haspinst.exe" which is the dongle HASP' Q* \/ k# n* f: x4 b5 a0 E6 f- M
Envelope utility use to protect DOS applications:; q9 |3 Z8 W/ E; T7 Z; B( t

. \1 M7 G9 M5 s  Z" F5 o, L' R& Q1 H
4C19:0095   MOV    AX,0911  ; execute command.
8 d6 L( M& h1 z+ u0 z' ]( \9 z4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
9 [& W+ h; c: D4C19:009A   MOV    SI,4647  ; 1st magic value.
8 T* Y  Z/ x) ]$ F4C19:009D   MOV    DI,4A4D  ; 2nd magic value.% ]0 N8 m; w. B/ u, X
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)4 ^# F; t. Q) z" T
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
% [6 L8 t3 R8 h& \; k4 }4C19:00A4   INC    CX' x) ~5 J8 Z; s: P  b$ y/ c
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute: [$ I! L4 o5 d. W) V" D
4C19:00A8   JB     0095     ; 6 different commands.
* _9 P) z3 ^7 q% v6 u, F; B. [4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
. J# z' ?5 z" I6 |4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
; q1 N# E. [# ~6 c( g0 w3 o# r* O; Q7 m
The program will execute 6 different SIce commands located at ds:dx, which
4 {2 v. ^7 Y  M" o; e9 Yare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
8 s! E' T- H+ w9 _* b# f' u* a  u: G7 a, M; I: w: v+ W" f
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 ^; C/ ]" L4 y5 o& z+ E0 B___________________________________________________________________________
9 |) ]" J8 [: A& V$ Q
6 k* D# K5 }4 v2 @) ^
- t- Q) Y! p" `6 E# t2 GMethod 039 Z- @/ U2 E/ h2 ?' f3 @* h
=========
" k* i, x6 Y9 o, B+ B, B! d0 F* ~4 B. D; ?) E+ A
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h- p# n# D' e) i! L6 l+ ~# B
(API Get entry point)
8 R1 i4 Y6 g6 A% R+ a1 [        0 r) G+ s6 q' K. @2 z: d
& |) ?. r5 c5 [% I0 C2 d
    xor     di,di
! y$ u" e5 e3 o% R    mov     es,di
* Z0 ]; V$ |0 \1 Q    mov     ax, 1684h      
% J; j8 p+ @3 J& d  R    mov     bx, 0202h       ; VxD ID of winice
7 ]2 H5 t) f9 |$ F0 U    int     2Fh
' I2 e  M4 A7 v, d    mov     ax, es          ; ES:DI -&gt; VxD API entry point4 `% W# s5 M$ ?6 T" I+ q. x+ p
    add     ax, di& L( e" V+ ]* \  K) g5 g, H
    test    ax,ax7 @! a+ J* E4 f7 [
    jnz     SoftICE_Detected/ c# ^9 U% m3 H% |, d7 ], E
8 [# D$ i9 r& S) q6 v4 \$ T
___________________________________________________________________________! o) U/ C" O: ?3 r8 O

6 V9 B$ ]$ {% e0 ~  ^: L8 vMethod 04
6 L4 r0 A, F+ u7 z# O2 y5 N" u=========
$ B3 `8 w6 }7 f& E. r9 v
& n7 r1 x5 ~7 u8 k- H9 JMethod identical to the preceding one except that it seeks the ID of SoftICE' c# y& A/ }1 f. \" R  H0 E. `
GFX VxD.) W9 R8 v& c/ h7 s% e5 b/ p

8 x% ~- @( U7 V) C; {5 P! H    xor     di,di
( V! e) w5 h+ B# H    mov     es,di
- V( b7 C7 G2 G+ ]! e5 F- z    mov     ax, 1684h      
/ Q4 P+ E3 B/ `1 `: H8 T: [/ c    mov     bx, 7a5Fh       ; VxD ID of SIWVID6 `+ e# k8 g; P: u8 ?' l: m; Y
    int     2fh
! n& X3 U# ~9 w  [* k    mov     ax, es          ; ES:DI -&gt; VxD API entry point% m' I! k7 S& B
    add     ax, di
5 t2 U$ X+ K4 t* z    test    ax,ax7 ?0 c% P/ Z, t( U6 b
    jnz     SoftICE_Detected" J% h0 o3 Z- X, A5 q# @

8 W  G, M3 y: M9 l4 Z__________________________________________________________________________5 o/ v; \4 U$ w2 }2 W* E" M- _1 W# k9 _
; p5 c/ T0 h/ L# e$ h* [

9 Z* p  a# ^% Z( C7 s" K6 rMethod 05! d2 i6 y6 U& Q0 N+ T
=========+ |$ L& t7 R6 y! c
: A3 ^( G2 m8 u7 z' E
Method seeking the 'magic number' 0F386h returned (in ax) by all system% J% l5 i3 O% n% i. I
debugger. It calls the int 41h, function 4Fh.
$ t2 a! C# c) @, N2 e+ JThere are several alternatives.  ) E; y& f! H3 r( m) G& K
, G3 N" l: ~1 u3 ^! \! u
The following one is the simplest:/ w* h" Z' Q# k: K
' N5 E5 {) F2 s9 @' z
    mov     ax,4fh  r! @( A0 l! ~8 k/ I  }. l2 y" W. }, J
    int     41h2 ~+ m* h( r9 S9 r$ d/ V" D
    cmp     ax, 0F386
' `+ ]. _) H7 J. A$ I/ Z4 Z, U    jz      SoftICE_detected7 v; Z1 }& h# f3 `5 D# {

0 V$ A% ~) b- R+ [- J: H0 [
5 D: t" |* T4 ?0 sNext method as well as the following one are 2 examples from Stone's
; T2 l# D! A* x4 c"stn-wid.zip" (www.cracking.net):
" A* R8 ~: ]' _/ i* v: _& b3 O/ m5 ]" _& c6 h
    mov     bx, cs
# k* D, ^" n5 p& S+ y7 i/ g    lea     dx, int41handler2
# V4 h. t% p  J3 C; O    xchg    dx, es:[41h*4]' e* M; Q/ q' M2 X$ H3 z5 k! l+ L
    xchg    bx, es:[41h*4+2]% Z& g! C1 w$ M- P. E0 k/ d
    mov     ax,4fh: n1 O) w" [) p- `; M
    int     41h0 M. h1 l4 ?) L- n+ ?
    xchg    dx, es:[41h*4]3 E/ A  ]" g  Y4 `; b6 o5 |  S. b
    xchg    bx, es:[41h*4+2]
' r9 a: \$ `7 k. T' |+ b    cmp     ax, 0f386h7 ?, `" F; `6 J: F. K
    jz      SoftICE_detected
& r) j8 h' ^" C, V% T' l7 K
3 n( t, s! w2 x/ Tint41handler2 PROC
' c- G; t! f$ h1 r' B, d    iret
2 N& Z4 Z- U: \" [: c1 y3 ^int41handler2 ENDP; L! m0 n8 j7 T7 n
& T2 q8 C% Q- w
9 W$ C& y2 y" w2 v
_________________________________________________________________________
! ?! }  O' B7 e. P! U+ q6 u, B7 N! |- Y* G# T; C! B

8 l' C4 e  `6 l- o9 `: Y9 n, mMethod 06! e; ~% Z' b' C" V! T
=========2 |4 H- l9 v0 }( ~5 {+ L6 T6 X

3 a5 i' f3 g+ `
$ o( h/ Z3 U2 Y3 m) z! X' A( G2nd method similar to the preceding one but more difficult to detect:
5 x) Y. v  Q' h$ D
# y- G" U* g& @! o; g- m5 c% O: @5 I# E6 |8 q/ ^* H) m
int41handler PROC+ d. o! C' k6 I4 u$ w1 ^& ~
    mov     cl,al
; D4 ~  ]) d7 [$ Z/ D2 P    iret1 e! u0 C' d" u$ d  Y! \
int41handler ENDP* ?4 l! ?* z+ h+ @
* o; c  l: k" K

! a# ~+ ]2 N: k! o    xor     ax,ax
8 H9 m+ v$ ]$ G* k  Z9 ^  P    mov     es,ax+ q3 @! B0 F3 a) f" `! J
    mov     bx, cs, O* Y# _% W5 i
    lea     dx, int41handler  H: P" s8 b' Z/ x. _$ U3 s( M
    xchg    dx, es:[41h*4]
6 a/ j  Q& j' M9 J8 s' Y7 d1 o+ b    xchg    bx, es:[41h*4+2]
, c. r$ i0 Q3 ~( N    in      al, 40h  \2 ]4 H* ~) F) T6 N$ k/ t
    xor     cx,cx
; D" p. U: x  P3 P- _( U    int     41h
; J. t9 B9 t- N2 H; S    xchg    dx, es:[41h*4]
4 C& S5 I* [: D& N; `, e    xchg    bx, es:[41h*4+2]9 B4 c$ V" }& Q9 E- u0 k  Q# q/ x) T
    cmp     cl,al
/ {6 D+ D) o0 K/ `4 S    jnz     SoftICE_detected5 d) \) q8 y2 A7 J

) d- u5 ~! B5 \4 [: D6 E* ?/ p_________________________________________________________________________
( i( p$ Z" V0 q% G$ K+ f  x0 Q! F: I/ I7 b8 x8 d7 Z2 h2 W% W
Method 07! n  }  |* s( h& w  u/ h% y6 @. w
=========
. ~3 m9 X' a* s
8 S; e7 O, c" l, yMethod of detection of the WinICE handler in the int68h (V86)
9 a; c& |5 `9 C2 j/ o/ S9 F) N* @5 u! X
    mov     ah,43h; Z* S! e$ f. Z  Y* K8 D3 |
    int     68h6 d% e4 h6 R8 |: T
    cmp     ax,0F386h/ p2 T7 ?/ E' ]6 {9 m- [* C, ^5 A: L5 {
    jz      SoftICE_Detected  n) ~  o: D' Z; I) c) Y0 Y7 V! ~
$ r7 l7 c: V6 E
+ N& z. j( p8 P: W- s( u
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' y' I) |' U& q/ P7 ]
   app like this:
  A1 u! |' ^- I
3 ?0 V. I8 m$ m   BPX exec_int if ax==68! I) ~# V9 A5 B6 a' n& Y% i* W( m
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ S3 R) T% b; t( y" S   located at [ebp+48h] for 32Bit apps)
* Q  \" H) J* ~# M! P& N__________________________________________________________________________* G. p! L) L4 g4 Y' z0 S
6 _6 X- M' ]5 |- H$ _/ I
1 Y5 e. m! p8 S0 E, i9 B4 P
Method 087 f% q- V! r" t
=========/ w0 I4 X" y% x1 P" H

" x) ]- O. _8 TIt is not a method of detection of SoftICE but a possibility to crash the- L+ s4 B& n$ S& s" B3 C5 O; l
system by intercepting int 01h and int 03h and redirecting them to another8 r- T$ g4 s) l* O
routine.
2 V$ E0 G+ Y( yIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ s" ?! K: ]$ u
to the new routine to execute (hangs computer...)% |/ X, @* v. w6 [( q# J: z
! d5 O6 o" Y$ L9 _2 l
    mov     ah, 25h
  a  n) _- N' R. U3 n% A; {    mov     al, Int_Number (01h or 03h)0 x9 w! {0 t0 a" L
    mov     dx, offset New_Int_Routine
* A6 @# k' T) S% }9 \, e" R" \" D$ G    int     21h
! n' R4 V& V3 P9 o( o8 ^) n6 D1 O
__________________________________________________________________________8 h0 s" v) `3 u: d: c

4 L% a* J/ Y# x& }- j# @Method 094 }6 L7 ^9 Y: |, S3 j) o% S
=========9 q9 n2 e/ b5 c; u  j+ c

: [6 P! n: V1 ]8 V, TThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
0 M. s5 X0 G2 ]* b* Lperformed in ring0 (VxD or a ring3 app using the VxdCall).
) }$ m  |( \: u  }$ X' u0 H3 e( MThe Get_DDB service is used to determine whether or not a VxD is installed# e* R, {" T5 u6 ^% {7 S( ^+ W
for the specified device and returns a Device Description Block (in ecx) for! W( T) I( X$ i- i! W
that device if it is installed.& Z- k$ [8 B# Y* F* g/ F/ b% M0 L
% T" z- ?& O2 X) G* A' v
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- c# T! J% W' e% P; G4 B; ~1 }   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)* z1 S5 l- `. I7 {1 P. t3 s1 M0 U
   VMMCall Get_DDB
9 j: r1 l* d, \2 {% [   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed9 v, @+ _# T7 }, E4 z3 a

$ l6 k- _* [! M; Z' gNote as well that you can easily detect this method with SoftICE:5 @, x% `- e, R3 o8 V
   bpx Get_DDB if ax==0202 || ax==7a5fh# X1 x7 }; b7 n7 }

7 F' h0 t! x1 C) j& \# x__________________________________________________________________________' l$ a/ z7 E0 x, a. }& r, Q' q

. {& j% D3 ]4 N9 U+ rMethod 10
' M- u# U" ]- l" ~=========
- T, X- R- @- j1 N* U- U. v% C  Y: e+ |$ b  f" p' X0 z
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* o/ }  f2 D" V  SoftICE while the option is enable!!+ k) f( v  ]3 Z. e
" }! @( r7 P0 s
This trick is very efficient:4 ?  `" N( v0 @: @- ?) d) w! d
by checking the Debug Registers, you can detect if SoftICE is loaded) [* \# [0 w. d" {# ]
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
  ]; A$ I( S- J% zthere are some memory breakpoints set (dr0 to dr3) simply by reading their
# ^" _/ X7 {8 @0 C! m2 J- \9 G0 wvalue (in ring0 only). Values can be manipulated and or changed as well3 L. `4 [2 e+ T- u  Q
(clearing BPMs for instance)
. S5 U9 z' K. w9 @1 M9 o! l, U& R9 P6 B7 \* `* P7 ?7 ^
__________________________________________________________________________, E' g- ~' H0 K7 n; D) t
% s! K& f* y7 G6 V* U
Method 11
; B2 h2 ?( S% n1 {0 f) l=========' J2 c8 P6 `) f" `4 P5 w

- n& z2 P# N  D+ d/ C( cThis method is most known as 'MeltICE' because it has been freely distributed
; l5 {0 `) y' r2 G# v) ovia www.winfiles.com. However it was first used by NuMega people to allow
) F0 ?, q) M) w8 D& r' V: PSymbol Loader to check if SoftICE was active or not (the code is located: F5 D7 u' e8 F7 O+ ~) M
inside nmtrans.dll).: Q+ I6 `3 T; d0 ]' F! D, L6 P
- L" |# q" `6 C) ?0 N
The way it works is very simple:) g: n6 }/ {4 n/ T
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
4 e) E) [* ^! j2 G7 l: j3 ZWinNT) with the CreateFileA API.
$ |5 F* g1 {& x3 q7 g2 c8 }$ ^" _* N& n8 A* c
Here is a sample (checking for 'SICE'):6 z/ T2 F8 }3 Y  b' k! I* y- O

: x, s3 b6 q4 y) \# [0 nBOOL IsSoftIce95Loaded(), _# Y( p" M9 c# E
{
8 m' J- r3 A( ^* o   HANDLE hFile;  ! m: Q& o$ g8 Z: L/ B/ _6 _0 H
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 H# g. [3 q  P$ J  a: m8 C4 z) [
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
0 {% w! e) C$ e+ Z  |                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ R+ h: y+ Q/ V   if( hFile != INVALID_HANDLE_VALUE )6 Q7 |1 T6 y! z& b: [
   {9 K" s. V- o: ^& n- y# t# O8 e
      CloseHandle(hFile);
1 ^4 T& }6 f1 {5 ^      return TRUE;
7 N* z/ E$ j6 P   }# \7 ~0 r% O/ T: a3 L6 q
   return FALSE;
4 g& f0 @8 ^5 v}
2 U. `, w* ]9 ]8 B  ]; i7 r, n* \) f0 W; o7 M# ~# l
Although this trick calls the CreateFileA function, don't even expect to be0 n) g5 d) {: [3 P
able to intercept it by installing a IFS hook: it will not work, no way!
0 x3 r* c1 \1 @+ w+ R6 m; yIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
) y6 b5 h9 g! S. b& }2 N$ z  eservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); x. U4 s0 j3 b
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
( h0 u2 Q6 e! k  Z2 bfield.
$ y( M4 I" @# M3 R8 G4 wIn fact, its purpose is not to load/unload VxDs but only to send a
$ f- U+ N7 P, ]) D1 m; }W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
5 k5 m: K" {; @. E+ G. {2 Lto the VxD Control_Dispatch proc (how the hell a shareware soft could try
! t) b: K" z$ x2 t5 ^to load/unload a non-dynamically loadable driver such as SoftICE ;-).5 N) ?$ C5 k! V: H+ ?) H1 C
If the VxD is loaded, it will always clear eax and the Carry flag to allow1 k* x. f, i4 I$ L& U
its handle to be opened and then, will be detected.+ J8 N- }7 l) G0 s3 `, d
You can check that simply by hooking Winice.exe control proc entry point
1 v4 W& w0 c* A% n: _) [while running MeltICE.
5 k' f! [- T/ Z- l. X: V% V; d! [/ W7 `- I4 {
6 F7 A+ E; X$ X) _
  00401067:  push      00402025    ; \\.\SICE
3 ]9 j" v+ W$ I9 ?, `  0040106C:  call      CreateFileA
  N' B( G6 \. h+ Z, g1 S" f  00401071:  cmp       eax,-001) M$ |9 o) q/ Z  w+ A5 X6 Q1 v
  00401074:  je        004010917 |( B$ O/ ]7 y& _) Z% j* \" z

" t( O  O2 p% ^$ q& j7 g7 v8 I
# a% `6 {7 M3 V& M0 O2 @7 ~There could be hundreds of BPX you could use to detect this trick.8 c+ v2 U9 r' X. j% M0 f
-The most classical one is:
# B: L3 |" o' b6 F6 a# ]% \; t$ i  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
2 }% ]) }! v( F/ S! g    *(esp-&gt;4+4)=='NTIC'8 B. I: [; s+ g4 r' v7 T
% O, V  X+ X" P+ W- O% ?
-The most exotic ones (could be very slooooow :-(9 E4 Z, p% D2 k) u
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
: k7 z0 c2 v8 I& C) f- u/ P     ;will break 3 times :-(
! n; Z/ h' |, D( b/ J5 Q9 x8 e. f. ]3 ^3 K- {# M
-or (a bit) faster: 6 e- A0 Q7 `; N0 e3 q0 N7 [
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ }2 l/ r& C2 y+ Y) G5 i# t/ a) r, W/ B# u. }/ j) _; x' y
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
" S- Y! G5 x: a) ~     ;will break 3 times :-(0 [, O, i1 m9 f, z( I  t( l
2 @- d4 x: V, j! R5 N& }
-Much faster:% B4 N; p, R; o$ e0 c: E
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
  Z( D# U) w! p6 @% N, _( p5 h( g. {* S
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
' d9 Q1 Z6 r- b5 n2 e/ M- ]function to do the same job:
! K; }4 W9 S- E; {% T- L0 A. s* K: V4 n
   push    00                        ; OF_READ" ?, d1 k! y# O* s& N/ v
   mov     eax,[00656634]            ; '\\.\SICE',0; E0 `  V9 L! Z$ S
   push    eax
3 c8 S8 |3 _8 n( Q, L4 h( \   call    KERNEL32!_lopen
- `: e0 W; c" e5 H) z   inc     eax4 `. |* }6 n+ X; P/ B( J
   jnz     00650589                  ; detected, `- _- J$ _1 \& z3 @. }" [( @
   push    00                        ; OF_READ
# K6 s  j/ ?; _6 r' R( N! G   mov     eax,[00656638]            ; '\\.\SICE'
9 s; J# C8 Q. S% n$ s0 h. A   push    eax1 t; }3 @8 T; o# I6 A9 h4 A
   call    KERNEL32!_lopen# m  `+ a+ G  K* ?: b/ C
   inc     eax
& B+ Q  \  a  ?9 t. Z3 m2 o3 s0 k   jz      006505ae                  ; not detected
: i; A, y) |) ?# f; o3 G+ V+ n
1 ^/ F; H+ I( E) G/ [
__________________________________________________________________________
$ g* P+ m$ p2 r2 M1 O( u% K9 J8 K' i
Method 12; x' l' {4 N% H: P$ S( c
=========
) S# l+ g+ R. e/ U* P# o+ N+ j% u) n7 h/ `  {5 E, [5 {; b/ \8 v
This trick is similar to int41h/4fh Debugger installation check (code 05# u. g0 y# y2 z
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 G2 l' Q# f* [9 n, ^" m( Aas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
/ }4 p- E8 \$ _& V/ \8 E  J+ ~
   push  0000004fh         ; function 4fh
8 N" [1 y6 L: ?, E2 h   push  002a002ah         ; high word specifies which VxD (VWIN32)4 Y9 a6 G, h- w
                           ; low word specifies which service/ n' p* c1 E3 ~! r1 D, ^8 I
                             (VWIN32_Int41Dispatch)
9 d0 U& p6 q( t: L- a' ?, c9 [   call  Kernel32!ORD_001  ; VxdCall: r, [' Z2 j0 Y" F/ W
   cmp   ax, 0f386h        ; magic number returned by system debuggers2 Z+ b- d0 T4 @2 W' ]- ^
   jz    SoftICE_detected
9 N. C- `7 ?) ]& f$ Y* C- B: E/ a" X) `
Here again, several ways to detect it:
. B" W$ v6 q+ j& ?% E- Q. h
0 x% r% p3 N( j, }' K+ x! Z. j4 a7 z    BPINT 41 if ax==4f
9 e$ V+ d& k3 c% X! ]$ c5 d( O5 |# v! T5 A& L
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one, r, [! ^0 n/ d5 V2 h
" T. L% f( u% f2 ~* w- I- a
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A+ w( L8 n; [! A3 S

: q  F% M$ d' ?1 |2 ^* u; y    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
7 T# c% u3 s& u8 h' D
  {1 a9 P5 O8 }9 Y. `* w  Y" f__________________________________________________________________________* m  O* ~* X8 A) V. u6 S, p
* V% Z1 I2 R+ r& O
Method 13) L* s! w1 q) p  Q
=========0 l' Y# y# g5 O9 @4 z
. p  c0 E4 y7 f: t
Not a real method of detection, but a good way to know if SoftICE is6 I* J: i1 C2 N1 ~6 G' P# D& v
installed on a computer and to locate its installation directory.
  @  O$ [6 W2 V0 s: [3 ^It is used by few softs which access the following registry keys (usually #2) :
! t, k% L1 z2 m; V0 L0 j$ L. R% i: H. q% ?( W
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  k- M% c2 E) u2 H\Uninstall\SoftICE
: X& H1 v0 N( s, V! }; i( m-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, E& P' V: {- `-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 W8 \6 K. M' L) ?" P! n$ G+ }  c
\App Paths\Loader32.Exe0 j9 E4 ^3 @" P* k' }! K: `
  t$ n6 a7 p  e+ ^& W; K! d7 ?3 `
; V9 i$ Z3 Y& D" a- Z" X
Note that some nasty apps could then erase all files from SoftICE directory/ p; Q( I( a  X3 B
(I faced that once :-(
0 K# h4 u! C# o  S" i4 D5 C5 U" X% x8 w
Useful breakpoint to detect it:
7 |1 K5 s$ t, c. z1 y+ h# l
' b' c1 u+ n  ^) F5 q! \     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
( z$ x; r) \/ h) e  g
% T) M$ K# m- ^. M- I5 M( F* M__________________________________________________________________________6 a$ L" U; y- X% A! t+ K( R

0 @" m; [! [) O( Q  B2 ?+ C3 }" v# ]1 S) ]
Method 14 $ K3 |4 Y/ ^" ]3 {. i9 k8 I
=========, g; o7 [6 |9 P. o5 ~. w

, Q+ f1 s% ^* q( QA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
6 H! J. R1 @+ w+ iis to determines whether a debugger is running on your system (ring0 only).
+ h. C9 k0 R4 x8 K# `
3 K! K2 D/ u1 w) F   VMMCall Test_Debug_Installed! ?  O- o3 |6 A; I, O
   je      not_installed
$ f+ c: N  i  S
) i( R7 F2 I" |, s+ lThis service just checks a flag.
" h. V# X) e2 t. k- t5 M</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-4 09:55

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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